Beispiel #1
0
 public static Automaton CreateFromPattern(string pattern)
 {
     try
     {
         var parser = new PatternParser(pattern);
         var tree = parser.Parse();
         var builder = new DfaBuilder(tree);
         builder.ExtendWithEos();
         builder.BuildNodeSets();
         builder.BuildAutomaton(tree);
         return new Automaton(builder.States, builder.Transitions);
     }
     catch
     {
         return null;
     }
 }
Beispiel #2
0
 public static Automaton CreateFromPattern(string pattern)
 {
     try
     {
         var parser  = new PatternParser(pattern);
         var tree    = parser.Parse();
         var builder = new DfaBuilder(tree);
         builder.ExtendWithEos();
         builder.BuildNodeSets();
         builder.BuildAutomaton(tree);
         return(new Automaton(builder.States, builder.Transitions));
     }
     catch
     {
         return(null);
     }
 }