Hello,

The manual for the semantic patch language provides the following information.
https://github.com/coccinelle/coccinelle/blob/7cf2c23e64066d5249a64a316cc5347831f7a63f/docs/manual/cocci_syntax.tex#L1122

…
   when ::= when != when_code
…
   when_code ::= OPTDOTSEQ(decl_stmt+, when)
               | OPTDOTSEQ(expr, when)
…
   OPTDOTSEQ(grammar_ds, when_ds) ::=
        [... (when_ds)*] grammar_ds (... (when_ds)* grammar_ds)* [... 
(when_ds)*]
…


The possible content is not explained for the item “grammar_ds” so far.
Examples show that source code may be specified there which should probably
be excluded from a text fragment.
https://github.com/coccinelle/coccinelle/blob/ed1eb8e06f800739d3992158d36945c0c4c6f0c7/docs/manual/examples.tex#L328

It is supported to specify the SmPL key word “when” on separate lines.
I got the impression that “grammar_ds” code needs to be specified only
in the same line so far. (A line break is treated as the final delimiter
for this use case.)
Data processing can work also with long lines.

* I imagine that developers (and reviewers) for semantic patch code
  would occasionally prefer to use multi-line text at such places.

* I imagine also that it can be helpful then to enclose the “when_code”
  by specific delimiters so that the separation of text parts would be
  clearer and hopefully safer.

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to