Expand description
Modules§
- Trailing
Delimiter - Policy for the delimiter of the last element in a sequence. Note that delimiters are
after some element, for cases where you have leading delimiters you need to define
grammars that start with
DelimiterorOption<Delimiter>.
Structs§
- Delimited
Vec - Since the delimiter in
Delimited<T,D>is optional aVec<Delimited<T,D>>would parse consecutive values even without delimiters.DelimitedVec<T, D, MIN, MAX, P>will stop parsing by MIN/MAX number of elements and depending on the policy defined byPwhich can be one ofTrailingDelimiter. - LazyVec
- A
Vec<T>that is filled up to the first appearance of an terminatingS. ThisSmay be a subset ofT, thus parsing become lazy. This is the same asCons<Vec<Cons<Except<S>,T>>,S>but more convenient and efficient. - Lazy
VecUntil - A
Vec<T>that is filled up to the first appearance of an terminatingS. ThisSmay be a subset ofT, thus parsing become lazy. UnlikeLazyVecthis variant does not consume the final terminator. This is the same asVec<Cons<Except<S>,T>>>but more convenient. - NonEmpty
Option NonEmptyOption<T>preventsOptionfrom matching whenTcan succeed with empty input. It ensuresNoneis returned when no tokens remain, regardless of whetherTcould succeed on an empty stream. This is crucial when parsing optional trailing content that should only match if tokens are actually available to consume.
Traits§
- Ranged
Repeats - A trait for parsing a repeating
Twith a minimum and maximum limit. Sometimes the number of elements to be parsed is determined at runtime eg. a number of header items needs a matching number of values.
Type Aliases§
- Any
- Any number of T delimited by D or
Nothing - AtLeast
- At least N of T delimited by D or
Nothing - AtMost
- At most N of T delimited by D or
Nothing - Colon
Delimited Vec DelimitedVecofTdelimited by:withPas policy for the last delimiter.- Comma
Delimited Vec DelimitedVecofTdelimited by,withPas policy for the last delimiter.- DotDelimited
Vec DelimitedVecofTdelimited by.withPas policy for the last delimiter.- Exactly
- Exactly N of T delimited by D or
Nothing - Many
- One or more of T delimited by D or
Nothing - Optional
- Zero or one of T delimited by D or
Nothing - Path
SepDelimited Vec DelimitedVecofTdelimited by::withPas policy for the last delimiter.- Repeats
DelimitedVec<T,D>with a minimum and maximum (inclusive) number of elements at first without defaults. Parsing will succeed when at least the minimum number of elements is reached and stop at the maximum number. The delimiterDdefaults toNothingto parse sequences which don’t have delimiters.- Semicolon
Delimited Vec DelimitedVecofTdelimited by;withPas policy for the last delimiter.