aboutsummaryrefslogtreecommitdiffstats
path: root/c_parser/include/ast_statement.hpp
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-02-17 15:44:24 +0000
committerYann Herklotz <ymherklotz@gmail.com>2017-02-17 15:44:24 +0000
commitb81f60d8b523260526af15361d4ce0ac4a7757c8 (patch)
treef2e779a6ed0f0879875e5a0482f2dfcafeaffef3 /c_parser/include/ast_statement.hpp
parent419384dbd0efced3af6c10ccfc2eee4ff6ca22c7 (diff)
downloadCompiler-b81f60d8b523260526af15361d4ce0ac4a7757c8.tar.gz
Compiler-b81f60d8b523260526af15361d4ce0ac4a7757c8.zip
Finished functions for now
Diffstat (limited to 'c_parser/include/ast_statement.hpp')
-rw-r--r--c_parser/include/ast_statement.hpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/c_parser/include/ast_statement.hpp b/c_parser/include/ast_statement.hpp
new file mode 100644
index 0000000..725308b
--- /dev/null
+++ b/c_parser/include/ast_statement.hpp
@@ -0,0 +1,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