Release coccinelle-0.1.10
[bpt/coccinelle.git] / tests / ifelse.cocci
CommitLineData
fc1ad971 1// ifelse.cocci, 3 Aug 09
708f4980 2
fc1ad971
C
3@ if_else_1
4disable neg_if
708f4980 5@
fc1ad971
C
6expression E_1_ie;
7statement S_1_ie, S_2_ie;
8position p_1_ie;
708f4980 9@@
fc1ad971
C
10if@p_1_ie (E_1_ie)
11 S_1_ie
12else
13 S_2_ie
708f4980
C
14
15@
fc1ad971
C
16script:python @ expr_1_ie << if_else_1.E_1_ie;
17 loc_1_ie << if_else_1.p_1_ie;
708f4980 18 @@
fc1ad971
C
19print "--- ifelse"
20print loc_1_ie[0].line, " ", loc_1_ie[0].column, " ", expr_1_ie
708f4980 21
708f4980 22
fc1ad971
C
23@ if_else_if_else
24disable neg_if
708f4980 25@
fc1ad971
C
26expression E_1, E_2;
27statement S_1, S_2, S_3;
28position p_1, p_2, p_3;
29@@
30if@p_1 (E_1)
31 S_1
32else if@p_2 (E_2)
33 S_2
34else
35 S_3@p_3
708f4980 36
fc1ad971
C
37@
38script:python @ expr_1 << if_else_if_else.E_1;
39 expr_2 << if_else_if_else.E_2;
40 loc_1 << if_else_if_else.p_1;
41 loc_2 << if_else_if_else.p_2;
42 loc_3 << if_else_if_else.p_3;
708f4980 43 @@
fc1ad971
C
44print "--- ifelseifelse"
45print loc_1[0].line, " ", loc_1[0].column, " ", expr_1
46print loc_2[0].line, " ", loc_2[0].column, " ", expr_2
47cocci.include_match(False)
708f4980 48
708f4980 49@
fc1ad971
C
50script:python @ expr_1 << if_else_if_else.E_1;
51 expr_2 << if_else_if_else.E_2;
52 loc_1 << if_else_if_else.p_1;
53 loc_2 << if_else_if_else.p_2;
708f4980 54 @@
fc1ad971
C
55print "--- ifelseif"
56print loc_1[0].line, " ", loc_1[0].column, " ", expr_1
57print loc_2[0].line, " ", loc_2[0].column, " ", expr_2
708f4980 58