Crate parser_compose

source ·
Expand description

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

The crate is logically organized into three parts

Parsers

Any rust item that implements the Parser trait can parse input by calling try_parse()

Additionally the Parser trait is implemented for all function with a particular signature.

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.

Errors

parser-compose take a simple approach to error handling: Builtin parsers report errors by appendding to a Failurelog. If the top level parser fails, the result will contain an instance of this structure.

Examples

Checkout the integration test directory for concrete parsing examples.

Structs

Enums

  • The reason parsing failed

Traits

Functions

  • A parser that recognizes the first item in a slice.
  • A parser that recognizes the first unicode scalar value at the start of a string slice.
  • A parser that succeeds if there is no more input to consume.
  • Returns a parser that recognizes the first unicode scalar value in a string slice if its value is in the specified range

Type Aliases