| Modifier and Type | Class and Description |
|---|---|
| protected static class | LexerATNSimulator.
When we hit an accept state in either the DFA or the ATN, we
have to notify the character stream to start buffering characters
via |
| Modifier and Type | Field and Description |
|---|---|
| protected int | charPositionInLine
The index of the character relative to the beginning of the line 0..n-1 |
| public static final boolean | |
| public final DFA[] | |
| public static final boolean | |
| protected int | line
line number 1..n within the input |
| public static final int | |
| public static final int | |
| protected int | |
| protected final LexerATNSimulator. | prevAccept
Used during DFA/ATN exec to record the most recent accept configuration info |
| protected final Lexer | |
| protected int | startIndex
The current token's starting index into the character stream. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | LexerATNSimulator(Lexer recog, ATN atn, DFA[] decisionToDFA, PredictionContextCache sharedContextCache)
|
| Modifier and Type | Method and Description |
|---|---|
| protected void | accept(CharStream input, LexerActionExecutor lexerActionExecutor, int startIndex, int index, int line, int charPos)
|
| protected DFAState | |
| protected void | |
| protected DFAState | addDFAState(ATNConfigSet configs)
Add a new DFA state if there isn't one with this set of configurations already. |
| protected void | |
| public void | clearDFA()
Clear the DFA cache used by the current instance.
|
| protected boolean | Returns: true if an accept state is reached, otherwise
false.Since the alternatives within any lexer decision are ordered by preference, this method stops pursuing the closure as soon as an accept state is reached. |
| protected ATNConfigSet | |
| protected DFAState | Returns: The computed target DFA state for the given input symbolt. If t does not lead to a valid DFA state, this method
returns ERROR.The input stream input, DFAState The current DFA state s, int The next input symbol t)Compute a target state for an edge in the DFA, and attempt to add the computed state and corresponding edge to the DFA. |
| public void | |
| public void | |
| protected boolean | Returns: true if the specified predicate evaluates to
true.The input stream. input, int The rule containing the predicate. ruleIndex, int The index of the predicate within the rule. predIndex, boolean true if the current index in input is
one character before the predicate's location.Evaluate a predicate specified in the lexer. |
| protected int | |
| protected int | |
| public int | |
| public final DFA | |
| protected LexerATNConfig | getEpsilonTarget(CharStream input, LexerATNConfig config, Transition t, ATNConfigSet configs, boolean speculative, boolean treatEofAsEpsilon)
|
| protected DFAState | Returns: The existing target DFA state for the given input symbolt, or null if the target state for this edge is not
already cachedThe current DFA state s, int The next input symbol t)Get an existing target state for an edge in the DFA. |
| public int | |
| protected void | getReachableConfigSet(CharStream input, ATNConfigSet closure, ATNConfigSet reach, int t)
Given a starting configuration set, figure out all ATN configurations
we can reach upon input |
| protected ATNState | |
| public String | |
| public String | |
| public int | |
| protected int | |
| public void | |
| public void | |
| public void |
| charPositionInLine | back to summary |
|---|---|
| protected int charPositionInLine The index of the character relative to the beginning of the line 0..n-1 | |
| debug | back to summary |
|---|---|
| public static final boolean debug | |
| decisionToDFA | back to summary |
|---|---|
| public final DFA[] decisionToDFA | |
| dfa_debug | back to summary |
|---|---|
| public static final boolean dfa_debug | |
| line | back to summary |
|---|---|
| protected int line line number 1..n within the input | |
| MAX_DFA_EDGE | back to summary |
|---|---|
| public static final int MAX_DFA_EDGE | |
| MIN_DFA_EDGE | back to summary |
|---|---|
| public static final int MIN_DFA_EDGE | |
| mode | back to summary |
|---|---|
| protected int mode | |
| prevAccept | back to summary |
|---|---|
| protected final LexerATNSimulator. Used during DFA/ATN exec to record the most recent accept configuration info | |
| recog | back to summary |
|---|---|
| protected final Lexer recog | |
| startIndex | back to summary |
|---|---|
| protected int startIndex The current token's starting index into the character stream. Shared across DFA to ATN simulation in case the ATN fails and the DFA did not have a previous accept state. In this case, we use the ATN-generated exception object. | |
| LexerATNSimulator | back to summary |
|---|---|
| public LexerATNSimulator(ATN atn, DFA[] decisionToDFA, PredictionContextCache sharedContextCache) | |
| LexerATNSimulator | back to summary |
|---|---|
| public LexerATNSimulator(Lexer recog, ATN atn, DFA[] decisionToDFA, PredictionContextCache sharedContextCache) | |
| accept | back to summary |
|---|---|
| protected void accept(CharStream input, LexerActionExecutor lexerActionExecutor, int startIndex, int index, int line, int charPos) | |
| addDFAEdge | back to summary |
|---|---|
| protected DFAState addDFAEdge(DFAState from, int t, ATNConfigSet q) | |
| addDFAEdge | back to summary |
|---|---|
| protected void addDFAEdge(DFAState p, int t, DFAState q) | |
| addDFAState | back to summary |
|---|---|
| protected DFAState addDFAState(ATNConfigSet configs) Add a new DFA state if there isn't one with this set of configurations already. This method also detects the first configuration containing an ATN rule stop state. Later, when traversing the DFA, we will know which rule to accept. | |
| captureSimState | back to summary |
|---|---|
| protected void captureSimState(LexerATNSimulator. | |
| clearDFA | back to summary |
|---|---|
| public void clearDFA() Overrides org. Doc from org. Clear the DFA cache used by the current instance. Since the DFA cache may be shared by multiple ATN simulators, this method may affect the performance (but not accuracy) of other parsers which are being used concurrently.
| |
| closure | back to summary |
|---|---|
| protected boolean closure(CharStream input, LexerATNConfig config, ATNConfigSet configs, boolean currentAltReachedAcceptState, boolean speculative, boolean treatEofAsEpsilon) Since the alternatives within any lexer decision are ordered by
preference, this method stops pursuing the closure as soon as an accept
state is reached. After the first accept state is reached by depth-first
search from
| |
| computeStartState | back to summary |
|---|---|
| protected ATNConfigSet computeStartState(CharStream input, ATNState p) | |
| computeTargetState | back to summary |
|---|---|
| protected DFAState computeTargetState(CharStream input, DFAState s, int t) Compute a target state for an edge in the DFA, and attempt to add the computed state and corresponding edge to the DFA.
| |
| consume | back to summary |
|---|---|
| public void consume(CharStream input) | |
| copyState | back to summary |
|---|---|
| public void copyState(LexerATNSimulator simulator) | |
| evaluatePredicate | back to summary |
|---|---|
| protected boolean evaluatePredicate(CharStream input, int ruleIndex, int predIndex, boolean speculative) Evaluate a predicate specified in the lexer. If
| |
| execATN | back to summary |
|---|---|
| protected int execATN(CharStream input, DFAState ds0) | |
| failOrAccept | back to summary |
|---|---|
| protected int failOrAccept(LexerATNSimulator. | |
| getCharPositionInLine | back to summary |
|---|---|
| public int getCharPositionInLine() | |
| getDFA | back to summary |
|---|---|
| public final DFA getDFA(int mode) | |
| getEpsilonTarget | back to summary |
|---|---|
| protected LexerATNConfig getEpsilonTarget(CharStream input, LexerATNConfig config, Transition t, ATNConfigSet configs, boolean speculative, boolean treatEofAsEpsilon) | |
| getExistingTargetState | back to summary |
|---|---|
| protected DFAState getExistingTargetState(DFAState s, int t) Get an existing target state for an edge in the DFA. If the target state
for the edge has not yet been computed or is otherwise not available,
this method returns | |
| getLine | back to summary |
|---|---|
| public int getLine() | |
| getReachableConfigSet | back to summary |
|---|---|
| protected void getReachableConfigSet(CharStream input, ATNConfigSet closure, ATNConfigSet reach, int t) Given a starting configuration set, figure out all ATN configurations
we can reach upon input | |
| getReachableTarget | back to summary |
|---|---|
| protected ATNState getReachableTarget(Transition trans, int t) | |
| getText | back to summary |
|---|---|
| public String getText(CharStream input) Get the text matched so far for the current token. | |
| getTokenName | back to summary |
|---|---|
| public String getTokenName(int t) | |
| match | back to summary |
|---|---|
| public int match(CharStream input, int mode) | |
| matchATN | back to summary |
|---|---|
| protected int matchATN(CharStream input) | |
| reset | back to summary |
|---|---|
| public void reset() Implements abstract org.
| |
| setCharPositionInLine | back to summary |
|---|---|
| public void setCharPositionInLine(int charPositionInLine) | |
| setLine | back to summary |
|---|---|
| public void setLine(int line) | |
IntStream#mark and record the current state. The current sim state
includes the current index into the input, the current line,
and current character position in that line. Note that the Lexer is
tracking the starting line and characterization of the token. These
variables track the "state" of the simulator when it hits an accept state.
We track these variables separately for the DFA and ATN simulation because the DFA simulation often has to fail over to the ATN simulation. If the ATN simulation fails, we need the DFA to fall back to its previously accepted state, if any. If the ATN succeeds, then the ATN does the accept and the DFA simulator that invoked it can simply return the predicted token type.
| Modifier and Type | Field and Description |
|---|---|
| protected int | |
| protected DFAState | |
| protected int | |
| protected int |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected void |
| charPos | back to summary |
|---|---|
| protected int charPos | |
| dfaState | back to summary |
|---|---|
| protected DFAState dfaState | |
| index | back to summary |
|---|---|
| protected int index | |
| line | back to summary |
|---|---|
| protected int line | |
| SimState | back to summary |
|---|---|
| protected SimState() | |
| reset | back to summary |
|---|---|
| protected void reset() | |