module Timing grammar NaturalTimeLanguage rule expression space* moment:moment space* zone_info:zone_info? space* end rule zone_info zone_offset / zone_name end rule moment timestamp / time_ago / moment_at_time / before_from_moment / date_moment end rule date_moment named_moment / last_next_day_name / day_month_name_year / year_month_day / beginning_end_interval end rule named_moment now / today / tomorrow / yesterday end rule last_next_day_name direction:last_next space* day_name:day_name space* including_today:'including today'? end rule day_month_name_year day:integer space* month:month_name space* year:integer? space* end rule year_month_day year:integer '-' month:integer '-' day:integer end rule beginning_end_interval direction:beginning_end space* interval_type:interval end rule time_ago number:integer space* interval_type:interval space* 'ago' end rule moment_at_time moment:date_moment space* 'at' space* time:hour_minute_second end rule before_from_moment number:integer space* interval_type:interval space* direction:before_from space* moment:moment end rule timestamp [\d]4..4 '-' [\d]2..2 '-' [\d]2..2 space* 't'? space* [\d]2..2 ':' [\d]2..2 ':' [\d]2..2 end rule now 'now' end rule today 'today' end rule tomorrow 'tomorrow' end rule yesterday 'yesterday' end rule last_next last / next end rule last 'last' end rule next 'next' end rule beginning_end beginning_of / end_of end rule beginning_of direction:'beginning' space* 'of' end rule end_of direction:'end' space* 'of' end rule before_from before / from end rule before 'before' end rule from 'from' end rule interval second_interval / minute_interval / hour_interval / day_interval / week_interval / month_interval / year_interval end rule second_interval 'second' 's'? end rule minute_interval 'minute' 's'? end rule hour_interval 'hour' 's'? end rule day_interval 'day' 's'? end rule week_interval 'week' 's'? end rule month_interval 'month' 's'? end rule year_interval 'year' 's'? end rule day_name long_day_name / short_day_name end rule long_day_name 'sunday' / 'monday' / 'tuesday' / 'wednesday' / 'thursday' / 'friday' / 'saturday' end rule short_day_name 'sun' / 'mon' / 'tue' / 'wed' / 'thu' / 'fri' / 'sat' end rule month_name long_month_name / short_month_name end rule long_month_name 'january' / 'february' / 'march' / 'april' / 'may' / 'june' / 'july' / 'august' / 'september' / 'october' / 'november' / 'december' end rule short_month_name 'jan' / 'feb' / 'mar' / 'apr' / 'may' / 'jun' / 'jul' / 'aug' / 'sep' / 'oct' / 'nov' / 'dec' end rule zone_offset [+-] [\d]2..2 ':'? [\d]2..2 end rule zone_name 'utc' end rule hour_minute_second [\d]2..2 ':' [\d]2..2 (':' [\d]2..2)? / 'beginning' / 'end' end rule integer [\d]+ end rule space [\s\t\n] end end end