LexerATNSimulator

"dup" of ParserInterpreter

class LexerATNSimulator : ATNSimulator {}

Constructors

this
this(ATN atn, DFA[] decisionToDFA, PredictionContextCache sharedContextCache)
Undocumented in source.
this
this(Lexer recog, ATN atn, DFA[] decisionToDFA, PredictionContextCache sharedContextCache)
Undocumented in source.

Members

Functions

accept
void accept(CharStream input, LexerActionExecutor lexerActionExecutor, size_t startIndex, size_t index, int line, int charPos)
Undocumented in source. Be warned that the author may not have intended to support it.
addDFAEdge
DFAState addDFAEdge(DFAState from, int t, ATNConfigSet q)
Undocumented in source. Be warned that the author may not have intended to support it.
addDFAEdge
void addDFAEdge(DFAState p, int t, DFAState q)
Undocumented in source. Be warned that the author may not have intended to support it.
addDFAState
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
void captureSimState(SimState settings, CharStream input, DFAState dfaState)
Undocumented in source. Be warned that the author may not have intended to support it.
clearDFA
void clearDFA()

@uml @override

closure
bool closure(CharStream input, LexerATNConfig config, ATNConfigSet configs, bool currentAltReachedAcceptState, bool speculative, bool treatEofAsEpsilon)

@uml 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 {@code config}, all other (potentially reachable) states for this rule would have a lower priority.

computeStartState
ATNConfigSet computeStartState(CharStream input, ATNState p)
Undocumented in source. Be warned that the author may not have intended to support it.
computeTargetState
DFAState computeTargetState(CharStream input, DFAState s, dchar t)

@uml Compute a target state for an edge in the DFA, and attempt to add the computed state and corresponding edge to the DFA.

consume
void consume(CharStream input)
Undocumented in source. Be warned that the author may not have intended to support it.
copyState
void copyState(LexerATNSimulator simulator)
Undocumented in source. Be warned that the author may not have intended to support it.
evaluatePredicate
bool evaluatePredicate(CharStream input, int ruleIndex, int predIndex, bool speculative)

Evaluate a predicate specified in the lexer.

execATN
int execATN(CharStream input, DFAState ds0)
Undocumented in source. Be warned that the author may not have intended to support it.
failOrAccept
int failOrAccept(SimState prevAccept, CharStream input, ATNConfigSet reach, dchar t)
Undocumented in source. Be warned that the author may not have intended to support it.
getCharPositionInLine
int getCharPositionInLine()
Undocumented in source. Be warned that the author may not have intended to support it.
getDFA
DFA getDFA(int mode)
Undocumented in source. Be warned that the author may not have intended to support it.
getEpsilonTarget
LexerATNConfig getEpsilonTarget(CharStream input, LexerATNConfig config, Transition t, ATNConfigSet configs, bool speculative, bool treatEofAsEpsilon)

side-effect: can alter configs.hasSemanticContext

getExistingTargetState
DFAState getExistingTargetState(DFAState s, int t)

@uml 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 {@code null}.

getLine
int getLine()
Undocumented in source. Be warned that the author may not have intended to support it.
getReachableConfigSet
void getReachableConfigSet(CharStream input, ATNConfigSet closureATNConfigSet, ATNConfigSet reach, dchar t)

Given a starting configuration set, figure out all ATN configurations we can reach upon input {@code t}. Parameter {@code reach} is a return parameter.

getReachableTarget
ATNState getReachableTarget(Transition trans, dchar t)
Undocumented in source. Be warned that the author may not have intended to support it.
getText
string getText(CharStream input)
Undocumented in source. Be warned that the author may not have intended to support it.
getTokenName
string getTokenName(int t)
Undocumented in source. Be warned that the author may not have intended to support it.
match
int match(CharStream input, int mode)
Undocumented in source. Be warned that the author may not have intended to support it.
matchATN
int matchATN(CharStream input)
Undocumented in source. Be warned that the author may not have intended to support it.
reset
void reset()

@uml @override

setCharPositionInLine
void setCharPositionInLine(int charPositionInLine)
Undocumented in source. Be warned that the author may not have intended to support it.
setLine
void setLine(int line)
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

match_calls
int match_calls;
Undocumented in source.

Variables

MAX_DFA_EDGE
enum int MAX_DFA_EDGE;

forces unicode to stay in ATN

MIN_DFA_EDGE
enum int MIN_DFA_EDGE;
Undocumented in source.
charPositionInLine
int charPositionInLine;

@uml The index of the character relative to the beginning of the line 0..n-1

decisionToDFA
DFA[] decisionToDFA;
Undocumented in source.
line
int line;

@uml line number 1..n within the input

mode
int mode;
Undocumented in source.
prevAccept
SimState prevAccept;
Undocumented in source.
recog
Lexer recog;
Undocumented in source.
startIndex
int startIndex;

@uml 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.

Inherited Members

From ATNSimulator

SERIALIZED_VERSION
int SERIALIZED_VERSION;
Undocumented in source.
SERIALIZED_UUID
UUID SERIALIZED_UUID;

This is the current serialized UUID. deprecated Use {@link ATNDeserializer#checkCondition(boolean)} instead.

ERROR
DFAState ERROR;

Must distinguish between missing edge and edge we know leads nowhere

atn
ATN atn;
Undocumented in source.
sharedContextCache
PredictionContextCache sharedContextCache;

The context cache maps all PredictionContext objects that are equals() to a single cached copy. This cache is shared across all contexts in all ATNConfigs in all DFA states. We rebuild each ATNConfigSet to use only cached nodes/graphs in addDFAState(). We don't want to fill this during closure() since there are lots of contexts that pop up but are not used ever again. It also greatly slows down closure().

reset
void reset()
Undocumented in source.
clearDFA
void clearDFA()

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.

getSharedContextCache
PredictionContextCache getSharedContextCache()
Undocumented in source. Be warned that the author may not have intended to support it.
getCachedContext
PredictionContext getCachedContext(PredictionContext context)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta