summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-06-13 21:57:45 +0300
committerAndrei Karas <akaras@inbox.ru>2015-06-13 21:57:45 +0300
commit20e220fe8580eb692a9b1e50406e4765db775f98 (patch)
treebea1a5ed149bb72e60cdc140560fd98e961dfe30
parentb97b0b653af25997c85bbd0651e09d02a84620ef (diff)
downloadparanucker-20e220fe8580eb692a9b1e50406e4765db775f98.tar.gz
paranucker-20e220fe8580eb692a9b1e50406e4765db775f98.tar.bz2
paranucker-20e220fe8580eb692a9b1e50406e4765db775f98.tar.xz
paranucker-20e220fe8580eb692a9b1e50406e4765db775f98.zip
Add parsing node TRY_BLOCK.
-rw-r--r--src/Makefile.files4
-rw-r--r--src/includes/nodeincludes.h1
-rw-r--r--src/includes/nodeshandling.inc1
-rw-r--r--src/includes/parserdefines.inc1
-rw-r--r--src/nodes/block/try_block.h42
-rw-r--r--src/parsers/block/try_block.cpp50
6 files changed, 98 insertions, 1 deletions
diff --git a/src/Makefile.files b/src/Makefile.files
index 5061422..93cbb73 100644
--- a/src/Makefile.files
+++ b/src/Makefile.files
@@ -246,4 +246,6 @@ SRC = analysis/analysis.cpp \
nodes/expr/exactdiv_expr.h \
parsers/expr/exactdiv_expr.cpp \
nodes/vec/tree_vec.h \
- parsers/vec/tree_vec.cpp \ No newline at end of file
+ parsers/vec/tree_vec.cpp \
+ nodes/block/try_block.h \
+ parsers/block/try_block.cpp \ No newline at end of file
diff --git a/src/includes/nodeincludes.h b/src/includes/nodeincludes.h
index f3247f6..be8c5b2 100644
--- a/src/includes/nodeincludes.h
+++ b/src/includes/nodeincludes.h
@@ -101,3 +101,4 @@
#include "nodes/decl/template_decl.h"
#include "nodes/expr/exactdiv_expr.h"
#include "nodes/vec/tree_vec.h"
+#include "nodes/block/try_block.h"
diff --git a/src/includes/nodeshandling.inc b/src/includes/nodeshandling.inc
index ce8eb8f..e4a769d 100644
--- a/src/includes/nodeshandling.inc
+++ b/src/includes/nodeshandling.inc
@@ -100,3 +100,4 @@ handleNodeType(CONST_DECL, ConstDecl)
handleNodeType(TEMPLATE_DECL, TemplateDecl)
handleNodeType(EXACT_DIV_EXPR, ExactDivExpr)
handleNodeType(TREE_VEC, TreeVec)
+handleNodeType(TRY_BLOCK, TryBlock)
diff --git a/src/includes/parserdefines.inc b/src/includes/parserdefines.inc
index aacb166..fd44758 100644
--- a/src/includes/parserdefines.inc
+++ b/src/includes/parserdefines.inc
@@ -100,3 +100,4 @@ parserDefine(ConstDecl);
parserDefine(TemplateDecl);
parserDefine(ExactDivExpr);
parserDefine(TreeVec);
+parserDefine(TryBlock);
diff --git a/src/nodes/block/try_block.h b/src/nodes/block/try_block.h
new file mode 100644
index 0000000..74a200f
--- /dev/null
+++ b/src/nodes/block/try_block.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_BLOCK_TRYBLOCKNODE_H
+#define NODES_BLOCK_TRYBLOCKNODE_H
+
+#include "nodes/base/expr.h"
+
+#include <string>
+
+struct TryBlockNode : public ExprNode
+{
+ TryBlockNode() :
+ ExprNode(),
+ body(nullptr),
+ handler(nullptr),
+ isClean(false)
+ {
+ }
+
+ Node *body;
+ Node *handler;
+ bool isClean;
+};
+
+#endif // NODES_BLOCK_TRYBLOCKNODE_H
diff --git a/src/parsers/block/try_block.cpp b/src/parsers/block/try_block.cpp
new file mode 100644
index 0000000..a46d232
--- /dev/null
+++ b/src/parsers/block/try_block.cpp
@@ -0,0 +1,50 @@
+/*
+ * 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(TryBlock);
+
+#include "parsers/base/expr.h"
+
+#include "nodes/block/try_block.h"
+
+namespace Generic
+{
+
+void parseTryBlockNode(TryBlockNode *node)
+{
+ fillType(node);
+ fillExprLocation(node);
+ Log::dump(node);
+
+ setPrintField(node, CLEANUP_P, isClean);
+
+ node->body = createParseNode(
+ node,
+ TRY_STMTS(node->gccNode),
+ "body");
+
+ node->handler = createParseNode(
+ node,
+ TRY_HANDLERS(node->gccNode),
+ "handler");
+}
+
+}