comparison Implab/Formats/JSON/JSONScanner.cs @ 165:e227e78d72e4 ref20160224

DFA refactoring
author cin
date Mon, 29 Feb 2016 02:02:17 +0300
parents 419aa51b04fd
children 0c3c69fe225b
comparison
equal deleted inserted replaced
164:ec35731ae299 165:e227e78d72e4
1 using Implab.Parsing; 1 using System;
2 using System;
3 using System.Collections.Generic;
4 using System.Globalization; 2 using System.Globalization;
5 using System.Linq; 3 using Implab.Automaton;
6 using System.Text;
7 using System.Threading.Tasks;
8 4
9 namespace Implab.JSON { 5 namespace Implab.Formats.JSON {
10 /// <summary> 6 /// <summary>
11 /// Сканнер (лексер), разбивающий поток символов на токены JSON. 7 /// Сканнер (лексер), разбивающий поток символов на токены JSON.
12 /// </summary> 8 /// </summary>
13 public class JSONScanner : Scanner { 9 public class JSONScanner : Scanner<object> {
14 char[] m_stringBuffer; 10 char[] m_stringBuffer;
15 DFAStateDescriptior[] m_stringDFA; 11 DFAStateDescriptior<>[] m_stringDFA;
16 int[] m_stringAlphabet; 12 int[] m_stringAlphabet;
17 13
18 /// <summary> 14 /// <summary>
19 /// Создает новый экземпляр сканнера 15 /// Создает новый экземпляр сканнера
20 /// </summary> 16 /// </summary>
21 public JSONScanner() 17 public JSONScanner()
22 : base(JSONGrammar.Instance.JsonDFA.States, JSONGrammar.Instance.JsonDFA.Alphabet.GetTranslationMap()) { 18 : base(JSONGrammar.Instance.JsonDFA.GetTransitionTable(), JSONGrammar.Instance.JsonDFA.Alphabet.GetTranslationMap()) {
23 m_stringBuffer = new char[1024]; 19 m_stringBuffer = new char[1024];
24 var dfa = JSONGrammar.Instance.JsonStringDFA; 20 var dfa = JSONGrammar.Instance.JsonStringDFA;
25 m_stringAlphabet = dfa.Alphabet.GetTranslationMap(); 21 m_stringAlphabet = dfa.Alphabet.GetTranslationMap();
26 m_stringDFA = dfa.States; 22 m_stringDFA = dfa.States;
27 } 23 }