Ergo.Terminals.literal
You're seeing just the function
literal
, go back to Ergo.Terminals module for more information.
Link to this function
literal(s, opts \\ [])
The literal/1
parser matches the specified string character by character.
Examples
iex> alias Ergo.Context
iex> import Ergo.Terminals
iex> parser = literal("Hello")
iex> assert %Context{status: :ok, input: " World", ast: "Hello", index: 5, line: 1, col: 6} = Ergo.parse(parser, "Hello World")
iex> alias Ergo.Context
iex> import Ergo.Terminals
iex> parser = literal("Hello")
iex> assert %Context{status: {:error, [{:bad_literal, {1, 5}, "literal<Hello>"}, {:unexpected_char, {1, 5}, "Expected: o Actual: x"}]}, input: "x World", index: 4, line: 1, col: 5} = Ergo.parse(parser, "Hellx World")