diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-16 23:51:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-16 23:51:04 +0300 |
commit | 8d8ef94e9595488fa1b2fdfcce75ef7f74aa0dca (patch) | |
tree | fbf122997b4cf3eeb3b8a0c0b28f762600e2ef50 | |
parent | c30dfff60882585eb2c6e6a3ec2a316209a247cb (diff) | |
download | paranucker-8d8ef94e9595488fa1b2fdfcce75ef7f74aa0dca.tar.gz paranucker-8d8ef94e9595488fa1b2fdfcce75ef7f74aa0dca.tar.bz2 paranucker-8d8ef94e9595488fa1b2fdfcce75ef7f74aa0dca.tar.xz paranucker-8d8ef94e9595488fa1b2fdfcce75ef7f74aa0dca.zip |
Add parsing node SWITCH_STMT.
-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/switch_stmt.h | 44 | ||||
-rw-r--r-- | src/parsers/stmt/switch_stmt.cpp | 59 |
6 files changed, 109 insertions, 1 deletions
diff --git a/src/Makefile.files b/src/Makefile.files index 272e3f4..9c69a23 100644 --- a/src/Makefile.files +++ b/src/Makefile.files @@ -296,4 +296,6 @@ SRC = analysis/analysis.cpp \ nodes/expr/staticcast_expr.h \ parsers/expr/staticcast_expr.cpp \ nodes/expr/switch_expr.h \ - parsers/expr/switch_expr.cpp
\ No newline at end of file + parsers/expr/switch_expr.cpp \ + nodes/stmt/switch_stmt.h \ + parsers/stmt/switch_stmt.cpp
\ No newline at end of file diff --git a/src/includes/nodeincludes.h b/src/includes/nodeincludes.h index 5a7b85e..8ef6c56 100644 --- a/src/includes/nodeincludes.h +++ b/src/includes/nodeincludes.h @@ -126,3 +126,4 @@ #include "nodes/ref/scope_ref.h" #include "nodes/expr/staticcast_expr.h" #include "nodes/expr/switch_expr.h" +#include "nodes/stmt/switch_stmt.h" diff --git a/src/includes/nodeshandling.inc b/src/includes/nodeshandling.inc index f51af23..da960bc 100644 --- a/src/includes/nodeshandling.inc +++ b/src/includes/nodeshandling.inc @@ -125,3 +125,4 @@ handleNodeType(RROTATE_EXPR, RRotateExpr) handleNodeType(SCOPE_REF, ScopeRef) handleNodeType(STATIC_CAST_EXPR, StaticCastExpr) handleNodeType(SWITCH_EXPR, SwitchExpr) +handleNodeType(SWITCH_STMT, SwitchStmt) diff --git a/src/includes/parserdefines.inc b/src/includes/parserdefines.inc index 52994af..e9b98b4 100644 --- a/src/includes/parserdefines.inc +++ b/src/includes/parserdefines.inc @@ -125,3 +125,4 @@ parserDefine(RRotateExpr); parserDefine(ScopeRef); parserDefine(StaticCastExpr); parserDefine(SwitchExpr); +parserDefine(SwitchStmt); diff --git a/src/nodes/stmt/switch_stmt.h b/src/nodes/stmt/switch_stmt.h new file mode 100644 index 0000000..a53c554 --- /dev/null +++ b/src/nodes/stmt/switch_stmt.h @@ -0,0 +1,44 @@ +/* + * 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_SWITCHSTMTNODE_H +#define NODES_STMT_SWITCHSTMTNODE_H + +#include "nodes/base/stmt.h" + +#include <string> + +struct SwitchStmtNode : public StmtNode +{ + SwitchStmtNode() : + StmtNode(), + body(nullptr), + condition(nullptr), + scope(nullptr), + type(nullptr) + { + } + + Node *body; + Node *condition; + Node *scope; + Node *type; +}; + +#endif // NODES_STMT_SWITCHSTMTNODE_H diff --git a/src/parsers/stmt/switch_stmt.cpp b/src/parsers/stmt/switch_stmt.cpp new file mode 100644 index 0000000..5fc1464 --- /dev/null +++ b/src/parsers/stmt/switch_stmt.cpp @@ -0,0 +1,59 @@ +/* + * 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(SwitchStmt); + +#include "parsers/base/expr.h" +#include "parsers/base/stmt.h" + +#include "nodes/stmt/switch_stmt.h" + +namespace Generic +{ + +void parseSwitchStmtNode(SwitchStmtNode *node) +{ + fillType(node); + fillExprLocation(node); + Log::dump(node); + + node->condition = createParseNode( + node, + SWITCH_STMT_COND(node->gccNode), + "condition"); + + node->body = createParseNode( + node, + SWITCH_STMT_BODY(node->gccNode), + "body"); + + node->type = createParseNode( + node, + SWITCH_STMT_TYPE(node->gccNode), + "type"); + + node->scope = createParseNode( + node, + SWITCH_STMT_SCOPE(node->gccNode), + "scope"); +} + +} |