On Wed, 5 Dec 2018, Timur Tabi wrote:

> Another thing that I don't understand is why do I need to have two
> rules for every Python script?  I've attached my .cocci file.  Each
> Python script is in between a pair of //---- comments.  They all have
> the same format:
>
> 1. One rule to specify the pattern to match
> 2. A Python script
> 3. Another rule to specify how to process the output of the Python script
>
> Can't I combine 1) and 3) into one rule?

No.  It is possible to attach script code to metavariable declarations,
but only to express predicates.  For example:

constant c : script:ocaml() { is_less_than_6 c };

is_less_than_6 would be defined in the @initialize:ocaml@ rule, and
takes a string as an argument, which is the potential term to bind to c,
and returns true or false.

julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to