diff options
author | Carlos Maniero <carlos@maniero.me> | 2023-05-10 17:49:36 -0300 |
---|---|---|
committer | Carlos Maniero <carlos@maniero.me> | 2023-05-10 19:24:00 -0300 |
commit | 6f187a71cbe3aa4ebb32ba287c75562d96c7a3f4 (patch) | |
tree | 55456bc94408ed74adb811835a95ad44208fcb4f /src/parser.c | |
parent | 3129b741064c2b4f2c6c2408bd42cc83f7341ea8 (diff) |
tests: Replace parse function with parse ns for error handling
It was necessary to test function calls errors.
Signed-off-by: Carlos Maniero <carlos@maniero.me>
Diffstat (limited to 'src/parser.c')
-rw-r--r-- | src/parser.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/parser.c b/src/parser.c index 578514c..377ff73 100644 --- a/src/parser.c +++ b/src/parser.c @@ -790,7 +790,17 @@ parser_parse_ns(parser_t *parser) } vector_push_back(nodes, node); + continue; } + + parser_error_t error; + + lexer_peek_next_token(parser->lexer, &error.token); + sprintf(error.message, "Unexpected token '" SVFMT "'", SVARG(&error.token.value)); + parser->errors[parser->errors_len++] = error; + + ast_node_destroy_vector(nodes); + return NULL; } return ast_node_new_namespace(nodes); |