1 |
/* ANTLR Translator Generator |
2 |
* Project led by Terence Parr at http://www.jGuru.com |
3 |
* Software rights: http://www.antlr.org/license.html |
4 |
* |
5 |
* $Id$ |
6 |
*/ |
7 |
#include "antlr/config.hpp" |
8 |
|
9 |
#include <cstdlib> |
10 |
#include <iostream> |
11 |
|
12 |
#include "antlr/CommonAST.hpp" |
13 |
#include "antlr/ANTLRUtil.hpp" |
14 |
|
15 |
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE |
16 |
namespace antlr { |
17 |
#endif |
18 |
|
19 |
const char* const CommonAST::TYPE_NAME = "CommonAST"; |
20 |
|
21 |
#ifdef ANTLR_SUPPORT_XML |
22 |
void CommonAST::initialize( ANTLR_USE_NAMESPACE(std)istream& in ) |
23 |
{ |
24 |
ANTLR_USE_NAMESPACE(std)string t1, t2, text; |
25 |
|
26 |
// text |
27 |
read_AttributeNValue( in, t1, text ); |
28 |
|
29 |
read_AttributeNValue( in, t1, t2 ); |
30 |
#ifdef ANTLR_ATOI_IN_STD |
31 |
int type = ANTLR_USE_NAMESPACE(std)atoi(t2.c_str()); |
32 |
#else |
33 |
int type = atoi(t2.c_str()); |
34 |
#endif |
35 |
|
36 |
// initialize first part of AST. |
37 |
this->initialize( type, text ); |
38 |
} |
39 |
#endif |
40 |
|
41 |
RefAST CommonAST::factory() |
42 |
{ |
43 |
return RefAST(new CommonAST); |
44 |
} |
45 |
|
46 |
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE |
47 |
} |
48 |
#endif |
49 |
|