[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <E1IN5oB-0000qw-6S@be1.lrz>
Date: Mon, 20 Aug 2007 13:52:35 +0200
From: Bodo Eggert <7eggert@....de>
To: Jan Engelhardt <jengelh@...putergmbh.de>,
Andy Whitcroft <apw@...dowen.org>,
Eugene Teo <eugeneteo@...nel.sg>, linux-kernel@...r.kernel.org,
auke-jan.h.kok@...el.com
Subject: Re: [PATCH] Make checkpatch rant about trailing ; at the end of "if" expr
Jan Engelhardt <jengelh@...putergmbh.de> wrote:
> On Aug 16 2007 10:21, Andy Whitcroft wrote:
>>> + if ($line =~ /\bif\s*\([^\)]*\)\s*\;/) {
>>
>>Heh, you are the second person to suggest this check today, do I detect
>>some ripped out hair due to one of these!
>>
>>I've taken this idea and expanded it to cover if, for and while which
>>can all suffer from this. Using the relative indent to work out which
>>are valid combinations:
>
> But. The above regex does not seem to handle
>
> if ((a = b));
> oops;
>
> I have tried to come up with a superduper regex that handles multiple
> (), but my regex fu seems to stop above two pairs of ().
This is because you can't do that using finite regular expressions.
Regular expressions are Type-3 grammars, but you'd need a Type-2
grammar to express the Dyck language (and you need to parse a Dyck
Language, ignoring the non-dyck-parts).
--
Your e-mail has been returned due to insufficient voltage.
Friß, Spammer: xVhgayew@...k1Uy.7eggert.dyndns.org G2@...gert.dyndns.org
MVt59@...E.7eggert.dyndns.org GBwox2uHv@...7eggert.dyndns.org
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists