Modified the JavaScript syntax checker to cope with incomplete source files.

Sat, 26 Aug 2017 17:10:43 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 26 Aug 2017 17:10:43 +0200
changeset 5849
512001065055
parent 5848
56388f41b1e6
child 5850
7fae79975686

Modified the JavaScript syntax checker to cope with incomplete source files.

Plugins/CheckerPlugins/SyntaxChecker/jsCheckSyntax.py file | annotate | diff | comparison | revisions
--- a/Plugins/CheckerPlugins/SyntaxChecker/jsCheckSyntax.py	Sat Aug 26 16:49:16 2017 +0200
+++ b/Plugins/CheckerPlugins/SyntaxChecker/jsCheckSyntax.py	Sat Aug 26 17:10:43 2017 +0200
@@ -188,5 +188,10 @@
         cline = min(len(codestring.splitlines()), int(line)) - 1
         code = codestring.splitlines()[cline]
         return [{'error': (fn, int(line), 0, code, error)}]
+    except IndexError:
+        error = "Incomplete source file"
+        splittedCode = codestring.splitlines()
+        return [{'error': (file, len(splittedCode) + 1, len(splittedCode[-1]),
+                           splittedCode[-1], error)}]
     
     return [{}]

eric ide

mercurial