summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--parse.c8
-rw-r--r--test.toc9
2 files changed, 8 insertions, 9 deletions
diff --git a/parse.c b/parse.c
index cfc66c9..dcc5531 100644
--- a/parse.c
+++ b/parse.c
@@ -1286,16 +1286,24 @@ static bool parse_expr(Parser *p, Expression *e, Token *end) {
if (paren_level > 0) {
t->token = start;
+ while (!token_is_kw(t->token, KW_LPAREN))
+ ++t->token;
+
tokr_err(t, "Too many opening parentheses (.");
return false;
}
if (brace_level > 0) {
t->token = start;
+ while (!token_is_kw(t->token, KW_LBRACE))
+ ++t->token;
+
tokr_err(t, "Too many opening braces {.");
return false;
}
if (square_level > 0) {
t->token = start;
+ while (!token_is_kw(t->token, KW_LSQUARE))
+ ++t->token;
tokr_err(t, "Too many opening square brackets [.");
return false;
}
diff --git a/test.toc b/test.toc
index 165b41f..10d2385 100644
--- a/test.toc
+++ b/test.toc
@@ -13,16 +13,7 @@ putf ::= fn(x: float) {
main ::= fn() {
- s ::= struct { x,y,z:int; f:f32; };
- puti(#alignof(s));
- puti(#sizeof(s));
-
-};
-/*
-something's wrong (should be too few opening parentheses!)
-main ::= fn() {
puti(#alignof(struct { x,y,z:int; f:f64; });
puti(#sizeof(struct { x,y,z:int; f:f64; });
};
-*/ \ No newline at end of file