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 a Span with a file identifier F to pin point a syntactic element in a source file.
  • Loc<T, F> wraps any value T and bind it to 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

Located data.

Syntax element location.

Range of bytes in a source file.

Traits

Provides the at function to locate any value.

Locates the error of a Result<T, E>.

Maps the located error of a Result<T, Loc<E, F>>.

Type that can be stripped of its location information.

Provides a transposition function from Option<Loc<T, F>> to Loc<Option<T>, F>.