Esempio n. 1
0
 public RegexTerm(RegexFactor factor)
 {
     Factor = factor;
     _hashCode = ComputeHashCode();
 }
Esempio n. 2
0
 public RegexTermFactor(RegexFactor factor, RegexTerm term)
     : base(factor)
 {
     Term = term;
     _hashCode = ComputeHashCode();
 }
        private static INfa Factor(RegexFactor factor)
        {
            var atomNfa = Atom(factor.Atom);
            switch (factor.NodeType)
            {
                case RegexNodeType.RegexFactor:
                    return atomNfa;

                case RegexNodeType.RegexFactorIterator:
                    var regexFactorIterator = factor as RegexFactorIterator;
                    switch (regexFactorIterator.Iterator)
                    {
                        case RegexIterator.ZeroOrMany:
                            return KleeneStar(atomNfa);
                        case RegexIterator.OneOrMany:
                            return KleenePlus(atomNfa);
                        case RegexIterator.ZeroOrOne:
                            return Optional(atomNfa);
                    }
                    break;
            }
            throw new InvalidOperationException("Unrecognized regex factor");
        }