mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
parsers: use 'next' instead of try/except
This get rid of another StopIteration abomination. The change in self.current value is supposed to not matter as nobody should be calling '_advance' after that (as per Matt wisdom).
This commit is contained in:
parent
f30c32a070
commit
5ec3f86b27
@ -27,10 +27,7 @@ class parser(object):
|
||||
def _advance(self):
|
||||
'advance the tokenizer'
|
||||
t = self.current
|
||||
try:
|
||||
self.current = self._iter.next()
|
||||
except StopIteration:
|
||||
pass
|
||||
self.current = next(self._iter, None)
|
||||
return t
|
||||
def _match(self, m, pos):
|
||||
'make sure the tokenizer matches an end condition'
|
||||
|
Loading…
Reference in New Issue
Block a user