On Mon, 5 Apr 2021, Markus Elfring wrote:
> >> @display@
> >> identifier i =~ "^(?:[A-Z]+_){3,3}[A-Z]+", x;
> >> constant c =~ "\"";
> >> @@
> >> *#define i x c
> >>
> >>
> >> elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --parse-cocci
> >> show_define_usage6.cocci
> >> …
> >> minus: parse error:
> >> File "show_define_usage6.cocci", line 5, column 13, charpos = 92
> >> around = 'c',
> >> whole content = *#define i x c
> >
> > No. You have to match the expression and then check it using python.
>
> I find this view improvable.
>
> I would like to avoid the repetition of parsing efforts as much as possible.
> Under which circumstances can replacement lists be taken better into account?
Why does my suggestion involve a repetition of parsing effort? You want
to use a regexp. I'm asking you to put the regexp in a python function.
julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci