mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
A3 Duration
- When parsing duration literals, look-ahead now prevents an ordinal such as '31st' (August 31st) from being interpreted as two tokens '31s' (duration) and 't' (word). This is the same fix that was applied to A3::is_number. I'll be there are more that I missed.
This commit is contained in:
parent
a4fc8aee6a
commit
587f2a002f
1 changed files with 11 additions and 2 deletions
13
src/A3.cpp
13
src/A3.cpp
|
@ -1456,6 +1456,9 @@ bool A3::is_dom (Nibbler& n, std::string& result)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// A duration may only be followed by '\0', ')' or ' '.
|
||||||
|
//
|
||||||
|
// This prevents the interpretation of '31st' as a duration ('31s').
|
||||||
bool A3::is_duration (Nibbler& n, std::string& result)
|
bool A3::is_duration (Nibbler& n, std::string& result)
|
||||||
{
|
{
|
||||||
n.save ();
|
n.save ();
|
||||||
|
@ -1468,8 +1471,14 @@ bool A3::is_duration (Nibbler& n, std::string& result)
|
||||||
if (n.getInt (quantity) &&
|
if (n.getInt (quantity) &&
|
||||||
n.getOneOf (units, unit))
|
n.getOneOf (units, unit))
|
||||||
{
|
{
|
||||||
result = format (quantity) + unit;
|
char next = n.next ();
|
||||||
return true;
|
if (next == '\0' ||
|
||||||
|
next == ')' ||
|
||||||
|
next == ' ')
|
||||||
|
{
|
||||||
|
result = format (quantity) + unit;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
n.restore ();
|
n.restore ();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue