diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-08 00:45:24 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-08 00:45:24 +0300 |
commit | aa2cbe702aa13f01f61c67b7468ad757dceae36d (patch) | |
tree | 8a5b5b23156800e463ccdf0e54cdde1cb7be485a /src | |
parent | 79b225e167bb46a1c6788c54fa17463fab7b1b06 (diff) | |
download | paranucker-aa2cbe702aa13f01f61c67b7468ad757dceae36d.tar.gz paranucker-aa2cbe702aa13f01f61c67b7468ad757dceae36d.tar.bz2 paranucker-aa2cbe702aa13f01f61c67b7468ad757dceae36d.tar.xz paranucker-aa2cbe702aa13f01f61c67b7468ad757dceae36d.zip |
Add parsing node EXPR_STMT.
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/stmt/expr_stmt.h | 40 | ||||
-rw-r--r-- | src/parsers/stmt/expr_stmt.cpp | 46 |
6 files changed, 92 insertions, 1 deletions
diff --git a/src/Makefile.files b/src/Makefile.files index 643c1fa..8896fb0 100644 --- a/src/Makefile.files +++ b/src/Makefile.files @@ -64,4 +64,6 @@ SRC = nodes/base/cst.h \ nodes/decl/var_decl.h \ parsers/decl/var_decl.cpp \ nodes/blocknode.h \ - parsers/blocknode.cpp
\ No newline at end of file + parsers/blocknode.cpp \ + nodes/stmt/expr_stmt.h \ + parsers/stmt/expr_stmt.cpp
\ No newline at end of file diff --git a/src/includes/nodeincludes.h b/src/includes/nodeincludes.h index 890d570..138d684 100644 --- a/src/includes/nodeincludes.h +++ b/src/includes/nodeincludes.h @@ -19,3 +19,4 @@ #include "nodes/expr/cleanuppoint_expr.h" #include "nodes/decl/var_decl.h" #include "nodes/blocknode.h" +#include "nodes/stmt/expr_stmt.h" diff --git a/src/includes/nodeshandling.inc b/src/includes/nodeshandling.inc index bdda88f..edfd14b 100644 --- a/src/includes/nodeshandling.inc +++ b/src/includes/nodeshandling.inc @@ -18,3 +18,4 @@ handleNodeType(CONVERT_EXPR, ConvertExpr) handleNodeType(CLEANUP_POINT_EXPR, CleanupPointExpr) handleNodeType(VAR_DECL, VarDecl) handleNodeType(BLOCK, Block) +handleNodeType(EXPR_STMT, ExprStmt) diff --git a/src/includes/parserdefines.inc b/src/includes/parserdefines.inc index 70b37c5..0bbca9c 100644 --- a/src/includes/parserdefines.inc +++ b/src/includes/parserdefines.inc @@ -18,3 +18,4 @@ parserDefine(ConvertExpr); parserDefine(CleanupPointExpr); parserDefine(VarDecl); parserDefine(Block); +parserDefine(ExprStmt); diff --git a/src/nodes/stmt/expr_stmt.h b/src/nodes/stmt/expr_stmt.h new file mode 100644 index 0000000..fb9600f --- /dev/null +++ b/src/nodes/stmt/expr_stmt.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_STMT_EXPRSTMTNODE_H +#define NODES_STMT_EXPRSTMTNODE_H + +#include "nodes/base/stmt.h" + +#include <string> + +struct ExprNode; + +struct ExprStmtNode : public StmtNode +{ + ExprStmtNode() : + StmtNode(), + expression(nullptr) + { + } + + ExprNode *expression; +}; + +#endif // NODES_STMT_EXPRSTMTNODE_H diff --git a/src/parsers/stmt/expr_stmt.cpp b/src/parsers/stmt/expr_stmt.cpp new file mode 100644 index 0000000..c243a91 --- /dev/null +++ b/src/parsers/stmt/expr_stmt.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(ExprStmt); + +#include "parsers/base/stmt.h" + +#include "nodes/base/expr.h" + +#include "nodes/stmt/expr_stmt.h" + +#include "cp/cp-tree.h" + +namespace Generic +{ + +void parseExprStmtNode(ExprStmtNode *node) +{ + fillType(node); + Log::log(node); + + node->expression = static_cast<ExprNode*>(createParseNode( + node, + EXPR_STMT_EXPR(node->gccNode), + "expresssion")); +} + +} |