changeset 127:18fa1a19f18a

info: Be silent on parseerrors
author Sigurd Meldgaard <stm@daimi.au.dk>
date Wed, 28 Oct 2009 12:48:09 +0100
parents 87a3c402aa1d
children ed89fc3147ae
files pysmcl/emacs/info.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pysmcl/emacs/info.py	Mon Oct 26 12:22:59 2009 +0100
+++ b/pysmcl/emacs/info.py	Wed Oct 28 12:48:09 2009 +0100
@@ -6,8 +6,10 @@
 
 
 def main():
-    prog = ast.parse(file(sys.argv[1]).read())
-    linenr = int(sys.argv[2]) if len(sys.argv) > 2 else 0
+    try:
+        prog = ast.parse(file(sys.argv[1]).read())
+    except SyntaxError:
+        exit(1)
     for i in prog.body:
         if isinstance(i, ast.FunctionDef):
             secret_analysis(i)