🧑💻 move some syntax checks to parser
This commit is contained in:
parent
b730713c0c
commit
46f60b6f9d
23
src/lexer.js
23
src/lexer.js
@ -184,16 +184,8 @@ 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 + "'");
|
||||
break;
|
||||
|
||||
// question mark
|
||||
case "?":
|
||||
@ -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});
|
||||
}
|
||||
|
Reference in New Issue
Block a user