permit multiline comments and strings in macros
[bpt/coccinelle.git] / demos / assignment_matching.cocci
CommitLineData
97111a47
C
1// This only matches cases where the assignment is a complete statement
2@@
3expression 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@@
12expression 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@@
20expression x;
21type 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@@
31expression x;
32type T;
33@@
34
35 x =
36-(T)i(3)
37+matches_most()
38