History

docs: kdoc_parser: fix parser to support multi-word types

The regular expression currently expects a single word for the type, but it may be something like "struct foo". Add support for it.

Mauro Carvalho Chehab committed 8 months ago

Commit 6d9c2e91 parent b7dc6351 file · +2 −2Browse files

Showing the changes to tools/lib/python (1 of 1 file). Show all

Unified · Split

tools/lib/python/kdoc/kdoc_parser.py+2−2
@@ -1018,14 +1018,14 @@ class KernelDoc: · 1017 unmodified lines
10181018
10191019 default_val = None
10201020
1021− r= KernRe(OPTIONAL_VAR_ATTR + r"[\w_]*\s+(?:\*+)?([\w_]+)\s*[\d\]\[]*\s*(=.*)?")
1021+ r= KernRe(OPTIONAL_VAR_ATTR + r"\s*[\w_\s]*\s+(?:\*+)?([\w_]+)\s*[\d\]\[]*\s*(=.*)?")
10221022 if r.match(proto):
10231023 if not declaration_name:
10241024 declaration_name = r.group(1)
10251025
10261026 default_val = r.group(2)
10271027 else:
1028− r= KernRe(OPTIONAL_VAR_ATTR + r"(?:[\w_]*)?\s+(?:\*+)?(?:[\w_]+)\s*[\d\]\[]*\s*(=.*)?")
1028+ r= KernRe(OPTIONAL_VAR_ATTR + r"(?:[\w_\s]*)?\s+(?:\*+)?(?:[\w_]+)\s*[\d\]\[]*\s*(=.*)?")
10291029
10301030 if r.match(proto):
10311031 default_val = r.group(1)