0
0

🧑‍💻 move some syntax checks to parser

This commit is contained in:
DrMaxNix 2022-09-09 13:39:19 +02:00
parent b730713c0c
commit 46f60b6f9d

View File

@ -184,15 +184,7 @@ class Juicescript_lexer {
// SPECIAL CHARS //
// ampersand
case "&":
// only if there's a dollar sign after it
if(this.peek() === "$"){
// add token
this.token_add({type: Juicescript.token_type.AMPERSAND});
break;
}
// ignore with error
this.error("unexpected character '" + this.char + "'");
this.token_add({type: Juicescript.token_type.AMPERSAND});
break;
// question mark
@ -365,21 +357,6 @@ class Juicescript_lexer {
let variable = this.source.substring(this.start + 1, this.end);
// CHECK IF THERE EVEN IS A NAME //
if(variable.length <= 0){
// has curly bracket after it?
if(this.peek() === "{"){
// add token without value
this.token_add({type: Juicescript.token_type.VARIABLE});
return;
}
// ignore with error
this.error("unexpected character '" + this.source.charAt(this.start) + "'");
return;
}
// ADD TOKEN //
this.token_add({type: Juicescript.token_type.VARIABLE, value: variable});
}