diff options
| author | gingerBill <bill@gingerbill.org> | 2023-05-29 14:55:27 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-05-29 14:55:27 +0100 |
| commit | d2f62730bc26fd18355de3c86d2d825a221aa288 (patch) | |
| tree | e28a60b682deb609a1b8554e1794921a28f22c4b /src | |
| parent | 508d7c3336319a60ff74695d69d7ad9648c5f3b2 (diff) | |
Fix #2560
Diffstat (limited to 'src')
| -rw-r--r-- | src/parser.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index bb492fca9..1b48dce87 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -3744,8 +3744,18 @@ gb_internal bool allow_field_separator(AstFile *f) { if (allow_token(f, Token_Comma)) { return true; } - if (ALLOW_NEWLINE && token.kind == Token_Semicolon) { - if (!token_is_newline(token)) { + if (token.kind == Token_Semicolon) { + bool ok = false; + if (ALLOW_NEWLINE && token_is_newline(token)) { + TokenKind next = peek_token(f).kind; + switch (next) { + case Token_CloseBrace: + case Token_CloseParen: + ok = true; + break; + } + } + if (!ok) { String p = token_to_string(token); syntax_error(token_end_of_line(f, f->prev_token), "Expected a comma, got a %.*s", LIT(p)); } |