annotate Implab/Parsing/CDFADefinition.cs @ 158:130781364799 v2

refactoring, code cleanup
author cin
date Thu, 18 Feb 2016 14:34:02 +0300
parents 97fbbf816844
children 5802131432e4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
158
130781364799 refactoring, code cleanup
cin
parents: 156
diff changeset
1 namespace Implab.Parsing {
130781364799 refactoring, code cleanup
cin
parents: 156
diff changeset
2 public class CDFADefinition : DFADefinition {
130781364799 refactoring, code cleanup
cin
parents: 156
diff changeset
3 readonly CharAlphabet m_alphabet;
55
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
4
158
130781364799 refactoring, code cleanup
cin
parents: 156
diff changeset
5 public CharAlphabet Alphabet {
55
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
6 get { return m_alphabet; }
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
7 }
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
8
158
130781364799 refactoring, code cleanup
cin
parents: 156
diff changeset
9 public CDFADefinition(CharAlphabet alphabet): base(alphabet.Count) {
55
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
10 m_alphabet = alphabet;
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
11 }
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
12
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
13 public CDFADefinition Optimize() {
158
130781364799 refactoring, code cleanup
cin
parents: 156
diff changeset
14 var optimized = new CDFADefinition(new CharAlphabet());
55
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
15
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
16 Optimize(optimized, m_alphabet, optimized.Alphabet);
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
17 return optimized;
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
18 }
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
19
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
20 public void PrintDFA() {
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
21 PrintDFA(m_alphabet);
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
22 }
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
23 }
c0bf853aa04f Added initial JSON support
cin
parents:
diff changeset
24 }