From: Jonathan Corbet <corbet@lwn.net>
To: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
Linux Doc Mailing List <linux-doc@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org,
Aleksandr Loktionov <aleksandr.loktionov@intel.com>,
Randy Dunlap <rdunlap@infradead.org>
Subject: Re: [PATCH 08/18] docs: kdoc_parser: fix parser to support multi-word types
Date: Tue, 03 Mar 2026 10:34:48 -0700 [thread overview]
Message-ID: <87jyvsbyvb.fsf@trenco.lwn.net> (raw)
In-Reply-To: <544c73a9e670b6fef1828bf4f2ba0de7d29d8675.1772469446.git.mchehab+huawei@kernel.org>
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> writes:
> The regular expression currently expects a single word for the
> type, but it may be something like "struct foo".
>
> Add support for it.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
> Acked-by: Randy Dunlap <rdunlap@infradead.org>
> Tested-by: Randy Dunlap <rdunlap@infradead.org>
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> ---
> tools/lib/python/kdoc/kdoc_parser.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/lib/python/kdoc/kdoc_parser.py b/tools/lib/python/kdoc/kdoc_parser.py
> index 39ff27d421eb..22a820d33dc8 100644
> --- a/tools/lib/python/kdoc/kdoc_parser.py
> +++ b/tools/lib/python/kdoc/kdoc_parser.py
> @@ -1018,14 +1018,14 @@ class KernelDoc:
>
> default_val = None
>
> - r= KernRe(OPTIONAL_VAR_ATTR + r"[\w_]*\s+(?:\*+)?([\w_]+)\s*[\d\]\[]*\s*(=.*)?")
> + r= KernRe(OPTIONAL_VAR_ATTR + r"\s*[\w_\s]*\s+(?:\*+)?([\w_]+)\s*[\d\]\[]*\s*(=.*)?")
Just for future reference...I *really* think that the code is improved
by breaking up and commenting gnarly regexes like this. They are really
unreadable in this form. (And yes, I know the code has been full of
these forever, but we can always try to make it better :)
Anyway, just grumbling.
Thanks,
jon
next prev parent reply other threads:[~2026-03-03 17:34 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 16:40 [PATCH 00/18] Several kdoc fixes Mauro Carvalho Chehab
2026-03-02 16:40 ` [PATCH 01/18] docs: kdoc_re: add support for groups() Mauro Carvalho Chehab
2026-03-02 16:40 ` [PATCH 02/18] docs: kdoc_re: don't go past the end of a line Mauro Carvalho Chehab
2026-03-02 16:40 ` [PATCH 03/18] docs: kdoc_parser: move var transformers to the beginning Mauro Carvalho Chehab
2026-03-02 16:40 ` [PATCH 04/18] docs: kdoc_parser: don't mangle with function defines Mauro Carvalho Chehab
2026-03-02 16:40 ` [PATCH 05/18] docs: kdoc_parser: fix variable regexes to work with size_t Mauro Carvalho Chehab
2026-03-02 16:40 ` [PATCH 06/18] docs: kdoc_parser: fix the default_value logic for variables Mauro Carvalho Chehab
2026-03-02 16:40 ` [PATCH 07/18] docs: kdoc_parser: don't exclude defaults from prototype Mauro Carvalho Chehab
2026-03-02 16:40 ` [PATCH 08/18] docs: kdoc_parser: fix parser to support multi-word types Mauro Carvalho Chehab
2026-03-03 17:34 ` Jonathan Corbet [this message]
2026-03-03 20:19 ` Mauro Carvalho Chehab
2026-03-03 20:24 ` Jonathan Corbet
2026-03-03 22:18 ` Mauro Carvalho Chehab
2026-03-02 16:40 ` [PATCH 09/18] docs: kdoc_parser: add support for LIST_HEAD Mauro Carvalho Chehab
2026-03-02 16:40 ` [PATCH 10/18] docs: kdoc_parser: handle struct member macro VIRTIO_DECLARE_FEATURES(name) Mauro Carvalho Chehab
2026-03-02 16:40 ` [PATCH 11/18] docs: kdoc_re: better show KernRe() at documentation Mauro Carvalho Chehab
2026-03-02 16:40 ` [PATCH 12/18] docs: kdoc_parser: move transform lists to a separate file Mauro Carvalho Chehab
2026-03-02 16:40 ` [PATCH 13/18] docs: xforms_lists: ignore context analysis and lock attributes Mauro Carvalho Chehab
2026-03-02 16:40 ` [PATCH 14/18] docs: kdoc_re: handle strings and escape chars on NextMatch Mauro Carvalho Chehab
2026-03-02 16:40 ` [PATCH 15/18] docs: kdoc_re: don't recompile NestedMatch regex every time Mauro Carvalho Chehab
2026-03-02 16:40 ` [PATCH 16/18] docs: kdoc_re: Change NestedMath args replacement to \0 Mauro Carvalho Chehab
2026-03-02 16:41 ` [PATCH 17/18] docs: kdoc_re: make NestedMatch use KernRe Mauro Carvalho Chehab
2026-03-02 16:41 ` [PATCH 18/18] docs: kdoc_parser: move nested match transforms to xforms_lists.py Mauro Carvalho Chehab
2026-03-03 17:56 ` [PATCH 00/18] Several kdoc fixes Jonathan Corbet
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=87jyvsbyvb.fsf@trenco.lwn.net \
--to=corbet@lwn.net \
--cc=aleksandr.loktionov@intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab+huawei@kernel.org \
--cc=rdunlap@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