Esempio n. 1
0
        private static IEnumerable <RegExInputRange> SplitRange(RegExInputRange range, IEnumerable <char> splitPoints)
        {
            if (range.Min == range.Max)
            {
                yield return(range);

                yield break;
            }
            var pending = range;

            foreach (var p in splitPoints)
            {
                if (p > pending.Max)
                {
                    break;
                }
                if ((p > range.Min) && (p < pending.Max))
                {
                    var sub = new RegExInputRange((char)pending.Min, (char)(p - 1));
                    yield return(sub);

                    pending = new RegExInputRange(p, (char)pending.Max);
                    if (pending.Min == pending.Max)
                    {
                        yield return(pending);

                        yield break;
                    }
                }
            }
            yield return(pending);
        }
Esempio n. 2
0
 private static void Transition(NfaState from, NfaState to, RegExInputRange via)
 {
     from.Map.Add(new KeyValuePair <RegExInputRange, NfaState>(via, to));
 }