Crate lrlex

source
Expand description

lrlex is a partial replacement for lex / flex. It takes in a .l file and statically compiles it to Rust code. The resulting LRNonStreamingLexerDef can then be given an input string, from which it instantiates an LRNonStreamingLexer. This provides an iterator which can produce the sequence of lrpar::Lexemes for that input, as well as answer basic queries about cfgrammar::Spans (e.g. extracting substrings, calculating line and column numbers).

Re-exports§

  • pub use crate::lexer::RegexOptions;
  • pub use crate::lexer::Rule;
  • pub use crate::parser::StartState;
  • pub use crate::parser::StartStateOperation;

Modules§

  • A module for lifting restrictions on visibility by enabling unstable features.

Macros§

Structs§

Enums§

Constants§

Traits§

  • Methods which all lexer definitions must implement.

Functions§

  • Create a Rust module named mod_name that can be imported with lrlex_mod!(mod_name). The module contains one const StorageT per token in token_map, with the token prefixed by T_. For example with StorageT u8, mod_name x, and token_map HashMap{"ID": 0, "INT": 1} the generated module will look roughly as follows:

Type Aliases§