> =========================================
> @rid@
> identifier xid;
> position p;
> @@
> 
> x...@p

This could be extremely expensive, because it will match every identifier 
in the program.  I think it would be better to filter on the identifier of 
interest first.  Actually, all that is necessary is to invert Nicolas's 
rid and r rules.

julia

> @r@
> position rid.p;
> @@
> 
>  \(x...@p\|y...@p\)
> 
> @script:python depends on r@
> p << rid.p;
> x << rid.xid;
> @@
> 
> print "Matched:  ", x, " ", p[0].current_element, " ",p[0].file , " ", 
> p[0].line," ",p[0].column, " ", p[0].line_end," ",p[0].column_end
> 
> @script:python depends on !r@
> p << rid.p;
> x << rid.xid;
> @@
> 
> print "Filtered: ", x, " ", p[0].current_element, " ",p[0].file , " ", 
> p[0].line," ",p[0].column, " ", p[0].line_end," ",p[0].column_end
> =========================================
> 
> -- 
> Nicolas Palix
> _______________________________________________
> Cocci mailing list
> [email protected]
> http://lists.diku.dk/mailman/listinfo/cocci
> (Web access from inside DIKUs LAN only)
> 
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to