On Mon, 7 Feb 2011, SF Markus Elfring wrote:

> > The main change is to introduce the possibility to use disjunctions on
> > identifiers,
> > such as function names, structure field names, local variable names, etc.
> 
> https://github.com/coccinelle/coccinelle/blob/d3f655c619238baba11f20bc9f55769e66d3e428/tests/disjid.cocci
> 
> The choice operator can be used in more situations now.
> I would like to clarify if this feature can also be used for the filtering of
> comments and string initialisations with the semantic patch language.
> 
> I find that another interesting aspect is the handling of whitespace
> characters in this context.
> - A couple of programming languages do not allow their use in identifiers
> while they are fine in some other places of the source code.
>   Can such special characters be enclosed by a selection element?
> 
> - How does the SmPL grammar distinguish the places where it is acceptable to
> add whitespaces between selection elements optionally?

I think you are confusing disjunctions on identifiers with regular 
expressions.  There is no connection.  A disjunction on an identifier is 
just like a disjunction on an expression, a statement, or anything else.  
It has nothing to do with the internal structure of the identifier, and 
nothing to do with strings, comments, etc.  It just considers whether the 
identifier found in the source code matches any of a selection of 
identifiers in the disjunction.

Ocaml regular expressions seem to provide some kind of disjunction if one 
wants to work on the internal struction:

      - \| (infix) Alternative between two expressions.

There are no metavariables in that case, and the arguments to the 
disjunction won't be used to prefilter at the file level.

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

Reply via email to