#! env ruby # something to help examine the possible variations of a sub-pattern # run without arguments to see usage # mind the expontential complexity! raw = <<-END.gsub %r{//.*$}, '' TOP -> r(r"\A") r(r"\z") // non-terminal patterns // these are roughly ordered by dependency time_expression => | particular => | one_time => two_times -> ("from")? to => | moment_or_period => | period => | specific_period => | | | modified_period -> ? // replacing [["week", "month", "year", "pay period", "payperiod", "pp", "weekend"]] with // because this script doesn't have handling for the [...] pattern modifiable_period => | | month_and_year -> year => | ("-")? year -> year_suffix => | relative_period -> count => r(r"[1-9][0-9]*") | named_period => | moment -> ? adjustment -> // two minutes before amount -> point_in_time -> ? ? | |