Overview   Project   Class   Tree   Deprecated   Index 
Grammatica 1.5 Documentation
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD

PerCederberg.Grammatica.Runtime
Class NFAState

System.Object
   |
   +--NFAState

   in TokenNFA.cs

internal class NFAState
extends System.Object

An NFA state. The NFA consists of a series of states, each having zero or more transitions to other states.


Field Summary
 internal bool epsilonOut
          The outgoing epsilon transitions flag.
 internal NFATransition[] incoming
          The incoming transitions to this state.
 internal NFATransition[] outgoing
          The outgoing transitions from this state.
 internal TokenPattern value
          The optional state value (if it is a final state).
 
Method Summary
 void AddIn( NFATransition trans )
          Adds a new incoming transition.
 NFAState AddOut( char ch, bool ignoreCase, NFAState state )
          Adds a new outgoing character transition.
 NFAState AddOut( NFATransition trans )
          Adds a new outgoing transition.
 bool HasTransitions()
          Checks if this state has any incoming or outgoing transitions.
 bool IsAsciiOutgoing()
          Checks if all outgoing transitions only match ASCII characters.
 void MatchEmpty( NFAStateQueue queue )
          Adds all the epsilon transition targets to the specified queue.
 void MatchTransitions( char ch, NFAStateQueue queue, bool initial )
          Attempts a match on each of the transitions leading from this state.
 void MergeInto( NFAState state )
          Merges all the transitions in this state into another state.
 

Field Detail

epsilonOut

 internal bool epsilonOut;
The outgoing epsilon transitions flag.

incoming

 internal NFATransition[] incoming;
The incoming transitions to this state.

outgoing

 internal NFATransition[] outgoing;
The outgoing transitions from this state.

value

 internal TokenPattern value;
The optional state value (if it is a final state).


Method Detail

AddIn

public void AddIn( NFATransition trans );
Adds a new incoming transition.
Parameters:
trans - the transition to add

AddOut

public NFAState AddOut( char ch, bool ignoreCase, NFAState state );
Adds a new outgoing character transition. If the target state specified was null and an identical transition already exists, it will be reused and its target returned.
Parameters:
ch - he character to match
ignoreCase - the case-insensitive flag
state - the target state, or null
Returns:
the transition target state

AddOut

public NFAState AddOut( NFATransition trans );
Adds a new outgoing transition.
Parameters:
trans - the transition to add
Returns:
the transition target state

HasTransitions

public bool HasTransitions();
Checks if this state has any incoming or outgoing transitions.
Returns:
true if this state has transitions, or false otherwise

IsAsciiOutgoing

public bool IsAsciiOutgoing();
Checks if all outgoing transitions only match ASCII characters.
Returns:
true if all transitions are ASCII-only, or false otherwise

MatchEmpty

public void MatchEmpty( NFAStateQueue queue );
Adds all the epsilon transition targets to the specified queue.
Parameters:
queue - the state queue

MatchTransitions

public void MatchTransitions( char ch, NFAStateQueue queue, bool initial );
Attempts a match on each of the transitions leading from this state. If a match is found, its state will be added to the queue. If the initial match flag is set, epsilon transitions will also be matched (and their targets called recursively).
Parameters:
ch - the character to match
queue - the state queue
initial - the initial match flag

MergeInto

public void MergeInto( NFAState state );
Merges all the transitions in this state into another state.
Parameters:
state - the state to merge into

 Overview   Project   Class   Tree   Deprecated   Index 
Grammatica 1.5 Documentation
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD