mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
ISO8601d: ::parse_named can also skip ::validate and ::resolve
This commit is contained in:
parent
7641a86f23
commit
abbebf69ad
2 changed files with 36 additions and 33 deletions
|
@ -103,6 +103,7 @@ static void midsommarafton (struct tm* t)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Note how these are all single words:
|
||||||
// <day>
|
// <day>
|
||||||
// <month>
|
// <month>
|
||||||
// Nth
|
// Nth
|
||||||
|
|
|
@ -239,8 +239,7 @@ bool ISO8601d::parse (
|
||||||
parse_date_ext (n) ||
|
parse_date_ext (n) ||
|
||||||
parse_time_utc_ext (n) ||
|
parse_time_utc_ext (n) ||
|
||||||
parse_time_off_ext (n) ||
|
parse_time_off_ext (n) ||
|
||||||
parse_time_ext (n) || // Time last, as it is the most permissive.
|
parse_time_ext (n)) // Time last, as it is the most permissive.
|
||||||
parse_named (n))
|
|
||||||
{
|
{
|
||||||
// Check the values and determine time_t.
|
// Check the values and determine time_t.
|
||||||
if (validate ())
|
if (validate ())
|
||||||
|
@ -253,8 +252,9 @@ bool ISO8601d::parse (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ::parse_epoch doesn't require ::validate and ::resolve.
|
// ::parse_epoch and ::parse_named do not require ::validate and ::resolve.
|
||||||
else if (parse_epoch (n))
|
else if (parse_epoch (n) ||
|
||||||
|
parse_named (n))
|
||||||
{
|
{
|
||||||
start = n.cursor ();
|
start = n.cursor ();
|
||||||
return true;
|
return true;
|
||||||
|
@ -575,14 +575,16 @@ bool ISO8601d::parse_formatted (Nibbler& n, const std::string& format)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
bool ISO8601d::parse_named (Nibbler& n)
|
bool ISO8601d::parse_named (Nibbler& n)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
Variant v;
|
Variant v;
|
||||||
if (namedDates (input, v))
|
if (namedDates (n.str ().substr (n.cursor ()), v))
|
||||||
{
|
{
|
||||||
|
// Advance n by the length of the found item.
|
||||||
|
std::string dummy;
|
||||||
|
n.getUntilEOS (dummy);
|
||||||
|
|
||||||
_date = v.get_date ();
|
_date = v.get_date ();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue