aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2021-09-03 14:21:03 -0700
committerMichael Forney <mforney@mforney.org>2021-09-03 14:21:03 -0700
commit6f874e47b62705b28175b135b3372a19a8108bf3 (patch)
tree6677ad575a55e1740965d6d46442a780d7fd4eea
parente2855dd3223f83e7638d1698622861d5e98cb1b2 (diff)
downloadcproc-6f874e47b62705b28175b135b3372a19a8108bf3.tar.xz
main: Add specialized error message for stray ';' at toplevel
-rw-r--r--main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/main.c b/main.c
index 004df85..e35419a 100644
--- a/main.c
+++ b/main.c
@@ -58,8 +58,11 @@ main(int argc, char *argv[])
} else {
scopeinit();
while (tok.kind != TEOF) {
- if (!decl(&filescope, NULL))
+ if (!decl(&filescope, NULL)) {
+ if (tok.kind == TSEMICOLON)
+ error(&tok.loc, "unexpected ';' at top-level");
error(&tok.loc, "expected declaration or function definition");
+ }
}
emittentativedefns();
}