aboutsummaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-06-06 16:28:53 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-06-06 16:28:53 -0400
commit8c7d53008072dfda8b9d60be92fae1a8046fae5d (patch)
tree769407e0461b3c989c27a740c423827a21adfa91 /parse.c
parent31c8d0af1597b6b4996a90808b1b8c0983db309e (diff)
Split header compilation into a separate function
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/parse.c b/parse.c
index 539c2950..c6d8cec2 100644
--- a/parse.c
+++ b/parse.c
@@ -19,6 +19,7 @@ static const char closing[128] = {['(']=')', ['[']=']', ['<']='>', ['{']='}'};
typedef struct {
file_t *file;
jmp_buf *on_err;
+ int64_t next_lambda_id;
} parse_ctx_t;
typedef ast_t* (parser_t)(parse_ctx_t*,const char*);
@@ -1224,7 +1225,7 @@ PARSER(parse_lambda) {
spaces(&pos);
expect_closing(ctx, &pos, ")", "I was expecting a ')' to finish this anonymous function's arguments");
ast_t *body = optional(ctx, &pos, parse_block);
- return NewAST(ctx->file, start, pos, Lambda, .args=args, .body=body);
+ return NewAST(ctx->file, start, pos, Lambda, .id=ctx->next_lambda_id++, .args=args, .body=body);
}
PARSER(parse_nil) {
@@ -2076,6 +2077,7 @@ ast_t *parse_expression_str(const char *str) {
parse_ctx_t ctx = {
.file=file,
.on_err=NULL,
+ .next_lambda_id=0,
};
const char *pos = file->text;