[pypy-svn] r45652 - in pypy/dist/pypy/lang/scheme: . test

jlg at codespeak.net jlg at codespeak.net
Tue Aug 14 12:39:44 CEST 2007


Author: jlg
Date: Tue Aug 14 12:39:43 2007
New Revision: 45652

Modified:
   pypy/dist/pypy/lang/scheme/interactive.py
   pypy/dist/pypy/lang/scheme/test/test_interactive.py
Log:
nice parsing errors for interactive interpreter

Modified: pypy/dist/pypy/lang/scheme/interactive.py
==============================================================================
--- pypy/dist/pypy/lang/scheme/interactive.py	(original)
+++ pypy/dist/pypy/lang/scheme/interactive.py	Tue Aug 14 12:39:43 2007
@@ -40,7 +40,10 @@
             except SchemeException, e:
                 print "error: %s" % e
             except BacktrackException, e:
-                print "syntax error"
+                (line, col) = e.error.get_line_column(to_exec)
+                expected = " ".join(e.error.expected)
+                print "parse error: in line %s, column %s expected: %s" % \
+                        (line, col, expected)
 
             to_exec = ""
             cont = False

Modified: pypy/dist/pypy/lang/scheme/test/test_interactive.py
==============================================================================
--- pypy/dist/pypy/lang/scheme/test/test_interactive.py	(original)
+++ pypy/dist/pypy/lang/scheme/test/test_interactive.py	Tue Aug 14 12:39:43 2007
@@ -48,7 +48,7 @@
         child = self.spawn()
         child.expect("-> ")
         child.sendline(")(")
-        child.expect("syntax error")
+        child.expect("parse error")
         child.expect("-> ")
 
     def test_multiline_enter(self):



More information about the Pypy-commit mailing list