diff Implab/Xml/JsonXmlReader.cs @ 228:6fa235c5a760 v2

Rewritten JsonScanner, JsonParser, fixed naming style
author cin
date Tue, 12 Sep 2017 01:19:12 +0300
parents 8d5de4eb9c2c
children 5f7a3e1d32b9
line wrap: on
line diff
--- a/Implab/Xml/JsonXmlReader.cs	Sat Sep 09 03:53:13 2017 +0300
+++ b/Implab/Xml/JsonXmlReader.cs	Tue Sep 12 01:19:12 2017 +0300
@@ -1,10 +1,8 @@
-using Implab.Formats.JSON;
+using Implab.Formats.Json;
 using System;
 using System.Collections.Generic;
 using System.Globalization;
 using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using System.Xml;
 
 namespace Implab.Xml {
@@ -14,7 +12,7 @@
             public bool skip;
         }
 
-        JSONParser m_parser;
+        JsonParser m_parser;
         JsonXmlReaderOptions m_options;
         JsonXmlReaderPosition m_position = JsonXmlReaderPosition.Initial;
         XmlNameTable m_nameTable;
@@ -52,7 +50,6 @@
 
 
         XmlNameContext m_context;
-        int m_nextPrefix = 1;
 
         readonly string m_xmlnsPrefix;
         readonly string m_xmlnsNamespace;
@@ -60,7 +57,7 @@
         readonly string m_xsiNamespace;
 
 
-        public JsonXmlReader(JSONParser parser, JsonXmlReaderOptions options) {
+        public JsonXmlReader(JsonParser parser, JsonXmlReaderOptions options) {
             Safe.ArgumentNotNull(parser, nameof(parser));
             m_parser = parser;
 
@@ -480,35 +477,35 @@
                     var jsonName = m_nameTable.Add(m_parser.ElementName);
 
                     switch (m_parser.ElementType) {
-                        case JSONElementType.BeginObject:
+                        case JsonElementType.BeginObject:
                             if (!EnterJsonObject(jsonName, out elementName))
                                 continue;
 
                             m_position = JsonXmlReaderPosition.BeginObject;
                             ElementNode(elementName, m_jsonNamespace, elementAttrs, false);
                             break;
-                        case JSONElementType.EndObject:
+                        case JsonElementType.EndObject:
                             if (!LeaveJsonScope(out elementName))
                                 continue;
 
                             m_position = JsonXmlReaderPosition.EndObject;
                             EndElementNode(elementName, m_jsonNamespace);
                             break;
-                        case JSONElementType.BeginArray:
+                        case JsonElementType.BeginArray:
                             if (!EnterJsonArray(jsonName, out elementName))
                                 continue;
 
                             m_position = JsonXmlReaderPosition.BeginArray;
                             ElementNode(elementName, m_jsonNamespace, elementAttrs, false);
                             break;
-                        case JSONElementType.EndArray:
+                        case JsonElementType.EndArray:
                             if (!LeaveJsonScope(out elementName))
                                 continue;
 
                             m_position = JsonXmlReaderPosition.EndArray;
                             EndElementNode(elementName, m_jsonNamespace);
                             break;
-                        case JSONElementType.Value:
+                        case JsonElementType.Value:
                             if (!VisitJsonValue(jsonName, out m_jsonValueName))
                                 continue;