Ergo.Terminals.wc

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

The wc/0 parser parses a word character and is analagous to the \w regular expression.

Examples

iex> alias Ergo.Context
iex> import Ergo.Terminals
iex> parser = wc()
iex> Ergo.parse(parser, "Hello World")
%Context{status: :ok, char: ?H, ast: ?H, input: "ello World", index: 1, col: 2}

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

iex> alias Ergo.Context
iex> import Ergo.Terminals
iex> parser = wc()
iex> Ergo.parse(parser, "_Hello")
%Context{status: :ok, char: ?_, ast: ?_, input: "Hello", index: 1, col: 2}

iex> alias Ergo.Context
iex> import Ergo.Terminals
iex> parser = wc()
iex> Ergo.parse(parser, " Hello")
%Context{status: {:error, :unexpected_char}, message: "Expected: [0..9, a..z, A..Z, _] Actual:  ", input: " Hello"}