Trait enso_flexer::State[][src]

pub trait State {
    fn new(parent_logger: &impl AnyLogger) -> Self;
fn initial_state(&self) -> Identifier;
fn groups(&self) -> &Registry;
fn groups_mut(&mut self) -> &mut Registry;
fn bookmarks(&self) -> &BookmarkManager;
fn bookmarks_mut(&mut self) -> &mut BookmarkManager;
fn specialize(&self) -> Result<String, GenError>; }
Expand description

Contains the state needed by the flexer from a lexer implementation.

The types for which this trait is implemented will normally also contain the user-defined state for that lexer.

Required methods

fn new(parent_logger: &impl AnyLogger) -> Self[src]

Expand description

Create a new instance of the lexer’s state.

This function is guaranteed to be called at most once per run of the lexer.

fn initial_state(&self) -> Identifier[src]

Expand description

Return the initial lexing state.

fn groups(&self) -> &Registry[src]

Expand description

Return a reference to the group registry for a given lexer.

fn groups_mut(&mut self) -> &mut Registry[src]

Expand description

Return a mutable reference to the group registry for a given lexer.

fn bookmarks(&self) -> &BookmarkManager[src]

Expand description

Get an immutable reference to the bookmark manager for this state.

fn bookmarks_mut(&mut self) -> &mut BookmarkManager[src]

Expand description

Get a mutable reference to the bookmark manager for this state.

fn specialize(&self) -> Result<String, GenError>[src]

Expand description

Generate code to specialize the flexer for the user’s particular lexer definition.

This function should be implemented as a call to generate::specialize, passing the name of your lexer, and the name of your lexer’s output type as a string.

Loading content...

Implementors

Loading content...