[pypy-svn] r75989 - in pypy/branch/rsre2/pypy/rlib/rsre_jit: . test

arigo at codespeak.net arigo at codespeak.net
Wed Jul 7 18:14:55 CEST 2010


Author: arigo
Date: Wed Jul  7 18:14:53 2010
New Revision: 75989

Modified:
   pypy/branch/rsre2/pypy/rlib/rsre_jit/rsre.py
   pypy/branch/rsre2/pypy/rlib/rsre_jit/test/test_match.py
Log:
Merge from rsre.


Modified: pypy/branch/rsre2/pypy/rlib/rsre_jit/rsre.py
==============================================================================
--- pypy/branch/rsre2/pypy/rlib/rsre_jit/rsre.py	(original)
+++ pypy/branch/rsre2/pypy/rlib/rsre_jit/rsre.py	Wed Jul  7 18:14:53 2010
@@ -369,6 +369,7 @@
             ptr1 = ptr - ctx.pat(ppos+1)
             if ptr1 >= 0 and sre_match(ctx, ppos + 2, ptr1, marks) is not None:
                 return
+            marks = ctx.match_marks
             ppos += ctx.pat(ppos)
 
         elif op == OPCODE_AT:

Modified: pypy/branch/rsre2/pypy/rlib/rsre_jit/test/test_match.py
==============================================================================
--- pypy/branch/rsre2/pypy/rlib/rsre_jit/test/test_match.py	(original)
+++ pypy/branch/rsre2/pypy/rlib/rsre_jit/test/test_match.py	Wed Jul  7 18:14:53 2010
@@ -195,3 +195,19 @@
         assert rsre.match(r, "xyxyxyB") is not None
         r = get_code(r"(?:xy(?:xy)+?)+?B")
         assert rsre.match(r, "xyxyxyB") is not None
+
+    def test_assert_group(self):
+        r = get_code(r"abc(?=(..)f)(.)")
+        res = rsre.match(r, "abcdefghi")
+        assert res is not None
+        assert res.span(2) == (3, 4)
+        assert res.span(1) == (3, 5)
+
+    def test_assert_not_group(self):
+        r = get_code(r"abc(?!(de)f)(.)")
+        res = rsre.match(r, "abcdeFghi")
+        assert res is not None
+        assert res.span(2) == (3, 4)
+        # this I definitely classify as Horrendously Implementation Dependent.
+        # CPython answers (3, 5).
+        assert res.span(1) == (-1, -1)



More information about the Pypy-commit mailing list