docs: kdoc: rework type prototype parsing
authorJonathan Corbet <corbet@lwn.net>
Mon, 30 Jun 2025 17:08:32 +0000 (11:08 -0600)
committerJonathan Corbet <corbet@lwn.net>
Tue, 1 Jul 2025 20:51:53 +0000 (14:51 -0600)
commit1aeb8099d053af79d50f4ffee740c29cc10d56fc
treea2c8841b4f82a5b25f77ccda639765613adcea8d
parentbfa5bb3d104b0f2ffd25daa3b4900d54fe060285
docs: kdoc: rework type prototype parsing

process_proto_type() is using a complex regex and a "while True" loop to
split a declaration into chunks and, in the end, count brackets.  Switch to
using a simpler regex to just do the split directly, and handle each chunk
as it comes.  The result is, IMO, easier to understand and reason about.

The old algorithm would occasionally elide the space between function
parameters; see struct rng_alg->generate(), foe example.  The only output
difference is to not elide that space, which is more correct.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
scripts/lib/kdoc/kdoc_parser.py