Crate logos

source ·
Expand description
Logos logo

Logos

Create ridiculously fast Lexers.

Logos has two goals:

  • To make it easy to create a Lexer, so you can focus on more complex problems.
  • To make the generated Lexer faster than anything you’d write by hand.

To achieve those, Logos:

See the Logos handbook for additional documentation and usage examples.

Re-exports

  • pub use crate::source::Source;

Modules

  • This module contains a bunch of traits necessary for processing byte strings.

Structs

  • Lexer is the main struct of the crate that allows you to read through a Source and produce tokens for enums implementing the Logos trait.
  • Type that can be returned from a callback, informing the Lexer, to skip current token match. See also logos::skip.
  • Iterator that pairs tokens with their position in the source.

Enums

  • Type that can be returned from a callback, either producing a field for a token, or skipping it.
  • Type that can be returned from a callback, either producing a field for a token, skipping it, or emitting an error.

Traits

  • Trait implemented for an enum representing all tokens. You should never have to implement it manually, use the #[derive(Logos)] attribute on your enum.

Functions

  • Predefined callback that will inform the Lexer to skip a definition.

Type Aliases

  • Byte range in the source.

Derive Macros