Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py

changeset 6247
5c677a7f7d51
parent 6235
0e6a395ecfe8
child 6645
ad476851d7e0
equal deleted inserted replaced
6246:fe07a9f16f23 6247:5c677a7f7d51
271 code = "" 271 code = ""
272 error = "" 272 error = ""
273 lines = traceback.format_exception_only(SyntaxError, detail) 273 lines = traceback.format_exception_only(SyntaxError, detail)
274 if sys.version_info[0] == 2: 274 if sys.version_info[0] == 2:
275 lines = [x.decode(sys.getfilesystemencoding()) for x in lines] 275 lines = [x.decode(sys.getfilesystemencoding()) for x in lines]
276 match = re.match('\s*File "(.+)", line (\d+)', 276 match = re.match(r'\s*File "(.+)", line (\d+)',
277 lines[0].replace('<string>', filename)) 277 lines[0].replace('<string>', filename))
278 if match is not None: 278 if match is not None:
279 fn, line = match.group(1, 2) 279 fn, line = match.group(1, 2)
280 if lines[1].startswith('SyntaxError:'): 280 if lines[1].startswith('SyntaxError:'):
281 error = re.match('SyntaxError: (.+)', lines[1]).group(1) 281 error = re.match('SyntaxError: (.+)', lines[1]).group(1)

eric ide

mercurial