Macro gstuff::find_parse_replace_s
source · macro_rules! find_parse_replace_s {
($i: expr, $starts: expr, $submac: ident! ($($args:tt)*)) => { ... };
($i: expr, $starts: expr, $f: expr) => { ... };
}
Expand description
Uses nom to find all matches of the given $submac
parser and replace them with the parser’s evaluations.
$starts
is a Pattern
that is used to speed up the search. It must match the beginning of any $submac
-compatible substrings.
For exaple, replacing “foo” with “bar” might look like this:
use nom::{self, IResult};
let bar_bar = find_parse_replace_s! ("foo bar", ascii_chars! ('f'), map! (tag_s! ("foo"), |_| "bar"));