Author: Matti Picus <matti.pi...@gmail.com>
Branch: unicode-utf8
Changeset: r95271:ac5e084fa5b9
Date: 2018-11-04 06:47 -0500
http://bitbucket.org/pypy/pypy/changeset/ac5e084fa5b9/

Log:    fix merge from fix-sre-problems

diff --git a/rpython/rlib/rsre/rsre_core.py b/rpython/rlib/rsre/rsre_core.py
--- a/rpython/rlib/rsre/rsre_core.py
+++ b/rpython/rlib/rsre/rsre_core.py
@@ -460,7 +460,7 @@
         ptr = self.start_ptr
         if not self.next_char_ok(ctx, pattern, ptr, self.ppos3):
             return
-        self.start_ptr = ptr + 1
+        self.start_ptr = ctx.next(ptr)
         return self.find_first_result(ctx, pattern)
 
     def next_char_ok(self, ctx, pattern, ptr, ppos):
@@ -736,9 +736,9 @@
             startptr, length_bytes = get_group_ref(ctx, marks, 
pattern.pat(ppos))
             if length_bytes < 0:
                 return     # group was not previously defined
-            if not match_repeated_ignore(ctx, ptr, startptr, length_bytes):
+            ptr = match_repeated_ignore(ctx, ptr, startptr, length_bytes)
+            if ptr < ctx.ZERO:
                 return     # no match
-            ptr = ctx.go_forward_by_bytes(ptr, length_bytes)
             ppos += 1
 
         elif op == OPCODE_GROUPREF_EXISTS:
diff --git a/rpython/rlib/rsre/rsre_utf8.py b/rpython/rlib/rsre/rsre_utf8.py
--- a/rpython/rlib/rsre/rsre_utf8.py
+++ b/rpython/rlib/rsre/rsre_utf8.py
@@ -66,12 +66,12 @@
         return position_high - position_low
 
 
-def make_utf8_ctx(pattern, utf8string, bytestart, byteend, flags):
+def make_utf8_ctx(utf8string, bytestart, byteend, flags):
     if bytestart < 0: bytestart = 0
     elif bytestart > len(utf8string): bytestart = len(utf8string)
     if byteend < 0: byteend = 0
     elif byteend > len(utf8string): byteend = len(utf8string)
-    ctx = Utf8MatchContext(pattern, utf8string, bytestart, byteend, flags)
+    ctx = Utf8MatchContext(utf8string, bytestart, byteend, flags)
     ctx.debug_check_pos(bytestart)
     ctx.debug_check_pos(byteend)
     return ctx
@@ -81,8 +81,8 @@
     # utf8string.
     from rpython.rlib.rsre.rsre_core import search_context
 
-    ctx = make_utf8_ctx(pattern, utf8string, bytestart, byteend, flags)
-    if search_context(ctx):
+    ctx = make_utf8_ctx(utf8string, bytestart, byteend, flags)
+    if search_context(ctx, pattern):
         return ctx
     else:
         return None
@@ -93,9 +93,9 @@
     # utf8string.
     from rpython.rlib.rsre.rsre_core import match_context
 
-    ctx = make_utf8_ctx(pattern, utf8string, bytestart, byteend, flags)
+    ctx = make_utf8_ctx(utf8string, bytestart, byteend, flags)
     ctx.fullmatch_only = fullmatch
-    if match_context(ctx):
+    if match_context(ctx, pattern):
         return ctx
     else:
         return None
diff --git a/rpython/rlib/rsre/test/support.py 
b/rpython/rlib/rsre/test/support.py
--- a/rpython/rlib/rsre/test/support.py
+++ b/rpython/rlib/rsre/test/support.py
@@ -111,9 +111,9 @@
     start, end = _adjust(start, end, len(string))
     start = Position(start)
     end = Position(end)
-    ctx = MatchContextForTests(pattern, string, start, end, flags)
+    ctx = MatchContextForTests(string, start, end, flags)
     ctx.fullmatch_only = fullmatch
-    if match_context(ctx):
+    if match_context(ctx, pattern):
         return ctx
     else:
         return None
@@ -125,8 +125,8 @@
     start, end = _adjust(start, end, len(string))
     start = Position(start)
     end = Position(end)
-    ctx = MatchContextForTests(pattern, string, start, end, flags)
-    if search_context(ctx):
+    ctx = MatchContextForTests(string, start, end, flags)
+    if search_context(ctx, pattern):
         return ctx
     else:
         return None
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to