1 /* ANTLR Translator Generator
2 * Project led by Terence Parr at http://www.jGuru.com
3 * Software rights: http://www.antlr.org/license.html
5 * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/CommonASTWithHiddenTokens.cpp#2 $
7 #include "antlr/config.hpp"
8 #include "antlr/AST.hpp"
9 #include "antlr/BaseAST.hpp"
10 #include "antlr/CommonAST.hpp"
11 #include "antlr/CommonASTWithHiddenTokens.hpp"
12 #include "antlr/CommonHiddenStreamToken.hpp"
14 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
18 const char* const CommonASTWithHiddenTokens::TYPE_NAME
= "CommonASTWithHiddenTokens";
19 // RK: Do not put constructor and destructor into the header file here..
20 // this triggers something very obscure in gcc 2.95.3 (and 3.0)
21 // missing vtables and stuff.
22 // Although this may be a problem with with binutils.
23 CommonASTWithHiddenTokens::CommonASTWithHiddenTokens()
28 CommonASTWithHiddenTokens::~CommonASTWithHiddenTokens()
32 void CommonASTWithHiddenTokens::initialize(int t
,const ANTLR_USE_NAMESPACE(std
)string
& txt
)
34 CommonAST::initialize(t
,txt
);
37 void CommonASTWithHiddenTokens::initialize(RefAST t
)
39 CommonAST::initialize(t
);
40 hiddenBefore
= RefCommonASTWithHiddenTokens(t
)->getHiddenBefore();
41 hiddenAfter
= RefCommonASTWithHiddenTokens(t
)->getHiddenAfter();
44 void CommonASTWithHiddenTokens::initialize(RefToken t
)
46 CommonAST::initialize(t
);
47 hiddenBefore
= static_cast<CommonHiddenStreamToken
*>(t
.get())->getHiddenBefore();
48 hiddenAfter
= static_cast<CommonHiddenStreamToken
*>(t
.get())->getHiddenAfter();
51 RefAST
CommonASTWithHiddenTokens::factory()
53 return RefAST(new CommonASTWithHiddenTokens
);
56 RefAST
CommonASTWithHiddenTokens::clone( void ) const
58 CommonASTWithHiddenTokens
*ast
= new CommonASTWithHiddenTokens( *this );
62 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE