mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-06-26 10:54:28 +02:00
Rules: ::parseRulesSettings now accepts a namespace prefix
This commit is contained in:
parent
d4fc846cfc
commit
0fd109924f
2 changed files with 9 additions and 5 deletions
|
@ -334,12 +334,17 @@ void Rules::parseRuleGeneral (const std::vector <std::string>& lines)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Rules::parseRuleSettings (const std::vector <std::string>& lines)
|
||||
void Rules::parseRuleSettings (
|
||||
const std::vector <std::string>& lines,
|
||||
const std::string& prefix)
|
||||
{
|
||||
std::vector <unsigned int> indents;
|
||||
std::vector <std::string> hierarchy;
|
||||
indents.push_back (0);
|
||||
|
||||
std::vector <std::string> 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 <std::string>& 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.");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue