pelecanus v0.3.0 Pelecanus
Parser combinator for Elixir
Using
Pelecanus
provide macro __using__/1
.
Using Pelecanus,
basical submodules such as Pelecanus.TerminalSymbol
or Pelecanus.Operator
are imported.
You can pass option sigil_p: true
.
When this flag is set, it also import Pelecanus.Sigil
which provide sigil ~p
.
~p/foo/bar
is shortened form of term("foo", "bar")
.
Example
iex> use Pelecanus, sigil_p: true
iex> parser = sequence [~p/hello/, ~p/, /, ~p/.+/]
iex> {:ok, _, result} = Pelecanus.parse "hello, world", parser
iex> result
["hello", ", ", "world"]
Link to this section Summary
Link to this section Types
Link to this section Functions
IO.inspect/2
wrapper
The parser show what given parser returned, and return it.
Opts are directory passed to IO.inspect/2
Link to this function
inspect(device, e, opts)
IO.inspect/3
wrapper
See also Pelecanus.inspect/2
Link to this function
parse(string, e)
Parses given string with given parser.
This ensure all graphemes in given string are consumed.
If some graphemes remain this returns {:error, reason}