[Cocci] please help me with a "repetition"

Julia Lawall julia.lawall at lip6.fr
Sun Apr 29 15:15:25 CEST 2018



On Sun, 29 Apr 2018, Robert Larice wrote:

> Julia Lawall <julia.lawall at lip6.fr> writes:
>
> > On Sun, 29 Apr 2018, Robert Larice wrote:
> >
> >> Hello,
> >>
> >>   probably a stupid question,
> >>   I'm failing to match something like this
> >>
> >> +  int newvar;
> >>    i++; i++; ... any sequence of only "i++";
> >> +  buckbear(42);
> >>
> >>   I don't succeed to express this "maximum length repetition"
> >>     in the mids of those two insertions.
> >
> > It's not completely straightforward.  You could try:
> >
> > @r1@
> > position p;
> > @@
> >
> > ...
>
> Thank You very much,
>
>   your suggestion works perfectly well in my actual task.
>
>   I was trying something different,
>   very aproximately something like:
>       ... when != i++;
>     + int newvar;
>       i++;
>   and didn't get anywhere.

This should work for the first bunch of i++;'s, but not if there are
several of them.

julia


More information about the Cocci mailing list