Package antlr
Class LLkParser
- java.lang.Object
-
- antlr.Parser
-
- antlr.LLkParser
-
- Direct Known Subclasses:
ANTLRParser
,ANTLRTokdefParser
,LLkDebuggingParser
,ParseTreeDebugParser
,Preprocessor
public class LLkParser extends Parser
An LL(k) parser.- See Also:
Token
,TokenBuffer
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int
k
-
Fields inherited from class antlr.Parser
astFactory, inputState, returnAST, tokenNames, tokenTypeToASTClassMap, traceDepth
-
-
Constructor Summary
Constructors Constructor Description LLkParser(int k_)
LLkParser(ParserSharedInputState state, int k_)
LLkParser(TokenBuffer tokenBuf, int k_)
LLkParser(TokenStream lexer, int k_)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
consume()
Consume another token from the input stream.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).Token
LT(int i)
Return the ith token of lookaheadvoid
traceIn(java.lang.String rname)
void
traceOut(java.lang.String rname)
-
Methods inherited from class antlr.Parser
addMessageListener, addParserListener, addParserMatchListener, addParserTokenListener, addSemanticPredicateListener, addSyntacticPredicateListener, addTraceListener, consumeUntil, consumeUntil, defaultDebuggingSetup, getAST, getASTFactory, getFilename, getInputState, getTokenName, getTokenNames, getTokenTypeToASTClassMap, isDebugMode, mark, match, match, matchNot, panic, recover, removeMessageListener, removeParserListener, removeParserMatchListener, removeParserTokenListener, removeSemanticPredicateListener, removeSyntacticPredicateListener, removeTraceListener, reportError, reportError, reportWarning, rewind, setASTFactory, setASTNodeClass, setASTNodeType, setDebugMode, setFilename, setIgnoreInvalidDebugCalls, setInputState, setTokenBuffer, traceIndent
-
-
-
-
Constructor Detail
-
LLkParser
public LLkParser(int k_)
-
LLkParser
public LLkParser(ParserSharedInputState state, int k_)
-
LLkParser
public LLkParser(TokenBuffer tokenBuf, int k_)
-
LLkParser
public LLkParser(TokenStream lexer, int k_)
-
-
Method Detail
-
consume
public void consume() throws TokenStreamException
Consume another token from the input stream. Can only write sequentially! If you need 3 tokens ahead, you must consume() 3 times.Note that it is possible to overwrite tokens that have not been matched. For example, calling consume() 3 times when k=2, means that the first token consumed will be overwritten with the 3rd.
- Specified by:
consume
in classParser
- Throws:
TokenStreamException
-
LA
public int LA(int i) throws TokenStreamException
Description copied from class:Parser
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).- Specified by:
LA
in classParser
- Throws:
TokenStreamException
-
LT
public Token LT(int i) throws TokenStreamException
Description copied from class:Parser
Return the ith token of lookahead- Specified by:
LT
in classParser
- Throws:
TokenStreamException
-
traceIn
public void traceIn(java.lang.String rname) throws TokenStreamException
- Overrides:
traceIn
in classParser
- Throws:
TokenStreamException
-
traceOut
public void traceOut(java.lang.String rname) throws TokenStreamException
- Overrides:
traceOut
in classParser
- Throws:
TokenStreamException
-
-