Sha256: c31c7e98277e1481918b999ddf1776da24886cbc94bca9e7a9c925934bc098e7

Contents?: true

Size: 797 Bytes

Versions: 8

Compression:

Stored size: 797 Bytes

Contents

module Tnql
  grammar Dates
    rule fuzzy_date
      date:(between_dates / on_dates) word_break <Nodes::FuzzyDateNode>
    end

    rule on_dates
      space ('on' / 'in') space date_fragment <Nodes::SpecificDateNode>
    end

    rule between_dates
      space 'between' space start:date_fragment space 'and' space finish:date_fragment <Nodes::FragmentedDateRangeNode>
    end

    rule date_fragment
     fragment:(daterange / chronic_date) word_break <Nodes::DateFragmentNode>
    end

    rule daterange
      day_or_month? day_or_month? year <Nodes::DateRangeNode>
    end

    rule day_or_month
      [0-9] 1..2 ('.' / '/')
    end

    rule year
      [0-9] 4..4
    end

    rule chronic_date
      (!(space ('and' / 'at' / 'with' / 'who')) .)+ <Nodes::ChronicDateNode>
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tnql-1.1.2 lib/tnql/grammars/dates.treetop
tnql-1.1.1 lib/tnql/grammars/dates.treetop
tnql-1.1.0 lib/tnql/grammars/dates.treetop
tnql-1.0.4 lib/tnql/grammars/dates.treetop
tnql-1.0.3 lib/tnql/grammars/dates.treetop
tnql-1.0.2 lib/tnql/grammars/dates.treetop
tnql-1.0.1 lib/tnql/grammars/dates.treetop
tnql-1.0.0 lib/tnql/grammars/dates.treetop