1 #ifndef INC_CommonAST_hpp__
2 #define INC_CommonAST_hpp__
4 /* ANTLR Translator Generator
5 * Project led by Terence Parr at http://www.jGuru.com
6 * Software rights: http://www.antlr.org/license.html
8 * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/CommonAST.hpp#2 $
11 #include <antlr/config.hpp>
12 #include <antlr/BaseAST.hpp>
14 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
18 class ANTLR_API CommonAST : public BaseAST {
22 , ttype( Token::INVALID_TYPE )
27 CommonAST( RefToken t )
29 , ttype( t->getType() )
30 , text( t->getText() )
34 CommonAST( const CommonAST& other )
45 virtual const char* typeName( void ) const
47 return CommonAST::TYPE_NAME;
50 /// Clone this AST node.
51 virtual RefAST clone( void ) const
53 CommonAST *ast = new CommonAST( *this );
57 virtual ANTLR_USE_NAMESPACE(std)string getText() const
61 virtual int getType() const
66 virtual void initialize( int t, const ANTLR_USE_NAMESPACE(std)string& txt )
72 virtual void initialize( RefAST t )
74 setType(t->getType());
75 setText(t->getText());
77 virtual void initialize( RefToken t )
79 setType(t->getType());
80 setText(t->getText());
83 #ifdef ANTLR_SUPPORT_XML
84 virtual void initialize( ANTLR_USE_NAMESPACE(std)istream& in );
87 virtual void setText( const ANTLR_USE_NAMESPACE(std)string& txt )
91 virtual void setType( int type )
96 static RefAST factory();
98 static const char* const TYPE_NAME;
101 ANTLR_USE_NAMESPACE(std)string text;
104 typedef ASTRefCount<CommonAST> RefCommonAST;
106 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
110 #endif //INC_CommonAST_hpp__