diff options
-rw-r--r-- | lexer.h | 28 | ||||
-rw-r--r-- | vm.c | 3 | ||||
-rw-r--r-- | vm.h | 30 |
3 files changed, 32 insertions, 29 deletions
@@ -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, @@ -1230,7 +1230,8 @@ uc_vm_value_arith(uc_vm *vm, enum insn_type operation, uc_value_t *value, uc_val int64_t n1, n2; double d1, d2; - if (operation > I_MOD) + if (operation == I_LSHIFT || operation == I_RSHIFT || + operation == I_BAND || operation == I_BXOR || operation == I_BOR) return uc_vm_value_bitop(vm, operation, value, operand); if (operation == I_ADD && (ucv_type(value) == UC_STRING || ucv_type(operand) == UC_STRING)) { @@ -56,27 +56,29 @@ __insn(MARR) \ __insn(NOBJ) \ __insn(SOBJ) \ __insn(MOBJ) \ -__insn(PLUS) \ -__insn(MINUS) \ -__insn(ADD) \ -__insn(SUB) \ -__insn(MUL) \ -__insn(DIV) \ -__insn(MOD) \ -__insn(LSHIFT) \ -__insn(RSHIFT) \ -__insn(BAND) \ -__insn(BXOR) \ __insn(BOR) \ -__insn(COMPL) \ -__insn(EQ) \ -__insn(NE) \ +__insn(BXOR) \ +__insn(BAND) \ __insn(EQS) \ __insn(NES) \ +__insn(EQ) \ +__insn(NE) \ __insn(LT) \ +__insn(LE) \ __insn(GT) \ +__insn(GE) \ __insn(IN) \ +__insn(LSHIFT) \ +__insn(RSHIFT) \ +__insn(ADD) \ +__insn(SUB) \ +__insn(MUL) \ +__insn(DIV) \ +__insn(MOD) \ __insn(NOT) \ +__insn(COMPL) \ +__insn(PLUS) \ +__insn(MINUS) \ __insn(JMP) \ __insn(JMPZ) \ __insn(COPY) \ |