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/ast.c | |
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/ast.c')
-rw-r--r-- | src/ast.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -108,6 +108,13 @@ ast_node_init_variable_declaration(ast_node_t *node, string_view_t variable_name } void +ast_node_init_variable(ast_node_t *node, ast_identifier_t *identifier) +{ + node->kind = AST_VARIABLE; + node->data = (ast_node_data_t){ .variable_ex = { .identifier = identifier } }; +} + +void ast_node_init_identifier(ast_node_t *node, string_view_t name) { node->kind = AST_IDENTIFIER; |