|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.antlr.runtime.BaseRecognizer
org.antlr.runtime.tree.TreeParser
public class TreeParser
A parser for a stream of tree nodes. "tree grammars" result in a subclass of this. All the error reporting and recovery is shared with Parser via the BaseRecognizer superclass.
Field Summary | |
---|---|
static int |
DOWN
|
protected TreeNodeStream |
input
|
static int |
UP
|
Fields inherited from class org.antlr.runtime.BaseRecognizer |
---|
DEFAULT_TOKEN_CHANNEL, HIDDEN, INITIAL_FOLLOW_STACK_SIZE, MEMO_RULE_FAILED, MEMO_RULE_UNKNOWN, NEXT_TOKEN_RULE_NAME, state |
Constructor Summary | |
---|---|
TreeParser(TreeNodeStream input)
|
|
TreeParser(TreeNodeStream input,
RecognizerSharedState state)
|
Method Summary | |
---|---|
protected java.lang.Object |
getCurrentInputSymbol(IntStream input)
Match needs to return the current input symbol, which gets put into the label for the associated token ref; e.g., x=ID. |
java.lang.String |
getErrorHeader(RecognitionException e)
Prefix error message with the grammar name because message is always intended for the programmer because the parser built the input tree not the user. |
java.lang.String |
getErrorMessage(RecognitionException e,
java.lang.String[] tokenNames)
Tree parsers parse nodes they usually have a token object as payload. |
protected java.lang.Object |
getMissingSymbol(IntStream input,
RecognitionException e,
int expectedTokenType,
BitSet follow)
Conjure up a missing token during error recovery. |
java.lang.String |
getSourceName()
|
TreeNodeStream |
getTreeNodeStream()
|
void |
matchAny(IntStream ignore)
Match '.' in tree parser has special meaning. |
protected java.lang.Object |
recoverFromMismatchedToken(IntStream input,
int ttype,
BitSet follow)
We have DOWN/UP nodes in the stream that have no line info; override. |
void |
reset()
reset the parser's state; subclasses must rewinds the input stream |
void |
setTreeNodeStream(TreeNodeStream input)
Set the input stream |
void |
traceIn(java.lang.String ruleName,
int ruleIndex)
|
void |
traceOut(java.lang.String ruleName,
int ruleIndex)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DOWN
public static final int UP
protected TreeNodeStream input
Constructor Detail |
---|
public TreeParser(TreeNodeStream input)
public TreeParser(TreeNodeStream input, RecognizerSharedState state)
Method Detail |
---|
public void reset()
BaseRecognizer
reset
in class BaseRecognizer
public void setTreeNodeStream(TreeNodeStream input)
public TreeNodeStream getTreeNodeStream()
public java.lang.String getSourceName()
getSourceName
in class BaseRecognizer
protected java.lang.Object getCurrentInputSymbol(IntStream input)
BaseRecognizer
getCurrentInputSymbol
in class BaseRecognizer
protected java.lang.Object getMissingSymbol(IntStream input, RecognitionException e, int expectedTokenType, BitSet follow)
BaseRecognizer
getMissingSymbol
in class BaseRecognizer
public void matchAny(IntStream ignore)
matchAny
in class BaseRecognizer
protected java.lang.Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException
recoverFromMismatchedToken
in class BaseRecognizer
RecognitionException
public java.lang.String getErrorHeader(RecognitionException e)
getErrorHeader
in class BaseRecognizer
public java.lang.String getErrorMessage(RecognitionException e, java.lang.String[] tokenNames)
getErrorMessage
in class BaseRecognizer
public void traceIn(java.lang.String ruleName, int ruleIndex)
public void traceOut(java.lang.String ruleName, int ruleIndex)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |