Ergo.Combinators.not_lookahead
You're seeing just the function
not_lookahead
, go back to Ergo.Combinators module for more information.
Link to this function
not_lookahead(parser)
The not_lookahead
parser accepts a parser and attempts to match it. If the match fails the not_lookahead parser returns status: :ok but does not affect the context otherwise.
If the match succeeds the not_lookahead
parser fails with {:error, :lookahead_fail}
Examples
iex> alias Ergo.{Context, Terminals, Combinators} iex> context = Context.new("Hello World") iex> parser = Combinators.not_lookahead(Terminals.literal("Foo")) iex> parser.(context) %Context{status: :ok, input: "Hello World"}
iex> alias Ergo.{Context, Terminals, Combinators} iex> context = Context.new("Hello World") iex> parser = Combinators.not_lookahead(Terminals.literal("Hello")) iex> parser.(context) %Context{status: {:error, :lookahead_fail}, input: "Hello World"}