Re: [PATCH RFCv2 4/5] scripts/kernel-doc.py: add a Python parser

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux