Fields Summary |
---|
public static ASTNULLType | ASTNULLThe 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. |
protected AST | _retTreeWhere did this rule leave off parsing; avoids a return parameter |
protected TreeParserSharedInputState | inputStateNesting level of registered handlers |
protected String[] | tokenNamesTable of token type to token names |
protected AST | returnASTAST return value for a rule is squirreled away here |
protected ASTFactory | astFactoryAST support code; parser and treeparser delegate to this object |
protected int | traceDepthUsed to keep track of indentdepth for traceIn/Out |
Methods Summary |
---|
public persistence.antlr.collections.AST | getAST()Get the AST return value squirreled away in the parser
return returnAST;
|
public persistence.antlr.ASTFactory | getASTFactory()
return astFactory;
|
public java.lang.String | getTokenName(int num)
return tokenNames[num];
|
public java.lang.String[] | getTokenNames()
return tokenNames;
|
protected void | match(persistence.antlr.collections.AST t, int ttype)
//System.out.println("match("+ttype+"); cursor is "+t);
if (t == null || t == ASTNULL || t.getType() != ttype) {
throw new MismatchedTokenException(getTokenNames(), t, ttype, false);
}
|
public void | match(persistence.antlr.collections.AST t, persistence.antlr.collections.impl.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.
if (t == null || t == ASTNULL || !b.member(t.getType())) {
throw new MismatchedTokenException(getTokenNames(), t, b, false);
}
|
protected void | matchNot(persistence.antlr.collections.AST t, int ttype)
//System.out.println("match("+ttype+"); cursor is "+t);
if (t == null || t == ASTNULL || t.getType() == ttype) {
throw new MismatchedTokenException(getTokenNames(), t, ttype, true);
}
|
public static void | panic()
System.err.println("TreeWalker: panic");
System.exit(1);
|
public void | reportError(persistence.antlr.RecognitionException ex)Parser error-reporting function can be overridden in subclass
System.err.println(ex.toString());
|
public void | reportError(java.lang.String s)Parser error-reporting function can be overridden in subclass
System.err.println("error: " + s);
|
public void | reportWarning(java.lang.String s)Parser warning-reporting function can be overridden in subclass
System.err.println("warning: " + s);
|
public void | setASTFactory(persistence.antlr.ASTFactory f)Specify an object with support code (shared by
Parser and TreeParser. Normally, the programmer
does not play with this, using setASTNodeType instead.
astFactory = f;
|
public void | setASTNodeClass(java.lang.String nodeType)Specify the type of node to create during tree building
astFactory.setASTNodeType(nodeType);
|
public void | setASTNodeType(java.lang.String nodeType)Specify the type of node to create during tree building.
setASTNodeClass(nodeType);
|
public void | traceIn(java.lang.String rname, persistence.antlr.collections.AST t)
traceDepth += 1;
traceIndent();
System.out.println("> " + rname +
"(" + (t != null?t.toString():"null") + ")" +
((inputState.guessing > 0)?" [guessing]":""));
|
public void | traceIndent()
for (int i = 0; i < traceDepth; i++)
System.out.print(" ");
|
public void | traceOut(java.lang.String rname, persistence.antlr.collections.AST t)
traceIndent();
System.out.println("< " + rname +
"(" + (t != null?t.toString():"null") + ")" +
((inputState.guessing > 0)?" [guessing]":""));
traceDepth--;
|