From 8d398ed4f4cc01e8d93b7d138d0e962922e52438 Mon Sep 17 00:00:00 2001 From: pantor Date: Fri, 1 Dec 2017 16:46:18 +0100 Subject: [PATCH] fix a few more bugs at codacy --- src/inja.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/inja.hpp b/src/inja.hpp index 19542b8..6302ec4 100644 --- a/src/inja.hpp +++ b/src/inja.hpp @@ -160,7 +160,7 @@ inline MatchType search(const std::string& input, std::map regexes, return search_match; } -inline MatchClosed search_closed_on_level(const std::string& input, const Regex& regex_statement, const Regex regex_level_up, const Regex regex_level_down, const Regex regex_search, Match open_match) { +inline MatchClosed search_closed_on_level(const std::string& input, const Regex& regex_statement, const Regex& regex_level_up, const Regex& regex_level_down, const Regex& regex_search, Match open_match) { int level = 0; size_t current_position = open_match.end_position(); @@ -179,7 +179,7 @@ inline MatchClosed search_closed_on_level(const std::string& input, const Regex& return MatchClosed(open_match, match_delimiter); } -inline MatchClosed search_closed(const std::string& input, const Regex& regex_statement, const Regex regex_open, const Regex regex_close, Match open_match) { +inline MatchClosed search_closed(const std::string& input, const Regex& regex_statement, const Regex& regex_open, const Regex& regex_close, Match open_match) { return search_closed_on_level(input, regex_statement, regex_open, regex_close, regex_close, open_match); } @@ -489,9 +489,9 @@ public: }; const std::map regex_map_statement_openers = { - {Parsed::Statement::Loop, Regex{"for (.*)"}}, - {Parsed::Statement::Condition, Regex{"if (.*)"}}, - {Parsed::Statement::Include, Regex{"include \"(.*)\""}} + {Parsed::Statement::Loop, Regex{"for (.+)"}}, + {Parsed::Statement::Condition, Regex{"if (.+)"}}, + {Parsed::Statement::Include, Regex{"include \"(.+)\""}} }; const Regex regex_loop_open = regex_map_statement_openers.at(Parsed::Statement::Loop); @@ -499,7 +499,7 @@ public: const Regex regex_loop_close{"endfor"}; const Regex regex_condition_open = regex_map_statement_openers.at(Parsed::Statement::Condition); - const Regex regex_condition_else_if{"else if (.*)"}; + const Regex regex_condition_else_if{"else if (.+)"}; const Regex regex_condition_else{"else"}; const Regex regex_condition_close{"endif"};