pub struct Lexer<T: Tokenizer> { /* private fields */ }
Expand description

Provides machinery for splitting up an underlying sequence of items into a sequence of tokens, where each token can correspond to one or more items in the underlying sequence.

Implementations

Construct a new lexer for a given string slice.

Determine the current lexing position

Reset the lexing position to a given (known) offset.

Check whether the lexer has reached the end of the file or not.

Get the slice which corresponds to a given span from the underlying sequence.

Peek at the next token in the sequence, or none if we have reached the end.

Get the next token in the sequence, or none if we have reached the end.

Match a given token type in the current stream. If the kind matches, then the token stream advances. Otherwise, it remains at the same position and an error is returned.

Match a given token type in the current stream for a set of candidates. If one of the candidates matches, then the token stream advances. Otherwise, it remains at the same position and an error is returned.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.