changeset 62:62b440d46313

Added Skip method to JSON parser to skip contents of the current node
author cin
date Sun, 22 Jun 2014 04:14:02 +0400
parents 90069a2ec20a
children 908b4f340c69
files Implab/JSON/JSONParser.cs Implab/Parsing/DFAutomaton.cs
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Implab/JSON/JSONParser.cs	Thu Jun 19 20:04:20 2014 +0400
+++ b/Implab/JSON/JSONParser.cs	Sun Jun 22 04:14:02 2014 +0400
@@ -250,6 +250,15 @@
         ~JSONParser() {
             Dispose(false);
         }
+
+        public void Skip() {
+            var level = Level-1;
+
+            Debug.Assert(level >= 0);
+
+            while (Level != level)
+                Read();
+        }
     }
 
 }
--- a/Implab/Parsing/DFAutomaton.cs	Thu Jun 19 20:04:20 2014 +0400
+++ b/Implab/Parsing/DFAutomaton.cs	Sun Jun 22 04:14:02 2014 +0400
@@ -20,7 +20,7 @@
         protected ContextFrame m_context;
         Stack<ContextFrame> m_contextStack = new Stack<ContextFrame>();
 
-        public int Level {
+        protected int Level {
             get { return m_contextStack.Count; }
         }