[pypy-svn] r37059 - in pypy/dist/pypy/lang/js: . test

santagada at codespeak.net santagada at codespeak.net
Sat Jan 20 13:33:26 CET 2007


Author: santagada
Date: Sat Jan 20 13:33:22 2007
New Revision: 37059

Modified:
   pypy/dist/pypy/lang/js/jsparser.py
   pypy/dist/pypy/lang/js/test/test_interp.py
Log:
trying to fix some more parse-slash-scape hell.


Modified: pypy/dist/pypy/lang/js/jsparser.py
==============================================================================
--- pypy/dist/pypy/lang/js/jsparser.py	(original)
+++ pypy/dist/pypy/lang/js/jsparser.py	Sat Jan 20 13:33:22 2007
@@ -14,9 +14,15 @@
 class JsSyntaxError(Exception):
     pass
 
+singlequote = re.compile(r"(?<!\\)'")
 def read_js_output(code_string):
-    stripped_code = code_string.replace("\n", "\\n")
-    stripped_code = stripped_code.replace("'",r"\'")
+    print "------ got:"
+    print code_string
+    print "------ put:"
+    stripped_code = re.sub(r"\\",r"\\\\", code_string)
+    stripped_code = stripped_code.replace("\n", "\\n")
+    stripped_code = singlequote.sub(r"\'", stripped_code)
+    print stripped_code
     jsdir = py.path.local(__file__).dirpath().join("js")
     jsdefs = jsdir.join("jsdefs.js").read()
     jsparse = jsdir.join("jsparse.js").read()

Modified: pypy/dist/pypy/lang/js/test/test_interp.py
==============================================================================
--- pypy/dist/pypy/lang/js/test/test_interp.py	(original)
+++ pypy/dist/pypy/lang/js/test/test_interp.py	Sat Jan 20 13:33:22 2007
@@ -333,10 +333,7 @@
         var x = 3;
         typeof x == 'number'
         """, W_Boolean(True))
-    
-    def test_switch(self):
-        py.test.skip('not ready yet')
-    
+        
     def test_semicolon(self):
         self.assert_prints(';', [])
 



More information about the Pypy-commit mailing list