[pypy-svn] r75791 - in pypy/branch/rsre2/pypy/rlib/rsre: . test

arigo at codespeak.net arigo at codespeak.net
Fri Jul 2 20:03:45 CEST 2010


Author: arigo
Date: Fri Jul  2 20:03:43 2010
New Revision: 75791

Modified:
   pypy/branch/rsre2/pypy/rlib/rsre/rsre.py
   pypy/branch/rsre2/pypy/rlib/rsre/test/test_match.py
Log:
NOT_LITERAL_IGNORE.


Modified: pypy/branch/rsre2/pypy/rlib/rsre/rsre.py
==============================================================================
--- pypy/branch/rsre2/pypy/rlib/rsre/rsre.py	(original)
+++ pypy/branch/rsre2/pypy/rlib/rsre/rsre.py	Fri Jul  2 20:03:43 2010
@@ -235,6 +235,14 @@
             ppos += 1
             ptr += 1
 
+        elif op == OPCODE_NOT_LITERAL_IGNORE:
+            # match if it's not a literal string, ignoring case
+            # <NOT_LITERAL> <code>
+            if ptr >= ctx.end or ctx.lowstr(ptr) == ctx.pat(ppos):
+                return False
+            ppos += 1
+            ptr += 1
+
         elif op == OPCODE_REPEAT:
             # general repeat.  in this version of the re module, all the work
             # is done here, and not on the later UNTIL operator.
@@ -410,6 +418,11 @@
         while ptr < end and ctx.str(ptr) != chr:
             ptr += 1
 
+    elif op == OPCODE_NOT_LITERAL_IGNORE:
+        chr = ctx.pat(ppos+1)
+        while ptr < end and ctx.lowstr(ptr) != chr:
+            ptr += 1
+
     else:
         assert 0, "XXX %d" % op
 

Modified: pypy/branch/rsre2/pypy/rlib/rsre/test/test_match.py
==============================================================================
--- pypy/branch/rsre2/pypy/rlib/rsre/test/test_match.py	(original)
+++ pypy/branch/rsre2/pypy/rlib/rsre/test/test_match.py	Fri Jul  2 20:03:43 2010
@@ -143,7 +143,6 @@
         assert not rsre.match(r, "--a--")
 
     def test_not_literal_ignore(self):
-        import py; py.test.skip("in-progress")
         r, _ = get_code(r"(?i)[^a]")
         assert rsre.match(r, "G")
         assert not rsre.match(r, "a")



More information about the Pypy-commit mailing list