On Thu, 28 Jul 2016, SF Markus Elfring wrote:

> > I believe that it is already possible.
>
> Should the following approach work together with the semantic patch language?
>
>
> @lengths@
> statement list [if_count] is;
> statement list [else_count] es;
> @@
>  if (...)
>     is
>  else
>     es
>
> @script:python display@
> if_n << lengths.if_count;
> else_n << lengths.else_count;
> @@
> print("{0}|{1}".format(if_n, else_n))

Did you try it?  I think you would need braces around is and es.
Otherwise, the result would always be 1, because there can only be one
statement in each branch of an if.

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

Reply via email to