From nobody Sun Oct 5 07:22:36 2025 Received: from ms.lwn.net (ms.lwn.net [45.79.88.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D1C1253934; Thu, 7 Aug 2025 21:16:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.79.88.28 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754601419; cv=none; b=Jagm21r6FSxwxbuCuehp87Pc0bbgDNDPF7TBm4lCcKNwHweXaZOaV5XIcKPAaucbEgyajEfe5/yZrE+wsgXCIXRFj3hJqLuCYzMRneoRPMAlYQ4CwTdWyiq5YGOaJEgJdND4e+Y/x4mC2X9XCNLaoL3KKmdJBBdtEQJ7OkrVNfA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754601419; c=relaxed/simple; bh=L2cDRRPB5aff3Em7QzWZf/GRyXBTUFvU1Z5hya/sLok=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=paCCadssNYw/FGXCWzbMSHtLBCz1SRB8IzO6GvAhRgaoYdcC9QzXEftPoLZZaNSlV5FASBD0V/Kzzo4zv0Hohm/ba+DERyy5KTRWFx+mOs0b/Sj0NcegJwKZ3/RU9rpvcn629J/3+qQTsfuI7H2/S2mOPTAU5kmsXGg7m0faHlo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lwn.net; spf=pass smtp.mailfrom=lwn.net; dkim=pass (2048-bit key) header.d=lwn.net header.i=@lwn.net header.b=sGHV8l5/; arc=none smtp.client-ip=45.79.88.28 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lwn.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lwn.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lwn.net header.i=@lwn.net header.b="sGHV8l5/" DKIM-Filter: OpenDKIM Filter v2.11.0 ms.lwn.net BC6E540AE7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lwn.net; s=20201203; t=1754601411; bh=YuXq70gYDsDxuz2bttxrJmH0VnivAUsKGyBztKXkuug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sGHV8l5/Rk2e+s7obyRPNjPZu1sjIXq0Lf8CK3psAherICZ84m+bSAOsI1kwwVKP/ 10U/lQg8Yg8jQzl96gdTdq1EP2qJjAnMX4hVKxUd2Rq95dYg/HlZAGjkB85iULYgus AjBA2tZzTHLgiSfV5Z7zawhQaCT1l8uVItwensWrgpW6VFpmD7NhvnxQQkTot2GpSv 6bRBjn2AbKGM6Y9uf5wIwNls3MzFzof74SrDkxp6wH/Fnfi+J9GPhcLa5m+nHIeMhG S1MMttXkPF9dHlz9ocLwtNbLKAswMcN+argwng/4S1KCMV6RDXT2xghez80DYkrkiE 44W2tLeXrM/TQ== Received: from trenco.lwn.net (unknown [IPv6:2601:280:4600:2da9::1fe]) by ms.lwn.net (Postfix) with ESMTPA id BC6E540AE7; Thu, 7 Aug 2025 21:16:50 +0000 (UTC) From: Jonathan Corbet To: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Mauro Carvalho Chehab , Akira Yokosawa , Jonathan Corbet Subject: [PATCH v2 03/12] docs: kdoc: backslashectomy in kdoc_parser Date: Thu, 7 Aug 2025 15:16:30 -0600 Message-ID: <20250807211639.47286-4-corbet@lwn.net> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250807211639.47286-1-corbet@lwn.net> References: <20250807211639.47286-1-corbet@lwn.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A lot of the regular expressions in this file have extraneous backslashes that may have been needed in Perl, but aren't helpful here. Take them out to reduce slightly the visual noise. Escaping of (){}[] has been left in place, even when unnecessary, for visual clarity. Reviewed-by: Mauro Carvalho Chehab Signed-off-by: Jonathan Corbet --- scripts/lib/kdoc/kdoc_parser.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/lib/kdoc/kdoc_parser.py b/scripts/lib/kdoc/kdoc_parser= .py index aa6d11bf29b1..14ded23f11e0 100644 --- a/scripts/lib/kdoc/kdoc_parser.py +++ b/scripts/lib/kdoc/kdoc_parser.py @@ -46,7 +46,7 @@ doc_decl =3D doc_com + KernRe(r'(\w+)', cache=3DFalse) known_section_names =3D 'description|context|returns?|notes?|examples?' known_sections =3D KernRe(known_section_names, flags =3D re.I) doc_sect =3D doc_com + \ - KernRe(r'\s*(\@[.\w]+|\@\.\.\.|' + known_section_names + r')\s*:([^:].= *)?$', + KernRe(r'\s*(@[.\w]+|@\.\.\.|' + known_section_names + r')\s*:([^:].*)= ?$', flags=3Dre.I, cache=3DFalse) =20 doc_content =3D doc_com_body + KernRe(r'(.*)', cache=3DFalse) @@ -60,7 +60,7 @@ attribute =3D KernRe(r"__attribute__\s*\(\([a-z0-9,_\*\s\= (\)]*\)\)", export_symbol =3D KernRe(r'^\s*EXPORT_SYMBOL(_GPL)?\s*\(\s*(\w+)\s*\)\s*',= cache=3DFalse) export_symbol_ns =3D KernRe(r'^\s*EXPORT_SYMBOL_NS(_GPL)?\s*\(\s*(\w+)\s*,= \s*"\S+"\)\s*', cache=3DFalse) =20 -type_param =3D KernRe(r"\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)", cache=3DFalse) +type_param =3D KernRe(r"@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)", cache=3DFalse) =20 # # Tests for the beginning of a kerneldoc block in its various forms. @@ -405,7 +405,7 @@ class KernelDoc: =20 for arg in args.split(splitter): # Strip comments - arg =3D KernRe(r'\/\*.*\*\/').sub('', arg) + arg =3D KernRe(r'/\*.*\*/').sub('', arg) =20 # Ignore argument attributes arg =3D KernRe(r'\sPOS0?\s').sub(' ', arg) @@ -428,7 +428,7 @@ class KernelDoc: =20 arg =3D arg.replace('#', ',') =20 - r =3D KernRe(r'[^\(]+\(\*?\s*([\w\[\]\.]*)\s*\)') + r =3D KernRe(r'[^\(]+\(\*?\s*([\w\[\].]*)\s*\)') if r.match(arg): param =3D r.group(1) else: @@ -443,7 +443,7 @@ class KernelDoc: # Array-of-pointers =20 arg =3D arg.replace('#', ',') - r =3D KernRe(r'[^\(]+\(\s*\*\s*([\w\[\]\.]*?)\s*(\s*\[\s*[= \w]+\s*\]\s*)*\)') + r =3D KernRe(r'[^\(]+\(\s*\*\s*([\w\[\].]*?)\s*(\s*\[\s*[\= w]+\s*\]\s*)*\)') if r.match(arg): param =3D r.group(1) else: @@ -709,7 +709,7 @@ class KernelDoc: if not arg: continue =20 - r =3D KernRe(r'^([^\(]+\(\*?\s*)([\w\.]*)(\s*\).*)= ') + r =3D KernRe(r'^([^\(]+\(\*?\s*)([\w.]*)(\s*\).*)') if r.match(arg): # Pointer-to-function dtype =3D r.group(1) @@ -1044,7 +1044,7 @@ class KernelDoc: Stores a typedef inside self.entries array. """ =20 - typedef_type =3D r'((?:\s+[\w\*]+\b){0,7}\s+(?:\w+\b|\*+))\s*' + typedef_type =3D r'((?:\s+[\w*]+\b){0,7}\s+(?:\w+\b|\*+))\s*' typedef_ident =3D r'\*?\s*(\w\S+)\s*' typedef_args =3D r'\s*\((.*)\);' =20 @@ -1265,7 +1265,7 @@ class KernelDoc: self.dump_section() =20 # Look for doc_com + + doc_end: - r =3D KernRe(r'\s*\*\s*[a-zA-Z_0-9:\.]+\*/') + r =3D KernRe(r'\s*\*\s*[a-zA-Z_0-9:.]+\*/') if r.match(line): self.emit_msg(ln, f"suspicious ending line: {line}") =20 @@ -1476,7 +1476,7 @@ class KernelDoc: """Ancillary routine to process a function prototype""" =20 # strip C99-style comments to end of line - line =3D KernRe(r"\/\/.*$", re.S).sub('', line) + line =3D KernRe(r"//.*$", re.S).sub('', line) # # Soak up the line's worth of prototype text, stopping at { or ; i= f present. # --=20 2.50.1