1 #ifndef INC_LLkParser_hpp__
2 #define INC_LLkParser_hpp__
4 /* ANTLR Translator Generator
5 * Project led by Terence Parr at http://www.jGuru.com
6 * Software rights: http://www.antlr.org/license.html
8 * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/LLkParser.hpp#2 $
11 #include <antlr/config.hpp>
12 #include <antlr/Parser.hpp>
14 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
21 * @see antlr.TokenBuffer
22 * @see antlr.LL1Parser
24 class ANTLR_API LLkParser : public Parser {
26 LLkParser(const ParserSharedInputState& lexer, int k_);
28 LLkParser(TokenBuffer& tokenBuf, int k_);
30 LLkParser(TokenStream& lexer, int k_);
32 /** Consume another token from the input stream. Can only write sequentially!
33 * If you need 3 tokens ahead, you must consume() 3 times.
35 * Note that it is possible to overwrite tokens that have not been matched.
36 * For example, calling consume() 3 times when k=2, means that the first token
37 * consumed will be overwritten with the 3rd.
39 virtual inline void consume()
41 inputState->getInput().consume();
44 virtual inline int LA(unsigned int i)
46 return inputState->getInput().LA(i);
49 virtual inline RefToken LT(unsigned int i)
51 return inputState->getInput().LT(i);
54 /// the lookahead this LL(k) parser is using.
57 void trace(const char* ee, const char* rname);
59 virtual void traceIn(const char* rname);
60 virtual void traceOut(const char* rname);
63 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
67 #endif //INC_LLkParser_hpp__