add missing eos token to force dase parser to backtrack

This commit is contained in:
byte[] 2020-02-06 18:01:22 -05:00
parent 8cb8e303a7
commit 25ea2013c6

View file

@ -157,6 +157,7 @@ defmodule Search.DateParser do
absolute_date = absolute_date =
date_part date_part
|> optional(timezone_part) |> optional(timezone_part)
|> eos()
|> post_traverse(:absolute_datetime) |> post_traverse(:absolute_datetime)
|> unwrap_and_tag(:date) |> unwrap_and_tag(:date)
@ -173,6 +174,7 @@ defmodule Search.DateParser do
string("year") |> optional(string("s")) |> replace(31_536_000) string("year") |> optional(string("s")) |> replace(31_536_000)
]) ])
|> ignore(string(" ago")) |> ignore(string(" ago"))
|> eos()
|> reduce(:relative_datetime) |> reduce(:relative_datetime)
|> unwrap_and_tag(:date) |> unwrap_and_tag(:date)