linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aditya Srivastava <yashsri421@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: corbet@lwn.net, lukas.bulwahn@gmail.com,
	linux-kernel-mentees@lists.linuxfoundation.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC v3] scripts: kernel-doc: reduce repeated regex expressions into variables
Date: Fri, 14 May 2021 21:47:27 +0530	[thread overview]
Message-ID: <490cdb39-74a1-951a-0688-0f72f58ae7f8@gmail.com> (raw)
In-Reply-To: <20210501154336.GS1847222@casper.infradead.org>

On 1/5/21 9:13 pm, Matthew Wilcox wrote:
> On Thu, Apr 29, 2021 at 12:07:29PM +0530, Aditya Srivastava wrote:
>> +    my $name = qr{[a-zA-Z0-9_~:]+};
>> +    my $prototype_end1 = qr{[^\(]*};
>> +    my $prototype_end2 = qr{[^\{]*};
>> +    my $prototype_end = qr{\(($prototype_end1|$prototype_end2)\)};
> 
> Would this be better written as:
> 
> 	my $prototype_end = qr{\([^\(\{]*\)}
> 

Hi Matthew
I have actually tried this earlier, but it does not work as expected,
probably because of greedy matching. I have produced the list of
warning differences before and after over the files, when using this
regex:
https://github.com/AdityaSrivast/kernel-tasks/blob/master/random/kernel-doc/diff_on_alt_protend


> And now that I look at the whole thing, doesn't this fail to parse
> a function declared as:
> 
> int f(void (*g)(long));
> 
> (that is, f takes a single argument, which is a pointer to a function
> which takes a long argument and returns void)
> 

I think this will match against:
$prototype =~ m/^($type1)\s+($name)\s*$prototype_end/

Thanks
Aditya



  reply	other threads:[~2021-05-14 16:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22 19:18 [RFC] scripts: kernel-doc: reduce repeated regex expressions into variables Aditya Srivastava
     [not found] ` <CAKXUXMx9q57cWXkcezKKo-uuh21Sd-Si9M9KydzFEMQ0ELYEng@mail.gmail.com>
2021-04-23 12:20   ` Aditya Srivastava
2021-04-23 13:21 ` Matthew Wilcox
2021-04-24 11:57   ` Aditya Srivastava
2021-04-24 12:47     ` [RFC v2] " Aditya Srivastava
2021-04-27 15:55       ` Jonathan Corbet
2021-04-27 16:56         ` Matthew Wilcox
2021-04-29  6:37           ` [RFC v3] " Aditya Srivastava
2021-04-29 23:39             ` Jonathan Corbet
2021-04-30  2:03               ` Joe Perches
2021-05-01  9:30               ` Aditya Srivastava
2021-05-01 15:03                 ` Jonathan Corbet
2021-05-14 14:42                   ` [RFC v4] " Aditya Srivastava
2021-05-14 15:10                     ` Aditya Srivastava
2021-05-17 17:49                     ` Jonathan Corbet
2021-05-01 15:43             ` [RFC v3] " Matthew Wilcox
2021-05-14 16:17               ` Aditya Srivastava [this message]
2021-04-26 17:31     ` [RFC] " Matthew Wilcox

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=490cdb39-74a1-951a-0688-0f72f58ae7f8@gmail.com \
    --to=yashsri421@gmail.com \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=willy@infradead.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;
as well as URLs for NNTP newsgroup(s).