All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] metavariables for initialize/finalize
@ 2013-06-19 21:37 Julia Lawall
  2013-06-21  7:29 ` [Cocci] Improvements for Coccinelle API SF Markus Elfring
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2013-06-19 21:37 UTC (permalink / raw)
  To: cocci

SmPL allows defining initialize and finalize script rules that are rnu 
before and after the treatment of any files, repectively.  They are useful 
for managing counters, hash tables, etc. and for defining frequently used 
script functions.

At the moment, they do not allow the declaration of any metavariables.  In 
particular the syntax is, eg:

@initialize:python@

python code

without the second @@ as found in all other kinds of rules.

The problem is that this makes it impossible to refer to command line 
arguments (ie virtual identifiers) in the initialize and finalize rules, 
which can be useful.

One possibility would be to add metavariable declarations, as found 
elsewhere.  This would mean adding @@ to any existing semantic patches 
that contain initialize and finalize rules.

Another option would be to make the second @@ optional.  This preserves 
backward compatability, but it makes the language more complex, and it is 
not so easy to implement, because normally I don't parse the script code.

A third option would be to make it possible to refer to eg virtual.xyz 
directly in the script code, regardless of the language.  These would then 
get replaced by their values from the command line before passing the code 
to the interpreter of the script language.

What do you think?  I prefer the fist option, because the language remains 
(indeed, becomes more) uniform.  But the backward compatability is an 
issue.  On the other hand, maybe most people don't use initialize and 
finalize rules?

Thanks,
julia

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-21  8:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-19 21:37 [Cocci] metavariables for initialize/finalize Julia Lawall
2013-06-21  7:29 ` [Cocci] Improvements for Coccinelle API SF Markus Elfring
2013-06-21  8:19   ` Nicolas Palix

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.