summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>2026-01-19 17:23:21 +0100
committerJonathan Corbet <corbet@lwn.net>2026-01-23 11:37:39 -0700
commitff91637dece7f4e108f7a2e76bd7e1054d24f600 (patch)
treed18febed6c91095f8ad2bdd3e31b82e4fd414a71 /tools
parent66c3bf974d48f8e5c5f94148e1171b62bd80e26d (diff)
docs: python: abi_regex: do some improvements at documentation
Add documentation for two consts and ensure that all sentenses will end with a dot. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <5419ad89a5042c1571198c2f055866674808579b.1768838938.git.mchehab+huawei@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/python/abi/abi_regex.py26
1 files changed, 20 insertions, 6 deletions
diff --git a/tools/lib/python/abi/abi_regex.py b/tools/lib/python/abi/abi_regex.py
index d5553206de3c..d0c5e3ede6b5 100644
--- a/tools/lib/python/abi/abi_regex.py
+++ b/tools/lib/python/abi/abi_regex.py
@@ -16,10 +16,22 @@ from abi.abi_parser import AbiParser
from abi.helpers import AbiDebug
class AbiRegex(AbiParser):
- """Extends AbiParser to search ABI nodes with regular expressions"""
+ """
+ Extends AbiParser to search ABI nodes with regular expressions.
- # Escape only ASCII visible characters
+ There some optimizations here to allow a quick symbol search:
+ instead of trying to place all symbols altogether an doing linear
+ search which is very time consuming, create a tree with one depth,
+ grouping similar symbols altogether.
+
+ Yet, sometimes a full search will be needed, so we have a special branch
+ on such group tree where other symbols are placed.
+ """
+
+ #: Escape only ASCII visible characters.
escape_symbols = r"([\x21-\x29\x2b-\x2d\x3a-\x40\x5c\x60\x7b-\x7e])"
+
+ #: Special group for other nodes.
leave_others = "others"
# Tuples with regular expressions to be compiled and replacement data
@@ -88,13 +100,15 @@ class AbiRegex(AbiParser):
# Recover plus characters
(re.compile(r"\xf7"), "+"),
]
+
+ #: Regex to check if the symbol name has a number on it.
re_has_num = re.compile(r"\\d")
- # Symbol name after escape_chars that are considered a devnode basename
+ #: Symbol name after escape_chars that are considered a devnode basename.
re_symbol_name = re.compile(r"(\w|\\[\.\-\:])+$")
- # List of popular group names to be skipped to minimize regex group size
- # Use AbiDebug.SUBGROUP_SIZE to detect those
+ #: List of popular group names to be skipped to minimize regex group size
+ #: Use AbiDebug.SUBGROUP_SIZE to detect those.
skip_names = set(["devices", "hwmon"])
def regex_append(self, what, new):
@@ -148,7 +162,7 @@ class AbiRegex(AbiParser):
def get_regexes(self, what):
"""
Given an ABI devnode, return a list of all regular expressions that
- may match it, based on the sub-groups created by regex_append()
+ may match it, based on the sub-groups created by regex_append().
"""
re_list = []