comparison Implab/Formats/ByteAlphabet.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
2 using System.Linq; 2 using System.Linq;
3 using Implab.Automaton; 3 using Implab.Automaton;
4 4
5 namespace Implab.Formats { 5 namespace Implab.Formats {
6 public class ByteAlphabet : IndexedAlphabetBase<byte> { 6 public class ByteAlphabet : IndexedAlphabetBase<byte> {
7 public ByteAlphabet() : base(byte.MaxValue + 1){ 7 public ByteAlphabet() {
8 } 8 }
9 9
10 #region implemented abstract members of IndexedAlphabetBase 10 #region implemented abstract members of IndexedAlphabetBase
11 11
12 public override int GetSymbolIndex(byte symbol) { 12 public override int GetSymbolIndex(byte symbol) {
13 return (int)symbol; 13 return (int)symbol;
14 }
15
16 public override byte GetSymbolByIndex(int index) {
17 return (byte)index;
18 } 14 }
19 15
20 public IEnumerable<byte> InputSymbols { 16 public IEnumerable<byte> InputSymbols {
21 get { 17 get {
22 return Enumerable.Range(byte.MinValue, byte.MaxValue).Cast<byte>(); 18 return Enumerable.Range(byte.MinValue, byte.MaxValue).Cast<byte>();