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/scope.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/scope.h') diff --git a/src/scope.h b/src/scope.h index c221703..2636990 100644 --- a/src/scope.h +++ b/src/scope.h @@ -14,6 +14,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ +#ifndef SCOPE_H +#define SCOPE_H + #include "ast.h" #include "string_view.h" #include "vector.h" @@ -41,6 +44,8 @@ void scope_leave(scope_t *scope); ast_node_t * -scope_get(scope_t *scope, ast_identifier_t *identifier); +scope_get(scope_t *scope, string_view_t name); void scope_push(scope_t *scope, ast_identifier_t *identifier, ast_node_t *node); + +#endif /* SCOPE_H */ -- cgit v1.2.3