diff options
Diffstat (limited to 'c_parser/include/ast_function.hpp')
-rw-r--r-- | c_parser/include/ast_function.hpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/c_parser/include/ast_function.hpp b/c_parser/include/ast_function.hpp new file mode 100644 index 0000000..60a1670 --- /dev/null +++ b/c_parser/include/ast_function.hpp @@ -0,0 +1,31 @@ +#ifndef AST_FUNCTION_HPP +#define AST_FUNCTION_HPP + +#include "ast.hpp" + +#include <string> +#include <iostream> + +class ast_Function : public ast_Base { +private: + std::string name; + mutable std::vector<const ast_Base*> param_list; +public: + ast_Function(const std::string& _name) : name(_name) {} + ast_Function(const ast_Base* param) { + param_list.push_back(param); + } + + virtual void print() const { + std::cout << "<Function id=\"" << name << "\">" << std::endl; + for(size_t i = 0; i < param_list.size(); ++i) { + param_list[i]->print(); + } + } + + virtual void push(const ast_Base* var) const { + param_list.push_back(var); + } +}; + +#endif |