LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cloner.hh
Go to the documentation of this file.
1 
6 #ifndef ASTCLONE_CLONER_HH
7 # define ASTCLONE_CLONER_HH
8 
9 # include <ast/default-visitor.hh>
10 
11 namespace astclone
12 {
13 
16  {
17  public:
19 
20  // Import overloaded virtual functions.
21  using super_type::operator();
22 
24  Cloner();
25 
27  virtual ~Cloner();
28 
29  // Return the cloned Ast.
31 
32  template <typename T>
33  T* recurse(const T& t);
34 
35  template <typename T>
36  T* recurse(const T* const t);
37 
47  template <typename CollectionType>
48  CollectionType* recurse_collection(const CollectionType& c);
49 
50 
51  // Visit methods.
52  public:
53  virtual void operator()(const ast::ArrayExp&) override;
54  virtual void operator()(const ast::ArrayTy&) override;
55  virtual void operator()(const ast::AssignExp&) override;
56  virtual void operator()(const ast::BreakExp&) override;
57  virtual void operator()(const ast::CallExp&) override;
58  virtual void operator()(const ast::CastExp&) override;
59  virtual void operator()(const ast::CastVar&) override;
60  virtual void operator()(const ast::ClassTy&) override;
61  virtual void operator()(const ast::DecsList&) override;
62  virtual void operator()(const ast::Field&) override;
63  virtual void operator()(const ast::FieldInit&) override;
64  virtual void operator()(const ast::FieldVar&) override;
65  virtual void operator()(const ast::ForExp&) override;
66  virtual void operator()(const ast::FunctionDec&) override;
67  virtual void operator()(const ast::IfExp&) override;
68  virtual void operator()(const ast::IntExp&) override;
69  virtual void operator()(const ast::LetExp&) override;
70  virtual void operator()(const ast::MethodCallExp&) override;
71  virtual void operator()(const ast::MethodDec&) override;
72  virtual void operator()(const ast::NameTy&) override;
73  virtual void operator()(const ast::NilExp&) override;
74  virtual void operator()(const ast::ObjectExp&) override;
75  virtual void operator()(const ast::OpExp&) override;
76  virtual void operator()(const ast::RecordExp&) override;
77  virtual void operator()(const ast::RecordTy&) override;
78  virtual void operator()(const ast::SeqExp&) override;
79  virtual void operator()(const ast::SimpleVar&) override;
80  virtual void operator()(const ast::StringExp&) override;
81  virtual void operator()(const ast::SubscriptVar&) override;
82  virtual void operator()(const ast::TypeDec&) override;
83  virtual void operator()(const ast::VarDec&) override;
84  virtual void operator()(const ast::WhileExp&) override;
85 
86  template <typename DecsType>
91  void decs_visit(const DecsType& e);
92 
93  // As we can't mix template and virtual methods, we have to
94  // duplicate these methods. That's too bad. :(
95  virtual void operator()(const ast::FunctionDecs&) override;
96  virtual void operator()(const ast::MethodDecs&) override;
97  virtual void operator()(const ast::TypeDecs&) override;
98  virtual void operator()(const ast::VarDecs&) override;
99 
100  protected:
103  };
104 
105 } // namespace ast
106 
107 # include <astclone/cloner.hxx>
108 
109 #endif // !ASTCLONE_CLONER_HH