public abstract class Recognizer<Symbol,ATNInterpreter extends ATNSimulator> extends Object
Modifier and Type | Field and Description |
---|---|
protected ATNInterpreter |
_interp |
static int |
EOF |
Constructor and Description |
---|
Recognizer() |
Modifier and Type | Method and Description |
---|---|
void |
action(RuleContext _localctx,
int ruleIndex,
int actionIndex) |
void |
addErrorListener(ANTLRErrorListener listener) |
abstract ATN |
getATN()
Get the
ATN used by the recognizer for prediction. |
String |
getErrorHeader(RecognitionException e)
What is the error header, normally line/character position information?
|
ANTLRErrorListener |
getErrorListenerDispatch() |
List<? extends ANTLRErrorListener> |
getErrorListeners() |
abstract String |
getGrammarFileName()
For debugging and other purposes, might want the grammar name.
|
abstract IntStream |
getInputStream() |
ATNInterpreter |
getInterpreter()
Get the ATN interpreter used by the recognizer for prediction.
|
ParseInfo |
getParseInfo()
If profiling during the parse/lex, this will return DecisionInfo records
for each decision in recognizer in a ParseInfo object.
|
Map<String,Integer> |
getRuleIndexMap()
Get a map from rule names to rule indexes.
|
abstract String[] |
getRuleNames() |
String |
getSerializedATN()
If this recognizer was generated, it will have a serialized ATN
representation of the grammar.
|
int |
getState() |
String |
getTokenErrorDisplay(Token t)
Deprecated.
This method is not called by the ANTLR 4 Runtime. Specific
implementations of
ANTLRErrorStrategy may provide a similar
feature when necessary. For example, see
DefaultErrorStrategy.getTokenErrorDisplay(org.antlr.v4.runtime.Token) . |
abstract TokenFactory<?> |
getTokenFactory() |
abstract String[] |
getTokenNames()
Deprecated.
Use
getVocabulary() instead. |
int |
getTokenType(String tokenName) |
Map<String,Integer> |
getTokenTypeMap()
Get a map from token names to token types.
|
Vocabulary |
getVocabulary()
Get the vocabulary used by the recognizer.
|
boolean |
precpred(RuleContext localctx,
int precedence) |
void |
removeErrorListener(ANTLRErrorListener listener) |
void |
removeErrorListeners() |
boolean |
sempred(RuleContext _localctx,
int ruleIndex,
int actionIndex) |
abstract void |
setInputStream(IntStream input) |
void |
setInterpreter(ATNInterpreter interpreter)
Set the ATN interpreter used by the recognizer for prediction.
|
void |
setState(int atnState)
Indicate that the recognizer has changed internal state that is
consistent with the ATN state passed in.
|
abstract void |
setTokenFactory(TokenFactory<?> input) |
public static final int EOF
protected ATNInterpreter extends ATNSimulator _interp
@Deprecated public abstract String[] getTokenNames()
getVocabulary()
instead.public abstract String[] getRuleNames()
public Vocabulary getVocabulary()
Vocabulary
instance providing information about the
vocabulary used by the grammar.public Map<String,Integer> getTokenTypeMap()
Used for XPath and tree pattern compilation.
public Map<String,Integer> getRuleIndexMap()
Used for XPath and tree pattern compilation.
public int getTokenType(String tokenName)
public String getSerializedATN()
For interpreters, we don't know their serialized ATN despite having created the interpreter from it.
public abstract String getGrammarFileName()
public abstract ATN getATN()
ATN
used by the recognizer for prediction.ATN
used by the recognizer for prediction.public ATNInterpreter getInterpreter()
public ParseInfo getParseInfo()
public void setInterpreter(ATNInterpreter interpreter)
interpreter
- The ATN interpreter used by the recognizer for
prediction.public String getErrorHeader(RecognitionException e)
@Deprecated public String getTokenErrorDisplay(Token t)
ANTLRErrorStrategy
may provide a similar
feature when necessary. For example, see
DefaultErrorStrategy.getTokenErrorDisplay(org.antlr.v4.runtime.Token)
.public void addErrorListener(ANTLRErrorListener listener)
NullPointerException
- if listener
is null
.public void removeErrorListener(ANTLRErrorListener listener)
public void removeErrorListeners()
public List<? extends ANTLRErrorListener> getErrorListeners()
public ANTLRErrorListener getErrorListenerDispatch()
public boolean sempred(RuleContext _localctx, int ruleIndex, int actionIndex)
public boolean precpred(RuleContext localctx, int precedence)
public void action(RuleContext _localctx, int ruleIndex, int actionIndex)
public final int getState()
public final void setState(int atnState)
public abstract IntStream getInputStream()
public abstract void setInputStream(IntStream input)
public abstract TokenFactory<?> getTokenFactory()
public abstract void setTokenFactory(TokenFactory<?> input)
Copyright © 1992-2015 ANTLR. All Rights Reserved.