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

Showing the changes to tools/lib/python (1 of 1 file). Show all

Unified · Split

tools/lib/python/kdoc/c_lex.py+7−1
@@ -177,7 +177,7 @@ class CTokenizer(): · 176 unmodified lines
177 # This class is inspired and follows the basic concepts of:177 # This class is inspired and follows the basic concepts of:
178 # https://docs.python.org/3/library/re.html#writing-a-tokenizer178 # https://docs.python.org/3/library/re.html#writing-a-tokenizer
179 179
180 def __init__(self, source=None, log=None):180 def __init__(self, source=None):
181 """181 """
182 Create a regular expression to handle RE_SCANNER_LIST.182 Create a regular expression to handle RE_SCANNER_LIST.
183 183
@@ -188,6 +188,12 @@ class CTokenizer(): · 4 unmodified lines
188 when matching a code via RE_SCANNER.188 when matching a code via RE_SCANNER.
189 """189 """
190 190
191 #
192 # Store logger to allow parser classes to re-use it
193 #
194 global log
195 self.log = log
196
191 self.tokens = []197 self.tokens = []
192 198
193 if not source:199 if not source: