##// END OF EJS Templates
Fixed promise rejection when there is not specified error handler in the reaction....
Fixed promise rejection when there is not specified error handler in the reaction. FIXED SPELLING IN THE XML CONTAINER CONFIGURATION signleton->singleton Code cleanup Update tests make them working on dotnet core

File last commit:

r289:95896f882995 v3.0.14 v3
r295:28af686e24f7 default
Show More
CharAlphabet.cs
36 lines | 1.0 KiB | text/x-csharp | CSharpLexer
using System.Collections.Generic;
using System.Linq;
using Implab.Automaton;
using System;
namespace Implab.Formats {
public class CharAlphabet : IndexedAlphabetBase<char> {
public override int GetSymbolIndex(char symbol) {
return symbol;
}
public IEnumerable<char> InputSymbols {
get { return Enumerable.Range(char.MinValue, char.MaxValue).Cast<char>(); }
}
public CharMap CreateCharMap() {
var map = new Dictionary<int, int>();
int max = 0, min = char.MaxValue;
foreach (var p in Mappings) {
var index = GetSymbolIndex(p.Key);
max = Math.Max(max, index);
min = Math.Min(min, index);
map[index] = p.Value;
}
var result = new int[max - min + 1];
for (int i = 0; i < result.Length; i++)
map.TryGetValue(min + i, out result[i]);
return new CharMap((char)min, result);
}
}
}