diff options
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/nodes/voidtypenode.h | 35 | ||||
-rw-r--r-- | src/parsers/generic.cpp | 16 | ||||
-rw-r--r-- | src/parsers/void_type.cpp | 44 | ||||
-rw-r--r-- | src/parsers/void_type.h | 32 |
5 files changed, 126 insertions, 4 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 58bd5ee..f784baa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,6 +8,7 @@ SRC = nodes/base/declnode.h \ nodes/parmdeclnode.h \ nodes/resultdeclnode.h \ nodes/treelistnode.h \ + nodes/voidtypenode.h \ parsers/function_decl.cpp \ parsers/function_decl.h \ parsers/function_type.cpp \ @@ -16,6 +17,8 @@ SRC = nodes/base/declnode.h \ parsers/generic.h \ parsers/result_decl.cpp \ parsers/result_decl.h \ + parsers/void_type.cpp \ + parsers/void_type.h \ parsers/base/decl.cpp \ parsers/base/decl.h \ parsers/base/type.cpp \ diff --git a/src/nodes/voidtypenode.h b/src/nodes/voidtypenode.h new file mode 100644 index 0000000..20ba48d --- /dev/null +++ b/src/nodes/voidtypenode.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_VOIDTYPENODE_H +#define NODES_VOIDTYPENODE_H + +#include "nodes/base/typenode.h" + +#include <string> + +struct VoidTypeNode : public TypeNode +{ + VoidTypeNode() : + TypeNode() + { + } +}; + +#endif // NODES_VOIDTYPENODE_H diff --git a/src/parsers/generic.cpp b/src/parsers/generic.cpp index 335c2ad..977321b 100644 --- a/src/parsers/generic.cpp +++ b/src/parsers/generic.cpp @@ -23,10 +23,12 @@ #include "nodes/functiondeclnode.h" #include "nodes/functiontypenode.h" +#include "nodes/voidtypenode.h" #include "parsers/function_decl.h" #include "parsers/function_type.h" #include "parsers/result_decl.h" +#include "parsers/void_type.h" #include "localconsts.h" @@ -59,11 +61,14 @@ Node *createParseNode(Node *parent, case FUNCTION_DECL: node = new FunctionDeclNode; break; + case RESULT_DECL: + node = new ResultDeclNode; + break; case FUNCTION_TYPE: node = new FunctionTypeNode; break; - case RESULT_DECL: - node = new ResultDeclNode; + case VOID_TYPE: + node = new VoidTypeNode; break; default: Log::log(parent, @@ -95,11 +100,14 @@ Node *createParseNode(Node *parent, case FUNCTION_DECL: parseFunctionDeclNode(static_cast<FunctionDeclNode*>(node)); break; + case RESULT_DECL: + parseResultDeclNode(static_cast<ResultDeclNode*>(node)); + break; case FUNCTION_TYPE: parseFunctionTypeNode(static_cast<FunctionTypeNode*>(node)); break; - case RESULT_DECL: - parseResultDeclNode(static_cast<ResultDeclNode*>(node)); + case VOID_TYPE: + parseVoidTypeNode(static_cast<VoidTypeNode*>(node)); break; default: break; diff --git a/src/parsers/void_type.cpp b/src/parsers/void_type.cpp new file mode 100644 index 0000000..5993202 --- /dev/null +++ b/src/parsers/void_type.cpp @@ -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/>. + */ + +#include "parsers/void_type.h" + +#include "logger.h" + +#include "parsers/generic.h" + +#include "parsers/base/type.h" + +#include "nodes/voidtypenode.h" + +#include "localconsts.h" + +namespace Generic +{ + +void parseVoidTypeNode(VoidTypeNode *node) +{ + fillType(node); + Log::log(node); + + fillTypeName(node); + fillTypeAttributes(node); +} + +} diff --git a/src/parsers/void_type.h b/src/parsers/void_type.h new file mode 100644 index 0000000..6212812 --- /dev/null +++ b/src/parsers/void_type.h @@ -0,0 +1,32 @@ +/* + * 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 PARSERS_VOID_TYPE_H +#define PARSERS_VOID_TYPE_H + +#include "includes.h" + +struct VoidTypeNode; + +namespace Generic +{ + void parseVoidTypeNode(VoidTypeNode *parent); +} + +#endif // PARSERS_VOID_TYPE_H |