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,32 +103,33 @@ static void midsommarafton (struct tm* t)
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// <day>
|
||||
// <month>
|
||||
// Nth
|
||||
// socy, eocy
|
||||
// socq, eocq
|
||||
// socm, eocm
|
||||
// som, eom
|
||||
// soq, eoq
|
||||
// soy, eoy
|
||||
// socw, eocw
|
||||
// sow, eow
|
||||
// soww, eoww
|
||||
// sod, eod
|
||||
// yesterday
|
||||
// today
|
||||
// now
|
||||
// tomorrow
|
||||
// later = midnight, Jan 18th, 2038.
|
||||
// someday = midnight, Jan 18th, 2038.
|
||||
// easter
|
||||
// eastermonday
|
||||
// ascension
|
||||
// pentecost
|
||||
// goodfriday
|
||||
// midsommar = midnight, 1st Saturday after 20th June
|
||||
// midsommarafton = midnight, 1st Friday after 19th June
|
||||
// Note how these are all single words:
|
||||
// <day>
|
||||
// <month>
|
||||
// Nth
|
||||
// socy, eocy
|
||||
// socq, eocq
|
||||
// socm, eocm
|
||||
// som, eom
|
||||
// soq, eoq
|
||||
// soy, eoy
|
||||
// socw, eocw
|
||||
// sow, eow
|
||||
// soww, eoww
|
||||
// sod, eod
|
||||
// yesterday
|
||||
// today
|
||||
// now
|
||||
// tomorrow
|
||||
// later = midnight, Jan 18th, 2038.
|
||||
// someday = midnight, Jan 18th, 2038.
|
||||
// easter
|
||||
// eastermonday
|
||||
// ascension
|
||||
// pentecost
|
||||
// goodfriday
|
||||
// midsommar = midnight, 1st Saturday after 20th June
|
||||
// midsommarafton = midnight, 1st Friday after 19th June
|
||||
//
|
||||
bool namedDates (const std::string& name, Variant& value)
|
||||
{
|
||||
|
|
|
@ -239,8 +239,7 @@ bool ISO8601d::parse (
|
|||
parse_date_ext (n) ||
|
||||
parse_time_utc_ext (n) ||
|
||||
parse_time_off_ext (n) ||
|
||||
parse_time_ext (n) || // Time last, as it is the most permissive.
|
||||
parse_named (n))
|
||||
parse_time_ext (n)) // Time last, as it is the most permissive.
|
||||
{
|
||||
// Check the values and determine time_t.
|
||||
if (validate ())
|
||||
|
@ -253,8 +252,9 @@ bool ISO8601d::parse (
|
|||
}
|
||||
}
|
||||
|
||||
// ::parse_epoch doesn't require ::validate and ::resolve.
|
||||
else if (parse_epoch (n))
|
||||
// ::parse_epoch and ::parse_named do not require ::validate and ::resolve.
|
||||
else if (parse_epoch (n) ||
|
||||
parse_named (n))
|
||||
{
|
||||
start = n.cursor ();
|
||||
return true;
|
||||
|
@ -575,14 +575,16 @@ bool ISO8601d::parse_formatted (Nibbler& n, const std::string& format)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool ISO8601d::parse_named (Nibbler& n)
|
||||
{
|
||||
/*
|
||||
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 ();
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue