OpenMD 3.0
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
TokenWithIndex.hpp
1#ifndef INC_TokenWithIndex_hpp__
2#define INC_TokenWithIndex_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$
9 */
10
11#include <antlr/config.hpp>
12#include <antlr/CommonToken.hpp>
13#include <antlr/String.hpp>
14
15#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
16namespace antlr {
17#endif
18
19class ANTLR_API TokenWithIndex : public ANTLR_USE_NAMESPACE(antlr)CommonToken {
20public:
21 // static size_t count;
22 TokenWithIndex() : CommonToken(), index(0)
23 {
24 // std::cout << __PRETTY_FUNCTION__ << std::endl;
25 // count++;
26 }
27 TokenWithIndex(int t, const ANTLR_USE_NAMESPACE(std)string& txt)
28 : CommonToken(t,txt)
29 , index(0)
30 {
31 // std::cout << __PRETTY_FUNCTION__ << std::endl;
32 // count++;
33 }
34 TokenWithIndex(const ANTLR_USE_NAMESPACE(std)string& s)
35 : CommonToken(s)
36 , index(0)
37 {
38 // std::cout << __PRETTY_FUNCTION__ << std::endl;
39 // count++;
40 }
42 {
43 // count--;
44 }
45 void setIndex( size_t idx )
46 {
47 index = idx;
48 }
49 size_t getIndex( void ) const
50 {
51 return index;
52 }
53
54 ANTLR_USE_NAMESPACE(std)string toString() const
55 {
56 return ANTLR_USE_NAMESPACE(std)string("[")+
57 index+
58 ":\""+
59 getText()+"\",<"+
60 getType()+">,line="+
61 getLine()+",column="+
62 getColumn()+"]";
63 }
64
65 static RefToken factory()
66 {
67 return RefToken(new TokenWithIndex());
68 }
69
70protected:
71 size_t index;
72
73private:
75 const TokenWithIndex& operator=(const TokenWithIndex&);
76};
77
78typedef TokenRefCount<TokenWithIndex> RefTokenWithIndex;
79
80#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
81}
82#endif
83
84#endif //INC_CommonToken_hpp__