1 #ifndef INC_TokenWithIndex_hpp__
2 #define INC_TokenWithIndex_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
11 #include <antlr/config.hpp>
12 #include <antlr/CommonToken.hpp>
13 #include <antlr/String.hpp>
15 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
19 class ANTLR_API TokenWithIndex : public ANTLR_USE_NAMESPACE(antlr)CommonToken {
21 // static size_t count;
22 TokenWithIndex() : CommonToken(), index(0)
24 // std::cout << __PRETTY_FUNCTION__ << std::endl;
27 TokenWithIndex(int t, const ANTLR_USE_NAMESPACE(std)string& txt)
31 // std::cout << __PRETTY_FUNCTION__ << std::endl;
34 TokenWithIndex(const ANTLR_USE_NAMESPACE(std)string& s)
38 // std::cout << __PRETTY_FUNCTION__ << std::endl;
45 void setIndex( size_t idx )
49 size_t getIndex( void ) const
54 ANTLR_USE_NAMESPACE(std)string toString() const
56 return ANTLR_USE_NAMESPACE(std)string("[")+
65 static RefToken factory()
67 return RefToken(new TokenWithIndex());
74 TokenWithIndex(const TokenWithIndex&);
75 const TokenWithIndex& operator=(const TokenWithIndex&);
78 typedef TokenRefCount<TokenWithIndex> RefTokenWithIndex;
80 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
84 #endif //INC_CommonToken_hpp__