summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am2
-rw-r--r--src/nodes/identifiernode.h35
-rw-r--r--src/parsers/generic.cpp4
-rw-r--r--src/parsers/identifier_node.cpp38
4 files changed, 79 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 2cd8616..6475cf4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,6 +5,7 @@ SRC = nodes/base/declnode.h \
nodes/base/typenode.h \
nodes/functiondeclnode.h \
nodes/functiontypenode.h \
+ nodes/identifiernode.h \
nodes/parmdeclnode.h \
nodes/resultdeclnode.h \
nodes/treelistnode.h \
@@ -14,6 +15,7 @@ SRC = nodes/base/declnode.h \
parsers/function_type.cpp \
parsers/generic.cpp \
parsers/generic.h \
+ parsers/identifier_node.cpp \
parsers/parserincludes.h \
parsers/result_decl.cpp \
parsers/tree_list.cpp \
diff --git a/src/nodes/identifiernode.h b/src/nodes/identifiernode.h
new file mode 100644
index 0000000..7d11951
--- /dev/null
+++ b/src/nodes/identifiernode.h
@@ -0,0 +1,35 @@
+/*
+ * 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_IDENTIFIERNODE_H
+#define NODES_IDENTIFIERNODE_H
+
+#include "nodes/base/node.h"
+
+#include <string>
+
+struct IdentifierNode : public Node
+{
+ IdentifierNode() :
+ Node()
+ {
+ }
+};
+
+#endif // NODES_IDENTIFIERNODE_H
diff --git a/src/parsers/generic.cpp b/src/parsers/generic.cpp
index 4028b80..184cd40 100644
--- a/src/parsers/generic.cpp
+++ b/src/parsers/generic.cpp
@@ -23,6 +23,7 @@
#include "nodes/functiontypenode.h"
#include "nodes/voidtypenode.h"
#include "nodes/typedeclnode.h"
+#include "nodes/identifiernode.h"
#include "parsers/parserincludes.h"
@@ -32,6 +33,7 @@ parserDefine(ResultDecl);
parserDefine(VoidType);
parserDefine(TypeDecl);
parserDefine(TreeList);
+parserDefine(Identifier);
#include "localconsts.h"
@@ -78,6 +80,7 @@ Node *createParseNode(Node *parent,
createNodeType(FUNCTION_TYPE, FunctionTypeNode);
createNodeType(VOID_TYPE, VoidTypeNode);
createNodeType(TREE_LIST, TreeListNode);
+ createNodeType(IDENTIFIER_NODE, IdentifierNode);
default:
Log::log(parent,
1,
@@ -111,6 +114,7 @@ Node *createParseNode(Node *parent,
parseNodeType(FUNCTION_TYPE, FunctionType);
parseNodeType(VOID_TYPE, VoidType);
parseNodeType(TREE_LIST, TreeList);
+ parseNodeType(IDENTIFIER_NODE, Identifier);
default:
break;
}
diff --git a/src/parsers/identifier_node.cpp b/src/parsers/identifier_node.cpp
new file mode 100644
index 0000000..bd20293
--- /dev/null
+++ b/src/parsers/identifier_node.cpp
@@ -0,0 +1,38 @@
+/*
+ * 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 "parsers/parserincludes.h"
+
+parserDefine(Identifier);
+
+#include "parsers/base/type.h"
+
+#include "nodes/identifiernode.h"
+
+namespace Generic
+{
+
+void parseIdentifierNode(IdentifierNode *node)
+{
+ fillType(node);
+ node->label = IDENTIFIER_POINTER(node->gccNode);
+ Log::log(node);
+}
+
+}