Macro gramma::string_pattern

source ·
macro_rules! string_pattern {
    ($expr:expr $(,)?) => { ... };
}
Expand description

Compose a StringPattern. All predefined patterns in the patterns module are brought into scope.

§Example

let quotes_pattern = gramma::string_pattern!(
    char('"') + char(..).repeat(..).lazy() + !follows(char('\\')) + char('"')
);

assert!(quotes_pattern.matcher().match_string(4, r#"s = "hello, \"world\"!";"#).is_some());