Expand description
This library provides essentials types and trait to locate syntax elements.
Span
describes a byte range in a source file, with an intuitive API to write lexers and parsers.Location<F>
combines aSpan
with a file identifierF
to pin point a syntactic element in a source file.Meta<T, M>
wraps any valueT
with some metadata of typeM
.Loc<T, F, S> = Meta<T, Location<F, S>>
wraps any valueT
and with its location.
Extra traits are also provided to extend common types (Option
, Result
, etc.) with localization functions.
The crate integrates well with diagnostic reporting libraries such as
codespan-reporting
to render beautiful error reports.
Structs
- Syntax element location.
- Data and its metadata.
- Range of bytes in a source file.
- Wrapper to consider values without metadata.
Traits
- Provides the
at
function to locate any value. - Locates the error of a
Result<T, E>
. - Value with a location.
- Maps the located error of a
Result<T, Meta<E, F>>
. - Provides a function to map the metadata inside a recursive data structure.
- Value with an optional location.
- Value with an optional span.
- Value with an optional span.
- Provides a transposition function from
Option<Meta<T, M>>
toMeta<Option<T>, M>
. - Value with a span.
- Value with a mutable span.
- Type that can be stripped of its metadata.
- Defines the total equality of values without considering metadata.
- Defines the partial ordering of located values without considering locations.
- Defines the partial ordering of located values without considering locations.
- Defines the equality of values without considering the metadata.
- Defines the partial ordering of located values without considering locations.
- Provides a function that tries to map the metadata inside a recursive data structure.
Type Aliases
- Data with
Location
metadata.