blob: 725308bf88e9e037de1c854c41990f460f2bd7ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#ifndef AST_STATEMENT_HPP
#define AST_STATEMENT_HPP
class ast_Statement : public ast_Base {
protected:
mutable std::vector<const ast_Base*> ast_list;
public:
ast_Statement(const ast_Base* _el) {
ast_list.push_back(_el);
}
virtual void print() const {
for(size_t i = 0; i < ast_list.size(); ++i) {
ast_list[i]->print();
}
}
virtual void push(const ast_Base* _var) const {
ast_list.push_back(_var);
}
};
class ast_CompoundStatement : public ast_Statement {
public:
ast_CompoundStatement(const ast_Base* _el) : ast_Statement(_el) {}
virtual void print() const override {
std::cout << "<Scope>" << std::endl;
for(size_t i = 0; i < ast_list.size(); ++i) {
ast_list[i]->print();
}
std::cout << "</Scope>" << std::endl;
}
};
#endif
|