On Mon, 5 Apr 2021, Markus Elfring wrote:

> > Thanks for the simpler examples.
>
> Would you like to support another search pattern by the means of
> the semantic patch language?
>
>
> @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.  YOu
can write:

@@
identifier i;
expression e : script:python() { ... python code to ceck e };
@@

#define i e

julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to