diff Implab/Automaton/RegularExpressions/RegularDFA.cs @ 176:0c3c69fe225b ref20160224

rewritten the text scanner
author cin
date Tue, 22 Mar 2016 18:58:40 +0300
parents 92d5278d1b10
children a0ff6a0e9c44
line wrap: on
line diff
--- a/Implab/Automaton/RegularExpressions/RegularDFA.cs	Mon Mar 21 18:41:45 2016 +0300
+++ b/Implab/Automaton/RegularExpressions/RegularDFA.cs	Tue Mar 22 18:58:40 2016 +0300
@@ -36,16 +36,11 @@
             return m_tags.TryGetValue(s, out tags) ? tags : new TTag[0];
         }
 
-        public new DFAStateDescriptor<TTag>[] CreateTransitionTable() {
-            var table = new DFAStateDescriptor<TTag>[StateCount];
+        public TTag[][] CreateTagTable() {
+            var table = new TTag[StateCount][];
 
-            foreach (var t in this) {
-                if (table[t.s1].transitions == null)
-                    table[t.s1] = new DFAStateDescriptor<TTag>(AlphabetSize, IsFinalState(t.s1), GetStateTag(t.s1));
-                if (table[t.s2].transitions == null)
-                    table[t.s2] = new DFAStateDescriptor<TTag>(AlphabetSize, IsFinalState(t.s2), GetStateTag(t.s2));
-                table[t.s1].transitions[t.edge] = t.s2;
-            }
+            foreach (var pair in m_tags)
+                table[pair.Key] = pair.Value;
 
             return table;
         }