Crates.io | luther |
lib.rs | luther |
version | 0.1.0 |
source | src |
created_at | 2018-05-28 00:42:15.040549 |
updated_at | 2018-05-28 00:42:15.040549 |
description | The runtime components of the Luther lexer generator. |
homepage | |
repository | https://github.com/sbosnick/luther |
max_upload_size | |
id | 67399 |
size | 53,229 |
Luther is an embedded lexer generator for stable Rust.
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.
Luther is licensed under either of
at your option.
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.