OpenMD 3.0
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
CommonToken.hpp
1#ifndef INC_CommonToken_hpp__
2#define INC_CommonToken_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/Token.hpp>
13#include <string>
14
15#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
16namespace antlr {
17#endif
18
19class ANTLR_API CommonToken : public Token {
20public:
22 CommonToken(int t, const ANTLR_USE_NAMESPACE(std)string& txt);
23 CommonToken(const ANTLR_USE_NAMESPACE(std)string& s);
24
25 /// return contents of token
26 virtual ANTLR_USE_NAMESPACE(std)string getText() const
27 {
28 return text;
29 }
30
31 /// set contents of token
32 virtual void setText(const ANTLR_USE_NAMESPACE(std)string& s)
33 {
34 text = s;
35 }
36
37 /** get the line the token is at (starting at 1)
38 * @see CharScanner::newline()
39 * @see CharScanner::tab()
40 */
41 virtual int getLine() const
42 {
43 return line;
44 }
45 /** gt the column the token is at (starting at 1)
46 * @see CharScanner::newline()
47 * @see CharScanner::tab()
48 */
49 virtual int getColumn() const
50 {
51 return col;
52 }
53
54 /// set line for token
55 virtual void setLine(int l)
56 {
57 line = l;
58 }
59 /// set column for token
60 virtual void setColumn(int c)
61 {
62 col = c;
63 }
64
65 virtual ANTLR_USE_NAMESPACE(std)string toString() const;
66 static RefToken factory();
67
68protected:
69 // most tokens will want line and text information
70 int line;
71 int col;
72 ANTLR_USE_NAMESPACE(std)string text;
73
74private:
76 const CommonToken& operator=(const CommonToken&);
77};
78
79#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
80}
81#endif
82
83#endif //INC_CommonToken_hpp__
virtual int getColumn() const
gt the column the token is at (starting at 1)
virtual void setText(const std ::string &s)
set contents of token
virtual int getLine() const
get the line the token is at (starting at 1)
virtual void setColumn(int c)
set column for token
virtual std::string getText() const
return contents of token
virtual void setLine(int l)
set line for token
A token is minimally a token type.
Definition Token.hpp:25