Merge remote-tracking branch 'origin/vendor/OPENSSH'
[dragonfly.git] / test / cocci / comma.cocci
1 //
2 //  convert comma to semicolon
3 //
4 // Target: Linux
5 // Copyright:  Copyright: 2014 - LIP6/INRIA
6 // License:  Licensed under GPLv2 or any later version.
7 // Author: Julia Lawall <Julia.Lawall@lip6.fr>
8 // URL: http://coccinelle.lip6.fr/ 
9 // URL: http://coccinellery.org/ 
10
11 @initialize:ocaml@
12 @@
13 let tbl = Hashtbl.create(100)
14
15 let add_if_not_present file =
16 try let _ = Hashtbl.find tbl file in ()
17 with Not_found ->
18    Hashtbl.add tbl file ();
19    let it = new iteration() in
20    it#set_files [file];
21    it#register()
22
23 @script:ocaml@
24 @@
25 Hashtbl.clear tbl
26
27 @r@
28 expression e1,e2,e;
29 position p1,p2;
30 type T;
31 identifier i;
32 @@
33
34 (
35 T i = ...;
36 |
37  e;
38 )
39  e1,@p1 e2@p2;
40
41 @script:ocaml@
42 p1 << r.p1;
43 p2 << r.p2;
44 @@
45
46 if (List.hd p1).line = (List.hd p2).line
47 then include_match false
48 else add_if_not_present ((List.hd p1).file)
49
50 @@
51 expression e1,e2;
52 position r.p1;
53 @@
54
55  e1
56 - ,@p1
57 + ;
58   e2;