Re: [PATCH 6/7] docs: kdoc: tighten up the pointer-to-function case
From: Jonathan Corbet
Date: Tue Aug 12 2025 - 19:22:52 EST
Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> writes:
> On Tue, 12 Aug 2025 13:57:47 -0600
> Jonathan Corbet <corbet@xxxxxxx> wrote:
>
>> - r = KernRe(r'[^\(]+\(\*?\s*([\w\[\].]*)\s*\)')
>> + r = KernRe(r'[^\(]+\(\*?\s*' r'([\w\[\].]*)' r'\s*\)')
>
> Heh, it took me a couple of seconds to understand this concat, as I haven't
> seem concat pattern like that before (maybe except for some old C book
> I read a millennium ago that I barely remember). So, IMO, it became harder
> to understand this way. I would either remove the extra two ' r' from the
> string or write it as:
>
> r = KernRe(r'[^\(]+\(\*?\s*'
> r'([\w\[\].]*)'
> r'\s*\)')
By remove the " r" you mean glom the pieces back together into a single
string? These long regexes are hard to make sense of, I do think it
helps to break them into logical chunks.
Certainly I can split it across multiple lines if that helps.
Thanks,
jon