Mercurial > pub > ImplabNet
comparison 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 |
comparison
equal
deleted
inserted
replaced
175:96a89dcb4060 | 176:0c3c69fe225b |
---|---|
34 public TTag[] GetStateTag(int s) { | 34 public TTag[] GetStateTag(int s) { |
35 TTag[] tags; | 35 TTag[] tags; |
36 return m_tags.TryGetValue(s, out tags) ? tags : new TTag[0]; | 36 return m_tags.TryGetValue(s, out tags) ? tags : new TTag[0]; |
37 } | 37 } |
38 | 38 |
39 public new DFAStateDescriptor<TTag>[] CreateTransitionTable() { | 39 public TTag[][] CreateTagTable() { |
40 var table = new DFAStateDescriptor<TTag>[StateCount]; | 40 var table = new TTag[StateCount][]; |
41 | 41 |
42 foreach (var t in this) { | 42 foreach (var pair in m_tags) |
43 if (table[t.s1].transitions == null) | 43 table[pair.Key] = pair.Value; |
44 table[t.s1] = new DFAStateDescriptor<TTag>(AlphabetSize, IsFinalState(t.s1), GetStateTag(t.s1)); | |
45 if (table[t.s2].transitions == null) | |
46 table[t.s2] = new DFAStateDescriptor<TTag>(AlphabetSize, IsFinalState(t.s2), GetStateTag(t.s2)); | |
47 table[t.s1].transitions[t.edge] = t.s2; | |
48 } | |
49 | 44 |
50 return table; | 45 return table; |
51 } | 46 } |
52 | 47 |
53 /// <summary> | 48 /// <summary> |