]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
docs: c_lex.py: store logger on its data
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 23 Mar 2026 09:10:53 +0000 (10:10 +0100)
committerJonathan Corbet <corbet@lwn.net>
Wed, 25 Mar 2026 19:36:46 +0000 (13:36 -0600)
By having the logger stored there, any code using CTokenizer can
log messages there.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <467979dc18149e4b2a7113c178e0cb07919632f2.1774256269.git.mchehab+huawei@kernel.org>

tools/lib/python/kdoc/c_lex.py

index e01b154f458ec7d4d3f39ff6bd8ca63e706aca5f..cb95f51724483da0d8946ab3cbf08149f40dfd04 100644 (file)
@@ -177,7 +177,7 @@ class CTokenizer():
     # This class is inspired and follows the basic concepts of:
     #   https://docs.python.org/3/library/re.html#writing-a-tokenizer
 
-    def __init__(self, source=None, log=None):
+    def __init__(self, source=None):
         """
         Create a regular expression to handle RE_SCANNER_LIST.
 
@@ -188,6 +188,12 @@ class CTokenizer():
         when matching a code via RE_SCANNER.
         """
 
+        #
+        # Store logger to allow parser classes to re-use it
+        #
+        global log
+        self.log = log
+
         self.tokens = []
 
         if not source: