summaryrefslogtreecommitdiff
path: root/vala/valaparser.vala
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2020-01-18 20:03:37 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2020-02-03 13:33:40 +0100
commit5464767cfa5a8dbbc5f46293693ca627b8fcc46d (patch)
treebce43410355e2be5fc89b46fa4478ea870eac5af /vala/valaparser.vala
parent5e5126b5a071f2bac83cef3548e4ef3b03772d7c (diff)
downloadvala-5464767cfa5a8dbbc5f46293693ca627b8fcc46d.tar.gz
parser: Deal with certain missing delimiters and let the parser continue
Diffstat (limited to 'vala/valaparser.vala')
-rw-r--r--vala/valaparser.vala15
1 files changed, 14 insertions, 1 deletions
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 2edfcce31..d399d9dd6 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -126,7 +126,20 @@ public class Vala.Parser : CodeVisitor {
return true;
}
- throw new ParseError.SYNTAX ("expected %s", type.to_string ());
+ switch (type) {
+ case TokenType.CLOSE_BRACE:
+ prev ();
+ report_parse_error (new ParseError.SYNTAX ("following block delimiter %s missing", type.to_string ()));
+ return true;
+ case TokenType.CLOSE_BRACKET:
+ case TokenType.CLOSE_PARENS:
+ case TokenType.SEMICOLON:
+ prev ();
+ report_parse_error (new ParseError.SYNTAX ("following expression/statement delimiter %s missing", type.to_string ()));
+ return true;
+ default:
+ throw new ParseError.SYNTAX ("expected %s", type.to_string ());
+ }
}
inline SourceLocation get_location () {