From 5a95b96631caa46e6397311364d93bb6fd46b006 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 14 Aug 2011 00:55:53 -0400 Subject: [PATCH] A3 Parsing - Durations now parse at higher precedence than operators, so that durations like '-3d' are not parsed as '-' '3d'. --- src/A3.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/A3.cpp b/src/A3.cpp index 736d07f9b..205123012 100644 --- a/src/A3.cpp +++ b/src/A3.cpp @@ -715,6 +715,20 @@ const A3 A3::tokenize (const A3& input) const 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)) { output.push_back (Arg (s, "op")); @@ -759,20 +773,6 @@ const A3 A3::tokenize (const A3& input) const 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)) { if (found_something_after_sequence)