From 602f18f834797aeebdf76fb3fd92af0cb04cbe1d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 6 Jun 2015 23:48:46 +0300 Subject: Add parsing INIT_EXPR node type. --- src/Makefile.files | 4 +++- src/includes/nodeincludes.h | 1 + src/includes/nodeshandling.inc | 1 + src/includes/parserdefines.inc | 1 + src/nodes/expr/init_expr.h | 35 +++++++++++++++++++++++++++++++++++ src/parsers/expr/init_expr.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 src/nodes/expr/init_expr.h create mode 100644 src/parsers/expr/init_expr.cpp (limited to 'src') diff --git a/src/Makefile.files b/src/Makefile.files index 1a17956..0b8a339 100644 --- a/src/Makefile.files +++ b/src/Makefile.files @@ -51,4 +51,6 @@ SRC = nodes/base/cst.h \ nodes/expr/bind_expr.h \ parsers/expr/bind_expr.cpp \ nodes/expr/decl_expr.h \ - parsers/expr/decl_expr.cpp \ No newline at end of file + parsers/expr/decl_expr.cpp \ + nodes/expr/init_expr.h \ + parsers/expr/init_expr.cpp \ No newline at end of file diff --git a/src/includes/nodeincludes.h b/src/includes/nodeincludes.h index dca72b0..4c35ac9 100644 --- a/src/includes/nodeincludes.h +++ b/src/includes/nodeincludes.h @@ -14,3 +14,4 @@ #include "nodes/type/void_type.h" #include "nodes/expr/bind_expr.h" #include "nodes/expr/decl_expr.h" +#include "nodes/expr/init_expr.h" diff --git a/src/includes/nodeshandling.inc b/src/includes/nodeshandling.inc index 6f5b67a..d9a4f5a 100644 --- a/src/includes/nodeshandling.inc +++ b/src/includes/nodeshandling.inc @@ -13,3 +13,4 @@ handleNodeType(INTEGER_CST, IntegerCst) handleNodeType(STATEMENT_LIST, StatementList) handleNodeType(BIND_EXPR, BindExpr) handleNodeType(DECL_EXPR, DeclExpr) +handleNodeType(INIT_EXPR, InitExpr) diff --git a/src/includes/parserdefines.inc b/src/includes/parserdefines.inc index c8f2b1e..bb401cf 100644 --- a/src/includes/parserdefines.inc +++ b/src/includes/parserdefines.inc @@ -13,3 +13,4 @@ parserDefine(IntegerCst); parserDefine(StatementList); parserDefine(BindExpr); parserDefine(DeclExpr); +parserDefine(InitExpr); diff --git a/src/nodes/expr/init_expr.h b/src/nodes/expr/init_expr.h new file mode 100644 index 0000000..55540cc --- /dev/null +++ b/src/nodes/expr/init_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_INITEXPRNODE_H +#define NODES_EXPR_INITEXPRNODE_H + +#include "nodes/base/expr.h" + +#include + +struct InitExprNode : public ExprNode +{ + InitExprNode() : + ExprNode() + { + } +}; + +#endif // NODES_EXPR_INITEXPRNODE_H diff --git a/src/parsers/expr/init_expr.cpp b/src/parsers/expr/init_expr.cpp new file mode 100644 index 0000000..9e4f303 --- /dev/null +++ b/src/parsers/expr/init_expr.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 . + */ + +#include "includes/parserincludes.h" + +parserDefine(InitExpr); + +#include "parsers/base/expr.h" + +#include "nodes/expr/init_expr.h" + +namespace Generic +{ + +void parseInitExprNode(InitExprNode *node) +{ + fillType(node); + Log::log(node); + + fillExprOperands(node); + + // args 0 - left side + // args 1 - right side +} + +} -- cgit v1.2.3-60-g2f50