Methods Summary |
---|
public abstract int | LA(int i)Return the token type of the ith token of lookahead where i=1
is the current token being examined by the parser (i.e., it
has not been matched yet).
|
public abstract persistence.antlr.Token | LT(int i)Return the ith token of lookahead
|
public void | addMessageListener(persistence.antlr.debug.MessageListener l)
if (!ignoreInvalidDebugCalls)
throw new IllegalArgumentException("addMessageListener() is only valid if parser built for debugging");
|
public void | addParserListener(persistence.antlr.debug.ParserListener l)
if (!ignoreInvalidDebugCalls)
throw new IllegalArgumentException("addParserListener() is only valid if parser built for debugging");
|
public void | addParserMatchListener(persistence.antlr.debug.ParserMatchListener l)
if (!ignoreInvalidDebugCalls)
throw new IllegalArgumentException("addParserMatchListener() is only valid if parser built for debugging");
|
public void | addParserTokenListener(persistence.antlr.debug.ParserTokenListener l)
if (!ignoreInvalidDebugCalls)
throw new IllegalArgumentException("addParserTokenListener() is only valid if parser built for debugging");
|
public void | addSemanticPredicateListener(persistence.antlr.debug.SemanticPredicateListener l)
if (!ignoreInvalidDebugCalls)
throw new IllegalArgumentException("addSemanticPredicateListener() is only valid if parser built for debugging");
|
public void | addSyntacticPredicateListener(persistence.antlr.debug.SyntacticPredicateListener l)
if (!ignoreInvalidDebugCalls)
throw new IllegalArgumentException("addSyntacticPredicateListener() is only valid if parser built for debugging");
|
public void | addTraceListener(persistence.antlr.debug.TraceListener l)
if (!ignoreInvalidDebugCalls)
throw new IllegalArgumentException("addTraceListener() is only valid if parser built for debugging");
|
public abstract void | consume()Get another token object from the token stream
|
public void | consumeUntil(int tokenType)Consume tokens until one matches the given token
while (LA(1) != Token.EOF_TYPE && LA(1) != tokenType) {
consume();
}
|
public void | consumeUntil(persistence.antlr.collections.impl.BitSet set)Consume tokens until one matches the given token set
while (LA(1) != Token.EOF_TYPE && !set.member(LA(1))) {
consume();
}
|
protected void | defaultDebuggingSetup(persistence.antlr.TokenStream lexer, persistence.antlr.TokenBuffer tokBuf)
// by default, do nothing -- we're not debugging
|
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 | getFilename()
return inputState.filename;
|
public persistence.antlr.ParserSharedInputState | getInputState()
return inputState;
|
public java.lang.String | getTokenName(int num)
return tokenNames[num];
|
public java.lang.String[] | getTokenNames()
return tokenNames;
|
public java.util.Hashtable | getTokenTypeToASTClassMap()If the user specifies a tokens{} section with heterogeneous
AST node types, then ANTLR generates code to fill
this mapping.
return tokenTypeToASTClassMap;
|
public boolean | isDebugMode()
return false;
|
public int | mark()
return inputState.input.mark();
|
public void | match(int t)Make sure current lookahead symbol matches token type t.
Throw an exception upon mismatch, which is catch by either the
error handler or by the syntactic predicate.
if (LA(1) != t)
throw new MismatchedTokenException(tokenNames, LT(1), t, false, getFilename());
else
// mark token as consumed -- fetch next token deferred until LA/LT
consume();
|
public void | match(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 (!b.member(LA(1)))
throw new MismatchedTokenException(tokenNames, LT(1), b, false, getFilename());
else
// mark token as consumed -- fetch next token deferred until LA/LT
consume();
|
public void | matchNot(int t)
if (LA(1) == t)
// Throws inverted-sense exception
throw new MismatchedTokenException(tokenNames, LT(1), t, true, getFilename());
else
// mark token as consumed -- fetch next token deferred until LA/LT
consume();
|
public static void | panic()
System.err.println("Parser: panic");
System.exit(1);
|
public void | removeMessageListener(persistence.antlr.debug.MessageListener l)
if (!ignoreInvalidDebugCalls)
throw new RuntimeException("removeMessageListener() is only valid if parser built for debugging");
|
public void | removeParserListener(persistence.antlr.debug.ParserListener l)
if (!ignoreInvalidDebugCalls)
throw new RuntimeException("removeParserListener() is only valid if parser built for debugging");
|
public void | removeParserMatchListener(persistence.antlr.debug.ParserMatchListener l)
if (!ignoreInvalidDebugCalls)
throw new RuntimeException("removeParserMatchListener() is only valid if parser built for debugging");
|
public void | removeParserTokenListener(persistence.antlr.debug.ParserTokenListener l)
if (!ignoreInvalidDebugCalls)
throw new RuntimeException("removeParserTokenListener() is only valid if parser built for debugging");
|
public void | removeSemanticPredicateListener(persistence.antlr.debug.SemanticPredicateListener l)
if (!ignoreInvalidDebugCalls)
throw new IllegalArgumentException("removeSemanticPredicateListener() is only valid if parser built for debugging");
|
public void | removeSyntacticPredicateListener(persistence.antlr.debug.SyntacticPredicateListener l)
if (!ignoreInvalidDebugCalls)
throw new IllegalArgumentException("removeSyntacticPredicateListener() is only valid if parser built for debugging");
|
public void | removeTraceListener(persistence.antlr.debug.TraceListener l)
if (!ignoreInvalidDebugCalls)
throw new RuntimeException("removeTraceListener() is only valid if parser built for debugging");
|
public void | reportError(persistence.antlr.RecognitionException ex)Parser error-reporting function can be overridden in subclass
System.err.println(ex);
|
public void | reportError(java.lang.String s)Parser error-reporting function can be overridden in subclass
if (getFilename() == null) {
System.err.println("error: " + s);
}
else {
System.err.println(getFilename() + ": error: " + s);
}
|
public void | reportWarning(java.lang.String s)Parser warning-reporting function can be overridden in subclass
if (getFilename() == null) {
System.err.println("warning: " + s);
}
else {
System.err.println(getFilename() + ": warning: " + s);
}
|
public void | rewind(int pos)
inputState.input.rewind(pos);
|
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 cl)
astFactory.setASTNodeType(cl);
|
public void | setASTNodeType(java.lang.String nodeType)Specify the type of node to create during tree building; use setASTNodeClass now
to be consistent with Token Object Type accessor.
setASTNodeClass(nodeType);
|
public void | setDebugMode(boolean debugMode)
if (!ignoreInvalidDebugCalls)
throw new RuntimeException("setDebugMode() only valid if parser built for debugging");
|
public void | setFilename(java.lang.String f)
inputState.filename = f;
|
public void | setIgnoreInvalidDebugCalls(boolean value)
ignoreInvalidDebugCalls = value;
|
public void | setInputState(persistence.antlr.ParserSharedInputState state)
inputState = state;
|
public void | setTokenBuffer(persistence.antlr.TokenBuffer t)Set or change the input token buffer
inputState.input = t;
|
public void | traceIn(java.lang.String rname)
traceDepth += 1;
traceIndent();
System.out.println("> " + rname + "; LA(1)==" + LT(1).getText() +
((inputState.guessing > 0)?" [guessing]":""));
|
public void | traceIndent()
for (int i = 0; i < traceDepth; i++)
System.out.print(" ");
|
public void | traceOut(java.lang.String rname)
traceIndent();
System.out.println("< " + rname + "; LA(1)==" + LT(1).getText() +
((inputState.guessing > 0)?" [guessing]":""));
traceDepth -= 1;
|