diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-06-06 16:28:53 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-06-06 16:28:53 -0400 |
| commit | 8c7d53008072dfda8b9d60be92fae1a8046fae5d (patch) | |
| tree | 769407e0461b3c989c27a740c423827a21adfa91 /parse.c | |
| parent | 31c8d0af1597b6b4996a90808b1b8c0983db309e (diff) | |
Split header compilation into a separate function
Diffstat (limited to 'parse.c')
| -rw-r--r-- | parse.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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; |
