diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-01-11 11:39:28 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-01-11 11:39:28 -0500 |
commit | 26963df1b3798f9eb13625561e3f1f9dbcce37c6 (patch) | |
tree | 0042023f99f1f8372b31803b306ff0d747baf89d | |
parent | dee206f197b32e18f0f43e6770f1e59e5c25af75 (diff) |
improved error message for too many (s
-rw-r--r-- | parse.c | 8 | ||||
-rw-r--r-- | test.toc | 9 |
2 files changed, 8 insertions, 9 deletions
@@ -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; } @@ -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 |