source: trunk/yao/share/antlr-2.7.7/lib/cpp/antlr/LLkParser.hpp @ 1

Last change on this file since 1 was 1, checked in by lnalod, 15 years ago

Initial import of YAO sources

File size: 1.6 KB
Line 
1#ifndef INC_LLkParser_hpp__
2#define INC_LLkParser_hpp__
3
4/* ANTLR Translator Generator
5 * Project led by Terence Parr at http://www.jGuru.com
6 * Software rights: http://www.antlr.org/license.html
7 *
8 * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/LLkParser.hpp#2 $
9 */
10
11#include <antlr/config.hpp>
12#include <antlr/Parser.hpp>
13
14#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
15namespace antlr {
16#endif
17
18/**An LL(k) parser.
19 *
20 * @see antlr.Token
21 * @see antlr.TokenBuffer
22 * @see antlr.LL1Parser
23 */
24class ANTLR_API LLkParser : public Parser {
25public:
26        LLkParser(const ParserSharedInputState& lexer, int k_);
27
28        LLkParser(TokenBuffer& tokenBuf, int k_);
29
30        LLkParser(TokenStream& lexer, int k_);
31
32        /** Consume another token from the input stream.  Can only write sequentially!
33         * If you need 3 tokens ahead, you must consume() 3 times.
34         * <p>
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.
38         */
39        virtual inline void consume()
40        {
41                inputState->getInput().consume();
42        }
43
44        virtual inline int LA(unsigned int i)
45        {
46                return inputState->getInput().LA(i);
47        }
48
49        virtual inline RefToken LT(unsigned int i)
50        {
51                return inputState->getInput().LT(i);
52        }
53protected:
54        /// the lookahead this LL(k) parser is using.
55        int k;
56private:
57        void trace(const char* ee, const char* rname);
58public:
59        virtual void traceIn(const char* rname);
60        virtual void traceOut(const char* rname);
61};
62
63#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
64}
65#endif
66
67#endif //INC_LLkParser_hpp__
Note: See TracBrowser for help on using the repository browser.