From 8c7d53008072dfda8b9d60be92fae1a8046fae5d Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 6 Jun 2024 16:28:53 -0400 Subject: Split header compilation into a separate function --- parse.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'parse.c') 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; -- cgit v1.2.3