Example #1
0
 public void RegexToStringShouldCreateConcatenationString()
 {
     var regex = new Regex(
         false,
         new RegexExpressionTerm(
             new RegexTermFactor(
                     new RegexFactor(
                         new RegexAtomCharacter(
                             new RegexCharacter('a'))),
                     new RegexTerm(
                         new RegexFactor(
                             new RegexAtomCharacter(
                                 new RegexCharacter('b')))))),
         false);
     Assert.AreEqual("ab", regex.ToString());
 }
Example #2
0
 public void RegexToStringShouldCreateRangeString()
 {
     var regex = new Regex(
         false,
         new RegexExpressionTerm(
             new RegexTerm(
                 new RegexFactor(
                     new RegexAtomSet(
                         new RegexSet(
                             false,
                             new RegexCharacterClass(
                                 new RegexCharacterRange(
                                     new RegexCharacterClassCharacter('a'),
                                     new RegexCharacterClassCharacter('z')))))))),
         false);
     Assert.AreEqual("[a-z]", regex.ToString());
 }
Example #3
0
 public override void Visit(IInternalTreeNode node)
 {
     if (RegexGrammar.Regex == node.Symbol.Value)
         Regex = VisitRegexNode(node);
 }
Example #4
0
 public IDfaState Compile(Regex regex)
 {
     var nfa = _regexToNfa.Transform(regex);
     var dfa = _nfaToDfa.Transform(nfa);
     return dfa;
 }
 public INfa Transform(Regex regex)
 {
     return Expression(regex.Expression);
 }