mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug - tags
- Modified A3::is_tag to allow @, # and $ in tag names. - Reduced the precedence of tag parsing to ensure that durations are detected first.
This commit is contained in:
parent
36db62728b
commit
69aa041218
1 changed files with 21 additions and 15 deletions
36
src/A3.cpp
36
src/A3.cpp
|
@ -709,13 +709,6 @@ const A3 A3::tokenize (const A3& input) const
|
|||
found_something_after_sequence = true;
|
||||
}
|
||||
|
||||
else if (is_tag (n, s))
|
||||
{
|
||||
output.push_back (Arg (s, Arg::cat_tag));
|
||||
if (found_sequence)
|
||||
found_something_after_sequence = true;
|
||||
}
|
||||
|
||||
// Must be higher than number.
|
||||
// Must be higher than operator.
|
||||
// Note that Nibbler::getDate does not read durations.
|
||||
|
@ -735,6 +728,13 @@ const A3 A3::tokenize (const A3& input) const
|
|||
found_something_after_sequence = true;
|
||||
}
|
||||
|
||||
else if (is_tag (n, s))
|
||||
{
|
||||
output.push_back (Arg (s, Arg::cat_tag));
|
||||
if (found_sequence)
|
||||
found_something_after_sequence = true;
|
||||
}
|
||||
|
||||
else if (n.getOneOf (operators, s))
|
||||
{
|
||||
output.push_back (Arg (s, Arg::cat_op));
|
||||
|
@ -1655,15 +1655,21 @@ bool A3::is_tag (Nibbler& n, std::string& result)
|
|||
{
|
||||
n.save ();
|
||||
|
||||
std::string indicator;
|
||||
std::string name;
|
||||
if (n.getN (1, indicator) &&
|
||||
(indicator == "+" || indicator == "-") &&
|
||||
n.getName (name) &&
|
||||
name.length ())
|
||||
std::string::size_type start = n.cursor ();
|
||||
|
||||
if (n.skipAllOneOf ("+-"))
|
||||
{
|
||||
result = indicator + name;
|
||||
return true;
|
||||
n.skipAllOneOf ("@#");
|
||||
|
||||
std::string name;
|
||||
if (n.getName (name) &&
|
||||
name.length ())
|
||||
{
|
||||
std::string::size_type end = n.cursor ();
|
||||
n.restore ();
|
||||
if (n.getN (end - start, result))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
n.restore ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue