All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Winter <sw@stefan-winter.net>
To: cocci@inria.fr
Subject: [cocci] Support for unary operator matching
Date: Wed, 02 Apr 2025 13:23:42 +0200	[thread overview]
Message-ID: <87r02an6w0.fsf@debiant14> (raw)

Hi,

I'm trying to match a unary operator with Coccinelle:

$ cat unary.cocci
@@
expression x;
unary operator o = {-};
@@
- o x
+ x

But it seems Coccinelle is choking on "unary":

$ spatch --cocci-file unary.cocci <(echo "int i = -42;")     
init_defs_builtins: /usr/lib/coccinelle/standard.h
meta: parse error: 
  File "unary.cocci", line 3, column 0, charpos = 17
  around = 'unary',
  whole content = unary operator o = {-};

Did I get something wrong or is this supposed to work according to
https://coccinelle.gitlabpages.inria.fr/website/docs/main_grammar.html ?

Thanks,
Stefan

             reply	other threads:[~2025-04-02 11:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-02 11:23 Stefan Winter [this message]
2025-04-02 12:25 ` [cocci] Support for unary operator matching 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=87r02an6w0.fsf@debiant14 \
    --to=sw@stefan-winter.net \
    --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 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.