public override Nfa GenerateNfa(bool ignoreCase) { Nfa retVal = new Nfa(); NfaState startState = retVal.Start; NfaState finalState = retVal.End; Nfa temp = RegularExpression.GenerateNfa(ignoreCase); startState.AddMove(temp.Start); startState.AddMove(finalState); temp.End.AddMove(finalState); return(retVal); }
public override Nfa GenerateNfa(bool ignoreCase) { if (units.Count == 1) { return(units[0].GenerateNfa(ignoreCase)); } Nfa retVal = new Nfa(); NfaState startState = retVal.Start; NfaState finalState = retVal.End; Nfa temp1; Nfa temp2 = null; RegularExpression curRE; curRE = units[0]; temp1 = curRE.GenerateNfa(ignoreCase); startState.AddMove(temp1.Start); for (int i = 1; i < units.Count; i++) { curRE = units[i]; temp2 = curRE.GenerateNfa(ignoreCase); temp1.End.AddMove(temp2.Start); temp1 = temp2; } temp2.End.AddMove(finalState); return(retVal); }
public override Nfa GenerateNfa(bool ignoreCase) { CompressCharLists(); if (choices.Count == 1) { return(choices[0].GenerateNfa(ignoreCase)); } Nfa retVal = new Nfa(); NfaState startState = retVal.Start; NfaState finalState = retVal.End; for (int i = 0; i < choices.Count; i++) { Nfa temp; RegularExpression curRE = choices[i]; temp = curRE.GenerateNfa(ignoreCase); startState.AddMove(temp.Start); temp.End.AddMove(finalState); } return(retVal); }