/// <summary> /// Creates a RegexFSM object. /// </summary> /// <param name="states">Collection of all required states.</param> /// <param name="startState">The starting state.</param> /// <param name="endState">The end (completed) state.</param> public RegexFSM(IEnumerable <RegexState> states, RegexState startState, RegexState endState) { _states = new HashSet <RegexState>(states); _states.Add(startState); _states.Add(endState); StartState = startState; EndState = endState; Reset(); }
public RegexStateTransition(RegexState target, CharacterClass charClass) { Target = target; CharacterClass = charClass; }
/// <summary> /// Adds an empty transition the the specified state. States connected by empty transitions are always set to active when /// the current state is set to active. /// </summary> /// <param name="state">The state to transition to.</param> public void Add(RegexState state) { _emptyTransitions.Add(state); }
/// <summary> /// Adds a transition to the specified state when a given character class is matched. /// </summary> /// <param name="state">The state to transition to on match.</param> /// <param name="charClass">The charcter class to attempt to match.</param> public void Add(RegexState state, CharacterClass charClass) { _classTransitions.Add(new RegexStateTransition(state, charClass)); }