diff Implab/Formats/JSON/StringTranslator.cs @ 176:0c3c69fe225b ref20160224

rewritten the text scanner
author cin
date Tue, 22 Mar 2016 18:58:40 +0300
parents 419aa51b04fd
children c32688129f14
line wrap: on
line diff
--- a/Implab/Formats/JSON/StringTranslator.cs	Mon Mar 21 18:41:45 2016 +0300
+++ b/Implab/Formats/JSON/StringTranslator.cs	Tue Mar 22 18:58:40 2016 +0300
@@ -1,5 +1,5 @@
 using Implab;
-using Implab.Parsing;
+using Implab.Formats;
 using System;
 using System.Collections.Generic;
 using System.Diagnostics;
@@ -7,11 +7,11 @@
 using System.Text;
 using System.Threading.Tasks;
 
-namespace Implab.JSON {
+namespace Implab.Formats.JSON {
     /// <summary>
     /// Класс для преобразования экранированной строки JSON
     /// </summary>
-    public class StringTranslator : Scanner {
+    public class StringTranslator : TextScanner<JSONGrammar.TokenType> {
         static readonly char[] _escMap;
         static readonly int[] _hexMap;
 
@@ -34,8 +34,7 @@
 
         }
 
-        public StringTranslator()
-            : base(JSONGrammar.Instance.JsonStringDFA.States, JSONGrammar.Instance.JsonStringDFA.Alphabet.GetTranslationMap()) {
+        public StringTranslator() {
         }
 
         public string Translate(string data) {
@@ -59,7 +58,7 @@
             int pos = 0;
 
             while (ReadTokenInternal()) {
-                switch ((JSONGrammar.TokenType)TokenTags[0]) {
+                switch ((JSONGrammar.TokenType)Tags[0]) {
                     case JSONGrammar.TokenType.UnescapedChar:
                         Array.Copy(m_buffer,m_tokenOffset,translated,pos,m_tokenLen);
                         pos += m_tokenLen;