permit multiline comments and strings in macros
[bpt/coccinelle.git] / demos / ocaml2.cocci
CommitLineData
aba5c457
C
1@r@
2expression E;
3statement S;
4@@
5
6if (f(E)) S
7
8@script:ocaml@
9(es,e) << r.E;
10@@
11
12(* note that an expression is a pair after being unwrapped *)
13match Ast_c.unwrap e with
14 (Ast_c.Ident nm,_) -> Printf.printf "argument %s is an identifier\n" es
15| _ -> Printf.printf "argument %s is not an identifier\n" es
16
17@script:ocaml@
18(es,_) << r.E;
19(ss,s) << r.S;
20@@
21
22(* note that a statement is not a pair after being unwrapped *)
23match Ast_c.unwrap s with
24 Ast_c.Jump _ ->
25 Printf.printf "%s: branch %s is a jump\n" es ss
26| _ -> Printf.printf "%s: branch %s is not a jump\n" es ss
27
28
29@script:ocaml@
30(ss,s) << r.S;
31(es,_) << r.E;
32@@
33
34(* note that a statement is not a pair after being unwrapped *)
35match Ast_c.unwrap s with
36 Ast_c.Decl _ ->
37 Printf.printf "%s: branch %s is a declaration\n" es ss
38| _ -> Printf.printf "%s: branch %s is not a declaration\n" es ss
39
40@script:ocaml@
41(ss,s) << r.S;
42es << r.E;
43@@
44
45(* note that a statement is not a pair after being unwrapped *)
46match Ast_c.unwrap s with
47 Ast_c.ExprStatement _ ->
48 Printf.printf "%s: branch %s is an exprstatement\n" es ss
49| _ -> Printf.printf "%s: branch %s is not an exprstatement\n" es ss