diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-12 19:34:48 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-12 19:34:48 +0300 |
commit | 09d1424e62b04bd75d90af78f49d08c9e366ddc8 (patch) | |
tree | 130d009471fb2f3d9279feb094965c9cf9a8969c /src | |
parent | 1457bb363f7c0bc80a04deff194a3d03978b501c (diff) | |
download | paranucker-09d1424e62b04bd75d90af78f49d08c9e366ddc8.tar.gz paranucker-09d1424e62b04bd75d90af78f49d08c9e366ddc8.tar.bz2 paranucker-09d1424e62b04bd75d90af78f49d08c9e366ddc8.tar.xz paranucker-09d1424e62b04bd75d90af78f49d08c9e366ddc8.zip |
Add parsing node VECTOR_CST.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.files | 4 | ||||
-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/cst/vector_cst.h | 40 | ||||
-rw-r--r-- | src/parsers/cst/vector_cst.cpp | 45 |
6 files changed, 91 insertions, 1 deletions
diff --git a/src/Makefile.files b/src/Makefile.files index bbc5246..558cc1f 100644 --- a/src/Makefile.files +++ b/src/Makefile.files @@ -134,4 +134,6 @@ SRC = analysis/analysis.cpp \ nodes/expr/viewconvert_expr.h \ parsers/expr/viewconvert_expr.cpp \ nodes/expr/nonlvalue_expr.h \ - parsers/expr/nonlvalue_expr.cpp
\ No newline at end of file + parsers/expr/nonlvalue_expr.cpp \ + nodes/cst/vector_cst.h \ + parsers/cst/vector_cst.cpp
\ No newline at end of file diff --git a/src/includes/nodeincludes.h b/src/includes/nodeincludes.h index 90eb14a..daa9f3b 100644 --- a/src/includes/nodeincludes.h +++ b/src/includes/nodeincludes.h @@ -48,3 +48,4 @@ #include "nodes/type/vector_type.h" #include "nodes/expr/viewconvert_expr.h" #include "nodes/expr/nonlvalue_expr.h" +#include "nodes/cst/vector_cst.h" diff --git a/src/includes/nodeshandling.inc b/src/includes/nodeshandling.inc index 4c9002e..fbd4fc2 100644 --- a/src/includes/nodeshandling.inc +++ b/src/includes/nodeshandling.inc @@ -47,3 +47,4 @@ handleNodeType(FIELD_DECL, FieldDecl) handleNodeType(VECTOR_TYPE, VectorType) handleNodeType(VIEW_CONVERT_EXPR, ViewConvertExpr) handleNodeType(NON_LVALUE_EXPR, NonLvalueExpr) +handleNodeType(VECTOR_CST, VectorCst) diff --git a/src/includes/parserdefines.inc b/src/includes/parserdefines.inc index f996798..067e5a5 100644 --- a/src/includes/parserdefines.inc +++ b/src/includes/parserdefines.inc @@ -47,3 +47,4 @@ parserDefine(FieldDecl); parserDefine(VectorType); parserDefine(ViewConvertExpr); parserDefine(NonLvalueExpr); +parserDefine(VectorCst); diff --git a/src/nodes/cst/vector_cst.h b/src/nodes/cst/vector_cst.h new file mode 100644 index 0000000..d33f9e5 --- /dev/null +++ b/src/nodes/cst/vector_cst.h @@ -0,0 +1,40 @@ +/* + * 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_CST_VECTORCSTNODE_H +#define NODES_CST_VECTORCSTNODE_H + +#include "nodes/base/cst.h" + +#include <vector> + +#include <string> + +struct VectorCstNode : public CstNode +{ + VectorCstNode() : + CstNode(), + args() + { + } + + std::vector<Node*> args; +}; + +#endif // NODES_CST_VECTORCSTNODE_H diff --git a/src/parsers/cst/vector_cst.cpp b/src/parsers/cst/vector_cst.cpp new file mode 100644 index 0000000..8d874a4 --- /dev/null +++ b/src/parsers/cst/vector_cst.cpp @@ -0,0 +1,45 @@ +/* + * 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(VectorCst); + + +#include "nodes/cst/vector_cst.h" + +namespace Generic +{ + +void parseVectorCstNode(VectorCstNode *node) +{ + fillType(node); + Log::dump(node); + + const int sz = VECTOR_CST_NELTS(node->gccNode); + for (int f = 0; f < sz; f ++) + { + node->args.push_back(createParseNode( + node, + VECTOR_CST_ELT(node->gccNode, f), + "element")); + } +} + +} |