diff options
author | Johnny Richard <johnny@johnnyrichard.com> | 2023-04-30 01:48:18 +0200 |
---|---|---|
committer | Johnny Richard <johnny@johnnyrichard.com> | 2023-04-30 01:55:29 +0200 |
commit | ef07fab261cce781ca750c1288574d4001f14bcf (patch) | |
tree | 9b4da44aee7cc64cec448adeee31b38e12d29e6d /src/parser.h | |
parent | 88a08db927629032d6d4c662e00f0dce2c112ce4 (diff) |
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 <johnny@johnnyrichard.com>
Co-authored-by: Carlos Maniero <carlosmaniero@gmail.com>
Diffstat (limited to 'src/parser.h')
-rw-r--r-- | src/parser.h | 4 |
1 files changed, 3 insertions, 1 deletions
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); |