permit multiline comments and strings in macros
[bpt/coccinelle.git] / demos / assignment_matching.cocci
1 // This only matches cases where the assignment is a complete statement
2 @@
3 expression x;
4 @@
5
6 -x = f(3);
7 +matches_little();
8
9 // This matches also cases where the assignment is a subterm of another
10 // statement, such as a conditional.
11 @@
12 expression x;
13 @@
14
15 -x = g(3)
16 +matches_more()
17
18 // An isomorphism will let this also match cases where the type is not there
19 @@
20 expression x;
21 type T;
22 @@
23
24 -x = (T)h(3)
25 +matches_even_more()
26
27 // This matches a variable declaration too. There are constraints on
28 // the transformation performed in this case, as it must ensure that the result
29 // will also be a variable declaration.
30 @@
31 expression x;
32 type T;
33 @@
34
35 x =
36 -(T)i(3)
37 +matches_most()
38