On Thu, 12 Jan 2012, Gregory Mounie wrote:
Hello,
I am just a beginner in coccinelle thus my question may have a simple
solution. Sorry if I miss it in the doc.
Is it possible to use a "#pragma string1 string2 string3" in a spatch ?
I did not find #pragma in the formal grammar description, just #include
and I did not succed to avoid "#" Lexer_cocci.Lexical("unrecognised symbol,
in token rule: #")
Ideally, I would like to get the pragma string in a python script of the
spatch :-)
Do you want to add the pragma? That is not really supported. But you
might be able to get around the problem by making an identifier in python
code (see demos/pythontococci.cocci) and then adding that identifier in a
matching rule. You might not be able to get exactly the code that you
want, though, because an identifier is eg not a statement by itself; it
needs a semicolon afterwards. It could be possible to extend the grammar
to allow adding pragmas.
There is no way to match against a pragma. Adding this would be much
harder.
Perhaps you could send an example, if the identifier trick is not good
enough.
julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)