All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] please help me with a "repetition"
@ 2018-04-29 11:00 Robert Larice
  2018-04-29 11:32 ` Julia Lawall
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Larice @ 2018-04-29 11:00 UTC (permalink / raw)
  To: cocci

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.

Best Regards,
  Robert

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Cocci] please help me with a "repetition"
  2018-04-29 11:00 [Cocci] please help me with a "repetition" Robert Larice
@ 2018-04-29 11:32 ` Julia Lawall
  2018-04-29 12:54   ` Robert Larice
  0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2018-04-29 11:32 UTC (permalink / raw)
  To: cocci



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;
@@

i++;
i++;@p

@@
position p != r1.p;
@@

+ int newvar;
i++;@p

@r2@
position p;
@@

i++;@p
i++;

@@
position p != r2.p;
@@

i++;@p
+ buckbear(42);

julia



>
> Best Regards,
>   Robert
> _______________________________________________
> Cocci mailing list
> Cocci at systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Cocci] please help me with a "repetition"
  2018-04-29 11:32 ` Julia Lawall
@ 2018-04-29 12:54   ` Robert Larice
  2018-04-29 13:15     ` Julia Lawall
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Larice @ 2018-04-29 12:54 UTC (permalink / raw)
  To: cocci

Julia Lawall <julia.lawall@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.

Thanks !
  Robert

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Cocci] please help me with a "repetition"
  2018-04-29 12:54   ` Robert Larice
@ 2018-04-29 13:15     ` Julia Lawall
  0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2018-04-29 13:15 UTC (permalink / raw)
  To: cocci



On Sun, 29 Apr 2018, Robert Larice wrote:

> Julia Lawall <julia.lawall@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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-04-29 13:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-29 11:00 [Cocci] please help me with a "repetition" Robert Larice
2018-04-29 11:32 ` Julia Lawall
2018-04-29 12:54   ` Robert Larice
2018-04-29 13:15     ` Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.