private int AddToNfa <T>(Nfa <T> nfa, IMatchable pattern, T match) { var start = nfa.AddState(); var accept = nfa.AddState(match); var state = pattern.AddToNfa(nfa, accept); nfa.AddEpsilon(start, state); return(start); }
public override int AddToNfa <TResult>(Nfa <TResult> nfa, int targetState) { var startState = pattern.AddToNfa(nfa, targetState); if (pattern.MatchesEmpty) { return(startState); } var skipState = nfa.AddState(); nfa.AddEpsilon(skipState, targetState, lazy ? NfaTransitionPriority.Normal : NfaTransitionPriority.Low); nfa.AddEpsilon(skipState, startState, lazy ? NfaTransitionPriority.Low : NfaTransitionPriority.Normal); return(skipState); }
public override int AddToNfa <TResult>(Nfa <TResult> nfa, int targetState) { return(tomatch.AddToNfa(nfa, targetState)); }
public override int AddToNfa <TResult>(Nfa <TResult> nfa, int targetState) { targetState = then.AddToNfa(nfa, targetState); targetState = first.AddToNfa(nfa, targetState); return(targetState); }