Crate parser_compose

source ·
Expand description

See the README.md for a crash course in parser combinators.

The crate is logically organized into two parts

Parsers

Any rust items that implement the Parser trait can parse input by calling try_parse()

Additionally, any function with the right signature automatically becomes a parser.

Parser combinators

The associated methods on the Parser trait are used to combine with other parsers.

The sequence combinator is so common that it has a special form. Tuples of parsers implement Parser such that the tuple parser succeeds if all its parsers succeed.

Structs

  • A parser that applies a function to the successful result of its inner parser
  • A parser that tries both inner parsers in turn, returning the result of the first one that succeeds
  • A parser that succeeds if the result of parsing the inner parser causes the predicate to pass
  • A parser that succeeds if inner parser repeatedly matches a specified number of times

Enums

  • The error type for parsers and their combinators

Traits

Functions

  • A parser that matches the first byte in a byte slice.
  • A parser that matches the first char at the start of the string slice.

Type Aliases

  • The return value of this crate’s parsers