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> assert %Context{status: :ok, ast: ?H, input: "ello World", index: 1, col: 2} = Ergo.parse(parser, "Hello World")

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

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

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