diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2014-02-24 04:33:44 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2014-02-24 04:33:44 (GMT) |
commit | 40f8c6774b7ddd6cc580b35e37df67db5ecb0cc1 (patch) | |
tree | 80649b62354ef5255580760e7965aa56e5f49ebf /Lib/tokenize.py | |
parent | aa5e2995c79c70419d9b1f13a5b02d0b2ad43883 (diff) | |
parent | 9dc3a36c849c15c227a8af218cfb215abe7b3c48 (diff) | |
download | cpython-40f8c6774b7ddd6cc580b35e37df67db5ecb0cc1.zip cpython-40f8c6774b7ddd6cc580b35e37df67db5ecb0cc1.tar.gz cpython-40f8c6774b7ddd6cc580b35e37df67db5ecb0cc1.tar.bz2 |
Merge with 3.3
Diffstat (limited to 'Lib/tokenize.py')
-rw-r--r-- | Lib/tokenize.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/tokenize.py b/Lib/tokenize.py index 74bd15c..e320d39 100644 --- a/Lib/tokenize.py +++ b/Lib/tokenize.py @@ -234,6 +234,10 @@ class Untokenizer: if row < self.prev_row or row == self.prev_row and col < self.prev_col: raise ValueError("start ({},{}) precedes previous end ({},{})" .format(row, col, self.prev_row, self.prev_col)) + row_offset = row - self.prev_row + if row_offset: + self.tokens.append("\\\n" * row_offset) + self.prev_col = 0 col_offset = col - self.prev_col if col_offset: self.tokens.append(" " * col_offset) @@ -248,6 +252,8 @@ class Untokenizer: if tok_type == ENCODING: self.encoding = token continue + if tok_type == ENDMARKER: + break self.add_whitespace(start) self.tokens.append(token) self.prev_row, self.prev_col = end |