Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-release > by-pkgid > 589b38626859682dda0b4289ae4806af > files > 184

coccinelle-examples-1.0.7-2.mga7.i586.rpm

@anyid@
type t;
identifier id;
@@

t id () {
...
}

@script:python@
x << anyid.id;
@@

print "Identifier: %s" % x

@contains@
type t;
identifier foo =~ "foo";
@@

t foo () {
...
}

@script:python@
x << contains.foo;
@@

print "Contains foo: %s" % x

@nocontain@
type t;
identifier foo !~ "foo";
@@

t foo () {
...
}

@script:python@
x << nocontain.foo;
@@

print "Does not contain foo: %s" % x

@endsby@
type t;
identifier foo =~ "foo$";
@@

t foo () {
...
}

@script:python@
x << endsby.foo;
@@

print "Ends by foo: %s" % x

@beginsby@
type t;
identifier foo =~ "^foo";
@@

t foo () {
...
}

@script:python@
x << beginsby.foo;
@@

print "Begins by foo: %s" % x