On Wed, 28 Dec 2011, SF Markus Elfring wrote:

The only way to merge names is to have matched them in different branches
of a disjunction, which unfortunately is not currently possible for a function
declaration/function prototype or to match the name and store its position,
and then have another rule that uses a disjunction and the position variables
to merge the names.

I imagine that I stumble on the need to assign data from eventually two source rules to variables with the same name.


@@
position first_match.p1;
position second_match.p2;
identifier x;
@@

(
x@p1
|
x@p2
)

I would interpret this filter pattern in the way that new values will be assigned to the metavariables.

The grammar of the semantic patch language shows following elements where I would like to suggest an extension.
http://coccinelle.lip6.fr/docs/main_grammar003.html

@ script:language [rulename] [depends on dep] @
...
script_metadecl ::= (id,id) << rulename_id1.id, rulename_id2.id, ..., rulename_idN.id ; | id << rulename_id1.id, rulename_id2.id, ..., rulename_idN.id ;
...

Which rule should provide some data for the target metavariable?

How do you think about it?

It only solves the problem for script code, but it could be a reasonable suggestion.

julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to