From b78b30a34d2f8a2bf58e1a9506a5b66281f3dde0 Mon Sep 17 00:00:00 2001 From: Araozu Date: Wed, 27 Mar 2024 12:01:14 -0500 Subject: [PATCH] use the new highlighter in all the pages --- lexer/lexer.ts | 27 +++++++-------------------- static/index.html | 4 +--- static/js/prism.min.js | 4 ---- static/js/prism.thp.js | 25 ------------------------- static/template.html | 23 ++++++++++++++++++++--- 5 files changed, 28 insertions(+), 55 deletions(-) delete mode 100644 static/js/prism.min.js delete mode 100644 static/js/prism.thp.js diff --git a/lexer/lexer.ts b/lexer/lexer.ts index 982f30f..3239728 100644 --- a/lexer/lexer.ts +++ b/lexer/lexer.ts @@ -36,9 +36,6 @@ export function lex(code: string): Array { while (current_pos < code_len) { const c = code[current_pos]; - let next_token: Token | null = null; - let next_position: number | null = null; - // try to scan a number if (is_digit(c)) { // if the current default token is not empty, push it to the tokens array @@ -118,25 +115,15 @@ export function lex(code: string): Array { current_pos = pos; continue; } - - // here, check if a token was found - if (next_token !== null && next_position !== null) { - // if there was a default token, push it to the tokens array - if (current_default_token !== "") { - tokens.push({ v: current_default_token, token_type: "" }); - current_default_token = ""; - } - - // then push the new token found - tokens.push(next_token); - current_pos = next_position; + // replace < with < + else if (c === "<") { + current_default_token += "<"; + current_pos++; continue; } - // otherwise, add the current character to the default token - else { - current_default_token += c; - current_pos++; - } + + current_default_token += c; + current_pos++; } // if there was a default token, push it to the tokens array diff --git a/static/index.html b/static/index.html index 6feb3d7..884448b 100644 --- a/static/index.html +++ b/static/index.html @@ -74,8 +74,6 @@ - - - - + + + \ No newline at end of file