OpenMD 3.1
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
CommonASTWithHiddenTokens.cpp
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#include "antlr/AST.hpp"
9#include "antlr/BaseAST.hpp"
10#include "antlr/CommonAST.hpp"
11#include "antlr/CommonASTWithHiddenTokens.hpp"
12#include "antlr/CommonHiddenStreamToken.hpp"
13
14#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
15namespace antlr {
16#endif
17
18const 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.
23CommonASTWithHiddenTokens::CommonASTWithHiddenTokens()
24: CommonAST()
25{
26}
27
28CommonASTWithHiddenTokens::~CommonASTWithHiddenTokens()
29{
30}
31
32void CommonASTWithHiddenTokens::initialize(int t,const ANTLR_USE_NAMESPACE(std)string& txt)
33{
34 CommonAST::initialize(t,txt);
35}
36
37void CommonASTWithHiddenTokens::initialize(RefAST t)
38{
39 CommonAST::initialize(t);
40 hiddenBefore = RefCommonASTWithHiddenTokens(t)->getHiddenBefore();
41 hiddenAfter = RefCommonASTWithHiddenTokens(t)->getHiddenAfter();
42}
43
44void CommonASTWithHiddenTokens::initialize(RefToken t)
45{
46 CommonAST::initialize(t);
47 hiddenBefore = static_cast<CommonHiddenStreamToken*>(t.get())->getHiddenBefore();
48 hiddenAfter = static_cast<CommonHiddenStreamToken*>(t.get())->getHiddenAfter();
49}
50
51RefAST CommonASTWithHiddenTokens::factory()
52{
53 return RefAST(new CommonASTWithHiddenTokens);
54}
55
56RefAST CommonASTWithHiddenTokens::clone( void ) const
57{
59 return RefAST(ast);
60}
61
62#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
63}
64#endif
A CommonAST whose initialization copies hidden token information from the Token used to create a node...