rulex-macro

Crates.iorulex-macro
lib.rsrulex-macro
version0.4.4
sourcesrc
created_at2022-03-11 16:42:18.464852
updated_at2022-08-24 19:28:58.476781
descriptionDEPRECATED: Use pomsky-macro instead. Macro for converting pomsky expressions to regexes
homepagehttps://pomsky-lang.org
repositoryhttps://github.com/rulex-rs/pomsky
max_upload_size
id548332
size9,209
Ludwig Stecher (Aloso)

documentation

https://docs.rs/rulex-macro

README

rulex-macro

⚠️ DEPRECATED ⚠️ Use the pomsky-macro crate instead. Rulex was renamed to pomsky.

This Rust procedural macro allows converting a rulex expression to a regex string literal at compile time:

use rulex_macro::rulex;

const REGEX: &str = rulex!("foo" | "bar"+ greedy);

This string can then used with the regex crate:

let my_regex = regex::Regex::new(REGEX).unwrap();

Diagnostics

Errors from rulex are shown at compile time and are highlighted in your IDE. You can improve the diagnostics by enabling the diagnostics feature, which requires Rust Nightly.

Regex flavor

If you want to use a regex flavor other than Rust, you can specify it after a hashtag:

const REGEX: &str = rulex!(
    #flavor = Pcre
    >> "test" %
);

License

Dual-licensed under the MIT license or the Apache 2.0 license.

Commit count: 346

cargo fmt