On Thu, 25 Aug 2011, Arie Middelkoop wrote:

> >>  In SmPL pseudo
> >> (and invalid) code I'm looking for something that does:
> >> @@
> >> macro interface;
> >> @@
> >> - interface
> >> + struct
> >> 
> >> Just using perl (interface is a very common word in the comments) or
> >> removing/modifying the define (it is used in macro expansion (API) as
> >> well in generated code from IDL) is very tedious and I wonder if there
> >> is a cleaner way to achieve it; preferably in coccinelle.
> > 
> > I'm not seeing anything very obvious.  The problem is that the SmPL code 
> > doesn't take into account the macro definition file.  So it won't know 
> > what to do with interface.
> 
> What if you could define an additional set of keywords and for each keyword a 
> mapping to a sequence of tokens?
> In that case, you can perform such substitutions before the actual parse 
> process starts. This would work for your particular problem: but it's rather 
> early in the entire process to be really useful.
> (not to mention that I'm not sure if it is possible to 'dynamically' extend 
> the lexer)

This is what is done for the C code.  But it is not done for the SmPL 
code.

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

Reply via email to