mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-12-22 08:58:00 +01:00
21 lines
428 B
Elixir
21 lines
428 B
Elixir
defmodule PhilomenaQuery.Parse.BoolParser do
|
|
@moduledoc false
|
|
|
|
import NimbleParsec
|
|
|
|
space =
|
|
choice([string(" "), string("\t"), string("\n"), string("\r"), string("\v"), string("\f")])
|
|
|> ignore()
|
|
|
|
bool =
|
|
choice([
|
|
string("true"),
|
|
string("false")
|
|
])
|
|
|> repeat(space)
|
|
|> unwrap_and_tag(:bool)
|
|
|> eos()
|
|
|> label("a boolean, like `true' or `false'")
|
|
|
|
defparsec(:parse, bool)
|
|
end
|