annotate Implab/Formats/ScannerContext.cs @ 176:0c3c69fe225b ref20160224

rewritten the text scanner
author cin
date Tue, 22 Mar 2016 18:58:40 +0300
parents
children a0ff6a0e9c44
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
176
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
1 using System;
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
2
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
3 namespace Implab.Formats {
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
4 public class ScannerContext<TTag> {
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
5 public int[,] Dfa { get; private set; }
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
6 public bool[] Final { get; private set; }
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
7 public TTag[][] Tags { get; private set; }
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
8 public int State { get; private set; }
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
9 public int[] Alphabet { get; private set; }
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
10
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
11 public ScannerContext(int[,] dfa, bool[] final, TTag[][] tags, int state, int[] alphabet) {
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
12 Dfa = dfa;
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
13 Final = final;
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
14 Tags = tags;
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
15 State = state;
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
16 Alphabet = alphabet;
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
17 }
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
18
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
19 public bool Execute(TextScanner scanner, out TTag[] tag) {
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
20 return scanner.ReadToken(Dfa, Final, Tags, State, Alphabet, out tag);
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
21 }
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
22 }
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
23 }
0c3c69fe225b rewritten the text scanner
cin
parents:
diff changeset
24