diff options
author | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-03-27 07:35:58 +0330 |
---|---|---|
committer | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-03-27 07:35:58 +0330 |
commit | 8ed01c4ca2d2356f008b40d8498173009f71d295 (patch) | |
tree | 931cd58461da6a137d7e6615657d7c7eb5bf1ed3 /src | |
parent | 4c7d3c1d1e71823efc47a78ef8a608ee1656b035 (diff) |
fix bug in multiple dereference
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/parser.c | 5 | ||||
-rw-r--r-- | src/runner/runner.c | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/compiler/parser.c b/src/compiler/parser.c index 17d596b..2ab8860 100644 --- a/src/compiler/parser.c +++ b/src/compiler/parser.c @@ -105,7 +105,8 @@ static constexpr ParserOrder PARSER_ORDER[] = { }, { .ltr = false, - ORDER_ARRAY(LEXER_TOKEN_SYMBOL_FUNCTION_ARROW, ), + ORDER_ARRAY(LEXER_TOKEN_SYMBOL_FUNCTION_ARROW, + LEXER_TOKEN_SYMBOL_POINTER, ), }, { .ltr = true, @@ -114,7 +115,7 @@ static constexpr ParserOrder PARSER_ORDER[] = { { .ltr = true, ORDER_ARRAY(LEXER_TOKEN_SYMBOL_PLUS, LEXER_TOKEN_SYMBOL_MINUS, - LEXER_TOKEN_SYMBOL_POINTER, LEXER_TOKEN_SYMBOL_ADDRESS, ), + LEXER_TOKEN_SYMBOL_ADDRESS, ), }, { .ltr = true, diff --git a/src/runner/runner.c b/src/runner/runner.c index efb91ee..4966893 100644 --- a/src/runner/runner.c +++ b/src/runner/runner.c @@ -868,7 +868,8 @@ AstTree *runExpression(AstTree *expr, bool *shouldRet) { case AST_TREE_TOKEN_OPERATOR_DEREFERENCE: { AstTreeSingleChild *metadata = expr->metadata; AstTree *operand = runExpression(metadata, shouldRet); - if (metadata->token != AST_TREE_TOKEN_VARIABLE) { + if (operand->token != AST_TREE_TOKEN_VARIABLE) { + printLog("%s", AST_TREE_TOKEN_STRINGS[operand->token]); UNREACHABLE; } AstTreeVariable *variable = operand->metadata; |