[][src]Module ttk91::parsing

Types and traits for common parsing functionality.

Structs

AssertToken

A parsing operation which consumes a specific token from the token stream or returns an error if the next token in the stream is not what was specified.

BufferedStream

An adapter that can be used to create SeekStreams from any type implementing the Iterator trait.

TakeToken

A parsing operation which consumes a specific token from the token stream and returns the token. If the next token in the stream is not what was specified, returns an error.

Enums

Context

Context type for parsing errors.

Either

An enum that contains either one of the two types L and R.

ErrorKind

Common error cases for parsing. Cases specific to the format being parsed can be defined via the K type parameter.

Traits

Operation

A parsing operation. Basically a function of the type FnOnce(&mut Parser) -> Result<Output, ParseError<Kind, Token>>.

Parser

Trait which provides convinience methods for parsers operating on SeekStreams of tokens and their Spans.

SeekStream

A stream that supports seeking.

Functions

assert_token

A convinience function that creates an AssertToken operation.

either

Tries both provided parsing operations and returns the result of the one that succeeds. If neither of the operations succeeds, tries to be clever about the error message that it returns.

take_token

A convinience function that creates a TakeToken operation.

Type Definitions

ParseError
Span