1 unstable release
Uses old Rust 2015
0.1.0 | May 28, 2018 |
---|
#1457 in Development tools
Used in luther-derive
35KB
628 lines
Luther
Luther is an embedded lexer generator for stable Rust.
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
- Apache License, Version 2.0, (LICENSE-APACHE-2.0 or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
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.
Dependencies
~215KB