[vala/wip/ricotz/lsp-rev: 7/9] parser: Make parse_identifier more robust



commit 1409329c4f10cee07226a317dd8dfd91d2fed2a4
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sat Jan 18 20:03:37 2020 +0100

    parser: Make parse_identifier more robust
    
    ... when --keep-going was passed

 vala/valaparser.vala | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 5ff367809..e0b8d5018 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -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 ();
        }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]