Coccinelle archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: cocci@inria.fr
Subject: [cocci] Fixing a parse error for a SmPL position variable constraint
Date: Tue, 13 Feb 2024 14:08:50 +0100	[thread overview]
Message-ID: <6346056f-abf8-47b9-9024-ceb60a3f36a8@web.de> (raw)

Hello,

I hope that you would like to take another look at a script variant
(like the following) for the semantic patch language also together with
the software combination “Coccinelle 1.1.1-00676-g99513ec1”.


@find@
position p1, p2;
statement s1, s2;
@@
 if@p1 (...)
 {
    ... when any
    s1
    s2
 }
 ... when any
 if@p2 (...)
 {
    ... when any
    s1
    s2
 }

@duplicated_code@
position find.p1, find.p2;
position pos != find.p2;
statement s1, s2;
@@
*if@p1@pos (...)
*{
    ... when any
*   s1
*   s2
*}
 ... when any
*if@p2 (...)
*{
    ... when any
*   s1
*   s2
*}


Temporary test result:
Markus_Elfring@Sonne:…/Projekte/Coccinelle/janitor> spatch --parse-cocci show_same_statements7z.cocci
…
meta: parse error:
  File "show_same_statements7z.cocci", line 21, column 21, charpos = 226
  around = 'p2',
  whole content = position pos != find.p2;


Will more desirable analyses become possible by similar source code search approaches?

Regards,
Markus

             reply	other threads:[~2024-02-13 13:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13 13:08 Markus Elfring [this message]
2024-02-13 20:45 ` [cocci] Fixing a parse error for a SmPL position variable constraint Julia Lawall
2024-02-14 17:38   ` Markus Elfring
2024-02-14 17:49     ` Julia Lawall
2024-02-14 18:08       ` 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=6346056f-abf8-47b9-9024-ceb60a3f36a8@web.de \
    --to=markus.elfring@web.de \
    --cc=cocci@inria.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 read-only IMAP folder(s) and NNTP newsgroup(s).