177
|
1 namespace Implab.Formats {
|
|
2 /// <summary>
|
|
3 /// Represents a scanner configuration usefull to recongnize token, based on the DFA.
|
|
4 /// </summary>
|
176
|
5 public class ScannerContext<TTag> {
|
177
|
6
|
176
|
7 public int[,] Dfa { get; private set; }
|
177
|
8
|
176
|
9 public bool[] Final { get; private set; }
|
177
|
10
|
176
|
11 public TTag[][] Tags { get; private set; }
|
177
|
12
|
176
|
13 public int State { get; private set; }
|
177
|
14
|
176
|
15 public int[] Alphabet { get; private set; }
|
|
16
|
|
17 public ScannerContext(int[,] dfa, bool[] final, TTag[][] tags, int state, int[] alphabet) {
|
|
18 Dfa = dfa;
|
|
19 Final = final;
|
|
20 Tags = tags;
|
|
21 State = state;
|
|
22 Alphabet = alphabet;
|
|
23 }
|
|
24
|
|
25 public bool Execute(TextScanner scanner, out TTag[] tag) {
|
|
26 return scanner.ReadToken(Dfa, Final, Tags, State, Alphabet, out tag);
|
|
27 }
|
|
28 }
|
|
29 }
|
|
30
|