From 1802437f63e14c1128918c4e3a00f60fb97182d9 Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Sun, 19 Feb 2017 13:59:24 +0000 Subject: FInished parser but still have one shift/reduce warning --- c_parser/include/ast_statement.hpp | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'c_parser/include/ast_statement.hpp') diff --git a/c_parser/include/ast_statement.hpp b/c_parser/include/ast_statement.hpp index e9864e9..224a809 100644 --- a/c_parser/include/ast_statement.hpp +++ b/c_parser/include/ast_statement.hpp @@ -77,4 +77,46 @@ public: } }; +class ast_ExpressionStatement : public ast_Statement { +public: + ast_ExpressionStatement() : ast_Statement() {} + ast_ExpressionStatement(const ast_Base* _el) : ast_Statement(_el) {} + ast_ExpressionStatement(const ast_Base* _if, const ast_Base* _else) : + ast_Statement(_if, _else) {} + + virtual void print() const override { + for(size_t i = 0; i < ast_list.size(); ++i) { + ast_list[i]->print(); + } + } +}; + +class ast_JumpStatement : public ast_Statement { +public: + ast_JumpStatement() : ast_Statement() {} + ast_JumpStatement(const ast_Base* _el) : ast_Statement(_el) {} + ast_JumpStatement(const ast_Base* _if, const ast_Base* _else) : + ast_Statement(_if, _else) {} + + virtual void print() const override { + for(size_t i = 0; i < ast_list.size(); ++i) { + ast_list[i]->print(); + } + } +}; + +class ast_IterationStatement : public ast_Statement { +public: + ast_IterationStatement() : ast_Statement() {} + ast_IterationStatement(const ast_Base* _el) : ast_Statement(_el) {} + ast_IterationStatement(const ast_Base* _if, const ast_Base* _else) : + ast_Statement(_if, _else) {} + + virtual void print() const override { + for(size_t i = 0; i < ast_list.size(); ++i) { + ast_list[i]->print(); + } + } +}; + #endif -- cgit