From: Julia Lawall <julia.lawall@lip6.fr>
To: "Christoph Böhmwalder" <christoph.boehmwalder@linbit.com>
Cc: cocci@systeme.lip6.fr
Subject: Re: [Cocci] Make rule depend on comment
Date: Wed, 7 Aug 2019 23:40:04 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.21.1908072337230.2601@hadrien> (raw)
In-Reply-To: <656aeb1b-9c94-a428-bb0e-4397a0432651@linbit.com>
If you pull Coccinelle from github, you will be able to write the
following. The code on line 2 probably has to be an ocaml script at the
moment, because I didn't do anything to support python. You can use the
code that is shown in the example directly. It checks that the list of
comments between the ) and the { is not empty. The second scriptcan use
ocaml or python as you like.
@ find_kmap_tagged_function @
comments tag : script:ocaml () { let (c1b,c1m,c1a) = List.hd tag in not
(c1a = []) };
identifier fn;
@@
fn(...)@tag {
...
}
@ script:ocaml parse_kmap_tag @
fn << find_kmap_tagged_function.fn;
@@
Printf.printf "have comment in %s\n" fn
--------
julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
next prev parent reply other threads:[~2019-08-07 21:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-02 7:34 [Cocci] Make rule depend on comment Christoph Böhmwalder
2019-08-03 12:32 ` Markus Elfring
2019-08-03 12:44 ` Julia Lawall
2019-08-05 8:36 ` Christoph Böhmwalder
2019-08-05 10:21 ` Julia Lawall
2019-08-06 7:03 ` Markus Elfring
2019-08-07 21:40 ` Julia Lawall [this message]
2019-08-08 8:35 ` Markus Elfring
2019-08-08 9:32 ` Christoph Böhmwalder
2019-08-09 15:07 ` Markus Elfring
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=alpine.DEB.2.21.1908072337230.2601@hadrien \
--to=julia.lawall@lip6.fr \
--cc=christoph.boehmwalder@linbit.com \
--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).