changeset 129:e39c14597e02

Change PySMCL exit code for syntax error. Prior to this commit the PySMCL compiler (pysmcl/emacs/info.py) returned exit code 1 both when the program to be compiled contained syntax errors and when other more serious internal exceptions occured during compilation. In this commit the exit code for syntax errors is changed to 2. This allows the Eclipse plugin to differentiate between syntax errors and internal compiler errors. The plugin will currently ignore syntax errors as this is supposed to be handled by e.g. the PyDev plugin.
author Thomas P Jakobsen <tpj@cs.au.dk>
date Thu, 29 Oct 2009 16:19:47 +0100
parents ed89fc3147ae
children 1c96a5080899
files eclipse/src/eu/cace/pysmcl/builder/PySMCLCompiler.java pysmcl/emacs/info.py
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/eclipse/src/eu/cace/pysmcl/builder/PySMCLCompiler.java	Wed Oct 28 12:48:54 2009 +0100
+++ b/eclipse/src/eu/cace/pysmcl/builder/PySMCLCompiler.java	Thu Oct 29 16:19:47 2009 +0100
@@ -31,6 +31,12 @@
 class PySMCLCompiler {
 
 	/**
+	 * Exit codes from the Python PySMCL compiler.
+	 */
+	private static final int PYSMCL_OK = 0;
+	private static final int PYSMCL_SYNTAX_ERROR = 2;
+
+	/**
 	 * Indicates an exceptional condition when compiling with the PySMCL.
 	 * 
 	 */
@@ -235,7 +241,7 @@
 					+ exec.getOutput());
 		}
 
-		if (0 != exec.getExitValue())
+		if (PYSMCL_OK != exec.getExitValue() && PYSMCL_SYNTAX_ERROR != exec.getExitValue())
 			throw new PySMCLException("PySMCL returned with error code "
 					+ exec.getExitValue() + "\n" + exec.getOutput());
 
--- a/pysmcl/emacs/info.py	Wed Oct 28 12:48:54 2009 +0100
+++ b/pysmcl/emacs/info.py	Thu Oct 29 16:19:47 2009 +0100
@@ -9,7 +9,7 @@
     try:
         prog = ast.parse(file(sys.argv[1]).read())
     except SyntaxError:
-        exit(1)
+        exit(2)  # Exit code signalling syntax error.
     for i in prog.body:
         if isinstance(i, ast.FunctionDef):
             secret_analysis(i)