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

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

In any case, in python, all other kinds of metavariables are represented as strings.

I imagine there could also be an interface which provides methods in the sense of object-orientation.

There is not.

I have discovered by introspection that a Python variable which got its contents from a metavariable with the SmPL type "identifier" has got an attribute "ident". How stable is this name selection in your programming interface?

There is indeed such a field in coccilib/elems.py. I don't know what the purpose of it is, but I don't see any reason to remove it either, so if you find it useful, then go ahead and use it.

How does the mapping look like for other key words and data types?

I don't know enough python to answer the question. You can look at the source code of python/coccilib/elems.py.

Indeed, they seem to be represented as some sort of strange raw string.

Are there any additional considerations needed for the support of Unicode?

No idea.

In ocaml it is possible to have access to both the string representation and the
internal AST of Coccinelle.

Do you operate the desired source code analysis more on the abstraction level "control flow graph" than on the "abstract syntax tree"?

I don't understand the sense of operate. The ocaml interface gives you access to the AST. You could in principle call the appropriate functions to construct a control-flow graph, but it is not made available directly.

There is no documentation for the latter. You just have to find the corresponding
file in the source code and read that.

I hope that this situation can be improved. How do you find out that these source files specify the really expected run time behaviour otherwise?

The source files are what is executed at run time. So they are necessarily always up to date (unlike our documentation :). The script code is just linked with the rest of the coccinelle implementation.

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

Reply via email to