diff options
author | Preston Pan <preston@nullring.xyz> | 2023-01-03 17:59:18 -0800 |
---|---|---|
committer | Preston Pan <preston@nullring.xyz> | 2023-01-03 17:59:18 -0800 |
commit | 2fe28946e426e241e87e8381d7a62e73b9278385 (patch) | |
tree | b374061dab88629c0b418fc4c9495711ba643143 /src/parser.c | |
parent | f8cedce5299d12adc3ce3249fd5b3a9fe5578c0a (diff) |
fix bug
Diffstat (limited to 'src/parser.c')
-rw-r--r-- | src/parser.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/parser.c b/src/parser.c index 7f174a5..ac4d709 100644 --- a/src/parser.c +++ b/src/parser.c @@ -14,7 +14,7 @@ parser_t *init_parser(lexer_t *lexer) { p->i = 0; p->tokens = malloc(sizeof(token_t *)); - p->symbol_table = init_hash_table(10000); + p->symbol_table = init_hash_table(1000); p->finished = false; if (p->tokens == NULL) die("malloc on p->tokens"); @@ -117,6 +117,8 @@ ast_t *parse_function(parser_t *parser) { ast_t *car = parse_function_args(parser); ast_t *cdr = parse_expr(parser); /* a function can contain a single expression */ + if (cdr == NULL) + parser_error(parser); parser_eat(parser, TOKEN_RPAREN); return init_ast_function(car, cdr); } |