summaryrefslogtreecommitdiff
path: root/src/compiler/lexer.c
diff options
context:
space:
mode:
authorA404M <ahmadmahmoudiprogrammer@gmail.com>2025-02-08 08:54:04 +0330
committerA404M <ahmadmahmoudiprogrammer@gmail.com>2025-02-08 08:54:04 +0330
commit964c7178a371f79123d54a43671375f5c0ceb7e4 (patch)
tree3d4b2fe193e8bfd9b880014a8895c28b832e593a /src/compiler/lexer.c
parent3adb71cebdec10823af28074a631bf929401e7c4 (diff)
better errors
Diffstat (limited to 'src/compiler/lexer.c')
-rw-r--r--src/compiler/lexer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/compiler/lexer.c b/src/compiler/lexer.c
index daf7931..f4718fa 100644
--- a/src/compiler/lexer.c
+++ b/src/compiler/lexer.c
@@ -139,7 +139,7 @@ LexerNodeArray lexer(char *str) {
} else {
RETURN_ERROR:
free(result.data);
- printLog("Unexpected character '%c' at position %ld", c, iter - str);
+ printError("Unexpected character '%c'", iter, iter+1, c);
return LEXER_NODE_ARRAY_ERROR;
}
}
@@ -179,6 +179,7 @@ void lexerPushClear(LexerNodeArray *array, size_t *array_size, char *iter,
case LEXER_TOKEN_KEYWORD_VOID:
case LEXER_TOKEN_KEYWORD_U64:
case LEXER_TOKEN_KEYWORD_PRINT_U64:
+ case LEXER_TOKEN_KEYWORD_RETURN:
case LEXER_TOKEN_NUMBER:
case LEXER_TOKEN_SYMBOL_EOL:
case LEXER_TOKEN_SYMBOL_OPEN_PARENTHESIS:
@@ -189,6 +190,7 @@ void lexerPushClear(LexerNodeArray *array, size_t *array_size, char *iter,
case LEXER_TOKEN_SYMBOL_COLON:
case LEXER_TOKEN_SYMBOL_ASSIGN:
case LEXER_TOKEN_SYMBOL_COMMA:
+ case LEXER_TOKEN_SYMBOL_PLUS:
if (*array_size == array->size) {
*array_size += 1 + *array_size / 2;
array->data =