[pypy-svn] r75994 - pypy/branch/rsre2/pypy/rlib/rsre

arigo at codespeak.net arigo at codespeak.net
Wed Jul 7 18:42:37 CEST 2010


Author: arigo
Date: Wed Jul  7 18:42:35 2010
New Revision: 75994

Modified:
   pypy/branch/rsre2/pypy/rlib/rsre/rsre.py
Log:
Minor simplification of logic.


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	Wed Jul  7 18:42:35 2010
@@ -299,21 +299,18 @@
             else:
                 enum = None    # 'max' reached, no more matches
 
-            while True:
-                if enum is not None:
-                    # matched one more 'item'.  record it and continue
-                    self.pending.append((ptr, marks, enum))
-                    ptr = ctx.match_end
-                    marks = ctx.match_marks
-                    break
-                else:
-                    # 'item' no longer matches.
-                    if len(self.pending) == 0:
-                        return
-                    ptr, marks, enum = self.pending.pop()
-                    enum = enum.move_to_next_result(ctx)
-                    continue
-                break
+            while enum is None:
+                # 'item' does not match; try to get further results from
+                # the 'pending' list.
+                if len(self.pending) == 0:
+                    return
+                ptr, marks, enum = self.pending.pop()
+                enum = enum.move_to_next_result(ctx)
+
+            # matched one more 'item'.  record it and continue
+            self.pending.append((ptr, marks, enum))
+            ptr = ctx.match_end
+            marks = ctx.match_marks
 
 # ____________________________________________________________
 



More information about the Pypy-commit mailing list