1107 if text.endswith('\n') and not parens: |
1107 if text.endswith('\n') and not parens: |
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 tokenize.TokenError as err: |
1112 except (SyntaxError, tokenize.TokenError) as err: |
1113 msg, (lnum, pos) = err.args |
1113 msg, (lnum, pos) = err.args |
1114 self.report_error_args(lnum, pos, "E901", "TokenError", msg) |
1114 self.report_error_args(lnum, pos, "E901", "TokenError", msg) |
1115 return self.file_errors |
1115 return self.file_errors |
1116 |
1116 |
1117 def report_error(self, line_number, offset, text, check): |
1117 def report_error(self, line_number, offset, text, check): |