From 01c3797636bda319d4660c1e4502ba0019688696 Mon Sep 17 00:00:00 2001 From: DrMaxNix Date: Thu, 8 Sep 2022 21:07:50 +0200 Subject: [PATCH] :sparkles: keep track of single equal sign `=` --- src/lexer.js | 4 ++-- src/main.js | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/lexer.js b/src/lexer.js index 7725231..380d574 100644 --- a/src/lexer.js +++ b/src/lexer.js @@ -86,8 +86,8 @@ class Juicescript_lexer { break; case "=": - if (this.match("=")) this.token_add({type: Juicescript.token_type.EQUAL}); - else this.error("unexpected character '" + this.char + "'"); + if (this.match("=")) this.token_add({type: Juicescript.token_type.EQUAL_EQUAL}); + else this.token_add({type: Juicescript.token_type.EQUAL}); break; case "<": diff --git a/src/main.js b/src/main.js index 866bae8..4cdce44 100644 --- a/src/main.js +++ b/src/main.js @@ -13,8 +13,8 @@ class Juicescript { "NULL", // operators - "NOT", - "EQUAL", "NOT_EQUAL", + "EQUAL", "NOT", + "EQUAL_EQUAL", "NOT_EQUAL", "GREATER", "GREATER_EQUAL", "LESS", "LESS_EQUAL", @@ -33,6 +33,12 @@ class Juicescript { ); + // ARGUMENT TYPES // + static argument_type = new Juicescript_helper_enum( + "VARIABLE", "LITERAL" + ); + + /* CONSTRUCTOR: Return new juicescript parser with OPTIONS @@ -103,6 +109,6 @@ class Juicescript { Run previously parsed program */ run(){ - //*/ TODO + /**/console.log(this.program_tree); } }