| 1 |
tim |
770 |
/* 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: CommonAST.cpp,v 1.1 2005-12-02 15:38:02 tim Exp $ |
| 6 |
|
|
*/ |
| 7 |
|
|
#include <cstdlib> |
| 8 |
|
|
#include <iostream> |
| 9 |
|
|
|
| 10 |
|
|
#include "antlr/config.hpp" |
| 11 |
|
|
#include "antlr/CommonAST.hpp" |
| 12 |
|
|
#include "antlr/ANTLRUtil.hpp" |
| 13 |
|
|
|
| 14 |
|
|
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE |
| 15 |
|
|
namespace antlr { |
| 16 |
|
|
#endif |
| 17 |
|
|
|
| 18 |
|
|
const char* const CommonAST::TYPE_NAME = "CommonAST"; |
| 19 |
|
|
|
| 20 |
|
|
#ifdef ANTLR_SUPPORT_XML |
| 21 |
|
|
void CommonAST::initialize( ANTLR_USE_NAMESPACE(std)istream& in ) |
| 22 |
|
|
{ |
| 23 |
|
|
ANTLR_USE_NAMESPACE(std)string t1, t2, text; |
| 24 |
|
|
|
| 25 |
|
|
// text |
| 26 |
|
|
read_AttributeNValue( in, t1, text ); |
| 27 |
|
|
|
| 28 |
|
|
read_AttributeNValue( in, t1, t2 ); |
| 29 |
|
|
#ifdef ANTLR_ATOI_IN_STD |
| 30 |
|
|
int type = ANTLR_USE_NAMESPACE(std)atoi(t2.c_str()); |
| 31 |
|
|
#else |
| 32 |
|
|
int type = atoi(t2.c_str()); |
| 33 |
|
|
#endif |
| 34 |
|
|
|
| 35 |
|
|
// initialize first part of AST. |
| 36 |
|
|
this->initialize( type, text ); |
| 37 |
|
|
} |
| 38 |
|
|
#endif |
| 39 |
|
|
|
| 40 |
|
|
RefAST CommonAST::factory() |
| 41 |
|
|
{ |
| 42 |
|
|
return RefAST(new CommonAST); |
| 43 |
|
|
} |
| 44 |
|
|
|
| 45 |
|
|
#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE |
| 46 |
|
|
} |
| 47 |
|
|
#endif |
| 48 |
|
|
|