From d9bd770992d85f07b86ce6366154c691b5c07347 Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Tue, 6 Dec 2016 14:06:31 +0000 Subject: Fix enumeration constant expressions; Remove empty file error --- src/parser.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/parser.c') diff --git a/src/parser.c b/src/parser.c index b0b2fe4a3..6514e0b20 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1176,6 +1176,11 @@ Token expect_closing(AstFile *f, TokenKind kind, String context) { } void expect_semicolon(AstFile *f, AstNode *s) { + if (f->prev_token.kind == Token_CloseBrace || + f->prev_token.kind == Token_CloseBrace) { + return; + } + if (f->curr_token.kind != Token_CloseParen && f->curr_token.kind != Token_CloseBrace) { switch (f->curr_token.kind) { @@ -3267,6 +3272,10 @@ ParseFileError parse_files(Parser *p, char *init_filename) { ParseFileError err = init_ast_file(&file, import_path); if (err != ParseFile_None) { + if (err == ParseFile_EmptyFile) { + return ParseFile_None; + } + if (pos.line != 0) { gb_printf_err("%.*s(%td:%td) ", LIT(pos.file), pos.line, pos.column); } @@ -3278,9 +3287,6 @@ ParseFileError parse_files(Parser *p, char *init_filename) { case ParseFile_InvalidFile: gb_printf_err("Invalid file"); break; - case ParseFile_EmptyFile: - gb_printf_err("File is empty"); - break; case ParseFile_Permission: gb_printf_err("File permissions problem"); break; -- cgit v1.2.3