mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug - Durations
- Duration were parsed as <int><unit> in A3, whereas <number><unit> is correct. - Added Nibbler::str method for internal access. - Nibbler::save, ::restore now return positions. Useful for extracting substrings. - Modified countdown.t to use the (now) correct units for durations.
This commit is contained in:
parent
ee2960b9b0
commit
08fcb5362e
5 changed files with 39 additions and 16 deletions
11
src/A3.cpp
11
src/A3.cpp
|
@ -1471,14 +1471,15 @@ bool A3::is_dom (Nibbler& n, std::string& result)
|
|||
// This prevents the interpretation of '31st' as a duration ('31s').
|
||||
bool A3::is_duration (Nibbler& n, std::string& result)
|
||||
{
|
||||
n.save ();
|
||||
std::string::size_type start = n.save ();
|
||||
|
||||
int quantity;
|
||||
int i;
|
||||
double d;
|
||||
std::string unit;
|
||||
|
||||
std::vector <std::string> units = Duration::get_units ();
|
||||
|
||||
if (n.getInt (quantity) &&
|
||||
if ((n.getInt (i) ||
|
||||
n.getNumber (d)) &&
|
||||
n.getOneOf (units, unit))
|
||||
{
|
||||
char next = n.next ();
|
||||
|
@ -1486,7 +1487,7 @@ bool A3::is_duration (Nibbler& n, std::string& result)
|
|||
next == ')' ||
|
||||
next == ' ')
|
||||
{
|
||||
result = format (quantity) + unit;
|
||||
result = n.str ().substr (start, n.cursor () - start);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue