From badf4fc1c880a0c0426cf7d945b9e60a7edb4198 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 8 Jun 2015 02:14:06 +0300 Subject: Add parsing node PLUS_EXPR. --- src/Makefile.files | 4 +++- src/includes/nodeincludes.h | 1 + src/includes/nodeshandling.inc | 1 + src/includes/parserdefines.inc | 1 + src/nodes/expr/plus_expr.h | 35 +++++++++++++++++++++++++++++++++++ src/parsers/expr/plus_expr.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 src/nodes/expr/plus_expr.h create mode 100644 src/parsers/expr/plus_expr.cpp (limited to 'src') diff --git a/src/Makefile.files b/src/Makefile.files index eb71264..ed8f5f4 100644 --- a/src/Makefile.files +++ b/src/Makefile.files @@ -70,4 +70,6 @@ SRC = nodes/base/cst.h \ nodes/stmt/if_stmt.h \ parsers/stmt/if_stmt.cpp \ nodes/stmt/while_stmt.h \ - parsers/stmt/while_stmt.cpp \ No newline at end of file + parsers/stmt/while_stmt.cpp \ + nodes/expr/plus_expr.h \ + parsers/expr/plus_expr.cpp \ No newline at end of file diff --git a/src/includes/nodeincludes.h b/src/includes/nodeincludes.h index 72c4c8c..fb469df 100644 --- a/src/includes/nodeincludes.h +++ b/src/includes/nodeincludes.h @@ -22,3 +22,4 @@ #include "nodes/stmt/expr_stmt.h" #include "nodes/stmt/if_stmt.h" #include "nodes/stmt/while_stmt.h" +#include "nodes/expr/plus_expr.h" diff --git a/src/includes/nodeshandling.inc b/src/includes/nodeshandling.inc index c301c9e..ebd8a65 100644 --- a/src/includes/nodeshandling.inc +++ b/src/includes/nodeshandling.inc @@ -21,3 +21,4 @@ handleNodeType(BLOCK, Block) handleNodeType(EXPR_STMT, ExprStmt) handleNodeType(IF_STMT, IfStmt) handleNodeType(WHILE_STMT, WhileStmt) +handleNodeType(PLUS_EXPR, PlusExpr) diff --git a/src/includes/parserdefines.inc b/src/includes/parserdefines.inc index 5494244..bea90cd 100644 --- a/src/includes/parserdefines.inc +++ b/src/includes/parserdefines.inc @@ -21,3 +21,4 @@ parserDefine(Block); parserDefine(ExprStmt); parserDefine(IfStmt); parserDefine(WhileStmt); +parserDefine(PlusExpr); diff --git a/src/nodes/expr/plus_expr.h b/src/nodes/expr/plus_expr.h new file mode 100644 index 0000000..29ef0fc --- /dev/null +++ b/src/nodes/expr/plus_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_PLUSEXPRNODE_H +#define NODES_EXPR_PLUSEXPRNODE_H + +#include "nodes/base/expr.h" + +#include + +struct PlusExprNode : public ExprNode +{ + PlusExprNode() : + ExprNode() + { + } +}; + +#endif // NODES_EXPR_PLUSEXPRNODE_H diff --git a/src/parsers/expr/plus_expr.cpp b/src/parsers/expr/plus_expr.cpp new file mode 100644 index 0000000..2450979 --- /dev/null +++ b/src/parsers/expr/plus_expr.cpp @@ -0,0 +1,39 @@ +/* + * 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(PlusExpr); + +#include "parsers/base/expr.h" + +#include "nodes/expr/plus_expr.h" + +namespace Generic +{ + +void parsePlusExprNode(PlusExprNode *node) +{ + fillType(node); + Log::log(node); + + fillExprOperands(node); +} + +} -- cgit v1.2.3-60-g2f50