On Mon, 26 Dec 2011, SF Markus Elfring wrote:

Hello!

1. The application of position variables are described in a short Wiki article for the semantic patch language.
  http://cocci.ekstranet.diku.dk/wiki/doku.php?id=source_location_information

The SmPL example shows that index specifications are needed to retrieve some data from Python variables. Can this programming interface work also without the specification of a "[0]"? When would a different index be needed?

The presence of the [0] indicates that the value of a position variable is an array. This is the case for python. In ocaml, the value is a list. A single position variable can be bound to many values in a nest, eg:

if (...) { <... foo@p(...); ...> }

2. Where are attributes and methods documented that are provided for matches from other SmPL metavariables?
  http://coccinelle.lip6.fr/docs/main_grammar003.html

I don't understand the question. In any case, in python, all other kinds of metavariables are represented as strings. Indeed, they seem to be represented as some sort of strange raw string. If you want to apply python string methods to them, you may need to do something like "%s" % E. In ocaml it is possible to have access to both the string representation and the internal AST of Coccinelle. There is no documentation for the latter. You just have to find the corresponding file in the source code and read that.

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

Reply via email to