luther

Crates.ioluther
lib.rsluther
version0.1.0
sourcesrc
created_at2018-05-28 00:42:15.040549
updated_at2018-05-28 00:42:15.040549
descriptionThe runtime components of the Luther lexer generator.
homepage
repositoryhttps://github.com/sbosnick/luther
max_upload_size
id67399
size53,229
Engineering (github:work180:engineering)

documentation

README

Luther

Luther is an embedded lexer generator for stable Rust.

Build Status Coverage Status

Usage

Luther is current very much a work in progress. The following roughly how it works:

extern crate luther;
#[macro_use]
extern crate luther_derive;

#[derive(Lexer)]
enum Token {
    #[luther(regex="ab")]
    Ab,

    #[luther(regex="acc*")]
    Acc,
}

fn main() {
    use luther::Lexer;

    let input = ... // some suitable iterator

    let tokens = Tokens::lexer(input)
        .map(|r| r.map(|s| s.into_inner()));

    // use tokens
}

The syntax outlined above has a few rough edges that should be smothed out before Luther is ready for prime-time.

The procedural macro implementation that provdes the #[derive(Lexer)] and recognized the #[luther(...)] attributes is in the luther-derive crate.

The intention is for the tokens iterator from the above example to be a suitable candate for an external lexer for the parser generator Lalrpop.

License

Luther is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Luther by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 93

cargo fmt