[PATCH 02/12] docs: kdoc: Move a regex line in dump_struct()

Jonathan Corbet posted 12 patches 2 months ago
There is a newer version of this series
[PATCH 02/12] docs: kdoc: Move a regex line in dump_struct()
Posted by Jonathan Corbet 2 months ago
The complex struct_members regex was defined far from its use; bring the
two together.  Remove some extraneous backslashes while making the move.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
---
 scripts/lib/kdoc/kdoc_parser.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser.py
index 93fcd8807aa8..9948ede739a5 100644
--- a/scripts/lib/kdoc/kdoc_parser.py
+++ b/scripts/lib/kdoc/kdoc_parser.py
@@ -551,7 +551,6 @@ class KernelDoc:
         ]
 
         definition_body = r'\{(.*)\}\s*' + "(?:" + '|'.join(qualifiers) + ")?"
-        struct_members = KernRe(type_pattern + r'([^\{\};]+)(\{)([^\{\}]*)(\})([^\{\}\;]*)(\;)')
 
         # Extract struct/union definition
         members = None
@@ -683,6 +682,7 @@ class KernelDoc:
         # So, we need to have an extra loop on Python to override such
         # re limitation.
 
+        struct_members = KernRe(type_pattern + r'([^{};]+)(\{)([^{}]*)(\})([^{};]*)(;)')
         while True:
             tuples = struct_members.findall(members)
             if not tuples:
-- 
2.50.1
Re: [PATCH 02/12] docs: kdoc: Move a regex line in dump_struct()
Posted by Mauro Carvalho Chehab 2 months ago
Em Thu, 31 Jul 2025 18:13:16 -0600
Jonathan Corbet <corbet@lwn.net> escreveu:

> The complex struct_members regex was defined far from its use; bring the
> two together.  Remove some extraneous backslashes while making the move.
> 
> Signed-off-by: Jonathan Corbet <corbet@lwn.net>

Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

> ---
>  scripts/lib/kdoc/kdoc_parser.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser.py
> index 93fcd8807aa8..9948ede739a5 100644
> --- a/scripts/lib/kdoc/kdoc_parser.py
> +++ b/scripts/lib/kdoc/kdoc_parser.py
> @@ -551,7 +551,6 @@ class KernelDoc:
>          ]
>  
>          definition_body = r'\{(.*)\}\s*' + "(?:" + '|'.join(qualifiers) + ")?"
> -        struct_members = KernRe(type_pattern + r'([^\{\};]+)(\{)([^\{\}]*)(\})([^\{\}\;]*)(\;)')
>  
>          # Extract struct/union definition
>          members = None
> @@ -683,6 +682,7 @@ class KernelDoc:
>          # So, we need to have an extra loop on Python to override such
>          # re limitation.
>  
> +        struct_members = KernRe(type_pattern + r'([^{};]+)(\{)([^{}]*)(\})([^{};]*)(;)')
>          while True:
>              tuples = struct_members.findall(members)
>              if not tuples:



Thanks,
Mauro