Example #1
0
 public void MatchEmpty(NFAStateQueue queue)
 {
     for (int i = 0; i < Outgoing.Length; i++)
     {
         var trans = Outgoing[i];
         if (trans is NFAEpsilonTransition)
         {
             var target = trans.State;
             queue.AddLast(target);
             if (target.EpsilonOut)
             {
                 target.MatchEmpty(queue);
             }
         }
     }
 }
Example #2
0
 public void MatchTransitions(char ch, NFAStateQueue queue, bool initial)
 {
     for (int i = 0; i < Outgoing.Length; i++)
     {
         var trans  = Outgoing[i];
         var target = trans.State;
         if (initial && trans is NFAEpsilonTransition)
         {
             target.MatchTransitions(ch, queue, true);
         }
         else if (trans.Match(ch))
         {
             queue.AddLast(target);
             if (target.EpsilonOut)
             {
                 target.MatchEmpty(queue);
             }
         }
     }
 }