mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bodo Eggert <7eggert@gmx.de>
To: Jan Engelhardt <jengelh@computergmbh.de>,
	Andy Whitcroft <apw@shadowen.org>,
	Eugene Teo <eugeneteo@kernel.sg>,
	linux-kernel@vger.kernel.org, auke-jan.h.kok@intel.com
Subject: Re: [PATCH] Make checkpatch rant about trailing ; at the end of "if"  expr
Date: Mon, 20 Aug 2007 13:52:35 +0200	[thread overview]
Message-ID: <E1IN5oB-0000qw-6S@be1.lrz> (raw)
In-Reply-To: <8T8Oy-3D0-13@gated-at.bofh.it>

Jan Engelhardt <jengelh@computergmbh.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@6yAk1Uy.7eggert.dyndns.org G2@7eggert.dyndns.org
 MVt59@gcEE.7eggert.dyndns.org GBwox2uHv@mb.7eggert.dyndns.org

       reply	other threads:[~2007-08-20 11:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8SGSb-2Kk-9@gated-at.bofh.it>
     [not found] ` <8SJQ6-7pj-13@gated-at.bofh.it>
     [not found]   ` <8T8Oy-3D0-13@gated-at.bofh.it>
2007-08-20 11:52     ` Bodo Eggert [this message]
2007-08-20 12:44       ` Jan Engelhardt
2007-08-22  9:21         ` Bodo Eggert
2007-08-22  9:57           ` Jan Engelhardt
2007-08-16  5:22 Eugene Teo
2007-08-16  9:21 ` Andy Whitcroft
2007-08-17 12:03   ` Jan Engelhardt

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=E1IN5oB-0000qw-6S@be1.lrz \
    --to=7eggert@gmx.de \
    --cc=apw@shadowen.org \
    --cc=auke-jan.h.kok@intel.com \
    --cc=eugeneteo@kernel.sg \
    --cc=jengelh@computergmbh.de \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®