From ce6081dbbd588fb111754f3c2c1c93d2421c6ee6 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 8 Jun 2021 12:58:09 +0200 Subject: lexer, vm: reorder token and instruction numbers Ensure that relational operators in the lexer token and vm instruction lists are both ordered in the same way according to the general operator precedence of the grammar. Signed-off-by: Jo-Philipp Wich --- lexer.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'lexer.h') diff --git a/lexer.h b/lexer.h index 9f26beb..e1a30ed 100644 --- a/lexer.h +++ b/lexer.h @@ -29,17 +29,17 @@ typedef enum { TK_IF, TK_ELSE, TK_COMMA, - TK_ASBAND, - TK_ASBXOR, - TK_ASBOR, - TK_ASLEFT, - TK_ASRIGHT, + TK_ASSIGN, + TK_ASADD, + TK_ASSUB, TK_ASMUL, TK_ASDIV, TK_ASMOD, - TK_ASADD, - TK_ASSUB, - TK_ASSIGN, + TK_ASLEFT, + TK_ASRIGHT, + TK_ASBAND, + TK_ASBXOR, + TK_ASBOR, TK_QMARK, TK_COLON, TK_OR, @@ -47,10 +47,10 @@ typedef enum { TK_BOR, TK_BXOR, TK_BAND, - TK_EQ, - TK_NE, TK_EQS, TK_NES, + TK_EQ, + TK_NE, TK_LT, TK_LE, TK_GT, @@ -67,13 +67,15 @@ typedef enum { TK_COMPL, TK_INC, TK_DEC, - TK_LPAREN, + TK_DOT, TK_LBRACK, + TK_RBRACK, + TK_LPAREN, + TK_RPAREN, TK_TEXT, TK_LBRACE, TK_RBRACE, TK_SCOL, - TK_RPAREN, TK_ENDIF, TK_ELIF, TK_WHILE, @@ -94,8 +96,6 @@ typedef enum { TK_CONTINUE, TK_LOCAL, TK_ARROW, - TK_DOT, - TK_RBRACK, TK_TRUE, TK_FALSE, TK_NUMBER, -- cgit v1.2.3