permit multiline comments and strings in macros
[bpt/coccinelle.git] / demos / pcre2.cocci
1 @m@
2 identifier SPAM ;
3 @@
4
5 SPAM
6
7 @script:ocaml r@
8 s << m.SPAM;
9 new_s;
10 @@
11
12 let re = Pcre.regexp "(WINE_)?(ERR|FIXME|WARN)" in
13 if Pcre.pmatch ~rex:re s then
14 (Printf.eprintf "Match %s\n" s;
15 new_s := Pcre.replace_first ~pat:"WINE_" s
16 )
17 else
18 (Printf.eprintf "Not match %s\n" s;
19 Coccilib.include_match false
20 )
21
22 @@
23 identifier m.SPAM;
24 identifier r.new_s;
25 @@
26
27 -SPAM
28 +new_s