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

View File

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