[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <490cdb39-74a1-951a-0688-0f72f58ae7f8@gmail.com>
Date: Fri, 14 May 2021 21:47:27 +0530
From: Aditya Srivastava <yashsri421@...il.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: corbet@....net, lukas.bulwahn@...il.com,
linux-kernel-mentees@...ts.linuxfoundation.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC v3] scripts: kernel-doc: reduce repeated regex expressions
into variables
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
Powered by blists - more mailing lists