diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-08 02:00:13 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-08 02:00:13 +0300 |
commit | 9888396cfc4a731dbe61a1c2b4dd6ad8584ee9a8 (patch) | |
tree | 664e07b8e3db4cbd131d4fd9fcae941852f29f4c /src | |
parent | f294d00453f3c66b283ea169da78b144d0d0b9dd (diff) | |
download | paranucker-9888396cfc4a731dbe61a1c2b4dd6ad8584ee9a8.tar.gz paranucker-9888396cfc4a731dbe61a1c2b4dd6ad8584ee9a8.tar.bz2 paranucker-9888396cfc4a731dbe61a1c2b4dd6ad8584ee9a8.tar.xz paranucker-9888396cfc4a731dbe61a1c2b4dd6ad8584ee9a8.zip |
Add parsing node WHILE_STMT.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.files | 4 | ||||
-rw-r--r-- | src/includes.h | 2 | ||||
-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/while_stmt.h | 40 | ||||
-rw-r--r-- | src/parsers/decl/var_decl.cpp | 2 | ||||
-rw-r--r-- | src/parsers/stmt/expr_stmt.cpp | 2 | ||||
-rw-r--r-- | src/parsers/stmt/if_stmt.cpp | 2 | ||||
-rw-r--r-- | src/parsers/stmt/while_stmt.cpp | 47 |
10 files changed, 95 insertions, 7 deletions
diff --git a/src/Makefile.files b/src/Makefile.files index 9c56328..eb71264 100644 --- a/src/Makefile.files +++ b/src/Makefile.files @@ -68,4 +68,6 @@ SRC = nodes/base/cst.h \ nodes/stmt/expr_stmt.h \ parsers/stmt/expr_stmt.cpp \ nodes/stmt/if_stmt.h \ - parsers/stmt/if_stmt.cpp
\ No newline at end of file + parsers/stmt/if_stmt.cpp \ + nodes/stmt/while_stmt.h \ + parsers/stmt/while_stmt.cpp
\ No newline at end of file diff --git a/src/includes.h b/src/includes.h index 6499aad..90cd1ca 100644 --- a/src/includes.h +++ b/src/includes.h @@ -41,4 +41,6 @@ #include "tree.h" #include "print-tree.h" +#include "cp/cp-tree.h" + #endif // PLUGIN_H diff --git a/src/includes/nodeincludes.h b/src/includes/nodeincludes.h index 7d5d0ba..72c4c8c 100644 --- a/src/includes/nodeincludes.h +++ b/src/includes/nodeincludes.h @@ -21,3 +21,4 @@ #include "nodes/blocknode.h" #include "nodes/stmt/expr_stmt.h" #include "nodes/stmt/if_stmt.h" +#include "nodes/stmt/while_stmt.h" diff --git a/src/includes/nodeshandling.inc b/src/includes/nodeshandling.inc index 94291cb..c301c9e 100644 --- a/src/includes/nodeshandling.inc +++ b/src/includes/nodeshandling.inc @@ -20,3 +20,4 @@ handleNodeType(VAR_DECL, VarDecl) handleNodeType(BLOCK, Block) handleNodeType(EXPR_STMT, ExprStmt) handleNodeType(IF_STMT, IfStmt) +handleNodeType(WHILE_STMT, WhileStmt) diff --git a/src/includes/parserdefines.inc b/src/includes/parserdefines.inc index 4cf250d..5494244 100644 --- a/src/includes/parserdefines.inc +++ b/src/includes/parserdefines.inc @@ -20,3 +20,4 @@ parserDefine(VarDecl); parserDefine(Block); parserDefine(ExprStmt); parserDefine(IfStmt); +parserDefine(WhileStmt); diff --git a/src/nodes/stmt/while_stmt.h b/src/nodes/stmt/while_stmt.h new file mode 100644 index 0000000..e86069a --- /dev/null +++ b/src/nodes/stmt/while_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_WHILESTMTNODE_H +#define NODES_STMT_WHILESTMTNODE_H + +#include "nodes/base/stmt.h" + +#include <string> + +struct WhileStmtNode : public StmtNode +{ + WhileStmtNode() : + StmtNode(), + condition(nullptr), + body(nullptr) + { + } + + Node *condition; + Node *body; +}; + +#endif // NODES_STMT_WHILESTMTNODE_H diff --git a/src/parsers/decl/var_decl.cpp b/src/parsers/decl/var_decl.cpp index 47408a9..ca1318a 100644 --- a/src/parsers/decl/var_decl.cpp +++ b/src/parsers/decl/var_decl.cpp @@ -25,8 +25,6 @@ parserDefine(VarDecl); #include "nodes/decl/var_decl.h" -#include "cp/cp-tree.h" - namespace Generic { diff --git a/src/parsers/stmt/expr_stmt.cpp b/src/parsers/stmt/expr_stmt.cpp index c243a91..a3104c8 100644 --- a/src/parsers/stmt/expr_stmt.cpp +++ b/src/parsers/stmt/expr_stmt.cpp @@ -27,8 +27,6 @@ parserDefine(ExprStmt); #include "nodes/stmt/expr_stmt.h" -#include "cp/cp-tree.h" - namespace Generic { diff --git a/src/parsers/stmt/if_stmt.cpp b/src/parsers/stmt/if_stmt.cpp index aa4f3a6..b342f1b 100644 --- a/src/parsers/stmt/if_stmt.cpp +++ b/src/parsers/stmt/if_stmt.cpp @@ -25,8 +25,6 @@ parserDefine(IfStmt); #include "nodes/stmt/if_stmt.h" -#include "cp/cp-tree.h" - namespace Generic { diff --git a/src/parsers/stmt/while_stmt.cpp b/src/parsers/stmt/while_stmt.cpp new file mode 100644 index 0000000..782b2c4 --- /dev/null +++ b/src/parsers/stmt/while_stmt.cpp @@ -0,0 +1,47 @@ +/* + * 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(WhileStmt); + +#include "parsers/base/stmt.h" + +#include "nodes/stmt/while_stmt.h" + +namespace Generic +{ + +void parseWhileStmtNode(WhileStmtNode *node) +{ + fillType(node); + Log::log(node); + + node->condition = createParseNode( + node, + WHILE_COND(node->gccNode), + "condition"); + + node->body = createParseNode( + node, + WHILE_BODY(node->gccNode), + "body"); +} + +} |