annotate Implab/Formats/CharAlphabet.cs @ 174:983df35b3ca1 ref20160224

sync
author cin
date Fri, 18 Mar 2016 18:10:30 +0300
parents 92d5278d1b10
children 0c3c69fe225b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
165
e227e78d72e4 DFA refactoring
cin
parents: 164
diff changeset
1 using System.Collections.Generic;
164
ec35731ae299 Almost complete DFA refactoring
cin
parents:
diff changeset
2 using System.Linq;
165
e227e78d72e4 DFA refactoring
cin
parents: 164
diff changeset
3 using Implab.Automaton;
164
ec35731ae299 Almost complete DFA refactoring
cin
parents:
diff changeset
4
165
e227e78d72e4 DFA refactoring
cin
parents: 164
diff changeset
5 namespace Implab.Formats {
164
ec35731ae299 Almost complete DFA refactoring
cin
parents:
diff changeset
6 public class CharAlphabet: IndexedAlphabetBase<char> {
ec35731ae299 Almost complete DFA refactoring
cin
parents:
diff changeset
7
ec35731ae299 Almost complete DFA refactoring
cin
parents:
diff changeset
8 public CharAlphabet()
ec35731ae299 Almost complete DFA refactoring
cin
parents:
diff changeset
9 : base(char.MaxValue + 1) {
ec35731ae299 Almost complete DFA refactoring
cin
parents:
diff changeset
10 }
ec35731ae299 Almost complete DFA refactoring
cin
parents:
diff changeset
11
ec35731ae299 Almost complete DFA refactoring
cin
parents:
diff changeset
12 public override int GetSymbolIndex(char symbol) {
ec35731ae299 Almost complete DFA refactoring
cin
parents:
diff changeset
13 return symbol;
ec35731ae299 Almost complete DFA refactoring
cin
parents:
diff changeset
14 }
ec35731ae299 Almost complete DFA refactoring
cin
parents:
diff changeset
15
172
92d5278d1b10 Working on text scanner
cin
parents: 165
diff changeset
16 public override char GetSymbolByIndex(int index) {
92d5278d1b10 Working on text scanner
cin
parents: 165
diff changeset
17 return (char)index;
92d5278d1b10 Working on text scanner
cin
parents: 165
diff changeset
18 }
92d5278d1b10 Working on text scanner
cin
parents: 165
diff changeset
19
164
ec35731ae299 Almost complete DFA refactoring
cin
parents:
diff changeset
20 public override IEnumerable<char> InputSymbols {
ec35731ae299 Almost complete DFA refactoring
cin
parents:
diff changeset
21 get { return Enumerable.Range(char.MinValue, char.MaxValue).Cast<char>(); }
ec35731ae299 Almost complete DFA refactoring
cin
parents:
diff changeset
22 }
ec35731ae299 Almost complete DFA refactoring
cin
parents:
diff changeset
23 }
ec35731ae299 Almost complete DFA refactoring
cin
parents:
diff changeset
24 }