public override StateRange AddTo <T>(NFA <T> nfa, CodePointEquivalenceClasses equivalenceClasses) { var startState = nfa.AddState(); var endState = startState; foreach (var codePoint in Value.GetCodePoints()) { var lastState = endState; endState = nfa.AddState(); nfa.AddTransition(lastState, equivalenceClasses.GetClass(codePoint), endState); } return(new StateRange(startState, endState)); }
private static IDictionary <int, Input[]> GenEquivalenceTable(CodePointEquivalenceClasses equivalenceClasses) { var equivalenceTable = new Dictionary <int, Input[]>(); foreach (var plane in UnicodePlanes) { var planeEquivalenceClasses = new Input[0x10000]; equivalenceTable.Add(plane, planeEquivalenceClasses); var planeBits = plane << 16; for (var planePlace = 0; planePlace < 0x10000; planePlace++) { planeEquivalenceClasses[planePlace] = equivalenceClasses.GetClass((CodePoint)(planeBits + planePlace)); } } return(equivalenceTable); }
private static IDictionary<int, Input[]> GenEquivalenceTable(CodePointEquivalenceClasses equivalenceClasses) { var equivalenceTable = new Dictionary<int, Input[]>(); foreach(var plane in UnicodePlanes) { var planeEquivalenceClasses = new Input[0x10000]; equivalenceTable.Add(plane, planeEquivalenceClasses); var planeBits = plane << 16; for(var planePlace = 0; planePlace < 0x10000; planePlace++) planeEquivalenceClasses[planePlace] = equivalenceClasses.GetClass((CodePoint)(planeBits + planePlace)); } return equivalenceTable; }