mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 04:27:59 +01:00
19 lines
No EOL
392 B
Elixir
19 lines
No EOL
392 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 |