diff options
author | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-04-09 22:54:40 +0330 |
---|---|---|
committer | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-04-09 22:54:40 +0330 |
commit | 5e95fdfa4b7e6960d83480b8e4062e7484037af7 (patch) | |
tree | 742e139dc1149daf4c5565b07c8e58a665355b4a /src/compiler/lexer.c | |
parent | 9b355a18b14f2ece7707e6c5334124dcc0961e2d (diff) |
add builtins (cast)
Diffstat (limited to 'src/compiler/lexer.c')
-rw-r--r-- | src/compiler/lexer.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/compiler/lexer.c b/src/compiler/lexer.c index d53560e..43502aa 100644 --- a/src/compiler/lexer.c +++ b/src/compiler/lexer.c @@ -13,6 +13,7 @@ const char *LEXER_TOKEN_STRINGS[] = { "LEXER_TOKEN_SYMBOL_CLOSE_PARENTHESIS", "LEXER_TOKEN_IDENTIFIER", + "LEXER_TOKEN_BUILTIN", "LEXER_TOKEN_KEYWORD_TYPE", "LEXER_TOKEN_KEYWORD_VOID", "LEXER_TOKEN_KEYWORD_I8", @@ -257,8 +258,10 @@ LexerNodeArray lexer(char *str) { } } } else if (isIdentifier(c) || - (node_token == LEXER_TOKEN_IDENTIFIER && isNumber(c))) { + (node_token == LEXER_TOKEN_IDENTIFIER && isNumber(c)) || + (node_token == LEXER_TOKEN_BUILTIN && isNumber(c))) { if (node_token != LEXER_TOKEN_IDENTIFIER && + node_token != LEXER_TOKEN_BUILTIN && node_token != LEXER_TOKEN_NUMBER) { lexerPushClear(&result, &result_size, iter, &node_str_begin, &node_token, LEXER_TOKEN_IDENTIFIER); @@ -274,6 +277,9 @@ LexerNodeArray lexer(char *str) { lexerPushClear(&result, &result_size, iter, &node_str_begin, &node_token, LEXER_TOKEN_SYMBOL); } + } else if (c == '@') { + lexerPushClear(&result, &result_size, iter, &node_str_begin, &node_token, + LEXER_TOKEN_BUILTIN); } else { RETURN_ERROR: free(result.data); @@ -380,6 +386,7 @@ void lexerPushClear(LexerNodeArray *array, size_t *array_size, char *iter, case LEXER_TOKEN_SYMBOL_LOGICAL_NOT: case LEXER_TOKEN_SYMBOL_LOGICAL_AND: case LEXER_TOKEN_SYMBOL_LOGICAL_OR: + case LEXER_TOKEN_BUILTIN: if (*array_size == array->size) { *array_size += 1 + *array_size / 2; array->data = |