# Autogenerated from a Treetop grammar. Edits may be lost. module Timing module NaturalTimeLanguage include Treetop::Runtime def root @root ||= :expression end module Expression0 def moment elements[1] end def zone_offset elements[3] end end def _nt_expression start_index = index if node_cache[:expression].has_key?(index) cached = node_cache[:expression][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] s1, i1 = [], index loop do r2 = _nt_space if r2 s1 << r2 else break end end r1 = instantiate_node(SyntaxNode,input, i1...index, s1) s0 << r1 if r1 r3 = _nt_moment s0 << r3 if r3 s4, i4 = [], index loop do r5 = _nt_space if r5 s4 << r5 else break end end r4 = instantiate_node(SyntaxNode,input, i4...index, s4) s0 << r4 if r4 r7 = _nt_zone_offset if r7 r6 = r7 else r6 = instantiate_node(SyntaxNode,input, index...index) end s0 << r6 if r6 s8, i8 = [], index loop do r9 = _nt_space if r9 s8 << r9 else break end end r8 = instantiate_node(SyntaxNode,input, i8...index, s8) s0 << r8 end end end end if s0.last r0 = instantiate_node(Expression,input, i0...index, s0) r0.extend(Expression0) else @index = i0 r0 = nil end node_cache[:expression][start_index] = r0 r0 end def _nt_moment start_index = index if node_cache[:moment].has_key?(index) cached = node_cache[:moment][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_timestamp if r1 r0 = r1 else r2 = _nt_time_ago if r2 r0 = r2 else r3 = _nt_moment_at_time if r3 r0 = r3 else r4 = _nt_before_from_moment if r4 r0 = r4 else r5 = _nt_date_moment if r5 r0 = r5 else @index = i0 r0 = nil end end end end end node_cache[:moment][start_index] = r0 r0 end def _nt_date_moment start_index = index if node_cache[:date_moment].has_key?(index) cached = node_cache[:date_moment][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_named_moment if r1 r0 = r1 else r2 = _nt_last_next_day_name if r2 r0 = r2 else r3 = _nt_day_month_name_year if r3 r0 = r3 else r4 = _nt_year_month_day if r4 r0 = r4 else r5 = _nt_beginning_end_interval if r5 r0 = r5 else @index = i0 r0 = nil end end end end end node_cache[:date_moment][start_index] = r0 r0 end def _nt_named_moment start_index = index if node_cache[:named_moment].has_key?(index) cached = node_cache[:named_moment][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_now if r1 r0 = r1 else r2 = _nt_today if r2 r0 = r2 else r3 = _nt_tomorrow if r3 r0 = r3 else r4 = _nt_yesterday if r4 r0 = r4 else @index = i0 r0 = nil end end end end node_cache[:named_moment][start_index] = r0 r0 end module LastNextDayName0 def direction elements[0] end def day_name elements[2] end def including_today elements[4] end end def _nt_last_next_day_name start_index = index if node_cache[:last_next_day_name].has_key?(index) cached = node_cache[:last_next_day_name][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_last_next s0 << r1 if r1 s2, i2 = [], index loop do r3 = _nt_space if r3 s2 << r3 else break end end r2 = instantiate_node(SyntaxNode,input, i2...index, s2) s0 << r2 if r2 r4 = _nt_day_name s0 << r4 if r4 s5, i5 = [], index loop do r6 = _nt_space if r6 s5 << r6 else break end end r5 = instantiate_node(SyntaxNode,input, i5...index, s5) s0 << r5 if r5 if has_terminal?('including today', false, index) r8 = instantiate_node(SyntaxNode,input, index...(index + 15)) @index += 15 else terminal_parse_failure('including today') r8 = nil end if r8 r7 = r8 else r7 = instantiate_node(SyntaxNode,input, index...index) end s0 << r7 end end end end if s0.last r0 = instantiate_node(LastNextDayName,input, i0...index, s0) r0.extend(LastNextDayName0) else @index = i0 r0 = nil end node_cache[:last_next_day_name][start_index] = r0 r0 end module DayMonthNameYear0 def day elements[0] end def month elements[2] end def year elements[4] end end def _nt_day_month_name_year start_index = index if node_cache[:day_month_name_year].has_key?(index) cached = node_cache[:day_month_name_year][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_integer s0 << r1 if r1 s2, i2 = [], index loop do r3 = _nt_space if r3 s2 << r3 else break end end r2 = instantiate_node(SyntaxNode,input, i2...index, s2) s0 << r2 if r2 r4 = _nt_month_name s0 << r4 if r4 s5, i5 = [], index loop do r6 = _nt_space if r6 s5 << r6 else break end end r5 = instantiate_node(SyntaxNode,input, i5...index, s5) s0 << r5 if r5 r8 = _nt_integer if r8 r7 = r8 else r7 = instantiate_node(SyntaxNode,input, index...index) end s0 << r7 if r7 s9, i9 = [], index loop do r10 = _nt_space if r10 s9 << r10 else break end end r9 = instantiate_node(SyntaxNode,input, i9...index, s9) s0 << r9 end end end end end if s0.last r0 = instantiate_node(DayMonthNameYear,input, i0...index, s0) r0.extend(DayMonthNameYear0) else @index = i0 r0 = nil end node_cache[:day_month_name_year][start_index] = r0 r0 end module YearMonthDay0 def year elements[0] end def month elements[2] end def day elements[4] end end def _nt_year_month_day start_index = index if node_cache[:year_month_day].has_key?(index) cached = node_cache[:year_month_day][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_integer s0 << r1 if r1 if has_terminal?('-', false, index) r2 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('-') r2 = nil end s0 << r2 if r2 r3 = _nt_integer s0 << r3 if r3 if has_terminal?('-', false, index) r4 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('-') r4 = nil end s0 << r4 if r4 r5 = _nt_integer s0 << r5 end end end end if s0.last r0 = instantiate_node(YearMonthDay,input, i0...index, s0) r0.extend(YearMonthDay0) else @index = i0 r0 = nil end node_cache[:year_month_day][start_index] = r0 r0 end module BeginningEndInterval0 def direction elements[0] end def interval_type elements[2] end end def _nt_beginning_end_interval start_index = index if node_cache[:beginning_end_interval].has_key?(index) cached = node_cache[:beginning_end_interval][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_beginning_end s0 << r1 if r1 s2, i2 = [], index loop do r3 = _nt_space if r3 s2 << r3 else break end end r2 = instantiate_node(SyntaxNode,input, i2...index, s2) s0 << r2 if r2 r4 = _nt_interval s0 << r4 end end if s0.last r0 = instantiate_node(BeginningEndInterval,input, i0...index, s0) r0.extend(BeginningEndInterval0) else @index = i0 r0 = nil end node_cache[:beginning_end_interval][start_index] = r0 r0 end module TimeAgo0 def number elements[0] end def interval_type elements[2] end end def _nt_time_ago start_index = index if node_cache[:time_ago].has_key?(index) cached = node_cache[:time_ago][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_integer s0 << r1 if r1 s2, i2 = [], index loop do r3 = _nt_space if r3 s2 << r3 else break end end r2 = instantiate_node(SyntaxNode,input, i2...index, s2) s0 << r2 if r2 r4 = _nt_interval s0 << r4 if r4 s5, i5 = [], index loop do r6 = _nt_space if r6 s5 << r6 else break end end r5 = instantiate_node(SyntaxNode,input, i5...index, s5) s0 << r5 if r5 if has_terminal?('ago', false, index) r7 = instantiate_node(SyntaxNode,input, index...(index + 3)) @index += 3 else terminal_parse_failure('ago') r7 = nil end s0 << r7 end end end end if s0.last r0 = instantiate_node(TimeAgo,input, i0...index, s0) r0.extend(TimeAgo0) else @index = i0 r0 = nil end node_cache[:time_ago][start_index] = r0 r0 end module MomentAtTime0 def moment elements[0] end def time elements[4] end end def _nt_moment_at_time start_index = index if node_cache[:moment_at_time].has_key?(index) cached = node_cache[:moment_at_time][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_date_moment s0 << r1 if r1 s2, i2 = [], index loop do r3 = _nt_space if r3 s2 << r3 else break end end r2 = instantiate_node(SyntaxNode,input, i2...index, s2) s0 << r2 if r2 if has_terminal?('at', false, index) r4 = instantiate_node(SyntaxNode,input, index...(index + 2)) @index += 2 else terminal_parse_failure('at') r4 = nil end s0 << r4 if r4 s5, i5 = [], index loop do r6 = _nt_space if r6 s5 << r6 else break end end r5 = instantiate_node(SyntaxNode,input, i5...index, s5) s0 << r5 if r5 r7 = _nt_hour_minute_second s0 << r7 end end end end if s0.last r0 = instantiate_node(MomentAtTime,input, i0...index, s0) r0.extend(MomentAtTime0) else @index = i0 r0 = nil end node_cache[:moment_at_time][start_index] = r0 r0 end module BeforeFromMoment0 def number elements[0] end def interval_type elements[2] end def direction elements[4] end def moment elements[6] end end def _nt_before_from_moment start_index = index if node_cache[:before_from_moment].has_key?(index) cached = node_cache[:before_from_moment][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] r1 = _nt_integer s0 << r1 if r1 s2, i2 = [], index loop do r3 = _nt_space if r3 s2 << r3 else break end end r2 = instantiate_node(SyntaxNode,input, i2...index, s2) s0 << r2 if r2 r4 = _nt_interval s0 << r4 if r4 s5, i5 = [], index loop do r6 = _nt_space if r6 s5 << r6 else break end end r5 = instantiate_node(SyntaxNode,input, i5...index, s5) s0 << r5 if r5 r7 = _nt_before_from s0 << r7 if r7 s8, i8 = [], index loop do r9 = _nt_space if r9 s8 << r9 else break end end r8 = instantiate_node(SyntaxNode,input, i8...index, s8) s0 << r8 if r8 r10 = _nt_moment s0 << r10 end end end end end end if s0.last r0 = instantiate_node(BeforeFromMoment,input, i0...index, s0) r0.extend(BeforeFromMoment0) else @index = i0 r0 = nil end node_cache[:before_from_moment][start_index] = r0 r0 end module Timestamp0 end def _nt_timestamp start_index = index if node_cache[:timestamp].has_key?(index) cached = node_cache[:timestamp][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] s1, i1 = [], index loop do if has_terminal?('\G[\\d]', true, index) r2 = true @index += 1 else r2 = nil end if r2 s1 << r2 else break end if s1.size == 4 break end end if s1.size < 4 @index = i1 r1 = nil else r1 = instantiate_node(SyntaxNode,input, i1...index, s1) end s0 << r1 if r1 if has_terminal?('-', false, index) r3 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('-') r3 = nil end s0 << r3 if r3 s4, i4 = [], index loop do if has_terminal?('\G[\\d]', true, index) r5 = true @index += 1 else r5 = nil end if r5 s4 << r5 else break end if s4.size == 2 break end end if s4.size < 2 @index = i4 r4 = nil else r4 = instantiate_node(SyntaxNode,input, i4...index, s4) end s0 << r4 if r4 if has_terminal?('-', false, index) r6 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('-') r6 = nil end s0 << r6 if r6 s7, i7 = [], index loop do if has_terminal?('\G[\\d]', true, index) r8 = true @index += 1 else r8 = nil end if r8 s7 << r8 else break end if s7.size == 2 break end end if s7.size < 2 @index = i7 r7 = nil else r7 = instantiate_node(SyntaxNode,input, i7...index, s7) end s0 << r7 if r7 s9, i9 = [], index loop do r10 = _nt_space if r10 s9 << r10 else break end end r9 = instantiate_node(SyntaxNode,input, i9...index, s9) s0 << r9 if r9 if has_terminal?('t', false, index) r12 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('t') r12 = nil end if r12 r11 = r12 else r11 = instantiate_node(SyntaxNode,input, index...index) end s0 << r11 if r11 s13, i13 = [], index loop do r14 = _nt_space if r14 s13 << r14 else break end end r13 = instantiate_node(SyntaxNode,input, i13...index, s13) s0 << r13 if r13 s15, i15 = [], index loop do if has_terminal?('\G[\\d]', true, index) r16 = true @index += 1 else r16 = nil end if r16 s15 << r16 else break end if s15.size == 2 break end end if s15.size < 2 @index = i15 r15 = nil else r15 = instantiate_node(SyntaxNode,input, i15...index, s15) end s0 << r15 if r15 if has_terminal?(':', false, index) r17 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure(':') r17 = nil end s0 << r17 if r17 s18, i18 = [], index loop do if has_terminal?('\G[\\d]', true, index) r19 = true @index += 1 else r19 = nil end if r19 s18 << r19 else break end if s18.size == 2 break end end if s18.size < 2 @index = i18 r18 = nil else r18 = instantiate_node(SyntaxNode,input, i18...index, s18) end s0 << r18 if r18 if has_terminal?(':', false, index) r20 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure(':') r20 = nil end s0 << r20 if r20 s21, i21 = [], index loop do if has_terminal?('\G[\\d]', true, index) r22 = true @index += 1 else r22 = nil end if r22 s21 << r22 else break end if s21.size == 2 break end end if s21.size < 2 @index = i21 r21 = nil else r21 = instantiate_node(SyntaxNode,input, i21...index, s21) end s0 << r21 end end end end end end end end end end end end if s0.last r0 = instantiate_node(Timestamp,input, i0...index, s0) r0.extend(Timestamp0) else @index = i0 r0 = nil end node_cache[:timestamp][start_index] = r0 r0 end def _nt_now start_index = index if node_cache[:now].has_key?(index) cached = node_cache[:now][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end if has_terminal?('now', false, index) r0 = instantiate_node(Now,input, index...(index + 3)) @index += 3 else terminal_parse_failure('now') r0 = nil end node_cache[:now][start_index] = r0 r0 end def _nt_today start_index = index if node_cache[:today].has_key?(index) cached = node_cache[:today][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end if has_terminal?('today', false, index) r0 = instantiate_node(Today,input, index...(index + 5)) @index += 5 else terminal_parse_failure('today') r0 = nil end node_cache[:today][start_index] = r0 r0 end def _nt_tomorrow start_index = index if node_cache[:tomorrow].has_key?(index) cached = node_cache[:tomorrow][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end if has_terminal?('tomorrow', false, index) r0 = instantiate_node(Tomorrow,input, index...(index + 8)) @index += 8 else terminal_parse_failure('tomorrow') r0 = nil end node_cache[:tomorrow][start_index] = r0 r0 end def _nt_yesterday start_index = index if node_cache[:yesterday].has_key?(index) cached = node_cache[:yesterday][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end if has_terminal?('yesterday', false, index) r0 = instantiate_node(Yesterday,input, index...(index + 9)) @index += 9 else terminal_parse_failure('yesterday') r0 = nil end node_cache[:yesterday][start_index] = r0 r0 end def _nt_last_next start_index = index if node_cache[:last_next].has_key?(index) cached = node_cache[:last_next][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_last if r1 r0 = r1 else r2 = _nt_next if r2 r0 = r2 else @index = i0 r0 = nil end end node_cache[:last_next][start_index] = r0 r0 end def _nt_last start_index = index if node_cache[:last].has_key?(index) cached = node_cache[:last][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end if has_terminal?('last', false, index) r0 = instantiate_node(LastNext,input, index...(index + 4)) @index += 4 else terminal_parse_failure('last') r0 = nil end node_cache[:last][start_index] = r0 r0 end def _nt_next start_index = index if node_cache[:next].has_key?(index) cached = node_cache[:next][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end if has_terminal?('next', false, index) r0 = instantiate_node(LastNext,input, index...(index + 4)) @index += 4 else terminal_parse_failure('next') r0 = nil end node_cache[:next][start_index] = r0 r0 end def _nt_beginning_end start_index = index if node_cache[:beginning_end].has_key?(index) cached = node_cache[:beginning_end][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_beginning_of if r1 r0 = r1 else r2 = _nt_end_of if r2 r0 = r2 else @index = i0 r0 = nil end end node_cache[:beginning_end][start_index] = r0 r0 end module BeginningOf0 def direction elements[0] end end def _nt_beginning_of start_index = index if node_cache[:beginning_of].has_key?(index) cached = node_cache[:beginning_of][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if has_terminal?('beginning', false, index) r1 = instantiate_node(SyntaxNode,input, index...(index + 9)) @index += 9 else terminal_parse_failure('beginning') r1 = nil end s0 << r1 if r1 s2, i2 = [], index loop do r3 = _nt_space if r3 s2 << r3 else break end end r2 = instantiate_node(SyntaxNode,input, i2...index, s2) s0 << r2 if r2 if has_terminal?('of', false, index) r4 = instantiate_node(SyntaxNode,input, index...(index + 2)) @index += 2 else terminal_parse_failure('of') r4 = nil end s0 << r4 end end if s0.last r0 = instantiate_node(BeginningEnd,input, i0...index, s0) r0.extend(BeginningOf0) else @index = i0 r0 = nil end node_cache[:beginning_of][start_index] = r0 r0 end module EndOf0 def direction elements[0] end end def _nt_end_of start_index = index if node_cache[:end_of].has_key?(index) cached = node_cache[:end_of][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if has_terminal?('end', false, index) r1 = instantiate_node(SyntaxNode,input, index...(index + 3)) @index += 3 else terminal_parse_failure('end') r1 = nil end s0 << r1 if r1 s2, i2 = [], index loop do r3 = _nt_space if r3 s2 << r3 else break end end r2 = instantiate_node(SyntaxNode,input, i2...index, s2) s0 << r2 if r2 if has_terminal?('of', false, index) r4 = instantiate_node(SyntaxNode,input, index...(index + 2)) @index += 2 else terminal_parse_failure('of') r4 = nil end s0 << r4 end end if s0.last r0 = instantiate_node(BeginningEnd,input, i0...index, s0) r0.extend(EndOf0) else @index = i0 r0 = nil end node_cache[:end_of][start_index] = r0 r0 end def _nt_before_from start_index = index if node_cache[:before_from].has_key?(index) cached = node_cache[:before_from][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_before if r1 r0 = r1 else r2 = _nt_from if r2 r0 = r2 else @index = i0 r0 = nil end end node_cache[:before_from][start_index] = r0 r0 end def _nt_before start_index = index if node_cache[:before].has_key?(index) cached = node_cache[:before][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end if has_terminal?('before', false, index) r0 = instantiate_node(BeforeFrom,input, index...(index + 6)) @index += 6 else terminal_parse_failure('before') r0 = nil end node_cache[:before][start_index] = r0 r0 end def _nt_from start_index = index if node_cache[:from].has_key?(index) cached = node_cache[:from][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end if has_terminal?('from', false, index) r0 = instantiate_node(BeforeFrom,input, index...(index + 4)) @index += 4 else terminal_parse_failure('from') r0 = nil end node_cache[:from][start_index] = r0 r0 end def _nt_interval start_index = index if node_cache[:interval].has_key?(index) cached = node_cache[:interval][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_second_interval if r1 r0 = r1 else r2 = _nt_minute_interval if r2 r0 = r2 else r3 = _nt_hour_interval if r3 r0 = r3 else r4 = _nt_day_interval if r4 r0 = r4 else r5 = _nt_week_interval if r5 r0 = r5 else r6 = _nt_month_interval if r6 r0 = r6 else r7 = _nt_year_interval if r7 r0 = r7 else @index = i0 r0 = nil end end end end end end end node_cache[:interval][start_index] = r0 r0 end module SecondInterval0 end def _nt_second_interval start_index = index if node_cache[:second_interval].has_key?(index) cached = node_cache[:second_interval][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if has_terminal?('second', false, index) r1 = instantiate_node(SyntaxNode,input, index...(index + 6)) @index += 6 else terminal_parse_failure('second') r1 = nil end s0 << r1 if r1 if has_terminal?('s', false, index) r3 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('s') r3 = nil end if r3 r2 = r3 else r2 = instantiate_node(SyntaxNode,input, index...index) end s0 << r2 end if s0.last r0 = instantiate_node(SecondInterval,input, i0...index, s0) r0.extend(SecondInterval0) else @index = i0 r0 = nil end node_cache[:second_interval][start_index] = r0 r0 end module MinuteInterval0 end def _nt_minute_interval start_index = index if node_cache[:minute_interval].has_key?(index) cached = node_cache[:minute_interval][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if has_terminal?('minute', false, index) r1 = instantiate_node(SyntaxNode,input, index...(index + 6)) @index += 6 else terminal_parse_failure('minute') r1 = nil end s0 << r1 if r1 if has_terminal?('s', false, index) r3 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('s') r3 = nil end if r3 r2 = r3 else r2 = instantiate_node(SyntaxNode,input, index...index) end s0 << r2 end if s0.last r0 = instantiate_node(MinuteInterval,input, i0...index, s0) r0.extend(MinuteInterval0) else @index = i0 r0 = nil end node_cache[:minute_interval][start_index] = r0 r0 end module HourInterval0 end def _nt_hour_interval start_index = index if node_cache[:hour_interval].has_key?(index) cached = node_cache[:hour_interval][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if has_terminal?('hour', false, index) r1 = instantiate_node(SyntaxNode,input, index...(index + 4)) @index += 4 else terminal_parse_failure('hour') r1 = nil end s0 << r1 if r1 if has_terminal?('s', false, index) r3 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('s') r3 = nil end if r3 r2 = r3 else r2 = instantiate_node(SyntaxNode,input, index...index) end s0 << r2 end if s0.last r0 = instantiate_node(HourInterval,input, i0...index, s0) r0.extend(HourInterval0) else @index = i0 r0 = nil end node_cache[:hour_interval][start_index] = r0 r0 end module DayInterval0 end def _nt_day_interval start_index = index if node_cache[:day_interval].has_key?(index) cached = node_cache[:day_interval][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if has_terminal?('day', false, index) r1 = instantiate_node(SyntaxNode,input, index...(index + 3)) @index += 3 else terminal_parse_failure('day') r1 = nil end s0 << r1 if r1 if has_terminal?('s', false, index) r3 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('s') r3 = nil end if r3 r2 = r3 else r2 = instantiate_node(SyntaxNode,input, index...index) end s0 << r2 end if s0.last r0 = instantiate_node(DayInterval,input, i0...index, s0) r0.extend(DayInterval0) else @index = i0 r0 = nil end node_cache[:day_interval][start_index] = r0 r0 end module WeekInterval0 end def _nt_week_interval start_index = index if node_cache[:week_interval].has_key?(index) cached = node_cache[:week_interval][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if has_terminal?('week', false, index) r1 = instantiate_node(SyntaxNode,input, index...(index + 4)) @index += 4 else terminal_parse_failure('week') r1 = nil end s0 << r1 if r1 if has_terminal?('s', false, index) r3 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('s') r3 = nil end if r3 r2 = r3 else r2 = instantiate_node(SyntaxNode,input, index...index) end s0 << r2 end if s0.last r0 = instantiate_node(WeekInterval,input, i0...index, s0) r0.extend(WeekInterval0) else @index = i0 r0 = nil end node_cache[:week_interval][start_index] = r0 r0 end module MonthInterval0 end def _nt_month_interval start_index = index if node_cache[:month_interval].has_key?(index) cached = node_cache[:month_interval][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if has_terminal?('month', false, index) r1 = instantiate_node(SyntaxNode,input, index...(index + 5)) @index += 5 else terminal_parse_failure('month') r1 = nil end s0 << r1 if r1 if has_terminal?('s', false, index) r3 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('s') r3 = nil end if r3 r2 = r3 else r2 = instantiate_node(SyntaxNode,input, index...index) end s0 << r2 end if s0.last r0 = instantiate_node(MonthInterval,input, i0...index, s0) r0.extend(MonthInterval0) else @index = i0 r0 = nil end node_cache[:month_interval][start_index] = r0 r0 end module YearInterval0 end def _nt_year_interval start_index = index if node_cache[:year_interval].has_key?(index) cached = node_cache[:year_interval][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if has_terminal?('year', false, index) r1 = instantiate_node(SyntaxNode,input, index...(index + 4)) @index += 4 else terminal_parse_failure('year') r1 = nil end s0 << r1 if r1 if has_terminal?('s', false, index) r3 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('s') r3 = nil end if r3 r2 = r3 else r2 = instantiate_node(SyntaxNode,input, index...index) end s0 << r2 end if s0.last r0 = instantiate_node(YearInterval,input, i0...index, s0) r0.extend(YearInterval0) else @index = i0 r0 = nil end node_cache[:year_interval][start_index] = r0 r0 end def _nt_day_name start_index = index if node_cache[:day_name].has_key?(index) cached = node_cache[:day_name][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_long_day_name if r1 r0 = r1 else r2 = _nt_short_day_name if r2 r0 = r2 else @index = i0 r0 = nil end end node_cache[:day_name][start_index] = r0 r0 end def _nt_long_day_name start_index = index if node_cache[:long_day_name].has_key?(index) cached = node_cache[:long_day_name][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index if has_terminal?('sunday', false, index) r1 = instantiate_node(DayName,input, index...(index + 6)) @index += 6 else terminal_parse_failure('sunday') r1 = nil end if r1 r0 = r1 else if has_terminal?('monday', false, index) r2 = instantiate_node(DayName,input, index...(index + 6)) @index += 6 else terminal_parse_failure('monday') r2 = nil end if r2 r0 = r2 else if has_terminal?('tuesday', false, index) r3 = instantiate_node(DayName,input, index...(index + 7)) @index += 7 else terminal_parse_failure('tuesday') r3 = nil end if r3 r0 = r3 else if has_terminal?('wednesday', false, index) r4 = instantiate_node(DayName,input, index...(index + 9)) @index += 9 else terminal_parse_failure('wednesday') r4 = nil end if r4 r0 = r4 else if has_terminal?('thursday', false, index) r5 = instantiate_node(DayName,input, index...(index + 8)) @index += 8 else terminal_parse_failure('thursday') r5 = nil end if r5 r0 = r5 else if has_terminal?('friday', false, index) r6 = instantiate_node(DayName,input, index...(index + 6)) @index += 6 else terminal_parse_failure('friday') r6 = nil end if r6 r0 = r6 else if has_terminal?('saturday', false, index) r7 = instantiate_node(DayName,input, index...(index + 8)) @index += 8 else terminal_parse_failure('saturday') r7 = nil end if r7 r0 = r7 else @index = i0 r0 = nil end end end end end end end node_cache[:long_day_name][start_index] = r0 r0 end def _nt_short_day_name start_index = index if node_cache[:short_day_name].has_key?(index) cached = node_cache[:short_day_name][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index if has_terminal?('sun', false, index) r1 = instantiate_node(DayName,input, index...(index + 3)) @index += 3 else terminal_parse_failure('sun') r1 = nil end if r1 r0 = r1 else if has_terminal?('mon', false, index) r2 = instantiate_node(DayName,input, index...(index + 3)) @index += 3 else terminal_parse_failure('mon') r2 = nil end if r2 r0 = r2 else if has_terminal?('tue', false, index) r3 = instantiate_node(DayName,input, index...(index + 3)) @index += 3 else terminal_parse_failure('tue') r3 = nil end if r3 r0 = r3 else if has_terminal?('wed', false, index) r4 = instantiate_node(DayName,input, index...(index + 3)) @index += 3 else terminal_parse_failure('wed') r4 = nil end if r4 r0 = r4 else if has_terminal?('thu', false, index) r5 = instantiate_node(DayName,input, index...(index + 3)) @index += 3 else terminal_parse_failure('thu') r5 = nil end if r5 r0 = r5 else if has_terminal?('fri', false, index) r6 = instantiate_node(DayName,input, index...(index + 3)) @index += 3 else terminal_parse_failure('fri') r6 = nil end if r6 r0 = r6 else if has_terminal?('sat', false, index) r7 = instantiate_node(DayName,input, index...(index + 3)) @index += 3 else terminal_parse_failure('sat') r7 = nil end if r7 r0 = r7 else @index = i0 r0 = nil end end end end end end end node_cache[:short_day_name][start_index] = r0 r0 end def _nt_month_name start_index = index if node_cache[:month_name].has_key?(index) cached = node_cache[:month_name][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index r1 = _nt_long_month_name if r1 r0 = r1 else r2 = _nt_short_month_name if r2 r0 = r2 else @index = i0 r0 = nil end end node_cache[:month_name][start_index] = r0 r0 end def _nt_long_month_name start_index = index if node_cache[:long_month_name].has_key?(index) cached = node_cache[:long_month_name][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index if has_terminal?('january', false, index) r1 = instantiate_node(MonthName,input, index...(index + 7)) @index += 7 else terminal_parse_failure('january') r1 = nil end if r1 r0 = r1 else if has_terminal?('february', false, index) r2 = instantiate_node(MonthName,input, index...(index + 8)) @index += 8 else terminal_parse_failure('february') r2 = nil end if r2 r0 = r2 else if has_terminal?('march', false, index) r3 = instantiate_node(MonthName,input, index...(index + 5)) @index += 5 else terminal_parse_failure('march') r3 = nil end if r3 r0 = r3 else if has_terminal?('april', false, index) r4 = instantiate_node(MonthName,input, index...(index + 5)) @index += 5 else terminal_parse_failure('april') r4 = nil end if r4 r0 = r4 else if has_terminal?('may', false, index) r5 = instantiate_node(MonthName,input, index...(index + 3)) @index += 3 else terminal_parse_failure('may') r5 = nil end if r5 r0 = r5 else if has_terminal?('june', false, index) r6 = instantiate_node(MonthName,input, index...(index + 4)) @index += 4 else terminal_parse_failure('june') r6 = nil end if r6 r0 = r6 else if has_terminal?('july', false, index) r7 = instantiate_node(MonthName,input, index...(index + 4)) @index += 4 else terminal_parse_failure('july') r7 = nil end if r7 r0 = r7 else if has_terminal?('august', false, index) r8 = instantiate_node(MonthName,input, index...(index + 6)) @index += 6 else terminal_parse_failure('august') r8 = nil end if r8 r0 = r8 else if has_terminal?('september', false, index) r9 = instantiate_node(MonthName,input, index...(index + 9)) @index += 9 else terminal_parse_failure('september') r9 = nil end if r9 r0 = r9 else if has_terminal?('october', false, index) r10 = instantiate_node(MonthName,input, index...(index + 7)) @index += 7 else terminal_parse_failure('october') r10 = nil end if r10 r0 = r10 else if has_terminal?('november', false, index) r11 = instantiate_node(MonthName,input, index...(index + 8)) @index += 8 else terminal_parse_failure('november') r11 = nil end if r11 r0 = r11 else if has_terminal?('december', false, index) r12 = instantiate_node(MonthName,input, index...(index + 8)) @index += 8 else terminal_parse_failure('december') r12 = nil end if r12 r0 = r12 else @index = i0 r0 = nil end end end end end end end end end end end end node_cache[:long_month_name][start_index] = r0 r0 end def _nt_short_month_name start_index = index if node_cache[:short_month_name].has_key?(index) cached = node_cache[:short_month_name][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index if has_terminal?('jan', false, index) r1 = instantiate_node(MonthName,input, index...(index + 3)) @index += 3 else terminal_parse_failure('jan') r1 = nil end if r1 r0 = r1 else if has_terminal?('feb', false, index) r2 = instantiate_node(MonthName,input, index...(index + 3)) @index += 3 else terminal_parse_failure('feb') r2 = nil end if r2 r0 = r2 else if has_terminal?('mar', false, index) r3 = instantiate_node(MonthName,input, index...(index + 3)) @index += 3 else terminal_parse_failure('mar') r3 = nil end if r3 r0 = r3 else if has_terminal?('apr', false, index) r4 = instantiate_node(MonthName,input, index...(index + 3)) @index += 3 else terminal_parse_failure('apr') r4 = nil end if r4 r0 = r4 else if has_terminal?('may', false, index) r5 = instantiate_node(MonthName,input, index...(index + 3)) @index += 3 else terminal_parse_failure('may') r5 = nil end if r5 r0 = r5 else if has_terminal?('jun', false, index) r6 = instantiate_node(MonthName,input, index...(index + 3)) @index += 3 else terminal_parse_failure('jun') r6 = nil end if r6 r0 = r6 else if has_terminal?('jul', false, index) r7 = instantiate_node(MonthName,input, index...(index + 3)) @index += 3 else terminal_parse_failure('jul') r7 = nil end if r7 r0 = r7 else if has_terminal?('aug', false, index) r8 = instantiate_node(MonthName,input, index...(index + 3)) @index += 3 else terminal_parse_failure('aug') r8 = nil end if r8 r0 = r8 else if has_terminal?('sep', false, index) r9 = instantiate_node(MonthName,input, index...(index + 3)) @index += 3 else terminal_parse_failure('sep') r9 = nil end if r9 r0 = r9 else if has_terminal?('oct', false, index) r10 = instantiate_node(MonthName,input, index...(index + 3)) @index += 3 else terminal_parse_failure('oct') r10 = nil end if r10 r0 = r10 else if has_terminal?('nov', false, index) r11 = instantiate_node(MonthName,input, index...(index + 3)) @index += 3 else terminal_parse_failure('nov') r11 = nil end if r11 r0 = r11 else if has_terminal?('dec', false, index) r12 = instantiate_node(MonthName,input, index...(index + 3)) @index += 3 else terminal_parse_failure('dec') r12 = nil end if r12 r0 = r12 else @index = i0 r0 = nil end end end end end end end end end end end end node_cache[:short_month_name][start_index] = r0 r0 end module ZoneOffset0 end def _nt_zone_offset start_index = index if node_cache[:zone_offset].has_key?(index) cached = node_cache[:zone_offset][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0, s0 = index, [] if has_terminal?('\G[+-]', true, index) r1 = true @index += 1 else r1 = nil end s0 << r1 if r1 s2, i2 = [], index loop do if has_terminal?('\G[\\d]', true, index) r3 = true @index += 1 else r3 = nil end if r3 s2 << r3 else break end if s2.size == 2 break end end if s2.size < 2 @index = i2 r2 = nil else r2 = instantiate_node(SyntaxNode,input, i2...index, s2) end s0 << r2 if r2 if has_terminal?(':', false, index) r5 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure(':') r5 = nil end if r5 r4 = r5 else r4 = instantiate_node(SyntaxNode,input, index...index) end s0 << r4 if r4 s6, i6 = [], index loop do if has_terminal?('\G[\\d]', true, index) r7 = true @index += 1 else r7 = nil end if r7 s6 << r7 else break end if s6.size == 2 break end end if s6.size < 2 @index = i6 r6 = nil else r6 = instantiate_node(SyntaxNode,input, i6...index, s6) end s0 << r6 end end end if s0.last r0 = instantiate_node(ZoneOffset,input, i0...index, s0) r0.extend(ZoneOffset0) else @index = i0 r0 = nil end node_cache[:zone_offset][start_index] = r0 r0 end module HourMinuteSecond0 end module HourMinuteSecond1 end def _nt_hour_minute_second start_index = index if node_cache[:hour_minute_second].has_key?(index) cached = node_cache[:hour_minute_second][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end i0 = index i1, s1 = index, [] s2, i2 = [], index loop do if has_terminal?('\G[\\d]', true, index) r3 = true @index += 1 else r3 = nil end if r3 s2 << r3 else break end if s2.size == 2 break end end if s2.size < 2 @index = i2 r2 = nil else r2 = instantiate_node(SyntaxNode,input, i2...index, s2) end s1 << r2 if r2 if has_terminal?(':', false, index) r4 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure(':') r4 = nil end s1 << r4 if r4 s5, i5 = [], index loop do if has_terminal?('\G[\\d]', true, index) r6 = true @index += 1 else r6 = nil end if r6 s5 << r6 else break end if s5.size == 2 break end end if s5.size < 2 @index = i5 r5 = nil else r5 = instantiate_node(SyntaxNode,input, i5...index, s5) end s1 << r5 if r5 i8, s8 = index, [] if has_terminal?(':', false, index) r9 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure(':') r9 = nil end s8 << r9 if r9 s10, i10 = [], index loop do if has_terminal?('\G[\\d]', true, index) r11 = true @index += 1 else r11 = nil end if r11 s10 << r11 else break end if s10.size == 2 break end end if s10.size < 2 @index = i10 r10 = nil else r10 = instantiate_node(SyntaxNode,input, i10...index, s10) end s8 << r10 end if s8.last r8 = instantiate_node(SyntaxNode,input, i8...index, s8) r8.extend(HourMinuteSecond0) else @index = i8 r8 = nil end if r8 r7 = r8 else r7 = instantiate_node(SyntaxNode,input, index...index) end s1 << r7 end end end if s1.last r1 = instantiate_node(HourMinuteSecond,input, i1...index, s1) r1.extend(HourMinuteSecond1) else @index = i1 r1 = nil end if r1 r0 = r1 else if has_terminal?('beginning', false, index) r12 = instantiate_node(HourMinuteSecond,input, index...(index + 9)) @index += 9 else terminal_parse_failure('beginning') r12 = nil end if r12 r0 = r12 else if has_terminal?('end', false, index) r13 = instantiate_node(HourMinuteSecond,input, index...(index + 3)) @index += 3 else terminal_parse_failure('end') r13 = nil end if r13 r0 = r13 else @index = i0 r0 = nil end end end node_cache[:hour_minute_second][start_index] = r0 r0 end def _nt_integer start_index = index if node_cache[:integer].has_key?(index) cached = node_cache[:integer][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end s0, i0 = [], index loop do if has_terminal?('\G[\\d]', true, index) r1 = true @index += 1 else r1 = nil end if r1 s0 << r1 else break end end if s0.empty? @index = i0 r0 = nil else r0 = instantiate_node(Int,input, i0...index, s0) end node_cache[:integer][start_index] = r0 r0 end def _nt_space start_index = index if node_cache[:space].has_key?(index) cached = node_cache[:space][index] if cached cached = SyntaxNode.new(input, index...(index + 1)) if cached == true @index = cached.interval.end end return cached end if has_terminal?('\G[\\s\\t\\n]', true, index) r0 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else r0 = nil end node_cache[:space][start_index] = r0 r0 end end class NaturalTimeLanguageParser < Treetop::Runtime::CompiledParser include NaturalTimeLanguage end end