Crates.io | regex-lexer-lalrpop |
lib.rs | regex-lexer-lalrpop |
version | 0.3.0 |
source | src |
created_at | 2021-09-09 09:54:55.04187 |
updated_at | 2021-10-28 15:48:08.902388 |
description | A regex-based lexer (tokenizer) |
homepage | https://github.com/sandeep-datta/regex-lexer-lalrpop |
repository | https://github.com/sandeep-datta/regex-lexer-lalrpop |
max_upload_size | |
id | 448791 |
size | 27,967 |
A regex-based lexer (tokenizer) in Rust.
enum Token {
Num(usize),
// ...
}
let lexer = regex_lexer::LexerBuilder::new()
.token(r"[0-9]+", |num| Some(Token::Num(num.parse().unwrap())))
.token(r"\s+", |_| None) // skip whitespace
// ...
.build();
let tokens = lexer.tokens(/* source */);
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusing in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.