mirror of
https://github.com/gryf/pythonhelper.git
synced 2025-12-19 12:28:16 +01:00
Use a zipper instead of counting by hand.
This commit is contained in:
@@ -178,14 +178,11 @@ class SimplePythonTagsParser(object):
|
|||||||
|
|
||||||
# initalize local auxiliary variables {{{
|
# initalize local auxiliary variables {{{
|
||||||
tagsStack = []
|
tagsStack = []
|
||||||
lineNumber = 0
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
import itertools
|
||||||
# go through all the lines in the source and localize all Python tags in it {{{
|
# go through all the lines in the source and localize all Python tags in it {{{
|
||||||
for line in self.source:
|
for (line, lineNumber) in zip(self.source, itertools.count(1)):
|
||||||
|
|
||||||
# increase line number
|
|
||||||
lineNumber += 1
|
|
||||||
|
|
||||||
# extract the line's indentation characters and its content {{{
|
# extract the line's indentation characters and its content {{{
|
||||||
lineMatch = self.COMMENTS_INDENT_RE.match(line)
|
lineMatch = self.COMMENTS_INDENT_RE.match(line)
|
||||||
|
|||||||
Reference in New Issue
Block a user