1 /**
2 * <b>SOFTWARE RIGHTS</b>
3 * <p>
4 * ANTLR 2.6.0 MageLang Insitute, 1998
5 * <p>
6 * We reserve no legal rights to the ANTLR--it is fully in the
7 * public domain. An individual or company may do whatever
8 * they wish with source code distributed with ANTLR or the
9 * code generated by ANTLR, including the incorporation of
10 * ANTLR, or its output, into commerical software.
11 * <p>
12 * We encourage users to develop software with ANTLR. However,
13 * we do ask that credit is given to us for developing
14 * ANTLR. By "credit", we mean that if you use ANTLR or
15 * incorporate any source code into one of your programs
16 * (commercial product, research project, or otherwise) that
17 * you acknowledge this fact somewhere in the documentation,
18 * research report, etc... If you like ANTLR and have
19 * developed a nice tool with the output, please mention that
20 * you developed it using ANTLR. In addition, we ask that the
21 * headers remain intact in our source code. As long as these
22 * guidelines are kept, we expect to continue enhancing this
23 * system and expect to make other tools available as they are
24 * completed.
25 * <p>
26 * The ANTLR gang:
27 * @version ANTLR 2.6.0 MageLang Insitute, 1998
28 * @author Terence Parr, <a href=http://www.MageLang.com>MageLang Institute</a>
29 * @author <br>John Lilley, <a href=http://www.Empathy.com>Empathy Software</a>
30 * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a>
31 */
32
33 #include "antlr/Token.hpp"
34 #include "antlr/String.hpp"
35
36 ANTLR_BEGIN_NAMESPACE(xparam_antlr)
37
38 RefToken Token::badToken(new Token(Token::INVALID_TYPE, "<no text>"));
39
Token()40 Token::Token() : type(INVALID_TYPE)
41 {
42 }
43
Token(int t)44 Token::Token(int t) : type(t)
45 {
46 }
47
Token(int t,const ANTLR_USE_NAMESPACE (std)string & txt)48 Token::Token(int t, const ANTLR_USE_NAMESPACE(std)string& txt)
49 : type(t)
50 {
51 type=t;
52 setText(txt);
53 }
54
getColumn() const55 int Token::getColumn() const
56 {
57 return 0;
58 }
59
getLine() const60 int Token::getLine() const
61 {
62 return 0;
63 }
64
ANTLR_USE_NAMESPACE(std)65 ANTLR_USE_NAMESPACE(std)string Token::getText() const
66 {
67 return "<no text>";
68 }
69
getType() const70 int Token::getType() const
71 {
72 return type;
73 }
74
setColumn(int c)75 void Token::setColumn(int c)
76 {}
77
setLine(int l)78 void Token::setLine(int l)
79 {}
80
setText(const ANTLR_USE_NAMESPACE (std)string & t)81 void Token::setText(const ANTLR_USE_NAMESPACE(std)string& t)
82 {}
83
setType(int t)84 void Token::setType(int t)
85 {
86 type=t;
87 }
88
ANTLR_USE_NAMESPACE(std)89 ANTLR_USE_NAMESPACE(std)string Token::toString() const
90 {
91 return "[\""+getText()+"\",<"+type+">]";
92 }
93
~Token()94 Token::~Token()
95 {}
96
97 RefToken nullToken;
98
99 #ifndef NO_STATIC_CONSTS
100 const int Token::MIN_USER_TYPE;
101 const int Token::NULL_TREE_LOOKAHEAD;
102 const int Token::INVALID_TYPE;
103 const int Token::EOF_TYPE;
104 const int Token::SKIP;
105 #endif
106
107 ANTLR_END_NAMESPACE
108
109