From ee9a40f9102f12357e7a46c3b48a486c62c2311e Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 16 May 2024 00:55:16 -0400 Subject: Fix 'else if' --- parse.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'parse.c') diff --git a/parse.c b/parse.c index cdebf0fb..868c8bb9 100644 --- a/parse.c +++ b/parse.c @@ -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); -- cgit v1.2.3