permit multiline comments and strings in macros
[bpt/coccinelle.git] / demos / ocaml.cocci
1 @r@
2 expression x,a;
3 position p1, p2;
4 @@
5
6 f(x@p1,a@p2)
7
8 @script:ocaml@
9 y << r.x;
10 yy << r.a;
11 p1 << r.p1;
12 p2 << r.p2;
13 @@
14
15 let p1_ = List.hd p1 in
16 let file1 = p1_.Coccilib.file in
17 let cure1 = p1_.Coccilib.current_element in
18 let line1 = p1_.Coccilib.line in
19 let line_end1 = p1_.Coccilib.line_end in
20 let colb1 = p1_.Coccilib.col in
21 let cole1 = p1_.Coccilib.col_end in
22
23 Printf.printf "%s and %s\n" y yy;
24 Printf.printf
25 "%s @ p1 (file:\"%s\" fct:\"%s\" line:%d-%d col:%d-%d)\n"
26 y file1 cure1 line1 line_end1 colb1 cole1;
27 Printf.printf "%s @ p2 - p2 is not used in the SP. ocamlc should have reported a warning.\n" yy
28
29 @script:ocaml@
30 y << r.a;
31 zz << r.x;
32 @@
33
34 Printf.printf "%s again and %s again \n" zz y