| Package | org.antlr.runtime.tree |
| Class | public class TreeParser |
| Inheritance | TreeParser BaseRecognizer |
| Property | Defined by | ||
|---|---|---|---|
![]() | backtrackingLevel : int | BaseRecognizer | |
![]() | grammarFileName : String For debugging and other purposes, might want the grammar name.
| BaseRecognizer | |
![]() | numberOfSyntaxErrors : int Get number of recognition errors (lexer, parser, tree parser).
| BaseRecognizer | |
| sourceName : String [read-only]
| TreeParser | ||
![]() | state : RecognizerSharedState
State of a lexer, parser, or tree parser are collected into a state
object so the state can be shared.
| BaseRecognizer | |
![]() | tokenNames : Array Used to print out token names like ID during debugging and
error reporting.
| BaseRecognizer | |
| treeNodeStream : TreeNodeStream | TreeParser | ||
| Property | Defined by | ||
|---|---|---|---|
| input : TreeNodeStream | TreeParser | ||
| Method | Defined by | ||
|---|---|---|---|
| TreeParser | |||
![]() |
alreadyParsedRule(input:IntStream, ruleIndex:int):Boolean
Has this rule already parsed input at the current index in the
input stream? Return the stop token index or MEMO_RULE_UNKNOWN.
| BaseRecognizer | |
![]() |
beginResync():void
A hook to listen in on the token consumption during error recovery.
| BaseRecognizer | |
![]() |
Consume tokens until one matches the given token set
| BaseRecognizer | |
![]() |
consumeUntilToken(input:IntStream, tokenType:int):void
| BaseRecognizer | |
![]() |
displayRecognitionError(tokenNames:Array, e:RecognitionException):void
| BaseRecognizer | |
![]() |
emitErrorMessage(msg:String):void
Override this method to change where error messages go
| BaseRecognizer | |
![]() |
endResync():void
| BaseRecognizer | |
|
getErrorHeader(e:RecognitionException):String
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.
| TreeParser | ||
|
getErrorMessage(e:RecognitionException, tokenNames:Array):String
Tree parsers parse nodes they usually have a token object as
payload.
| TreeParser | ||
![]() |
getRuleMemoization(ruleIndex:int, ruleStartIndex:int):int
Given a rule number and a start token index number, return
MEMO_RULE_UNKNOWN if the rule has not parsed input starting from
start index.
| BaseRecognizer | |
![]() |
return how many rule/input-index pairs there are in total.
| BaseRecognizer | |
![]() |
getTokenErrorDisplay(t:Token):String
How should a token be displayed in an error message? The default
is to display just the text, but during development you might
want to have a lot of information spit out.
| BaseRecognizer | |
|
Match '.' in tree parser has special meaning.
| TreeParser | ||
![]() |
matchAnyStream(input:IntStream):void
Match the wildcard: in a symbol
| BaseRecognizer | |
![]() |
Match current input symbol against ttype.
| BaseRecognizer | |
![]() |
Record whether or not this rule parsed the input at this position
successfully.
| BaseRecognizer | |
![]() | BaseRecognizer | ||
![]() |
mismatchIsUnwantedToken(input:IntStream, ttype:int):Boolean
| BaseRecognizer | |
![]() |
Not currently used
| BaseRecognizer | |
![]() |
Attempt to recover from a single missing or extra token.
| BaseRecognizer | |
![]() |
Recover from an error found on the input stream.
| BaseRecognizer | |
![]() |
reportError(e:RecognitionException):void
Report a recognition problem.
| BaseRecognizer | |
|
reset():void
| TreeParser | ||
![]() |
toStrings(tokens:Array):Array
A convenience method for use most often with template rewrites.
| BaseRecognizer | |
|
traceIn(ruleName:String, ruleIndex:int):void
| TreeParser | ||
![]() |
traceInSymbol(ruleName:String, ruleIndex:int, inputSymbol:Object):void
| BaseRecognizer | |
|
traceOut(ruleName:String, ruleIndex:int):void
| TreeParser | ||
![]() |
traceOutSymbol(ruleName:String, ruleIndex:int, inputSymbol:Object):void
| BaseRecognizer | |
| Method | Defined by | ||
|---|---|---|---|
![]() |
combineFollows(exact:Boolean):BitSet
| BaseRecognizer | |
![]() |
Compute the context-sensitive FOLLOW set for current rule.
| BaseRecognizer | |
![]() | BaseRecognizer | ||
|
getCurrentInputSymbol(input:IntStream):Object
| TreeParser | ||
|
getMissingSymbol(input:IntStream, e:RecognitionException, expectedTokenType:int, follow:BitSet):Object
| TreeParser | ||
|
We have DOWN/UP nodes in the stream that have no line info; override.
| TreeParser | ||
![]() |
pushFollow(fset:BitSet):void
Push a rule's follow set using our own hardcoded stack
| BaseRecognizer | |
| Constant | Defined by | ||
|---|---|---|---|
![]() | DEFAULT_TOKEN_CHANNEL : int = 0 [static]
| BaseRecognizer | |
| DOWN : int = 2 [static]
| TreeParser | ||
![]() | HIDDEN : int = 99 [static]
| BaseRecognizer | |
![]() | INITIAL_FOLLOW_STACK_SIZE : int = 100 [static]
| BaseRecognizer | |
![]() | MEMO_RULE_FAILED : int = -2 [static]
| BaseRecognizer | |
![]() | MEMO_RULE_UNKNOWN : int = -1 [static]
| BaseRecognizer | |
![]() | NEXT_TOKEN_RULE_NAME : String = "nextToken" [static]
| BaseRecognizer | |
| UP : int = 3 [static]
| TreeParser | ||
| input | property |
protected var input:TreeNodeStream
| sourceName | property |
sourceName:String [read-only]Implementation
public function get sourceName():String
| treeNodeStream | property |
treeNodeStream:TreeNodeStream [read-write]Implementation
public function get treeNodeStream():TreeNodeStream
public function set treeNodeStream(value:TreeNodeStream):void
| TreeParser | () | constructor |
public function TreeParser(input:TreeNodeStream, state:RecognizerSharedState = null)Parameters
input:TreeNodeStream |
|
state:RecognizerSharedState (default = null) |
| getCurrentInputSymbol | () | method |
protected override function getCurrentInputSymbol(input:IntStream):ObjectParameters
input:IntStream |
Object |
| getErrorHeader | () | method |
public override function getErrorHeader(e:RecognitionException):StringPrefix error message with the grammar name because message is always intended for the programmer because the parser built the input tree not the user.
Parameterse:RecognitionException |
String |
| getErrorMessage | () | method |
public override function getErrorMessage(e:RecognitionException, tokenNames:Array):StringTree parsers parse nodes they usually have a token object as payload. Set the exception token and do the default behavior.
Parameterse:RecognitionException |
|
tokenNames:Array |
String |
| getMissingSymbol | () | method |
protected override function getMissingSymbol(input:IntStream, e:RecognitionException, expectedTokenType:int, follow:BitSet):ObjectParameters
input:IntStream |
|
e:RecognitionException |
|
expectedTokenType:int |
|
follow:BitSet |
Object |
| matchAny | () | method |
public function matchAny(ignore:IntStream):voidMatch '.' in tree parser has special meaning. Skip node or entire tree if node has children. If children, scan until corresponding UP node.
Parametersignore:IntStream |
| mismatch | () | method |
protected override function mismatch(input:IntStream, ttype:int, follow:BitSet):voidWe have DOWN/UP nodes in the stream that have no line info; override. plus we want to alter the exception type. Don't try to recover from tree parser errors inline...
Parametersinput:IntStream |
|
ttype:int |
|
follow:BitSet |
| reset | () | method |
public override function reset():void
| traceIn | () | method |
public function traceIn(ruleName:String, ruleIndex:int):voidParameters
ruleName:String |
|
ruleIndex:int |
| traceOut | () | method |
public function traceOut(ruleName:String, ruleIndex:int):voidParameters
ruleName:String |
|
ruleIndex:int |
| DOWN | constant |
public static const DOWN:int = 2
| UP | constant |
public static const UP:int = 3