On Fri, 2 Dec 2011, SF Markus Elfring wrote:

No, I think it would be difficult. Yacc-like parsers are not always so helpful
in this respect.

Would you like to consider alternative tools for improved error reporting from source code parsing?

I don't know of a yacc-like tool for ocaml that gives more information, and the risks involved in changing to another parsing technology would be very high.

On the other hand, nothing is done behind the scenes to help you.

Thanks for your clarification.

Now I am looking for a way to make the analysis and matching of connected variable assignments easier. If the suggested filter pattern should become mostly safe, I see a need to handle the special use case when a return value is forwarded through several variables until it will be finally used by a conditional expression or a function call parameter.

It is not very easy in Coccinelle to do an unbounded sequence of things. One could do iteration, which is mostly designed for figuring out who calls who interprocedurally. I don't think the iteration process is currently well enough developed to help you. Because you can only pass identifiers from one iteration the next, not other information such as the position at which your previous search left off.

I realize that it is not totally satisfactory, but currently the easiest thing would be to consider a few special cases. You can always generate a warning message to suggest that the user should look at the remaining cases by hand.

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

Reply via email to