diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.files | 7 | ||||
-rw-r--r-- | src/includes/nodeincludes.h | 1 | ||||
-rw-r--r-- | src/includes/nodeshandling.inc | 1 | ||||
-rw-r--r-- | src/includes/parserdefines.inc | 1 | ||||
-rw-r--r-- | src/nodes/base/vec.h | 35 | ||||
-rw-r--r-- | src/nodes/vec/tree_vec.h | 38 | ||||
-rw-r--r-- | src/parsers/base/vec.cpp | 33 | ||||
-rw-r--r-- | src/parsers/base/vec.h | 29 | ||||
-rw-r--r-- | src/parsers/vec/tree_vec.cpp | 46 |
9 files changed, 190 insertions, 1 deletions
diff --git a/src/Makefile.files b/src/Makefile.files index a522a6a..5061422 100644 --- a/src/Makefile.files +++ b/src/Makefile.files @@ -16,6 +16,7 @@ SRC = analysis/analysis.cpp \ nodes/base/ref.h \ nodes/base/stmt.h \ nodes/base/type.h \ + nodes/base/vec.h \ nodes/cst/integer_cst.h \ nodes/decl/function_decl.h \ nodes/decl/parm_decl.h \ @@ -42,6 +43,8 @@ SRC = analysis/analysis.cpp \ parsers/base/stmt.h \ parsers/base/type.cpp \ parsers/base/type.h \ + parsers/base/vec.cpp \ + parsers/base/vec.h \ parsers/cst/integer_cst.cpp \ parsers/decl/function_decl.cpp \ parsers/decl/parm_decl.cpp \ @@ -241,4 +244,6 @@ SRC = analysis/analysis.cpp \ nodes/decl/template_decl.h \ parsers/decl/template_decl.cpp \ nodes/expr/exactdiv_expr.h \ - parsers/expr/exactdiv_expr.cpp
\ No newline at end of file + parsers/expr/exactdiv_expr.cpp \ + nodes/vec/tree_vec.h \ + parsers/vec/tree_vec.cpp
\ No newline at end of file diff --git a/src/includes/nodeincludes.h b/src/includes/nodeincludes.h index f41b46b..f3247f6 100644 --- a/src/includes/nodeincludes.h +++ b/src/includes/nodeincludes.h @@ -100,3 +100,4 @@ #include "nodes/decl/const_decl.h" #include "nodes/decl/template_decl.h" #include "nodes/expr/exactdiv_expr.h" +#include "nodes/vec/tree_vec.h" diff --git a/src/includes/nodeshandling.inc b/src/includes/nodeshandling.inc index a5e50d9..ce8eb8f 100644 --- a/src/includes/nodeshandling.inc +++ b/src/includes/nodeshandling.inc @@ -99,3 +99,4 @@ handleNodeType(USING_DECL, UsingDecl) handleNodeType(CONST_DECL, ConstDecl) handleNodeType(TEMPLATE_DECL, TemplateDecl) handleNodeType(EXACT_DIV_EXPR, ExactDivExpr) +handleNodeType(TREE_VEC, TreeVec) diff --git a/src/includes/parserdefines.inc b/src/includes/parserdefines.inc index ef52fcd..aacb166 100644 --- a/src/includes/parserdefines.inc +++ b/src/includes/parserdefines.inc @@ -99,3 +99,4 @@ parserDefine(UsingDecl); parserDefine(ConstDecl); parserDefine(TemplateDecl); parserDefine(ExactDivExpr); +parserDefine(TreeVec); diff --git a/src/nodes/base/vec.h b/src/nodes/base/vec.h new file mode 100644 index 0000000..747a7fa --- /dev/null +++ b/src/nodes/base/vec.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2015 Andrei Karas + * + * This file is part of AstDumper. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef NODES_BASE_VECNODE_H +#define NODES_BASE_VECNODE_H + +#include "nodes/base/node.h" + +#include <vector> + +struct VecNode : public Node +{ + VecNode() : + Node() + { + } +}; + +#endif // NODES_BASE_VECNODE_H diff --git a/src/nodes/vec/tree_vec.h b/src/nodes/vec/tree_vec.h new file mode 100644 index 0000000..cba66cc --- /dev/null +++ b/src/nodes/vec/tree_vec.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2015 Andrei Karas + * + * This file is part of AstDumper. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef NODES_VEC_TREEVECNODE_H +#define NODES_VEC_TREEVECNODE_H + +#include "nodes/base/vec.h" + +#include <vector> + +struct TreeVecNode : public VecNode +{ + TreeVecNode() : + VecNode(), + args() + { + } + + std::vector<Node*> args; +}; + +#endif // NODES_VEC_TREEVECNODE_H diff --git a/src/parsers/base/vec.cpp b/src/parsers/base/vec.cpp new file mode 100644 index 0000000..3f297d5 --- /dev/null +++ b/src/parsers/base/vec.cpp @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2015 Andrei Karas + * + * This file is part of AstDumper. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "parsers/base/vec.h" + +#include "includes.h" + +#include "nodes/base/vec.h" + +#include "parsers/generic.h" + +#include "localconsts.h" + +namespace Generic +{ + +} diff --git a/src/parsers/base/vec.h b/src/parsers/base/vec.h new file mode 100644 index 0000000..35807c5 --- /dev/null +++ b/src/parsers/base/vec.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2015 Andrei Karas + * + * This file is part of AstDumper. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef PARSERS_BASE_VEC_H +#define PARSERS_BASE_VEC_H + +struct VecNode; + +namespace Generic +{ +} + +#endif // PARSERS_BASE_VEC_H diff --git a/src/parsers/vec/tree_vec.cpp b/src/parsers/vec/tree_vec.cpp new file mode 100644 index 0000000..548765e --- /dev/null +++ b/src/parsers/vec/tree_vec.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2015 Andrei Karas + * + * This file is part of AstDumper. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "includes/parserincludes.h" + +parserDefine(TreeVec); + +#include "parsers/base/vec.h" + +#include "nodes/vec/tree_vec.h" + +namespace Generic +{ + +void parseTreeVecNode(TreeVecNode *node) +{ + fillType(node); + Log::dump(node); + + const int sz = TREE_VEC_LENGTH(node->gccNode); + for (int f = 0; f < sz; f ++) + { + node->args.push_back(createParseNode( + node, + TREE_VEC_ELT (node->gccNode, f), + "element")); + } +} + +} |