Expand description
Common functions to drop in instead of reinventing the wheel.
Modules§
- lang
- Common patterns in programming languages.
- precedence
- Operator-precedence parsing, e.g. for infix math.
Structs§
- AnySeq
- Match any of a set of sequences of options. Set represented as a binary tree for efficient lookup.
- Anything
- Match any single item and return a reference to it.
- End
- Make sure we’ve reached exactly the end of the stream of input; don’t advance to it.
- Exact
Seq - Match exactly this sequence of items.
- Optional
- Parse if possible; otherwise, don’t move.
- Parse
While - Continue parsing while a predicate holds. Return a contiguous slice referencing the section of input that held.
- Punctuated
- Parse a punctuated (e.g. comma-separated) list of elements determined by the parsers passed in here.
- Punctuated
Meaningfully - Parse a punctuated (e.g. by mathematical operators) list of elements determined by the parsers passed in here.
- Runaway
- Continue parsing as long as we can. Return a contiguous slice referencing the section of input that successfully parsed.
Functions§
- any
- Match any of a set of options. Set represented as a binary tree for efficient lookup.
- any_seq
- Match any of a set of sequences of options, preferring the longest applicable. Set represented as a binary tree for efficient lookup.
- anything
- Match any single item and return a reference to it.
- comma_
separated - Match any of a set of sequences of options. Set represented as a binary tree for efficient lookup.
- digit
- Match a single digit.
- end
- Make sure we’ve reached exactly the end of the stream of input; don’t advance to it.
- exact
- Match exactly this item and return a reference to the original (not the parsed one).
- exact_
seq - Match exactly this sequence of items.
- lowercase
- Match any lowercase letter and return a reference to it.
- maybe_
space - Match zero or more whitespace characters and return a reference to their contiguous slice.
- need_
space - Match one or more whitespace characters and return a reference to their contiguous slice.
- not
- Return anything that does not satisfy this predicate.
- optional
- Parse if possible; otherwise, don’t move.
- parse_
while - Match any of a set of sequences of options. Set represented as a binary tree for efficient lookup.
- punctuated
- Match any of a set of sequences of options. Set represented as a binary tree for efficient lookup.
- punctuated_
meaningfully - Match any of a set of sequences of options. Set represented as a binary tree for efficient lookup.
- runaway
- Match any of a set of sequences of options. Set represented as a binary tree for efficient lookup.
- satisfy
- Skip zero or more items while this predicate holds on them.
- satisfy_
result - Skip zero or more items while this predicate holds on them.
- screaming_
case - Match a
SCREAMING_CASEterm. - signed_
integer - Match a base-ten signed integer.
- snake_
case - Match a
snake_caseterm. - unsigned_
integer - Match a base-ten unsigned integer.
- uppercase
- Match any uppercase letter and return a reference to it.