[pypy-svn] r34584 - pypy/dist/pypy/lang/prolog/interpreter

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Nov 13 22:03:50 CET 2006


Author: cfbolz
Date: Mon Nov 13 22:03:48 2006
New Revision: 34584

Modified:
   pypy/dist/pypy/lang/prolog/interpreter/main.py
Log:
better error messages for here too


Modified: pypy/dist/pypy/lang/prolog/interpreter/main.py
==============================================================================
--- pypy/dist/pypy/lang/prolog/interpreter/main.py	(original)
+++ pypy/dist/pypy/lang/prolog/interpreter/main.py	Mon Nov 13 22:03:48 2006
@@ -178,7 +178,15 @@
         if not len(sys.argv) == 2:
             e = Engine()
         else:
-            e = get_engine(py.path.local(sys.argv[1]).read())
+            try:
+                source = py.path.local(sys.argv[1]).read()
+                e = get_engine(source)
+            except ParseError, exc:
+                print exc.nice_error_message("<stdin>", source) + "\n"
+                sys.exit(1)
+            except LexerError, exc:
+                print exc.nice_error_message("<stdin>") + "\n"
+                sys.exit(1)
         c = PrologConsole(e)
         c.interact("PyPy Prolog Console")
     finally:



More information about the Pypy-commit mailing list