All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Michal Marek <mmarek@suse.cz>
Cc: Stephen Boyd <sboyd@codeaurora.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tags: fix use of parenthesis in regex
Date: Fri, 24 Feb 2012 16:56:02 -0800	[thread overview]
Message-ID: <20120224165602.6fe303d3@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <20120225003411.GA27390@sepie.suse.cz>

On Sat, 25 Feb 2012 01:34:12 +0100
Michal Marek <mmarek@suse.cz> wrote:

> On Mon, Feb 06, 2012 at 03:15:43PM -0800, Stephen Hemminger wrote:
> > Several of the regular expressions passed to etags and ctags where incorrect
> > and missing the backslash before the closing paren, and matching the wrong
> > part of the start of the function causing warning:
> >   etags: Unmatched ( or \( while compiling pattern
> 
> But your patch introduces another imbalances, e.g.
> 
> 
> > @@ -129,31 +129,31 @@ exuberant()
> ...
> > -	--regex-c++='/^TRACE_EVENT\(([^,)]*).*/trace_\1/'		\
> ...
> > +	--regex-c++='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/'		\
> 
> The old version had left paren, start of group, ..., end of group
> The new version has start of group, left paren, ..., right paren
> 
> Where left / right paren means the character without any special
> meaning. I actually can't see anything wrong with the old TRACE_EVENT matching, the regular expression is correct and I think it does what it should do (turn
> TRACE_EVENT(foo) into trace_foo).
> 
> Below is the full list of warnings I get from
> 
> Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
>   Addresses: <dhiebert@users.sourceforge.net>, http://ctags.sourceforge.net
>   Optional compiled features: +wildcards, +regex
> 
> 
>   GEN     tags
> ctags: Warning: regcomp ^SYSCALL_DEFINE[[:digit:]]?(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp ^TRACE_EVENT(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp ^DEFINE_EVENT\([^,)]*, *([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp PAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp PAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp PAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp TESTSETFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp TESTPAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp SETPAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp __SETPAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp TESTCLEARFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp __TESTCLEARFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp CLEARPAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp __CLEARPAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp __PAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp __PAGEFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp PAGEFLAG_FALSE(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp TESTSCFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp TESTSCFLAG(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp SETPAGEFLAG_NOOP(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp CLEARPAGEFLAG_NOOP(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp __CLEARPAGEFLAG_NOOP(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp TESTCLEARFLAG_FALSE(\([^,)]*\).*: Unmatched ( or \(
> ctags: Warning: regcomp __TESTCLEARFLAG_FALSE(\([^,)]*\).*: Unmatched ( or \(
> 
> The same list repeats, as ctags is called multiple times.
> 
> Michal

The problem is that in proper regex each start of sub-expression \(
needs to have a matching end of sub-expression \)
The old version had no matching-end of sub-expression and therefore was technically
malformed, probably old tools just ignored it.

   --regex='/PAGEFLAG\(([^,)]*).*/Page\1/'
                      ^
                      start but no end?

My initial patch just fixed those, but others kept wanting more.

  


  reply	other threads:[~2012-02-25  0:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-03 19:27 [PATCH] tags: fix regex passed to etags Stephen Hemminger
2012-02-03 19:42 ` Stephen Boyd
2012-02-03 20:18   ` Stephen Hemminger
2012-02-06 20:32     ` Stephen Boyd
2012-02-06 20:40       ` [PATCH] tags: fix regex passed to etags and ctags Stephen Hemminger
2012-02-06 23:05         ` Stephen Boyd
2012-02-06 23:15           ` [PATCH] tags: fix use of parenthesis in regex Stephen Hemminger
2012-02-07 19:18             ` Stephen Boyd
2012-02-25  0:34             ` Michal Marek
2012-02-25  0:56               ` Stephen Hemminger [this message]
2012-02-25  9:37                 ` Michal Marek

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=20120224165602.6fe303d3@nehalam.linuxnetplumber.net \
    --to=shemminger@vyatta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=sboyd@codeaurora.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 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.