mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Fix unbound local error in RE tokenizer example. Thanks to Herman L. Jackson.
This commit is contained in:
parent
cc5ea6860f
commit
325477e20e
1 changed files with 2 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue