| |
|
| java.lang.Object org.antlr.analysis.State org.antlr.analysis.NFAState
NFAState | public class NFAState extends State (Code) | | A state within an NFA. At most 2 transitions emanate from any NFA state.
|
BLOCK_START | final public static int BLOCK_START(Code) | | |
BYPASS | final public static int BYPASS(Code) | | |
EOTTargetState | protected boolean EOTTargetState(Code) | | Is this state the sole target of an EOT transition?
|
LOOPBACK | final public static int LOOPBACK(Code) | | |
MAX_TRANSITIONS | final public static int MAX_TRANSITIONS(Code) | | |
OPTIONAL_BLOCK_START | final public static int OPTIONAL_BLOCK_START(Code) | | |
RIGHT_EDGE_OF_BLOCK | final public static int RIGHT_EDGE_OF_BLOCK(Code) | | |
associatedASTNode | protected GrammarAST associatedASTNode(Code) | | Associate this NFAState with the corresponding GrammarAST node
from which this node was created. This is useful not only for
associating the eventual lookahead DFA with the associated
Grammar position, but also for providing users with
nondeterminism warnings. Mainly used by decision states to
report line:col info. Could also be used to track line:col
for elements such as token refs.
|
decisionNumber | protected int decisionNumber(Code) | | What's its decision number from 1..n?
|
decisionStateType | public int decisionStateType(Code) | | Subrules (...)* and (...)+ have more than one decision point in
the NFA created for them. They both have a loop-exit-or-stay-in
decision node (the loop back node). They both have a normal
alternative block decision node at the left edge. The (...)* is
worse as it even has a bypass decision (2 alts: stay in or bypass)
node at the extreme left edge. This is not how they get generated
in code as a while-loop or whatever deals nicely with either. For
error messages (where I need to print the nondeterministic alts)
and for interpretation, I need to use the single DFA that is created
(for efficiency) but interpret the results differently depending
on which of the 2 or 3 decision states uses the DFA. For example,
the DFA will always report alt n+1 as the exit branch for n real
alts, so I need to translate that depending on the decision state.
If decisionNumber>0 then this var tells you what kind of decision
state it is.
|
description | protected String description(Code) | | During debugging and for nondeterminism warnings, it's useful
to know what relationship this node has to the original grammar.
For example, "start of alt 1 of rule a".
|
enclosingRule | protected String enclosingRule(Code) | | What rule do we live in?
|
endOfBlockStateNumber | public int endOfBlockStateNumber(Code) | | Jean Bovet needs in the GUI to know which state pairs correspond
to the start/stop of a block.
|
numTransitions | int numTransitions(Code) | | How many transitions; 0, 1, or 2 transitions
|
getDecisionNumber | public int getDecisionNumber()(Code) | | |
getNumberOfTransitions | public int getNumberOfTransitions()(Code) | | |
isDecisionState | public boolean isDecisionState()(Code) | | |
isEOTTargetState | public boolean isEOTTargetState()(Code) | | |
setDecisionASTNode | public void setDecisionASTNode(GrammarAST decisionASTNode)(Code) | | What AST node is associated with this NFAState? When you
set the AST node, I set the node to point back to this NFA state.
|
setDecisionNumber | public void setDecisionNumber(int decisionNumber)(Code) | | |
setDescription | public void setDescription(String description)(Code) | | |
setEOTTargetState | public void setEOTTargetState(boolean eot)(Code) | | |
setEnclosingRuleName | public void setEnclosingRuleName(String rule)(Code) | | |
setTransition0 | public void setTransition0(Transition e)(Code) | | Used during optimization to reset a state to have the (single)
transition another state has.
|
translateDisplayAltToWalkAlt | public int translateDisplayAltToWalkAlt(DFA dfa, int displayAlt)(Code) | | The DFA decision for this NFA decision state always has
an exit path for loops as n+1 for n alts in the loop.
That is really useful for displaying nondeterministic alts
and so on, but for walking the NFA to get a sequence of edge
labels or for actually parsing, we need to get the real alt
number. The real alt number for exiting a loop is always 1
as transition 0 points at the exit branch (we compute DFAs
always for loops at the loopback state).
For walking/parsing the loopback state:
1 2 3 display alt (for human consumption)
2 3 1 walk alt
For walking the block start:
1 2 3 display alt
1 2 3
For walking the bypass state of a (...)* loop:
1 2 3 display alt
1 1 2 all block alts map to entering loop exit means take bypass
Non loop EBNF do not need to be translated; they are ignored by
this method as decisionStateType==0.
Return same alt if we can't translate.
|
|
|
|