diff Implab/Parsing/Scanner.cs @ 158:130781364799 v2

refactoring, code cleanup
author cin
date Thu, 18 Feb 2016 14:34:02 +0300
parents 240aa6994018
children
line wrap: on
line diff
--- a/Implab/Parsing/Scanner.cs	Thu Feb 18 11:03:47 2016 +0300
+++ b/Implab/Parsing/Scanner.cs	Thu Feb 18 14:34:02 2016 +0300
@@ -39,11 +39,12 @@
         int m_chunkSize = 1024; // 1k
         int m_limit = 10 * 1024 * 1024; // 10Mb
 
-        protected Scanner(CDFADefinition definition) {
-            Safe.ArgumentNotNull(definition, "definition");
+        protected Scanner(DFAStateDescriptior[] states, int[] alphabet) {
+            Safe.ArgumentNotEmpty(states, "states");
+            Safe.ArgumentNotNull(alphabet, "alphabet");
 
-            m_states = definition.States;
-            m_alphabetMap = definition.Alphabet.GetTranslationMap();
+            m_states = states;
+            m_alphabetMap = alphabet;
 
             Feed(new char[0]);
         }
@@ -129,13 +130,13 @@
             if (m_pointer >= m_bufferSize)
                 return false;
 
-            m_currentState = m_states[CDFADefinition.INITIAL_STATE];
+            m_currentState = m_states[DFADefinition.INITIAL_STATE];
             m_tokenLen = 0;
             m_tokenOffset = m_pointer;
-            int nextState = CDFADefinition.UNREACHEBLE_STATE;
+            int nextState;
             do {
                 nextState = m_currentState.transitions[m_previewCode];
-                if (nextState == CDFADefinition.UNREACHEBLE_STATE) {
+                if (nextState == DFADefinition.UNREACHEBLE_STATE) {
                     if (m_currentState.final)
                         return true;
                     else