From ef07fab261cce781ca750c1288574d4001f14bcf Mon Sep 17 00:00:00 2001 From: Johnny Richard Date: Sun, 30 Apr 2023 01:48:18 +0200 Subject: parser: Registry identifiers on scope We are parsing variables/functions and checking if they are defined on scope. Otherwise we fail the parsing with a nice message. Signed-off-by: Johnny Richard Co-authored-by: Carlos Maniero --- src/parser.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/parser.h') diff --git a/src/parser.h b/src/parser.h index bdf0c5a..d3e1431 100644 --- a/src/parser.h +++ b/src/parser.h @@ -19,6 +19,7 @@ #include "ast.h" #include "lexer.h" +#include "scope.h" #include "string_view.h" typedef struct parser_error_t @@ -30,13 +31,14 @@ typedef struct parser_error_t typedef struct parser_t { lexer_t *lexer; + scope_t *scope; int errors_len; // FIXME: replace with vector parser_error_t errors[1]; } parser_t; void -parser_init(parser_t *parser, lexer_t *lexer); +parser_init(parser_t *parser, lexer_t *lexer, scope_t *scope); bool parser_parse_function_declaration(parser_t *parser, ast_node_t *node); -- cgit v1.2.3