On Mon, 23 May 2011, Francis Galiegue wrote:

> I don't understand what is wrong at all with this one :(
> 
> It is pretty much what I already did in another script, the only
> difference is that after the constant char [], there can be 0 or more
> arguments...
> 
> spatch tells me:
> 
> File "dbprintf.cocci", line 29, column 0,  charpos = 316
>     around = '', whole content =
> Fatal error: exception Failure("lexing: empty token")
> 
> which means it waits for a token. Uh, what token?
> 
> ----
> @initialize:python@
> 
> import re
> 
> @r@
> constant char [] fmt;
> expression list[n] E;
> @@
> 
>   dbprintf(fmt, E)
> 
> @script:python p@
> oldfmt <<r.fmt;
> tmp;
> newfmt;
> @@
> 
> tmp = str(oldfmt)
> coccinelle.newfmt = tmp + "\n""

You have too many quotes in your python code.  YOu may also want a \\ in 
front of n?

julia

> @@
> identifier r.fmt;
> expression list[n] r.E;
> identifier p.newfmt;
> @@
> 
> - dbprintf(fmt, E)
> + g_debug(newfmt, E)
> 
> ----
> 
> -- 
> Francis Galiegue, [email protected]
> "It seems obvious [...] that at least some 'business intelligence'
> tools invest so much intelligence on the business side that they have
> nothing left for generating SQL queries" (Stéphane Faroult, in "The
> Art of SQL", ISBN 0-596-00894-5)
> _______________________________________________
> 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