From d1996ffb82390b0480438318bf377eb16353fc5a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 4 Jun 2015 16:25:41 +0300 Subject: Move base nodes into base directory. --- src/Makefile.am | 6 ++--- src/logger.cpp | 2 +- src/nodes/base/declnode.h | 40 ++++++++++++++++++++++++++++ src/nodes/base/node.h | 63 ++++++++++++++++++++++++++++++++++++++++++++ src/nodes/base/typenode.h | 41 ++++++++++++++++++++++++++++ src/nodes/declnode.h | 40 ---------------------------- src/nodes/functiondeclnode.h | 3 ++- src/nodes/functiontypenode.h | 3 ++- src/nodes/node.h | 63 -------------------------------------------- src/nodes/parmdeclnode.h | 2 +- src/nodes/resultdeclnode.h | 2 +- src/nodes/treelistnode.h | 2 +- src/nodes/typenode.h | 41 ---------------------------- src/parsers/base/decl.cpp | 2 +- src/parsers/base/type.cpp | 2 +- src/parsers/result_decl.cpp | 3 ++- 16 files changed, 159 insertions(+), 156 deletions(-) create mode 100644 src/nodes/base/declnode.h create mode 100644 src/nodes/base/node.h create mode 100644 src/nodes/base/typenode.h delete mode 100644 src/nodes/declnode.h delete mode 100644 src/nodes/node.h delete mode 100644 src/nodes/typenode.h (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 0061b3a..58bd5ee 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,13 +1,13 @@ AUTOMAKE_OPTIONS = subdir-objects -SRC = nodes/declnode.h \ +SRC = nodes/base/declnode.h \ + nodes/base/node.h \ + nodes/base/typenode.h \ nodes/functiondeclnode.h \ nodes/functiontypenode.h \ - nodes/node.h \ nodes/parmdeclnode.h \ nodes/resultdeclnode.h \ nodes/treelistnode.h \ - nodes/typenode.h \ parsers/function_decl.cpp \ parsers/function_decl.h \ parsers/function_type.cpp \ diff --git a/src/logger.cpp b/src/logger.cpp index b3465a5..1933fb4 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -19,7 +19,7 @@ #include "logger.h" -#include "nodes/node.h" +#include "nodes/base/node.h" #include "localconsts.h" diff --git a/src/nodes/base/declnode.h b/src/nodes/base/declnode.h new file mode 100644 index 0000000..f7c7f8c --- /dev/null +++ b/src/nodes/base/declnode.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 . + */ + +#ifndef NODES_BASE_DECLNODE_H +#define NODES_BASE_DECLNODE_H + +#include "nodes/base/node.h" + +#include + +struct DeclNode : public Node +{ + DeclNode() : + Node(), + attribute(nullptr), + isAutoGenerated(false) + { + } + + Node *attribute; + bool isAutoGenerated; +}; + +#endif // NODES_BASE_DECLNODE_H diff --git a/src/nodes/base/node.h b/src/nodes/base/node.h new file mode 100644 index 0000000..51aa4ed --- /dev/null +++ b/src/nodes/base/node.h @@ -0,0 +1,63 @@ +/* + * 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 . + */ + +#ifndef NODES_BASE_NODE_H +#define NODES_BASE_NODE_H + +#include "includes.h" + +#include + +struct Node +{ + Node() : + parent(nullptr), + nodeType(), + label(), + file(), + tag(), + gccNode(nullptr), + line(-1), + column(-1), + treeNumber(0), + indent(0) + { + } + + std::string getIndent() const + { + std::string str; + for (int f = 0; f < indent; f ++) + str.append(" "); + return str; + } + + Node *parent; + std::string nodeType; + std::string label; + std::string file; + std::string tag; + tree gccNode; + int line; + int column; + int treeNumber; + int indent; +}; + +#endif // NODES_BASE_NODE_H diff --git a/src/nodes/base/typenode.h b/src/nodes/base/typenode.h new file mode 100644 index 0000000..265407b --- /dev/null +++ b/src/nodes/base/typenode.h @@ -0,0 +1,41 @@ +/* + * 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 . + */ + +#ifndef NODES_BASE_TYPENODE_H +#define NODES_BASE_TYPENODE_H + +#include "nodes/base/declnode.h" +#include "nodes/base/node.h" + +#include + +struct TypeNode : public Node +{ + TypeNode() : + Node(), + attribute(nullptr), + typeName(nullptr) + { + } + + Node *attribute; + DeclNode *typeName; +}; + +#endif // NODES_BASE_TYPENODE_H diff --git a/src/nodes/declnode.h b/src/nodes/declnode.h deleted file mode 100644 index 840caef..0000000 --- a/src/nodes/declnode.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 . - */ - -#ifndef NODES_DECLNODE_H -#define NODES_DECLNODE_H - -#include "nodes/node.h" - -#include - -struct DeclNode : public Node -{ - DeclNode() : - Node(), - attribute(nullptr), - isAutoGenerated(false) - { - } - - Node *attribute; - bool isAutoGenerated; -}; - -#endif // NODES_DECLNODE_H diff --git a/src/nodes/functiondeclnode.h b/src/nodes/functiondeclnode.h index 2154218..0800e1f 100644 --- a/src/nodes/functiondeclnode.h +++ b/src/nodes/functiondeclnode.h @@ -20,11 +20,12 @@ #ifndef NODES_FUNCTIONDECLNODE_H #define NODES_FUNCTIONDECLNODE_H -#include "nodes/declnode.h" #include "nodes/functiontypenode.h" #include "nodes/parmdeclnode.h" #include "nodes/resultdeclnode.h" +#include "nodes/base/declnode.h" + #include #include diff --git a/src/nodes/functiontypenode.h b/src/nodes/functiontypenode.h index d33eb48..48886bb 100644 --- a/src/nodes/functiontypenode.h +++ b/src/nodes/functiontypenode.h @@ -21,7 +21,8 @@ #define NODES_FUNCTIONTYPENODE_H #include "nodes/treelistnode.h" -#include "nodes/typenode.h" + +#include "nodes/base/typenode.h" #include diff --git a/src/nodes/node.h b/src/nodes/node.h deleted file mode 100644 index e405a4d..0000000 --- a/src/nodes/node.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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 . - */ - -#ifndef NODES_NODE_H -#define NODES_NODE_H - -#include "includes.h" - -#include - -struct Node -{ - Node() : - parent(nullptr), - nodeType(), - label(), - file(), - tag(), - gccNode(nullptr), - line(-1), - column(-1), - treeNumber(0), - indent(0) - { - } - - std::string getIndent() const - { - std::string str; - for (int f = 0; f < indent; f ++) - str.append(" "); - return str; - } - - Node *parent; - std::string nodeType; - std::string label; - std::string file; - std::string tag; - tree gccNode; - int line; - int column; - int treeNumber; - int indent; -}; - -#endif // NODES_NODE_H diff --git a/src/nodes/parmdeclnode.h b/src/nodes/parmdeclnode.h index e61b057..c7188c5 100644 --- a/src/nodes/parmdeclnode.h +++ b/src/nodes/parmdeclnode.h @@ -20,7 +20,7 @@ #ifndef NODES_PARMDECLNODE_H #define NODES_PARMDECLNODE_H -#include "nodes/node.h" +#include "nodes/base/node.h" #include diff --git a/src/nodes/resultdeclnode.h b/src/nodes/resultdeclnode.h index 7605208..b30de96 100644 --- a/src/nodes/resultdeclnode.h +++ b/src/nodes/resultdeclnode.h @@ -20,7 +20,7 @@ #ifndef NODES_RESULTDECLNODE_H #define NODES_RESULTDECLNODE_H -#include "nodes/declnode.h" +#include "nodes/base/declnode.h" #include diff --git a/src/nodes/treelistnode.h b/src/nodes/treelistnode.h index c24479d..3d6bfd0 100644 --- a/src/nodes/treelistnode.h +++ b/src/nodes/treelistnode.h @@ -20,7 +20,7 @@ #ifndef NODES_TREELISTNODE_H #define NODES_TREELISTNODE_H -#include "nodes/node.h" +#include "nodes/base/node.h" #include diff --git a/src/nodes/typenode.h b/src/nodes/typenode.h deleted file mode 100644 index 174fe06..0000000 --- a/src/nodes/typenode.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 . - */ - -#ifndef NODES_TYPENODE_H -#define NODES_TYPENODE_H - -#include "nodes/declnode.h" -#include "nodes/node.h" - -#include - -struct TypeNode : public Node -{ - TypeNode() : - Node(), - attribute(nullptr), - typeName(nullptr) - { - } - - Node *attribute; - DeclNode *typeName; -}; - -#endif // NODES_TYPENODE_H diff --git a/src/parsers/base/decl.cpp b/src/parsers/base/decl.cpp index 3b3e6b3..23a253f 100644 --- a/src/parsers/base/decl.cpp +++ b/src/parsers/base/decl.cpp @@ -22,7 +22,7 @@ #include "includes.h" #include "logger.h" -#include "nodes/declnode.h" +#include "nodes/base/declnode.h" #include "parsers/generic.h" diff --git a/src/parsers/base/type.cpp b/src/parsers/base/type.cpp index 147c98e..80300f1 100644 --- a/src/parsers/base/type.cpp +++ b/src/parsers/base/type.cpp @@ -22,7 +22,7 @@ #include "includes.h" #include "logger.h" -#include "nodes/typenode.h" +#include "nodes/base/typenode.h" #include "parsers/generic.h" diff --git a/src/parsers/result_decl.cpp b/src/parsers/result_decl.cpp index b17796e..82ad0e8 100644 --- a/src/parsers/result_decl.cpp +++ b/src/parsers/result_decl.cpp @@ -26,7 +26,8 @@ #include "parsers/base/decl.h" #include "nodes/resultdeclnode.h" -#include "nodes/typenode.h" + +#include "nodes/base/typenode.h" #include "localconsts.h" -- cgit v1.2.3-70-g09d2