Module parser

Module parser 

Source
Expand description

Parser combinator library.

Macros§

byte_map
Helper to create a parser::byte_lut parser using match-like syntax.
literal_map
Helper to create a Leaf parser matching string literals using match-like syntax.
parsable_enum
Helper to define a Parseable fieldless unit-only enum.
parse_tree
Helper to define a custom Parser using a match inspired parse tree syntax.

Structs§

ErrToken
ZST used to ensure that Parser implementations push errors to ParseState.
ParseState
Per-parse shared state.
ParserIterator
An iterator that lazily parses the input using the provided parser.
ParserMatchesIterator
An iterator which returns successful parse outputs only, skipping over errors.

Enums§

ParseError
Error type returned by parsers.

Traits§

Leaf
Trait implemented by atomic, fail‑fast parsers.
Parseable
Trait for types that have a canonical Leaf parser.
Parser
Trait implemented by all parsers.

Functions§

byte
Leaf parser that consumes a single byte.
byte_lut
Leaf parser that consumes a single byte and maps it using a lookup table.
byte_range
Leaf parser that consumes a single byte in the supplied range.
constant
Leaf parser that consumes no input and always succeeds, returning the provided value.
digit
Leaf parser for single digits.
eof
Leaf parser which matches the end of the input.
eol
Leaf parser which matches newlines or the end of the input.
from_leaf_fn
Coerces the provided function/closure into a Leaf parser.
from_parser_fn
Parser which delegates to the provided function/closure.
i8
Leaf parser for i8 values.
i16
Leaf parser for i16 values.
i32
Leaf parser for i32 values.
i64
Leaf parser for i64 values.
i128
Leaf parser for i128 values.
noop
Leaf parser that consumes no input and always succeeds, returning ().
number_range
Leaf parser for numbers in the supplied range.
one_of
Parser which tries a list of parsers in order until one succeeds.
take_while
Leaf parser for substrings matching the provided function.
take_while1
Leaf parser for non-empty substrings matching the provided function.
u8
Leaf parser for u8 values.
u16
Leaf parser for u16 values.
u32
Leaf parser for u32 values.
u64
Leaf parser for u64 values.
u128
Leaf parser for u128 values.

Type Aliases§

LeafResult
Result type returned by Leaf::parse.
ParserResult
Result type returned by Parser::parse_ctx.