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 but comprehensive approach to error handling: All parsers and combinators report errors by building up an ErrorTree. If the top level parser fails, the result will contain an instance of this tree.

Examples

Checkout the integration test directory for concrete parsing examples.

Structs

Enums

Traits

Functions

  • A parser that recognizes the first byte in a byte slice.
  • A parser that recognizes the first unicode scalar value at the start of a string slice.
  • Returns a parser that recognizes the first byte in a byte slice if its value is in the specified range
  • 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

  • The return value of this crate’s parsers