antlr

Class TreeParser

public class TreeParser extends Object

Field Summary
static ASTNULLTypeASTNULL
The AST Null object; the parsing cursor is set to this when it is found to be null.
protected ASTFactoryastFactory
AST support code; parser and treeparser delegate to this object
protected TreeParserSharedInputStateinputState
Nesting level of registered handlers
protected ASTreturnAST
AST return value for a rule is squirreled away here
protected String[]tokenNames
Table of token type to token names
protected inttraceDepth
Used to keep track of indentdepth for traceIn/Out
protected AST_retTree
Where did this rule leave off parsing; avoids a return parameter
Constructor Summary
TreeParser()
Method Summary
ASTgetAST()
Get the AST return value squirreled away in the parser
ASTFactorygetASTFactory()
StringgetTokenName(int num)
String[]getTokenNames()
protected voidmatch(AST t, int ttype)
voidmatch(AST t, BitSet b)
Make sure current lookahead symbol matches the given set Throw an exception upon mismatch, which is catch by either the error handler or by the syntactic predicate.
protected voidmatchNot(AST t, int ttype)
static voidpanic()
voidreportError(RecognitionException ex)
Parser error-reporting function can be overridden in subclass
voidreportError(String s)
Parser error-reporting function can be overridden in subclass
voidreportWarning(String s)
Parser warning-reporting function can be overridden in subclass
voidsetASTFactory(ASTFactory f)
Specify an object with support code (shared by Parser and TreeParser.
voidsetASTNodeClass(String nodeType)
Specify the type of node to create during tree building
voidsetASTNodeType(String nodeType)
Specify the type of node to create during tree building.
voidtraceIn(String rname, AST t)
voidtraceIndent()
voidtraceOut(String rname, AST t)

Field Detail

ASTNULL

public static ASTNULLType ASTNULL
The AST Null object; the parsing cursor is set to this when it is found to be null. This way, we can test the token type of a node without having to have tests for null everywhere.

astFactory

protected ASTFactory astFactory
AST support code; parser and treeparser delegate to this object

inputState

protected TreeParserSharedInputState inputState
Nesting level of registered handlers

returnAST

protected AST returnAST
AST return value for a rule is squirreled away here

tokenNames

protected String[] tokenNames
Table of token type to token names

traceDepth

protected int traceDepth
Used to keep track of indentdepth for traceIn/Out

_retTree

protected AST _retTree
Where did this rule leave off parsing; avoids a return parameter

Constructor Detail

TreeParser

public TreeParser()

Method Detail

getAST

public AST getAST()
Get the AST return value squirreled away in the parser

getASTFactory

public ASTFactory getASTFactory()

getTokenName

public String getTokenName(int num)

getTokenNames

public String[] getTokenNames()

match

protected void match(AST t, int ttype)

match

public void match(AST t, BitSet b)
Make sure current lookahead symbol matches the given set Throw an exception upon mismatch, which is catch by either the error handler or by the syntactic predicate.

matchNot

protected void matchNot(AST t, int ttype)

panic

public static void panic()

Deprecated: as of 2.7.2. This method calls System.exit() and writes directly to stderr, which is usually not appropriate when a parser is embedded into a larger application. Since the method is static, it cannot be overridden to avoid these problems. ANTLR no longer uses this method internally or in generated code.

reportError

public void reportError(RecognitionException ex)
Parser error-reporting function can be overridden in subclass

reportError

public void reportError(String s)
Parser error-reporting function can be overridden in subclass

reportWarning

public void reportWarning(String s)
Parser warning-reporting function can be overridden in subclass

setASTFactory

public void setASTFactory(ASTFactory f)
Specify an object with support code (shared by Parser and TreeParser. Normally, the programmer does not play with this, using setASTNodeType instead.

setASTNodeClass

public void setASTNodeClass(String nodeType)
Specify the type of node to create during tree building

setASTNodeType

public void setASTNodeType(String nodeType)

Deprecated: since 2.7.2

Specify the type of node to create during tree building.

traceIn

public void traceIn(String rname, AST t)

traceIndent

public void traceIndent()

traceOut

public void traceOut(String rname, AST t)