1108 # The comment also ends a physical line. This works around |
1108 # The comment also ends a physical line. This works around |
1109 # Python < 2.6 behaviour, which does not generate NL after |
1109 # Python < 2.6 behaviour, which does not generate NL after |
1110 # a comment which is on a line by itself. |
1110 # a comment which is on a line by itself. |
1111 self.tokens = [] |
1111 self.tokens = [] |
1112 except (SyntaxError, tokenize.TokenError) as err: |
1112 except (SyntaxError, tokenize.TokenError) as err: |
1113 msg, (lnum, pos) = err.args |
1113 msg = err.args[0] |
1114 self.report_error_args(lnum, pos, "E901", "TokenError", msg) |
1114 if len(err.args) > 1: |
|
1115 offset = err.args[1] |
|
1116 if len(offset) > 2: |
|
1117 offset = offset[1:3] |
|
1118 else: |
|
1119 offset = (1, 0) |
|
1120 self.report_error_args( |
|
1121 offset[0], offset[1] or 0, "E901", "TokenError", msg) |
1115 return self.file_errors |
1122 return self.file_errors |
1116 |
1123 |
1117 def report_error(self, line_number, offset, text, check): |
1124 def report_error(self, line_number, offset, text, check): |
1118 """ |
1125 """ |
1119 Report an error, according to options. |
1126 Report an error, according to options. |