Coccinelle archive on
 help / color / Atom feed
From: Markus Elfring <>
To: Coccinelle <>
Subject: [Cocci] Support for multi-line “when code” by SmPL?
Date: Sun, 17 May 2020 10:15:29 +0200
Message-ID: <> (raw)


The manual for the semantic patch language provides the following information.

   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.

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.

Cocci mailing list

                 reply index

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:

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

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Coccinelle archive on

Archives are clonable:
	git clone --mirror cocci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 cocci cocci/ \
	public-inbox-index cocci

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone