mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 20:37:59 +01:00
19 lines
394 B
Elixir
19 lines
394 B
Elixir
defmodule Search.BoolParser do
|
|
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
|