From: elfring@users.sourceforge.net (SF Markus Elfring)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Search/replace inside string constants?
Date: Sat, 28 Jul 2018 08:42:59 +0200 [thread overview]
Message-ID: <a87fbecd-88fa-e638-7bab-e662030850dd@users.sourceforge.net> (raw)
In-Reply-To: <CAOZdJXV4rb-Snt95ZcLJG1v-qV_O+RKjC=X0ACZghmDK=WXGnA@mail.gmail.com>
> @script:python s@
> c << r.c;
> c2;
> @@
> if c.startswith('"NVRM: '):
> coccinelle.c2 = '"' + c[7:];
> else:
> coccinelle.c2 = c;
I have got another software development idea for this transformation approach.
The detection of unwanted prefixes could be moved into a regular expression
like ?^"NVRM: ? for the constraint of the metavariable for which SmPL inheritance
is used here, couldn't it?
The shown SmPL rule ?s? needs to work only with matching data then so that
the Python code could be reduced to the statement ?coccinelle.c2 = '"' + c[7:]?.
How do you think about to try such a script variant out besides adjustments
for comma positions?
https://systeme.lip6.fr/pipermail/cocci/2018-July/005212.html
Regards,
Markus
next prev parent reply other threads:[~2018-07-28 6:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-26 22:19 [Cocci] Search/replace inside string constants? Timur Tabi
2018-07-26 22:36 ` Julia Lawall
2018-07-26 22:44 ` Timur Tabi
2018-07-26 22:54 ` Julia Lawall
2018-07-27 16:38 ` Timur Tabi
2018-07-27 16:46 ` Julia Lawall
[not found] ` <69450411-cc54-ccad-2dfa-7dfbd439c0ba@nvidia.com>
[not found] ` <alpine.DEB.2.20.1807271910330.12787@hadrien>
[not found] ` <6ca5500f-039e-e586-9366-719f847f3352@nvidia.com>
2018-07-27 19:40 ` Julia Lawall
2018-07-27 20:25 ` Timur Tabi
2018-07-27 21:28 ` Timur Tabi
2018-07-27 17:09 ` SF Markus Elfring
2018-07-27 17:14 ` Julia Lawall
2018-07-28 6:42 ` SF Markus Elfring [this message]
2018-07-28 6:54 ` Julia Lawall
2018-07-26 22:39 ` Timur Tabi
2018-07-26 22:51 ` Julia Lawall
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=a87fbecd-88fa-e638-7bab-e662030850dd@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.