[vala/wip/lsp-rev: 1/7] parser: Deal with certain missing delimiters and let the parser continue
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/lsp-rev: 1/7] parser: Deal with certain missing delimiters and let the parser continue
- Date: Mon, 20 Jan 2020 09:24:40 +0000 (UTC)
commit 70449b452733e07fb1cfe700454fccaa93b573c2
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sat Jan 18 20:03:37 2020 +0100
parser: Deal with certain missing delimiters and let the parser continue
vala/valaparser.vala | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index a030d24f2..5df812644 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 () {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]