1 #ifndef INC_CommonToken_hpp__
2 #define INC_CommonToken_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/CommonToken.hpp#2 $
11 #include <antlr/config.hpp>
12 #include <antlr/Token.hpp>
15 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
19 class ANTLR_API CommonToken : public Token {
22 CommonToken(int t, const ANTLR_USE_NAMESPACE(std)string& txt);
23 CommonToken(const ANTLR_USE_NAMESPACE(std)string& s);
25 /// return contents of token
26 virtual ANTLR_USE_NAMESPACE(std)string getText() const
31 /// set contents of token
32 virtual void setText(const ANTLR_USE_NAMESPACE(std)string& s)
37 /** get the line the token is at (starting at 1)
38 * @see CharScanner::newline()
39 * @see CharScanner::tab()
41 virtual int getLine() const
45 /** gt the column the token is at (starting at 1)
46 * @see CharScanner::newline()
47 * @see CharScanner::tab()
49 virtual int getColumn() const
54 /// set line for token
55 virtual void setLine(int l)
59 /// set column for token
60 virtual void setColumn(int c)
65 virtual ANTLR_USE_NAMESPACE(std)string toString() const;
66 static RefToken factory();
69 // most tokens will want line and text information
72 ANTLR_USE_NAMESPACE(std)string text;
75 CommonToken(const CommonToken&);
76 const CommonToken& operator=(const CommonToken&);
79 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
83 #endif //INC_CommonToken_hpp__