aboutsummaryrefslogtreecommitdiffstats
path: root/c_parser/include/ast_function.hpp
blob: 60a1670cfae9f2a724587231e38b45bb56521d92 (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
#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