Skip to content

Commit

Permalink
Update main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
najmiter authored Jan 14, 2024
1 parent 1da3fd1 commit 366c0f3
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}<span class="comment">${da_big_cmnt}</span>`
`${spaces}<span class="comment">${cmnt_char}</span>`
);

is_comment = false;
da_big_cmnt = "";
cmnt_char = "";
Expand All @@ -107,20 +106,32 @@ const chittify = () => {

if (is_comment) {
da_big_cmnt += token;
if (i === 0) {
line_.push(
`${spaces}<span class="comment">${da_big_cmnt}</span>`
);
da_big_cmnt = "";
}
continue;
}
if (token === ";" || nikka_token === "comment") {
if (nikka_token === ";") {
if (token === ";") {
token = tokens[++i] ?? "";
klass = "comment";
} else {
line_.push(
`${spaces}<span class="instructions">${token}</span>`
);
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}<span class="comment">${cmnt_char}</span>`
);
already_been_added = true;
}
} else if (!isNaN(token[0]) && notation_ok(token)) {
klass = "constant";
Expand Down Expand Up @@ -269,5 +280,4 @@ output_text.addEventListener("keydown", (btn) => {
}
});


// document.getElementById("input-text").addEventListener("input", chittify); // React but O(n)

0 comments on commit 366c0f3

Please sign in to comment.