]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
parser: Make parse_identifier more robust
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)
... when --keep-going was passed

vala/valaparser.vala

index 5f9bd34646433b401eec0b25070eee73b98d154a..18a636b35afc2f26943db234d2e4201f92b1aa80 100644 (file)
@@ -281,7 +281,17 @@ public class Vala.Parser : CodeVisitor {
        }
 
        string parse_identifier () throws ParseError {
-               skip_identifier ();
+               try {
+                       skip_identifier ();
+               } catch (ParseError e) {
+                       if (context.keep_going) {
+                               report_parse_error (e);
+                               prev ();
+                               return "";
+                       } else {
+                               throw e;
+                       }
+               }
                return get_last_string ();
        }