Release coccinelle-0.2.0
[bpt/coccinelle.git] / demos / regexp.cocci
CommitLineData
951c7801
C
1@anyid@
2type t;
3identifier id;
4@@
5
6t id () {
7...
8}
9
10@script:python@
11x << anyid.id;
12@@
13
14print "Identifier: %s" % x
15
16@contains@
17type t;
18identifier foo ~= ".*foo";
19@@
20
21t foo () {
22...
23}
24
25@script:python@
26x << contains.foo;
27@@
28
29print "Contains foo: %s" % x
30
31@nocontain@
32type t;
9f8e26f4 33identifier foo !~= ".*foo";
951c7801
C
34@@
35
36t foo () {
37...
38}
39
40@script:python@
41x << nocontain.foo;
42@@
43
44print "Does not contain foo: %s" % x
45
46@endsby@
47type t;
48identifier foo ~= ".*foo$";
49@@
50
51t foo () {
52...
53}
54
55@script:python@
56x << endsby.foo;
57@@
58
59print "Ends by foo: %s" % x
60
61@beginsby@
62type t;
63identifier foo ~= "^foo";
64@@
65
66t foo () {
67...
68}
69
70@script:python@
71x << beginsby.foo;
72@@
73
74print "Begins by foo: %s" % x