Crates.io | rflex |
lib.rs | rflex |
version | 0.8.1 |
source | src |
created_at | 2019-04-08 11:16:44.254617 |
updated_at | 2024-01-26 11:31:31.161811 |
description | Fast lexer code generator for Rust |
homepage | |
repository | https://github.com/pfnet/rflex |
max_upload_size | |
id | 126578 |
size | 183,264 |
rflex is a fast lexical analyzer generator for Rust.
cargo install rflex
or
Write your Cargo.toml and build.rs
[package]
# ...
build = "build.rs"
[build-dependencies]
# ...
failure = "0.1.5"
rflex = "0.8"
extern crate rflex;
use std::env;
use std::path::Path;
fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let dest = Path::new(&out_dir).join("target.rs");
let path = Path::new("src").join("target.l");
if let Err(e) = rflex::process(path, Some(dest)) {
for cause in failure::Fail::iter_chain(&e) {
eprintln!("{}: {}", cause.name().unwrap_or("Error"), cause);
}
std::process::exit(1);
}
}
See tutorial.md.
e{num}
... repeat e num
timese{min,max}
... repeat e min
to max
timese/s
... lookahead s
before accept e
These libraries are used only rflex lexer generator, generated code doesn't depend on them.