mirror of https://github.com/python/cpython
Fix unbound local error in RE tokenizer example. Thanks to Herman L. Jackson.
This commit is contained in:
parent
cc5ea6860f
commit
325477e20e
|
@ -1322,9 +1322,10 @@ successive matches::
|
||||||
line_start = pos
|
line_start = pos
|
||||||
line += 1
|
line += 1
|
||||||
elif typ != 'SKIP':
|
elif typ != 'SKIP':
|
||||||
|
val = mo.group(typ)
|
||||||
if typ == 'ID' and val in keywords:
|
if typ == 'ID' and val in keywords:
|
||||||
typ = val
|
typ = val
|
||||||
yield Token(typ, mo.group(typ), line, mo.start()-line_start)
|
yield Token(typ, val, line, mo.start()-line_start)
|
||||||
pos = mo.end()
|
pos = mo.end()
|
||||||
mo = gettok(s, pos)
|
mo = gettok(s, pos)
|
||||||
if pos != len(s):
|
if pos != len(s):
|
||||||
|
|
Loading…
Reference in New Issue