From 412938c6bebd07afbd592ff7a9d75be7110af7c7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 13 Jun 2015 22:21:11 +0300 Subject: Add parsing node CAST_EXPR. --- src/Makefile.files | 4 +++- src/includes/nodeincludes.h | 1 + src/includes/nodeshandling.inc | 1 + src/includes/parserdefines.inc | 1 + src/nodes/expr/cast_expr.h | 35 +++++++++++++++++++++++++++++++++++ src/parsers/expr/cast_expr.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 src/nodes/expr/cast_expr.h create mode 100644 src/parsers/expr/cast_expr.cpp diff --git a/src/Makefile.files b/src/Makefile.files index 93cbb73..31c3de5 100644 --- a/src/Makefile.files +++ b/src/Makefile.files @@ -248,4 +248,6 @@ SRC = analysis/analysis.cpp \ nodes/vec/tree_vec.h \ parsers/vec/tree_vec.cpp \ nodes/block/try_block.h \ - parsers/block/try_block.cpp \ No newline at end of file + parsers/block/try_block.cpp \ + nodes/expr/cast_expr.h \ + parsers/expr/cast_expr.cpp \ No newline at end of file diff --git a/src/includes/nodeincludes.h b/src/includes/nodeincludes.h index be8c5b2..1f150c7 100644 --- a/src/includes/nodeincludes.h +++ b/src/includes/nodeincludes.h @@ -102,3 +102,4 @@ #include "nodes/expr/exactdiv_expr.h" #include "nodes/vec/tree_vec.h" #include "nodes/block/try_block.h" +#include "nodes/expr/cast_expr.h" diff --git a/src/includes/nodeshandling.inc b/src/includes/nodeshandling.inc index e4a769d..488fad7 100644 --- a/src/includes/nodeshandling.inc +++ b/src/includes/nodeshandling.inc @@ -101,3 +101,4 @@ handleNodeType(TEMPLATE_DECL, TemplateDecl) handleNodeType(EXACT_DIV_EXPR, ExactDivExpr) handleNodeType(TREE_VEC, TreeVec) handleNodeType(TRY_BLOCK, TryBlock) +handleNodeType(CAST_EXPR, CastExpr) diff --git a/src/includes/parserdefines.inc b/src/includes/parserdefines.inc index fd44758..74d5261 100644 --- a/src/includes/parserdefines.inc +++ b/src/includes/parserdefines.inc @@ -101,3 +101,4 @@ parserDefine(TemplateDecl); parserDefine(ExactDivExpr); parserDefine(TreeVec); parserDefine(TryBlock); +parserDefine(CastExpr); diff --git a/src/nodes/expr/cast_expr.h b/src/nodes/expr/cast_expr.h new file mode 100644 index 0000000..f4728e1 --- /dev/null +++ b/src/nodes/expr/cast_expr.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 . + */ + +#ifndef NODES_EXPR_CASTEXPRNODE_H +#define NODES_EXPR_CASTEXPRNODE_H + +#include "nodes/base/expr.h" + +#include + +struct CastExprNode : public ExprNode +{ + CastExprNode() : + ExprNode() + { + } +}; + +#endif // NODES_EXPR_CASTEXPRNODE_H diff --git a/src/parsers/expr/cast_expr.cpp b/src/parsers/expr/cast_expr.cpp new file mode 100644 index 0000000..cea9fc6 --- /dev/null +++ b/src/parsers/expr/cast_expr.cpp @@ -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 . + */ + +#include "includes/parserincludes.h" + +parserDefine(CastExpr); + +#include "parsers/base/expr.h" + +#include "nodes/expr/cast_expr.h" + +namespace Generic +{ + +void parseCastExprNode(CastExprNode *node) +{ + fillType(node); + fillExprLocation(node); + Log::dump(node); + + fillExprOperands(node); +} + +} -- cgit v1.2.3-60-g2f50