Skip to main content

Module primitive

Module primitive 

Source
Expand description

Parser primitives that accept specific token patterns.

“These creatures you call mice, you see, they are not quite as they appear. They are merely the protrusion into our dimension of vastly hyperintelligent pandimensional beings.”

Chumsky parsers are created by combining together smaller parsers. Right at the bottom of the pile are the parser primitives, a parser developer’s bread & butter. Each of these primitives are very easy to understand in isolation, usually only doing one thing.

§The Important Ones

  • just: parses a specific input or sequence of inputs
  • any: parses any single input
  • one_of: parses any one of a sequence of inputs
  • none_of: parses any input that does not appear in a sequence of inputs
  • end: parses the end of input (i.e: if there any more inputs, this parse fails)

Structs§

Any
See any.
AnyRef
See any_ref.
Choice
See choice.
Custom
See custom.
Empty
See empty.
End
See end.
Group
See group.
Just
See just.
JustCfg
Configuration for just, used in ConfigParser::configure
MapCtx
See map_ctx.
NoneOf
See none_of.
OneOf
See one_of.
OneOfCfg
Configuration for one_of, used in ConfigParser::configure
Select
See select!.
SelectRef
See select_ref!.
Set
See set.
Todo
See todo.

Functions§

any
A parser that accepts any input (but not the end of input).
any_ref
A parser that accepts any input (but not the end of input).
choice
Parse using a tuple of many parsers, producing the output of the first to successfully parse.
custom
Declare a parser that uses custom imperative parsing logic.
empty
A parser that parses no inputs.
end
A parser that accepts only the end of input.
group
Parse using a tuple of many parsers, producing a tuple of outputs if all successfully parse, otherwise returning an error if any parsers fail.
just
A parser that accepts only the given input.
map_ctx
Apply a mapping function to the context of this parser.
none_of
A parser that accepts any input that is not in a sequence of specific inputs.
one_of
A parser that accepts one of a sequence of specific inputs.
select
See select!.
select_ref
See select_ref!.
set
Parse using a tuple of parsers in any order, producing the output of the parser set in the provided order.
todo
A parser that can be used wherever you need to implement a parser later.