Crates.io | rulex-macro |
lib.rs | rulex-macro |
version | 0.4.4 |
source | src |
created_at | 2022-03-11 16:42:18.464852 |
updated_at | 2022-08-24 19:28:58.476781 |
description | DEPRECATED: Use pomsky-macro instead. Macro for converting pomsky expressions to regexes |
homepage | https://pomsky-lang.org |
repository | https://github.com/rulex-rs/pomsky |
max_upload_size | |
id | 548332 |
size | 9,209 |
⚠️ 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();
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.
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" %
);
Dual-licensed under the MIT license or the Apache 2.0 license.