diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch) | |
tree | acaf47eb0fa12142d3896416a69e74cbf5a72242 /lib/antlr/antlr/LLkParser.hpp | |
download | tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/antlr/antlr/LLkParser.hpp')
-rw-r--r-- | lib/antlr/antlr/LLkParser.hpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/lib/antlr/antlr/LLkParser.hpp b/lib/antlr/antlr/LLkParser.hpp new file mode 100644 index 00000000..32acd3dd --- /dev/null +++ b/lib/antlr/antlr/LLkParser.hpp @@ -0,0 +1,67 @@ +#ifndef INC_LLkParser_hpp__ +#define INC_LLkParser_hpp__ + +/* ANTLR Translator Generator + * Project led by Terence Parr at http://www.jGuru.com + * Software rights: http://www.antlr.org/license.html + * + * $Id$ + */ + +#include <antlr/config.hpp> +#include <antlr/Parser.hpp> + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +namespace antlr { +#endif + +/**An LL(k) parser. + * + * @see antlr.Token + * @see antlr.TokenBuffer + * @see antlr.LL1Parser + */ +class ANTLR_API LLkParser : public Parser { +public: + LLkParser(const ParserSharedInputState& lexer, int k_); + + LLkParser(TokenBuffer& tokenBuf, int k_); + + LLkParser(TokenStream& lexer, int k_); + + /** Consume another token from the input stream. Can only write sequentially! + * If you need 3 tokens ahead, you must consume() 3 times. + * <p> + * 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. + */ + virtual inline void consume() + { + inputState->getInput().consume(); + } + + virtual inline int LA(unsigned int i) + { + return inputState->getInput().LA(i); + } + + virtual inline RefToken LT(unsigned int i) + { + return inputState->getInput().LT(i); + } +protected: + /// the lookahead this LL(k) parser is using. + int k; +private: + void trace(const char* ee, const char* rname); +public: + virtual void traceIn(const char* rname); + virtual void traceOut(const char* rname); +}; + +#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE +} +#endif + +#endif //INC_LLkParser_hpp__ |