Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py

branch
Py2 comp.
changeset 3525
66f4b8646622
parent 3515
1b8381afe38f
child 3544
431c842fd09a
equal deleted inserted replaced
3524:c6141071339a 3525:66f4b8646622
5 # pylint: disable=C0103 5 # pylint: disable=C0103
6 6
7 """ 7 """
8 Module implementing the syntax check for Python 2/3. 8 Module implementing the syntax check for Python 2/3.
9 """ 9 """
10 import ast
10 import re 11 import re
11 import sys 12 import sys
12 import traceback 13 import traceback
13 14
14 try: 15 try:
109 return [{'error': (filename, 0, 0, '', 110 return [{'error': (filename, 0, 0, '',
110 'Quixote plugin not found.')}] 111 'Quixote plugin not found.')}]
111 template = quixote.ptl_compile.Template(codestring, file_enc) 112 template = quixote.ptl_compile.Template(codestring, file_enc)
112 template.compile() 113 template.compile()
113 else: 114 else:
114 # ast.PyCF_ONLY_AST = 1024, speed optimisation 115 module = builtins.compile(
115 module = builtins.compile(codestring, file_enc, 'exec', 1024) 116 codestring, file_enc, 'exec', ast.PyCF_ONLY_AST)
116 except SyntaxError as detail: 117 except SyntaxError as detail:
117 index = 0 118 index = 0
118 code = "" 119 code = ""
119 error = "" 120 error = ""
120 lines = traceback.format_exception_only(SyntaxError, detail) 121 lines = traceback.format_exception_only(SyntaxError, detail)

eric ide

mercurial