fix bug affecting almost empty files

--HG--
branch : pmacs2
This commit is contained in:
moculus 2007-07-24 21:22:35 +00:00
parent 17ba41e335
commit ada40b4224
1 changed files with 2 additions and 1 deletions

View File

@ -253,12 +253,13 @@ class RegionRule(Rule):
# 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
# it.
tok = None
for tok in self._lex(lexer, toresume, tokname, stopre, grammar):
yield tok
# ok, so now either we found the stop-token, and have a new parent
# for future tokens (if any), or we are done.
if tok.name == tokname:
if tok is not None and tok.name == tokname:
toresume = [tok]
matchd.update(tok.matchd)
else: