Expand description
This module provides helper types for common grammar idioms/needs, such as:
- Repetition
- Parenthesization, delimiting
- Separation of consecutive items
Modules
Tokens representing Rust punctuation, keywords, and delimiters.
Macros
A type-macro that expands to the name of the Rust type representation of a given token.
Structs
Marker type for CustomIdent
that allows parsing
any word as a valid identifier (i.e. it doesn’t mark any of them as a keyword).
Parses a subexpression inside curly braces.
Parses a subexpression inside square brackets.
An identifier which allows customizing the keywords of the language, i.e., which words should be accepted and rejected when parsing.
Always parses succesfully, consuming no tokens. Emits nothing when printed.
Verifies that parsing reached the end of the input (i.e., the end of the parse stream at the current level of nesting). Useful for ensuring that an input or a group is fully parsed by preceding types.
A word of Rust code, which may be a keyword or legal variable name.
Parses an optional expression introduced by a single-token lookahead.
Verifies that parsing did not yet reach the end of the input (i.e., the end of the parse stream at the current level of nesting). Useful for conditionally parsing an optional production with no other obvious prefix token.
Parses a subexpression inside parentheses.
Parses a given production repeatedly, separated by punctuation.
Optional trailing punctuation is allowed, and the entire token
stream must consist of interleaved representations of T
and P
.
(Thus, this is generally only useful within a delimited group.)
Parses a given production repeatedly, separated by punctuation. Trailing punctuation is not allowed, and the production must appear at least once in the input. Parsing stops gracefully once there are no more separators left at the head of the input stream.
Enums
Helper type for parsing left-associative binary infix operators.
Represents any literal value.
Helper type for parsing right-associative binary infix operators.
Traits
A trait for parameterizing CustomIdent
over a set of keywords.
Functions
Creates an Ident
spanned to the call site. Useful for testing.