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
  • filter: parses a single input, if the given filter function returns true
  • end: parses the end of input (i.e: if there any more inputs, this parse fails)

Structs§

Choice
See choice.
Custom
See custom.
Empty
See empty.
End
See end.
Filter
See filter.
FilterMap
See filter_map.
Just
See just.
NoneOf
See none_of.
OneOf
See one_of.
Seq
See seq.
TakeUntil
See take_until.
Todo
See todo.

Traits§

Container
A utility trait to abstract over container-like things.
OrderedContainer
A utility trait to abstract over linear and ordered container-like things, excluding things such as sets and heaps.

Functions§

any
A parser that accepts any input (but not the end of input).
choice
Parse using a tuple or array of many parsers, producing the output of the first to successfully parse.
custom
A parser primitive that allows you to define your own custom parsers.
empty
A parser that parses no inputs.
end
A parser that accepts only the end of input.
filter
A parser that accepts only inputs that match the given predicate.
filter_map
A parser that accepts a input and tests it against the given fallible function.
just
A parser that accepts only the given input.
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.
seqDeprecated
A parser that accepts only a sequence of specific inputs.
take_until
A parser that accepts any number of inputs until a terminating pattern is reached.
todo
A parser that can be used wherever you need to implement a parser later.

Type Aliases§

Any
See any.