Ergo.Terminals.digit

You're seeing just the function digit, go back to Ergo.Terminals module for more information.

The digit/0 parser accepts a character in the range of 0..9

Examples

iex> alias Ergo.Context
iex> import Ergo.Terminals
iex> parser = digit()
iex> Ergo.parse(parser, "0000")
%Context{status: :ok, char: ?0, ast: ?0, input: "000", index: 1, line: 1, col: 2}

iex> alias Ergo.Context
iex> import Ergo.Terminals
iex> import Ergo.Terminals
iex> parser = digit()
iex> Ergo.parse(parser, "AAAA")
%Context{status: {:error, :unexpected_char}, message: "Expected: 0..9 Actual: A", char: 0, input: "AAAA", index: 0, line: 1, col: 1}

iex> alias Ergo.{Context, Parser}
iex> import Ergo.Terminals
iex> context = Context.new()
iex> parser = digit()
iex> Parser.call(parser, context)
%Context{status: {:error, :unexpected_eoi}, message: "Unexpected end of input", char: 0, input: "", index: 0, line: 1, col: 1}