X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/ecdbf085a772e8d737b8a8735d39a7af413cecfb..661908cd0282ff464794a8193475693e9130b866:/blib2to3/pgen2/tokenize.py diff --git a/blib2to3/pgen2/tokenize.py b/blib2to3/pgen2/tokenize.py index 4f03130..a352713 100644 --- a/blib2to3/pgen2/tokenize.py +++ b/blib2to3/pgen2/tokenize.py @@ -412,10 +412,6 @@ def generate_tokens(readline): yield (NL, line[pos:], (lnum, pos), (lnum, len(line)), line) continue - if column > indents[-1]: # count indents - indents.append(column) - yield (INDENT, line[:pos], (lnum, 0), (lnum, pos), line) - if line[pos] == '#': # skip comments comment_token = line[pos:].rstrip('\r\n') nl_pos = pos + len(comment_token) @@ -425,6 +421,10 @@ def generate_tokens(readline): (lnum, nl_pos), (lnum, len(line)), line) continue + if column > indents[-1]: # count indents + indents.append(column) + yield (INDENT, line[:pos], (lnum, 0), (lnum, pos), line) + while column < indents[-1]: # count dedents if column not in indents: raise IndentationError( @@ -451,8 +451,6 @@ def generate_tokens(readline): while pos < max: pseudomatch = pseudoprog.match(line, pos) - if not pseudomatch: - print('no pseudomatch') if pseudomatch: # scan for tokens start, end = pseudomatch.span(1) spos, epos, pos = (lnum, start), (lnum, end), end