diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-13 22:30:53 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-13 22:30:53 +0300 |
commit | 0f84327ef128f4990651d8385117a05e887ce29f (patch) | |
tree | fb00a375609d81dc82841cda69c914e30ed5d450 | |
parent | 412938c6bebd07afbd592ff7a9d75be7110af7c7 (diff) | |
download | paranucker-0f84327ef128f4990651d8385117a05e887ce29f.tar.gz paranucker-0f84327ef128f4990651d8385117a05e887ce29f.tar.bz2 paranucker-0f84327ef128f4990651d8385117a05e887ce29f.tar.xz paranucker-0f84327ef128f4990651d8385117a05e887ce29f.zip |
Add parsing node HANDLER.
-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/handler.h | 42 | ||||
-rw-r--r-- | src/parsers/handler.cpp | 48 |
6 files changed, 96 insertions, 1 deletions
diff --git a/src/Makefile.files b/src/Makefile.files index 31c3de5..9437936 100644 --- a/src/Makefile.files +++ b/src/Makefile.files @@ -250,4 +250,6 @@ SRC = analysis/analysis.cpp \ nodes/block/try_block.h \ parsers/block/try_block.cpp \ nodes/expr/cast_expr.h \ - parsers/expr/cast_expr.cpp
\ No newline at end of file + parsers/expr/cast_expr.cpp \ + nodes/handler.h \ + parsers/handler.cpp
\ No newline at end of file diff --git a/src/includes/nodeincludes.h b/src/includes/nodeincludes.h index 1f150c7..65a3cff 100644 --- a/src/includes/nodeincludes.h +++ b/src/includes/nodeincludes.h @@ -103,3 +103,4 @@ #include "nodes/vec/tree_vec.h" #include "nodes/block/try_block.h" #include "nodes/expr/cast_expr.h" +#include "nodes/handler.h" diff --git a/src/includes/nodeshandling.inc b/src/includes/nodeshandling.inc index 488fad7..3d8c552 100644 --- a/src/includes/nodeshandling.inc +++ b/src/includes/nodeshandling.inc @@ -102,3 +102,4 @@ handleNodeType(EXACT_DIV_EXPR, ExactDivExpr) handleNodeType(TREE_VEC, TreeVec) handleNodeType(TRY_BLOCK, TryBlock) handleNodeType(CAST_EXPR, CastExpr) +handleNodeType(HANDLER, Handler) diff --git a/src/includes/parserdefines.inc b/src/includes/parserdefines.inc index 74d5261..91a7da0 100644 --- a/src/includes/parserdefines.inc +++ b/src/includes/parserdefines.inc @@ -102,3 +102,4 @@ parserDefine(ExactDivExpr); parserDefine(TreeVec); parserDefine(TryBlock); parserDefine(CastExpr); +parserDefine(Handler); diff --git a/src/nodes/handler.h b/src/nodes/handler.h new file mode 100644 index 0000000..d512a4a --- /dev/null +++ b/src/nodes/handler.h @@ -0,0 +1,42 @@ +/* + * 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_HANDLERNODE_H +#define NODES_HANDLERNODE_H + +#include "nodes/base/node.h" + +#include <string> + +struct HandlerNode : public Node +{ + HandlerNode() : + Node(), + body(nullptr), + parms(nullptr), + type(nullptr) + { + } + + Node *body; + Node *parms; + Node *type; +}; + +#endif // NODES_HANDLERNODE_H diff --git a/src/parsers/handler.cpp b/src/parsers/handler.cpp new file mode 100644 index 0000000..f1c62a6 --- /dev/null +++ b/src/parsers/handler.cpp @@ -0,0 +1,48 @@ +/* + * 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(Handler); + +#include "nodes/handler.h" + +namespace Generic +{ + +void parseHandlerNode(HandlerNode *node) +{ + fillType(node); + Log::dump(node); + + node->type = createParseNode( + node, + HANDLER_TYPE(node->gccNode), + "type"); + node->parms = createParseNode( + node, + HANDLER_PARMS(node->gccNode), + "parms"); + node->body = createParseNode( + node, + HANDLER_BODY(node->gccNode), + "body"); +} + +} |