philomena/lib/search/bool_parser.ex

14 lines
248 B
Elixir
Raw Normal View History

2019-11-02 19:34:25 +01:00
defmodule Search.BoolParser do
import NimbleParsec
bool =
choice([
string("true"),
string("false")
])
|> unwrap_and_tag(:bool)
|> eos()
2019-11-02 21:31:55 +01:00
|> label("a boolean, like `true' or `false'")
2019-11-02 19:34:25 +01:00
defparsec :parse, bool
end