* [cocci] Support for unary operator matching
@ 2025-04-02 11:23 Stefan Winter
2025-04-02 12:25 ` Markus Elfring
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Winter @ 2025-04-02 11:23 UTC (permalink / raw)
To: cocci
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [cocci] Support for unary operator matching
2025-04-02 11:23 [cocci] Support for unary operator matching Stefan Winter
@ 2025-04-02 12:25 ` Markus Elfring
0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2025-04-02 12:25 UTC (permalink / raw)
To: Stefan Winter, cocci
> But it seems Coccinelle is choking on "unary":
I wonder also why a SmPL script variant (like the following) does not get accepted
by the software combination “Coccinelle 1.3-00083-g4093aad2d” so far.
@deletion@
expression x;
unary operator uo = { - };
@@
-uo
x
Questionable test result:
Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> spatch --parse-cocci suggestion_for_Stefan_Winter-20250402.cocci
…
meta: parse error:
File "suggestion_for_Stefan_Winter-20250402.cocci", line 3, column 0, charpos = 25
around = 'unary',
whole content = unary operator uo = { - };
Regards,
Markus
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-02 12:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-02 11:23 [cocci] Support for unary operator matching Stefan Winter
2025-04-02 12:25 ` Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox