From 1bd43564b2edda3358e1b0ad9b83b64dfb59c0d9 Mon Sep 17 00:00:00 2001 From: A404M Date: Sun, 23 Feb 2025 12:09:38 +0330 Subject: fix < >= operator bug --- src/compiler/lexer.c | 4 +++- src/runner/runner.c | 7 +++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/compiler/lexer.c b/src/compiler/lexer.c index 6263854..b75bd7e 100644 --- a/src/compiler/lexer.c +++ b/src/compiler/lexer.c @@ -86,8 +86,8 @@ const LexerToken LEXER_SYMBOL_TOKENS[] = { LEXER_TOKEN_SYMBOL_EQUAL, LEXER_TOKEN_SYMBOL_NOT_EQUAL, LEXER_TOKEN_SYMBOL_GREATER, - LEXER_TOKEN_SYMBOL_SMALLER, LEXER_TOKEN_SYMBOL_GREATER_OR_EQUAL, + LEXER_TOKEN_SYMBOL_SMALLER, LEXER_TOKEN_SYMBOL_SMALLER_OR_EQUAL, }; const size_t LEXER_SYMBOL_SIZE = @@ -314,12 +314,14 @@ bool isSymbol(char c) { switch (c) { case '-': case '>': + case '<': case '.': case '+': case '*': case '/': case '%': case '=': + case '!': return true; default: return false; diff --git a/src/runner/runner.c b/src/runner/runner.c index a1a1f44..81154f5 100644 --- a/src/runner/runner.c +++ b/src/runner/runner.c @@ -19,10 +19,8 @@ #define doLogicalOperation(op0, op1, operator, originalType, _type) \ { \ - bool res = (bool)((_type)(originalType)(op0) \ - ->metadata \ - operator(_type)(originalType)(op1) \ - ->metadata); \ + bool res = (bool)(((_type)(originalType)(op0)->metadata) operator( \ + (_type)(originalType)(op1)->metadata)); \ astTreeDestroy(*(op0)); \ (op0)->metadata = (void *)(u64)res; \ (op0)->type = &AST_TREE_BOOL_TYPE; \ @@ -188,6 +186,7 @@ AstTree *runnerVariableGetValue(RunnerVariablePages *pages, } } + printError(variable->name_begin,variable->name_end,"Variable not found"); UNREACHABLE; } -- cgit v1.2.3