summaryrefslogtreecommitdiff
path: root/src/parser.c
diff options
context:
space:
mode:
authorPreston Pan <preston@nullring.xyz>2023-01-06 20:48:56 -0800
committerPreston Pan <preston@nullring.xyz>2023-01-06 20:48:56 -0800
commitc620d528fb9d9efbac559002d23857623e71df05 (patch)
treed8d6ee788cc4688a3c4a4401906fe3ce25307855 /src/parser.c
parent0771dd0e1a143c17920d65d5de8d010aa433ce1c (diff)
whoops, fixed concat. Include in the making
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/parser.c b/src/parser.c
index 6a77e87..0a2b213 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -133,6 +133,8 @@ void parse_bind(parser_t *parser) {
hash table transfers to visitor JIT */
if (expr == NULL)
parser_error(parser);
+ if (expr->type == AST_ROOT)
+ parser_error(parser);
hash_table_add(parser->symbol_table, name, expr);
if (parser->tokens[parser->i]->type != TOKEN_RPAREN)
parser_error(parser);
@@ -140,6 +142,8 @@ void parse_bind(parser_t *parser) {
parser_move(parser);
}
+ast_t *parse_include(parser_t *parser) { parser_eat(parser, TOKEN_STRING); }
+
ast_t *parse_list(parser_t *parser) {
ast_t *car;
ast_t *head = init_ast_pair(NULL, NULL);
@@ -162,6 +166,8 @@ ast_t *parse_list(parser_t *parser) {
car = parse_expr(parser);
if (car == NULL)
parser_error(parser);
+ if (car->type == AST_ROOT)
+ parser_error(parser);
}
cur->car = car;
cur->cdr = init_ast_pair(NULL, NULL);
@@ -179,6 +185,8 @@ ast_t *parse_quote(parser_t *parser) {
ast_t *expr = parse_expr(parser);
if (expr == NULL)
parser_error(parser);
+ if (expr->type == AST_ROOT)
+ parser_error(parser);
ast_t *ret = init_ast_pair(
car, init_ast_pair(
expr, init_ast_pair(NULL, NULL))); /* Converts ' to `quote` */