0
0

tokenize question mark

This commit is contained in:
DrMaxNix 2022-09-09 13:34:55 +02:00
parent bfbd49c9fe
commit 46461c9de0
2 changed files with 9 additions and 2 deletions

View File

@ -180,7 +180,8 @@ class Juicescript_lexer {
break; break;
// AMPERSAND // // SPECIAL CHARS //
// ampersand
case "&": case "&":
// only if there's a dollar sign after it // only if there's a dollar sign after it
if(this.peek() === "$"){ if(this.peek() === "$"){
@ -193,6 +194,11 @@ class Juicescript_lexer {
this.error("unexpected character '" + this.char + "'"); this.error("unexpected character '" + this.char + "'");
break; break;
// question mark
case "?":
this.token_add({type: Juicescript.token_type.QUESTION_MARK});
break;
// EVERYTHING ELSE // // EVERYTHING ELSE //
default: default:

View File

@ -23,7 +23,7 @@ class Juicescript {
"BRACKET_CURLY_OPEN", "BRACKET_CURLY_CLOSE", "BRACKET_CURLY_OPEN", "BRACKET_CURLY_CLOSE",
// special chars // special chars
"AMPERSAND", "AMPERSAND", "QUESTION_MARK",
// delimiters // delimiters
"DELIMITER", "DELIMITER",
@ -79,6 +79,7 @@ class Juicescript {
// run lexical analysis // run lexical analysis
let token_list = lexer.scan(); let token_list = lexer.scan();
/**/console.log(token_list);
// stop here if unsuccessful // stop here if unsuccessful
if(lexer.error_count > 0) return false; if(lexer.error_count > 0) return false;