From c1a1bd2320b4c1508c4ab20d23b7c193a94d8026 Mon Sep 17 00:00:00 2001 From: Carlos Maniero Date: Tue, 25 Apr 2023 03:52:59 -0300 Subject: parser: Add support for variables and identifiers in function body This commit adds support for variables and identifiers in the function body of the parser, stored as a vector. However, at this point, identifier resolution is not fully implemented, and we currently accept identifiers without checking if they can be resolved. This is a known limitation that will be addressed in a future commit once hash-tables are added to the parser. Signed-off-by: Carlos Maniero Reviewed-by: Johnny Richard --- src/lexer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/lexer.c') diff --git a/src/lexer.c b/src/lexer.c index b641752..e1f0d80 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -154,7 +154,8 @@ lexer_next_token(lexer_t *lexer, token_t *token) if (lexer_current_char(lexer) == '+' || lexer_current_char(lexer) == '-' || lexer_current_char(lexer) == '*' - || lexer_current_char(lexer) == '/') { + || lexer_current_char(lexer) == '/' + || lexer_current_char(lexer) == '=') { lexer_define_literal_token_props(lexer, token, TOKEN_OP); lexer_drop_char(lexer); return; -- cgit v1.2.3