Module chumsky::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

Traits

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

Functions

  • A parser that accepts any input (but not the end of input).
  • Parse using a tuple or array of many parsers, producing the output of the first to successfully parse.
  • A parser primitive that allows you to define your own custom parsers.
  • A parser that parses no inputs.
  • A parser that accepts only the end of input.
  • A parser that accepts only inputs that match the given predicate.
  • A parser that accepts a input and tests it against the given fallible function.
  • A parser that accepts only the given input.
  • A parser that accepts any input that is not in a sequence of specific inputs.
  • A parser that accepts one of a sequence of specific inputs.
  • seqDeprecated
    A parser that accepts only a sequence of specific inputs.
  • A parser that accepts any number of inputs until a terminating pattern is reached.
  • A parser that can be used wherever you need to implement a parser later.

Type Definitions