On Thu, 3 Nov 2016, Waldemar Rymarkiewicz wrote:

> Hi,
>
> Wondering if there is a quick solution in cocci to replace a suffix in
> a group of identifiers?
>
> I need something like this
>
> @@
> identifier  id  =~ "^XXX_.*";       // say it matches XXX_foo and XXX_bar
> fresh identifier xx =  "YYY" ##  id[3:]      // where id[:3]  takes
> string starting at position 3
>
> @@
> -id
> +xx
>
>
> or is that possible to manipulate identifier in python  and pas it
> back to cocci ?

Yes, the latter is the solution.  Look at demos/pythontococci.cocci.
Write back if anything is not clear.

julia


>
>
> Thanks,
> /Waldek
> _______________________________________________
> Cocci mailing list
> [email protected]
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to