aboutsummaryrefslogtreecommitdiffstats
path: root/c_compiler/include/declaration.hpp
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-03-02 23:22:51 +0000
committerYann Herklotz <ymherklotz@gmail.com>2017-03-02 23:22:51 +0000
commit446c2394ec8970198d645bbbb462c67b9e3f1b1e (patch)
treefc85d32c2b68efa80910d0a4ce4c1bed78ec4717 /c_compiler/include/declaration.hpp
parent34d69709e621b9609833a3d6bae31195b425f2f8 (diff)
downloadCompiler-446c2394ec8970198d645bbbb462c67b9e3f1b1e.tar.gz
Compiler-446c2394ec8970198d645bbbb462c67b9e3f1b1e.zip
Changing ast structure again
Diffstat (limited to 'c_compiler/include/declaration.hpp')
-rw-r--r--c_compiler/include/declaration.hpp43
1 files changed, 8 insertions, 35 deletions
diff --git a/c_compiler/include/declaration.hpp b/c_compiler/include/declaration.hpp
index bfd3070..bf72f2d 100644
--- a/c_compiler/include/declaration.hpp
+++ b/c_compiler/include/declaration.hpp
@@ -3,48 +3,21 @@
#include "ast.hpp"
-#include <vector>
-
// Declaration that holds a list of declarations
-class DeclarationList : public Base {
-private:
- mutable std::vector<const Base*> dec_list;
-
+class Declaration : public BaseNode {
public:
- DeclarationList(const Base* _dec) {
- dec_list.push_back(_dec);
- }
-
- virtual void print() const {
- for(size_t i = 0; i < dec_list.size(); ++i) {
- dec_list[i]->print();
- }
- }
-
- virtual void push(const Base* _dec) const {
- dec_list.push_back(_dec);
- }
+ Declaration(const Base* _var) : BaseNode(_var) {}
};
-class VariableDeclaration : public Base {
-private:
- mutable std::vector<const Base*> var_list;
-
+class DeclarationList : public BaseList {
public:
- VariableDeclaration(const Base* _var) {
- var_list.push_back(_var);
- }
-
- virtual void print() const {
- for(size_t i = 0; i < var_list.size(); ++i) {
- var_list[i]->print();
- }
- }
+ DeclarationList(const Base* _var) : BaseList(_var) {}
+};
- virtual void push(const Base* _var) const {
- var_list.push_back(_var);
- }
+class InitDeclaratorList : public BaseList {
+public:
+ InitDeclaratorList(const Base* _var) : BaseList(_var) {}
};
#endif