cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Coccinelle <cocci@systeme.lip6.fr>
Subject: [Cocci] Support for multi-line “when code” by SmPL?
Date: Sun, 17 May 2020 10:15:29 +0200	[thread overview]
Message-ID: <64e05245-c387-b50c-bb6f-9609d0b0aad8@web.de> (raw)

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	other threads:[~2020-05-17  8:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=64e05245-c387-b50c-bb6f-9609d0b0aad8@web.de \
    --to=markus.elfring@web.de \
    --cc=cocci@systeme.lip6.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).