[pypy-svn] r75959 - in pypy/branch/rsre2/pypy/rlib/rsre: . test
arigo at codespeak.net
arigo at codespeak.net
Wed Jul 7 11:29:46 CEST 2010
Author: arigo
Date: Wed Jul 7 11:29:43 2010
New Revision: 75959
Added:
pypy/branch/rsre2/pypy/rlib/rsre/test/targetrsre.py
- copied, changed from r75953, pypy/trunk/pypy/rlib/rsre/test/targetrsre.py
Modified:
pypy/branch/rsre2/pypy/rlib/rsre/rsre.py
Log:
Copy targetrsre.py from trunk. Translation fixes.
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 11:29:43 2010
@@ -43,6 +43,7 @@
match_marks_flat = None
def __init__(self, pattern, string, match_start, flags):
+ assert match_start >= 0
self.pattern = pattern
self.string = string
self.end = len(string)
@@ -761,6 +762,7 @@
if i == prefix_len:
# found a potential match
start = string_position + 1 - prefix_len
+ assert start >= 0
ptr = start + prefix_skip
if flags & rsre_char.SRE_INFO_LITERAL:
# matched all of pure literal pattern
Copied: pypy/branch/rsre2/pypy/rlib/rsre/test/targetrsre.py (from r75953, pypy/trunk/pypy/rlib/rsre/test/targetrsre.py)
==============================================================================
--- pypy/trunk/pypy/rlib/rsre/test/targetrsre.py (original)
+++ pypy/branch/rsre2/pypy/rlib/rsre/test/targetrsre.py Wed Jul 7 11:29:43 2010
@@ -26,15 +26,13 @@
data = read(filename)
p = 0
while True:
- state = rsre.SimpleStringState(data, p)
- res = state.search(r_code1)
- if not res:
+ res = rsre.search(r_code1, data, p)
+ if res is None:
break
- groups = state.create_regs(1)
- matchstart, matchstop = groups[1]
+ matchstart, matchstop = res.span(1)
assert 0 <= matchstart <= matchstop
print '%s: %s' % (filename, data[matchstart:matchstop])
- p = groups[0][1]
+ p = res.span(0)[1]
# __________ Entry point __________
More information about the Pypy-commit
mailing list