aboutsummaryrefslogtreecommitdiff
path: root/src/parser.c
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2016-12-06 14:06:31 +0000
committerGinger Bill <bill@gingerbill.org>2016-12-06 14:06:31 +0000
commitd9bd770992d85f07b86ce6366154c691b5c07347 (patch)
tree2b6de4522ef32a40b871ba543ce59ba6429388cc /src/parser.c
parent517b34f7982796dfc81f5ec2d6162172b42b89a2 (diff)
Fix enumeration constant expressions; Remove empty file error
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c12
1 files changed, 9 insertions, 3 deletions
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;