@brief Baseclass for generated tree parsers.
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.
|
__init__(self,
input,
state=None)
x.__init__(...) initializes x; see help(type(x)) for signature |
|
|
|
reset(self)
reset the parser's state; subclasses must rewinds the input stream |
|
|
|
setTreeNodeStream(self,
input)
Set the input stream |
|
|
|
|
|
|
|
getCurrentInputSymbol(self,
input)
Match needs to return the current input symbol, which gets put into
the label for the associated token ref; e.g., x=ID. |
|
|
|
getMissingSymbol(self,
input,
e,
expectedTokenType,
follow)
Conjure up a missing token during error recovery. |
|
|
|
inContext(self,
context,
adaptor=None,
tokenName=None,
t=None)
Check if current node in input has a context. |
|
|
|
matchAny(self,
ignore)
Match '.' in tree parser has special meaning. |
|
|
|
mismatch(self,
input,
ttype,
follow)
We have DOWN/UP nodes in the stream that have no line info; override. |
|
|
|
getErrorHeader(self,
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. |
|
|
|
getErrorMessage(self,
e,
tokenNames)
Tree parsers parse nodes they usually have a token object as payload. |
|
|
|
|
|
|
Inherited from recognizers.BaseRecognizer :
alreadyParsedRule ,
beginResync ,
combineFollows ,
computeContextSensitiveRuleFOLLOW ,
computeErrorRecoverySet ,
consumeUntil ,
displayRecognitionError ,
emitErrorMessage ,
endResync ,
failed ,
getBacktrackingLevel ,
getGrammarFileName ,
getNumberOfSyntaxErrors ,
getRuleInvocationStack ,
getRuleMemoization ,
getTokenErrorDisplay ,
match ,
memoize ,
mismatchIsMissingToken ,
mismatchIsUnwantedToken ,
recover ,
recoverFromMismatchedSet ,
recoverFromMismatchedToken ,
reportError ,
setBacktrackingLevel ,
setInput ,
toStrings
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__sizeof__ ,
__str__ ,
__subclasshook__
|