blob: 091d7b6ee13214bef08ced3645a5d6edeabdaa4f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
#ifndef INC_CommonAST_hpp__
#define INC_CommonAST_hpp__
/* ANTLR Translator Generator
* Project led by Terence Parr at http://www.jGuru.com
* Software rights: http://www.antlr.org/license.html
*
* $Id$
*/
#include <antlr/config.hpp>
#include <antlr/BaseAST.hpp>
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
namespace antlr {
#endif
class ANTLR_API CommonAST : public BaseAST {
public:
CommonAST()
: BaseAST()
, ttype( Token::INVALID_TYPE )
, text()
{
}
CommonAST( RefToken t )
: BaseAST()
, ttype( t->getType() )
, text( t->getText() )
{
}
CommonAST( const CommonAST& other )
: BaseAST(other)
, ttype(other.ttype)
, text(other.text)
{
}
virtual ~CommonAST()
{
}
virtual const char* typeName( void ) const
{
return CommonAST::TYPE_NAME;
}
/// Clone this AST node.
virtual RefAST clone( void ) const
{
CommonAST *ast = new CommonAST( *this );
return RefAST(ast);
}
virtual ANTLR_USE_NAMESPACE(std)string getText() const
{
return text;
}
virtual int getType() const
{
return ttype;
}
virtual void initialize( int t, const ANTLR_USE_NAMESPACE(std)string& txt )
{
setType(t);
setText(txt);
}
virtual void initialize( RefAST t )
{
setType(t->getType());
setText(t->getText());
}
virtual void initialize( RefToken t )
{
setType(t->getType());
setText(t->getText());
}
#ifdef ANTLR_SUPPORT_XML
virtual void initialize( ANTLR_USE_NAMESPACE(std)istream& in );
#endif
virtual void setText( const ANTLR_USE_NAMESPACE(std)string& txt )
{
text = txt;
}
virtual void setType( int type )
{
ttype = type;
}
static RefAST factory();
static const char* const TYPE_NAME;
protected:
int ttype;
ANTLR_USE_NAMESPACE(std)string text;
};
typedef ASTRefCount<CommonAST> RefCommonAST;
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
}
#endif
#endif //INC_CommonAST_hpp__
|