diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.files | 4 | ||||
-rw-r--r-- | src/includes/nodeincludes.h | 1 | ||||
-rw-r--r-- | src/includes/nodeshandling.inc | 1 | ||||
-rw-r--r-- | src/includes/parserdefines.inc | 1 | ||||
-rw-r--r-- | src/nodes/cst/real_cst.h | 38 | ||||
-rw-r--r-- | src/parsers/cst/real_cst.cpp | 42 |
6 files changed, 86 insertions, 1 deletions
diff --git a/src/Makefile.files b/src/Makefile.files index a84c643..b678db8 100644 --- a/src/Makefile.files +++ b/src/Makefile.files @@ -148,4 +148,6 @@ SRC = analysis/analysis.cpp \ nodes/type/real_type.h \ parsers/type/real_type.cpp \ nodes/constructor.h \ - parsers/constructor.cpp
\ No newline at end of file + parsers/constructor.cpp \ + nodes/cst/real_cst.h \ + parsers/cst/real_cst.cpp
\ No newline at end of file diff --git a/src/includes/nodeincludes.h b/src/includes/nodeincludes.h index e56eb16..f4a081e 100644 --- a/src/includes/nodeincludes.h +++ b/src/includes/nodeincludes.h @@ -55,3 +55,4 @@ #include "nodes/errormark.h" #include "nodes/type/real_type.h" #include "nodes/constructor.h" +#include "nodes/cst/real_cst.h" diff --git a/src/includes/nodeshandling.inc b/src/includes/nodeshandling.inc index 0d7b78c..f39f4fb 100644 --- a/src/includes/nodeshandling.inc +++ b/src/includes/nodeshandling.inc @@ -54,3 +54,4 @@ handleNodeType(SIZEOF_EXPR, SizeOfExpr) handleNodeType(ERROR_MARK, ErrorMark) handleNodeType(REAL_TYPE, RealType) handleNodeType(CONSTRUCTOR, Constructor) +handleNodeType(REAL_CST, RealCst) diff --git a/src/includes/parserdefines.inc b/src/includes/parserdefines.inc index 2138470..c8b97d1 100644 --- a/src/includes/parserdefines.inc +++ b/src/includes/parserdefines.inc @@ -54,3 +54,4 @@ parserDefine(SizeOfExpr); parserDefine(ErrorMark); parserDefine(RealType); parserDefine(Constructor); +parserDefine(RealCst); diff --git a/src/nodes/cst/real_cst.h b/src/nodes/cst/real_cst.h new file mode 100644 index 0000000..2ec1909 --- /dev/null +++ b/src/nodes/cst/real_cst.h @@ -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/>. + */ + +#ifndef NODES_CST_REALCSTNODE_H +#define NODES_CST_REALCSTNODE_H + +#include "nodes/base/cst.h" + +#include <string> + +struct RealCstNode : public CstNode +{ + RealCstNode() : + CstNode(), + realString() + { + } + + std::string realString; +}; + +#endif // NODES_CST_REALCSTNODE_H diff --git a/src/parsers/cst/real_cst.cpp b/src/parsers/cst/real_cst.cpp new file mode 100644 index 0000000..37a2a4a --- /dev/null +++ b/src/parsers/cst/real_cst.cpp @@ -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/>. + */ + +#include "includes/parserincludes.h" + +parserDefine(RealCst); + + +#include "nodes/cst/real_cst.h" + +namespace Generic +{ + +void parseRealCstNode(RealCstNode *node) +{ + fillType(node); + Log::dump(node); + + const REAL_VALUE_TYPE *const real = TREE_REAL_CST_PTR(node->gccNode); + char buf[32]; + real_to_decimal(buf, real, sizeof (buf), 0, true); + node->realString = buf; + Log::dumpRaw(node, "- real number: %s", node->realString.c_str()); +} + +} |