Release coccinelle-0.1.8
[bpt/coccinelle.git] / tests / ifelse.cocci
1 @ if_else_3 @
2 position p_3_1, p_3_2;
3 expression E_3_1, E_3_2, E_3_3, E_3_4;
4 statement S_3_1, S_3_2, S_3_3, S_3_4;
5 @@
6 if (E_3_1)
7 S_3_1
8 else if (E_3_2)
9 S_3_2
10 else if@p_3_1 (E_3_3)
11 S_3_3
12 else if@p_3_2 (E_3_4)
13 S_3_4
14 // + foo_3();
15
16 @
17
18 script:python @ expr_1 << if_else_3.E_3_1;
19 expr_2 << if_else_3.E_3_2;
20 expr_3 << if_else_3.E_3_3;
21 expr_4 << if_else_3.E_3_4;
22 @@
23 print "--- 4"
24 print expr_1
25 print expr_2
26 print expr_3
27 print expr_4
28
29 @ if_else_2 @
30 position p_2 != if_else_3.p_3_2;
31 expression E_2_1, E_2_2, E_2_3;
32 statement S_2_1, S_2_2, S_2_3;
33 @@
34 if (E_2_1)
35 S_2_1
36 else if (E_2_2)
37 S_2_2
38 else if@p_2 (E_2_3)
39 S_2_3
40 // + foo_2();
41
42 @
43
44 script:python @ expr_1 << if_else_2.E_2_1;
45 expr_2 << if_else_2.E_2_2;
46 expr_3 << if_else_2.E_2_3;
47 @@
48 print "--- 3"
49 print expr_1
50 print expr_2
51 print expr_3
52
53 @ if_else_1 @
54 // @@
55 // position p1;
56 expression E_1_1, E_1_2;
57 statement S_1_1, S_1_2;
58 position p_1_1 != if_else_3.p_3_1;
59 position p_1_2 != if_else_2.p_2;
60 @@
61 if@p_1_1 (E_1_1)
62 S_1_1
63 else if@p_1_2 (E_1_2)
64 S_1_2
65 // + foo_1();
66
67 @
68
69 script:python @ expr_1 << if_else_1.E_1_1;
70 expr_2 << if_else_1.E_1_2;
71 @@
72 print "--- 2"
73 print expr_1
74 print expr_2
75
76 @ if_if_1 @
77 expression E_10_1, E_10_2;
78 statement S_10_1, S_10_2;
79 @@
80 if (E_10_1)
81 S_10_1
82 if (E_10_2)
83 S_10_2
84 // + bar();
85 @
86
87 script:python @ expr_1 << if_if_1.E_10_1;
88 expr_2 << if_if_1.E_10_2;
89 @@
90 print "- 2"
91 print expr_1
92 print expr_2
93