From: Chuhong Yuan <hslester96@gmail.com>
To: cocci@systeme.lip6.fr
Subject: [Cocci] How to match all conditions in if-else if blocks?
Date: Tue, 30 Jul 2019 22:43:46 +0800 [thread overview]
Message-ID: <CANhBUQ0Rc5Q=R6Ufc=UEmLe4d0emQz4Cv+VsoA_7v=mHBY_LuQ@mail.gmail.com> (raw)
Hi all,
I want to write a script to match a pattern of conditional statement.
However, I find that I can only match the first "if" in the block.
The script is like this:
fn(...) {
...
- f(arg1, arg2, arg3)
...
}
where f returns the condition check result.
But when I apply to source code like this:
if (f(a1, a2, a3)) {
...
} else if (f(a4, a5, a6)) {
...
}
I find it can only match f(a1, a2, a3).
So how to fix this problem?
Thanks,
Chuhong
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
next reply other threads:[~2019-07-31 11:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-30 14:43 Chuhong Yuan [this message]
2019-07-31 11:27 ` [Cocci] How to match all conditions in if-else if blocks? 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='CANhBUQ0Rc5Q=R6Ufc=UEmLe4d0emQz4Cv+VsoA_7v=mHBY_LuQ@mail.gmail.com' \
--to=hslester96@gmail.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).