History

docs: c_lex.py: store logger on its data

By having the logger stored there, any code using CTokenizer can log messages there.

Mauro Carvalho Chehab committed 7 months ago

Commit 2ca0b541 parent 9c391181 file · +7 −1Browse files

Unified · Split

tools/lib/python/kdoc/c_lex.py+7−1
@@ -177,7 +177,7 @@ class CTokenizer(): · 176 unmodified lines
177177 # This class is inspired and follows the basic concepts of:
178178 # https://docs.python.org/3/library/re.html#writing-a-tokenizer
179179
180− def __init__(self, source=None, log=None):
180+ def __init__(self, source=None):
181181 """
182182 Create a regular expression to handle RE_SCANNER_LIST.
183183
@@ -188,6 +188,12 @@ class CTokenizer(): · 4 unmodified lines
188188 when matching a code via RE_SCANNER.
189189 """
190190
191+ #
192+ # Store logger to allow parser classes to re-use it
193+ #
194+ global log
195+ self.log = log
196+
191197 self.tokens = []
192198
193199 if not source: