diff Implab/Formats/JSON/JSONGrammar.cs @ 178:d5c5db0335ee ref20160224

working on JSON parser
author cin
date Wed, 23 Mar 2016 19:51:45 +0300
parents 0c3c69fe225b
children c32688129f14
line wrap: on
line diff
--- a/Implab/Formats/JSON/JSONGrammar.cs	Wed Mar 23 01:42:00 2016 +0300
+++ b/Implab/Formats/JSON/JSONGrammar.cs	Wed Mar 23 19:51:45 2016 +0300
@@ -4,7 +4,7 @@
 using Implab.Automaton;
 
 namespace Implab.Formats.JSON {
-    class JSONGrammar : Grammar<char,JSONGrammar.TokenType> {
+    class JSONGrammar : Grammar<char> {
         public enum TokenType {
             None,
             BeginObject,
@@ -29,8 +29,8 @@
             get { return _instance.Value; }
         }
 
-        readonly ScannerContext<TokenType> m_jsonDFA;
-        readonly ScannerContext<TokenType> m_stringDFA;
+        readonly ScannerContext<TokenType> m_jsonExpression;
+        readonly ScannerContext<TokenType> m_stringExpression;
 
         public JSONGrammar() {
             DefineAlphabet(Enumerable.Range(0, 0x20).Select(x => (char)x));
@@ -81,23 +81,25 @@
                 .Or(unescaped.Closure().Tag(TokenType.UnescapedChar));
                     
 
-            m_jsonDFA = BuildScannerContext(jsonExpression);
-            m_stringDFA = BuildScannerContext(jsonStringExpression);
+            m_jsonExpression = BuildScannerContext<TokenType>(jsonExpression);
+            m_stringExpression = BuildScannerContext<TokenType>(jsonStringExpression);
+
+
         }
 
-        public ScannerContext<TokenType> JsonDFA {
+        public ScannerContext<TokenType> JsonExpression {
             get {
-                return m_jsonDFA;
+                return m_jsonExpression;
             }
         }
 
-        public ScannerContext<TokenType> JsonStringDFA {
+        public ScannerContext<TokenType> JsonStringExpression {
             get {
-                return m_stringDFA;
+                return m_stringExpression;
             }
         }
 
-        Token<TokenType> SymbolRangeToken(char start, char stop) {
+        Token SymbolRangeToken(char start, char stop) {
             return SymbolToken(Enumerable.Range(start,stop - start).Cast<char>());
         }