diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-05-16 00:55:16 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-05-16 00:55:16 -0400 |
| commit | ee9a40f9102f12357e7a46c3b48a486c62c2311e (patch) | |
| tree | a30b93c781ddf7db6462e738171635fc519b404a /parse.c | |
| parent | c1e4730f353aa5424a038bfdc39d338ca8a1cb73 (diff) | |
Fix 'else if'
Diffstat (limited to 'parse.c')
| -rw-r--r-- | parse.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -889,7 +889,8 @@ PARSER(parse_if) { const char *else_start = pos; if (get_indent(ctx, tmp) == starting_indent && match_word(&tmp, "else")) { pos = tmp; - expect_str(ctx, start, &pos, ":", "I expected a ':' here"); + if (!match_word(&tmp, "if")) + expect_str(ctx, start, &pos, ":", "I expected a ':' here"); else_body = expect(ctx, else_start, &pos, parse_opt_indented_block, "I expected a body for this 'else'"); } return NewAST(ctx->file, start, pos, If, .condition=condition, .body=body, .else_body=else_body); |
