From 366c0f33d47d271323216527c6ceaaf087901776 Mon Sep 17 00:00:00 2001
From: Najam <85332859+najmiter@users.noreply.github.com>
Date: Mon, 15 Jan 2024 01:06:13 +0500
Subject: [PATCH] Update main.js
---
main.js | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/main.js b/main.js
index 77e78c4..400a8a3 100644
--- a/main.js
+++ b/main.js
@@ -94,11 +94,10 @@ const chittify = () => {
}
if (is_comment && token === cmnt_char) {
- da_big_cmnt += cmnt_char;
- console.log(da_big_cmnt);
line_.push(
- `${spaces}`
+ `${spaces}`
);
+
is_comment = false;
da_big_cmnt = "";
cmnt_char = "";
@@ -107,20 +106,32 @@ const chittify = () => {
if (is_comment) {
da_big_cmnt += token;
+ if (i === 0) {
+ line_.push(
+ `${spaces}`
+ );
+ da_big_cmnt = "";
+ }
continue;
}
if (token === ";" || nikka_token === "comment") {
- if (nikka_token === ";") {
+ if (token === ";") {
token = tokens[++i] ?? "";
klass = "comment";
} else {
+ line_.push(
+ `${spaces}${token}`
+ );
+ spaces = "";
is_comment = true;
klass = "instructions";
while (tokens[++i] === " " || tokens[i] === "\t")
spaces += tokens[i];
cmnt_char = tokens[i] ?? "";
- // console.log(cmnt_char);
- da_big_cmnt += cmnt_char;
+ line_.push(
+ `${spaces}`
+ );
+ already_been_added = true;
}
} else if (!isNaN(token[0]) && notation_ok(token)) {
klass = "constant";
@@ -269,5 +280,4 @@ output_text.addEventListener("keydown", (btn) => {
}
});
-
// document.getElementById("input-text").addEventListener("input", chittify); // React but O(n)