A3 Parsing
- Durations now parse at higher precedence than operators, so that durations like '-3d' are not parsed as '-' '3d'.
This commit is contained in:
28
src/A3.cpp
28
src/A3.cpp
@@ -715,6 +715,20 @@ const A3 A3::tokenize (const A3& input) const
|
|||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (n.getDate (date_format, t))
|
||||||
|
{
|
||||||
|
output.push_back (Arg (Date (t).toString (date_format), "date"));
|
||||||
|
if (found_sequence)
|
||||||
|
found_something_after_sequence = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (is_duration (n, s))
|
||||||
|
{
|
||||||
|
output.push_back (Arg (s, "duration"));
|
||||||
|
if (found_sequence)
|
||||||
|
found_something_after_sequence = true;
|
||||||
|
}
|
||||||
|
|
||||||
else if (n.getOneOf (operators, s))
|
else if (n.getOneOf (operators, s))
|
||||||
{
|
{
|
||||||
output.push_back (Arg (s, "op"));
|
output.push_back (Arg (s, "op"));
|
||||||
@@ -759,20 +773,6 @@ const A3 A3::tokenize (const A3& input) const
|
|||||||
found_something_after_sequence = true;
|
found_something_after_sequence = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (n.getDate (date_format, t))
|
|
||||||
{
|
|
||||||
output.push_back (Arg (Date (t).toString (date_format), "date"));
|
|
||||||
if (found_sequence)
|
|
||||||
found_something_after_sequence = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (is_duration (n, s))
|
|
||||||
{
|
|
||||||
output.push_back (Arg (s, "duration"));
|
|
||||||
if (found_sequence)
|
|
||||||
found_something_after_sequence = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (is_id (n, s))
|
else if (is_id (n, s))
|
||||||
{
|
{
|
||||||
if (found_something_after_sequence)
|
if (found_something_after_sequence)
|
||||||
|
|||||||
Reference in New Issue
Block a user