From 0fd109924f91991b64d983ebb901a45f7fcc881d Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 26 Mar 2016 19:07:46 -0400 Subject: [PATCH] Rules: ::parseRulesSettings now accepts a namespace prefix --- src/Rules.cpp | 12 ++++++++---- src/Rules.h | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Rules.cpp b/src/Rules.cpp index 8ba84a26..11bad593 100644 --- a/src/Rules.cpp +++ b/src/Rules.cpp @@ -334,12 +334,17 @@ void Rules::parseRuleGeneral (const std::vector & lines) } //////////////////////////////////////////////////////////////////////////////// -void Rules::parseRuleSettings (const std::vector & lines) +void Rules::parseRuleSettings ( + const std::vector & lines, + const std::string& prefix) { std::vector indents; - std::vector hierarchy; indents.push_back (0); + std::vector hierarchy; + if (prefix != "") + hierarchy.push_back (prefix); + for (auto& line : lines) { auto indent = getIndentation (line); @@ -379,8 +384,7 @@ void Rules::parseRuleSettings (const std::vector & lines) // Should arrive here with indents and hierarchy in their original state. if (indents.size () != 1 || - indents[0] != 0 || - hierarchy.size () != 0) + indents[0] != 0) throw std::string ("Syntax error - indentation is not right."); } diff --git a/src/Rules.h b/src/Rules.h index 5766b40b..fa7c0477 100644 --- a/src/Rules.h +++ b/src/Rules.h @@ -57,7 +57,7 @@ private: void parse (const std::string&, int next = 1); void parseRule (const std::string&); void parseRuleGeneral (const std::vector &); - void parseRuleSettings (const std::vector &); + void parseRuleSettings (const std::vector &, const std::string& prefix = ""); void parseRuleExclusions (const std::vector &); void parseRuleTag (const std::vector &);