mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
validateWriteContext: Tag exclusion should also be detected as invalid write context
This commit is contained in:
parent
7de681aa3b
commit
531881f651
1 changed files with 12 additions and 1 deletions
|
@ -115,10 +115,12 @@ std::string CmdContext::joinWords (const std::vector <std::string>& words, unsig
|
||||||
// Returns True if the context is a valid write context. If the context is
|
// Returns True if the context is a valid write context. If the context is
|
||||||
// invalid due to a wrong modifier use, the modifier string will contain the
|
// invalid due to a wrong modifier use, the modifier string will contain the
|
||||||
// first invalid modifier.
|
// first invalid modifier.
|
||||||
|
//
|
||||||
bool CmdContext::validateWriteContext (const std::vector <A2>& lexedArgs, std::string& modifier_token)
|
bool CmdContext::validateWriteContext (const std::vector <A2>& lexedArgs, std::string& modifier_token)
|
||||||
{
|
{
|
||||||
bool contains_or = false;
|
bool contains_or = false;
|
||||||
bool contains_modifier = false;
|
bool contains_modifier = false;
|
||||||
|
bool contains_tag_exclusion = false;
|
||||||
|
|
||||||
for (auto &arg: lexedArgs) {
|
for (auto &arg: lexedArgs) {
|
||||||
if (arg._lextype == Lexer::Type::op)
|
if (arg._lextype == Lexer::Type::op)
|
||||||
|
@ -137,9 +139,18 @@ bool CmdContext::validateWriteContext (const std::vector <A2>& lexedArgs, std::s
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (arg._lextype == Lexer::Type::tag) {
|
||||||
|
if (arg.attribute ("sign") == "-")
|
||||||
|
{
|
||||||
|
contains_tag_exclusion = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return not contains_or and not contains_modifier;
|
}
|
||||||
|
|
||||||
|
return not contains_or and not contains_modifier and not contains_tag_exclusion;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue