Crate luther [] [src]

A library for creating a lexer for a token type.

The motivating case for this crate is a token enum that has the Lexer trait implemented on it. The lexer method of this trait will return a token iterator when given a char iterator.

The Lexer trait would normally be derived through the luther-derive crate.

The input to the lexer method is a fallible iterator (i.e. an iterator with a Result item type) over a Span of char. The output is a fallible iterator over a Span of the token type.

Modules

dfa

Defines the LexerIter iterator that lexes a char iterator using a supplied deterministic finite automaton.

spanned

Defines iterators and other utilities for working with Span<T>.

Structs

Location

An abstract location within a stream of tokens or characters.

Span

Wraps a value with start and end Location's.

Enums

LexError

The error type for the lexers produced by Lexer implementations.

Traits

Lexer

An interface for creating a lexer for a char iterator for the type on which it is implemented.

Type Definitions

Result

A specialized Result type for lexer operations.