summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-06-13 19:37:25 +0300
committerAndrei Karas <akaras@inbox.ru>2015-06-13 19:37:25 +0300
commitabc66b0f06ed9bc11b8f643f18fcf976765c751b (patch)
treeccc3186e1db23f06ffee0eeb39b192d63f5c7a07
parent469c62758e704aa293cbe24d0781524268c5bc07 (diff)
downloadparanucker-abc66b0f06ed9bc11b8f643f18fcf976765c751b.tar.gz
paranucker-abc66b0f06ed9bc11b8f643f18fcf976765c751b.tar.bz2
paranucker-abc66b0f06ed9bc11b8f643f18fcf976765c751b.tar.xz
paranucker-abc66b0f06ed9bc11b8f643f18fcf976765c751b.zip
Add parsing node CONST_DECL.
-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/decl/const_decl.h40
-rw-r--r--src/parsers/decl/const_decl.cpp50
6 files changed, 96 insertions, 1 deletions
diff --git a/src/Makefile.files b/src/Makefile.files
index 297e96c..8625cb2 100644
--- a/src/Makefile.files
+++ b/src/Makefile.files
@@ -235,4 +235,6 @@ SRC = analysis/analysis.cpp \
nodes/decl/label_decl.h \
parsers/decl/label_decl.cpp \
nodes/decl/using_decl.h \
- parsers/decl/using_decl.cpp \ No newline at end of file
+ parsers/decl/using_decl.cpp \
+ nodes/decl/const_decl.h \
+ parsers/decl/const_decl.cpp \ No newline at end of file
diff --git a/src/includes/nodeincludes.h b/src/includes/nodeincludes.h
index 3d566f2..1904773 100644
--- a/src/includes/nodeincludes.h
+++ b/src/includes/nodeincludes.h
@@ -97,3 +97,4 @@
#include "nodes/expr/compound_expr.h"
#include "nodes/decl/label_decl.h"
#include "nodes/decl/using_decl.h"
+#include "nodes/decl/const_decl.h"
diff --git a/src/includes/nodeshandling.inc b/src/includes/nodeshandling.inc
index 915cae8..32d910b 100644
--- a/src/includes/nodeshandling.inc
+++ b/src/includes/nodeshandling.inc
@@ -96,3 +96,4 @@ handleNodeType(BREAK_STMT, BreakStmt)
handleNodeType(COMPOUND_EXPR, CompoundExpr)
handleNodeType(LABEL_DECL, LabelDecl)
handleNodeType(USING_DECL, UsingDecl)
+handleNodeType(CONST_DECL, ConstDecl)
diff --git a/src/includes/parserdefines.inc b/src/includes/parserdefines.inc
index c3c4762..204c43e 100644
--- a/src/includes/parserdefines.inc
+++ b/src/includes/parserdefines.inc
@@ -96,3 +96,4 @@ parserDefine(BreakStmt);
parserDefine(CompoundExpr);
parserDefine(LabelDecl);
parserDefine(UsingDecl);
+parserDefine(ConstDecl);
diff --git a/src/nodes/decl/const_decl.h b/src/nodes/decl/const_decl.h
new file mode 100644
index 0000000..89b6530
--- /dev/null
+++ b/src/nodes/decl/const_decl.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_DECL_CONSTDECLNODE_H
+#define NODES_DECL_CONSTDECLNODE_H
+
+#include "nodes/base/decl.h"
+
+#include "nodes/cst/integer_cst.h"
+
+#include <string>
+
+struct ConstDeclNode : public DeclNode
+{
+ ConstDeclNode() :
+ DeclNode(),
+ initial(nullptr)
+ {
+ }
+
+ IntegerCstNode *initial;
+};
+
+#endif // NODES_DECL_CONSTDECLNODE_H
diff --git a/src/parsers/decl/const_decl.cpp b/src/parsers/decl/const_decl.cpp
new file mode 100644
index 0000000..2a2e1d2
--- /dev/null
+++ b/src/parsers/decl/const_decl.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(ConstDecl);
+
+#include "parsers/base/decl.h"
+
+#include "nodes/decl/const_decl.h"
+
+#include "nodes/cst/integer_cst.h"
+
+namespace Generic
+{
+
+void parseConstDeclNode(ConstDeclNode *node)
+{
+ fillType(node);
+ fillLocation(node);
+ fillDeclLabel(node);
+ Log::dump(node);
+
+ fillDeclAutoGenerated(node);
+ fillDeclAttributes(node);
+
+ node->initial = static_cast<IntegerCstNode*>(createParseNode(
+ node,
+ DECL_INITIAL(node->gccNode),
+ INTEGER_CST,
+ "initial"));
+}
+
+}