From ac6cdc8dd5f42820014b5d0b09b5e52593fb0a20 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 10 Mar 2017 16:18:56 +0300 Subject: Add check for new CLASS(). Here brackets should be removed. --- src/Makefile.am | 1 + src/rules/constructorbrackets.cpp | 43 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 src/rules/constructorbrackets.cpp (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index 0375ff2..3557e43 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -19,6 +19,7 @@ mplint_SOURCES = \ template.hpp \ rules/brackets.cpp \ rules/constructor.cpp \ + rules/constructorbrackets.cpp \ rules/copyconstructor.cpp \ rules/debug.cpp \ rules/dump.cpp \ diff --git a/src/rules/constructorbrackets.cpp b/src/rules/constructorbrackets.cpp new file mode 100644 index 0000000..73dd9f3 --- /dev/null +++ b/src/rules/constructorbrackets.cpp @@ -0,0 +1,43 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * 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 "template.hpp" + +registerRuleExt(constructorBrackets, "017", "(.+)[.](cpp|h)") + +startRule(constructorBrackets) +{ +} + +endRule(constructorBrackets) +{ +} + +parseLineRule(constructorBrackets) +{ + if (data.find("new ") != std::string::npos) + { + std::smatch m; + if (isMatch(data, "(.+)[ ]new[ ]([a-zA-Z_0123456789]+)[(][)](.+)", m)) + { + print("Remove () after new CLASS()."); + } + } +} -- cgit v1.2.3-70-g09d2