✨ tokenize question mark
This commit is contained in:
parent
bfbd49c9fe
commit
46461c9de0
@ -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:
|
||||||
|
@ -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;
|
||||||
|
Reference in New Issue
Block a user