fix bug affecting almost empty files
--HG-- branch : pmacs2
This commit is contained in:
parent
17ba41e335
commit
ada40b4224
3
lex3.py
3
lex3.py
|
@ -253,12 +253,13 @@ class RegionRule(Rule):
|
||||||
# ok, so now loop over all the tokens in the current grammar, until
|
# ok, so now loop over all the tokens in the current grammar, until
|
||||||
# the stop-token (if any) is found, and return each result as we get
|
# the stop-token (if any) is found, and return each result as we get
|
||||||
# it.
|
# it.
|
||||||
|
tok = None
|
||||||
for tok in self._lex(lexer, toresume, tokname, stopre, grammar):
|
for tok in self._lex(lexer, toresume, tokname, stopre, grammar):
|
||||||
yield tok
|
yield tok
|
||||||
|
|
||||||
# ok, so now either we found the stop-token, and have a new parent
|
# ok, so now either we found the stop-token, and have a new parent
|
||||||
# for future tokens (if any), or we are done.
|
# for future tokens (if any), or we are done.
|
||||||
if tok.name == tokname:
|
if tok is not None and tok.name == tokname:
|
||||||
toresume = [tok]
|
toresume = [tok]
|
||||||
matchd.update(tok.matchd)
|
matchd.update(tok.matchd)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue