Module parse

Module parse 

Source
Expand description

Logic for parsing elements of the TeX grammar from token streams.

This parsing module is based around the Parsable trait, which is the most important type in the module. This trait is implemented by Rust types that correspond to elements of the TeX grammar. The trait implementation provides a way to parse grammar elements out of the input stream.

The module contains implementations of Parsable for tuples where each element is parsable. This allows expressions like <integer><relation><integer> to be parsed by one invocation of Parsable::parse, in this case on the type (i32, std::cmp::Ordering, i32).

The second most important thing is the collection of custom Rust types like OptionalEquals and FileLocation which correspond to Rust grammar elements.

Finally this module contains some functions for special situation like parsing lists of tokens.

Structs§

Error
FileLocation
Representation of a file location in TeX
LeftBrace
OptionalEquals
When parsed, this type consumes an optional equals from the token stream.
OptionalEqualsUnexpanded
When parsed, this type consumes an optional equals from the token stream without performing expansion.
OptionalSpace
When parsed, this type consumes an optional space from the token stream.
Ordering
Spaces
When parsed, this type consumes an arbitrary number of spaces from the input stream
SpacesUnexpanded
When parsed, this type consumes an arbitrary number of spaces from the unexpanded input stream
Uint
When parsed, this type returns a nonnegative integer with the provided upper bound.
UnexpandedTokenList

Traits§

Parsable
Implementations of this trait are elements of the TeX grammar than can be parsed from a stream of tokens.

Functions§

finish_parsing_balanced_tokens
Parses balanced tokens from the stream.
parse_keyword
Parses a keyword from the input stream.