Ergo.Terminals.not_char
You're seeing just the function
not_char
, go back to Ergo.Terminals module for more information.
Link to this function
not_char(c_or_l, opts \\ [])
The not_char matcher accepts a char or a list of chars and will match any char that is not in the list.
Examples
iex> alias Ergo.Context
iex> import Ergo.Terminals
iex> parser = not_char(?0)
iex> assert %Context{status: {:error, [{:unexpected_char, {1, 1}, "Should not have matched |0|"}]}, input: "0000"} = Ergo.parse(parser, "0000")
iex> assert %Context{status: :ok, ast: ?1} = Ergo.parse(parser, "1111")
iex> parser = not_char([?{, ?}])
iex> assert %Context{status: {:error, [{:unexpected_char, {1, 1}, "Should not have matched |{|"}]}, input: "{}"} = Ergo.parse(parser, "{}")
iex> assert %Context{status: {:error, [{:unexpected_char, {1, 1}, "Should not have matched |}|"}]}, input: "}"} = Ergo.parse(parser, "}")