diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2022-03-03 17:06:13 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-03 17:06:13 +0100 |
| commit | b4ca99ead948e66204b83bb92bad855998f7b542 (patch) | |
| tree | 45099d7066cf27a3df5d080af862290493932713 /src | |
| parent | 09f5713cf8d3ac05ccbc92d7770d1835b1632963 (diff) | |
| parent | dfe2c0a600aa3d78b56b5df54ba4c46620c59a4f (diff) | |
Merge pull request #1583 from semarie/semi-colons-eof
Semi colons and EOF
Diffstat (limited to 'src')
| -rw-r--r-- | src/parser.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index f70afe346..94a585f35 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -1538,7 +1538,7 @@ void fix_advance_to_next_stmt(AstFile *f) { Token expect_closing(AstFile *f, TokenKind kind, String context) { if (f->curr_token.kind != kind && f->curr_token.kind == Token_Semicolon && - f->curr_token.string == "\n") { + (f->curr_token.string == "\n" || f->curr_token.kind == Token_EOF)) { Token tok = f->prev_token; tok.pos.column += cast(i32)tok.string.len; syntax_error(tok, "Missing ',' before newline in %.*s", LIT(context)); @@ -1560,6 +1560,7 @@ void assign_removal_flag_to_semicolon(AstFile *f) { switch (curr_token->kind) { case Token_CloseBrace: case Token_CloseParen: + case Token_EOF: ok = true; break; } |