Re: [PATCH RFCv2 4/5] scripts/kernel-doc.py: add a Python parser
From: Mauro Carvalho Chehab
Date: Thu Feb 13 2025 - 11:06:06 EST
Em Thu, 13 Feb 2025 13:06:17 +0100
Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> escreveu:
> + def dump_function(self, ln, prototype):
> +
...
> + (r"""
> + __attribute__\s*\(\(
> + (?:
> + [\w\s]++ # attribute name
> + (?:\([^)]*+\))? # attribute arguments
> + \s*+,? # optional comma at the end
> + )+
> + \)\)\s+
> + """, "", re.X),
Heh, funny enough, this regex doesn't work here (Python 3.13.2), even
after removing the extra "+" on some lines, e. g.:
(r"""
__attribute__\s*\(\(
(?:
[\w\s]+ # attribute name
(?:\([^)]*\))? # attribute arguments
\s*,? # optional comma at the end
)+
\)\)\s+
""", "", re.X),
I had to fold it into a non-verbose/extended regex, e. g.:
(r"__attribute__\s*\(\((?:[\w\s]+(?:\([^)]*\))?\s*,?)+\)\)\s+", "", 0),
Thanks,
Mauro