]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
parser: Deal with certain missing delimiters and let the parser continue 5464767cfa5a8dbbc5f46293693ca627b8fcc46d
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 18 Jan 2020 19:03:37 +0000 (20:03 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 3 Feb 2020 12:33:40 +0000 (13:33 +0100)
vala/valaparser.vala

index 2edfcce31dfd005c8080a74d49ab3fd84e951165..d399d9dd6451919c97423ef7711d248770cfa688 100644 (file)
@@ -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 () {