[pypy-svn] r75781 - in pypy/branch/rsre2/pypy/rlib/rsre: . test
arigo at codespeak.net
arigo at codespeak.net
Fri Jul 2 18:21:19 CEST 2010
Author: arigo
Date: Fri Jul 2 18:21:18 2010
New Revision: 75781
Added:
pypy/branch/rsre2/pypy/rlib/rsre/
- copied from r75674, user/arigo/hack/pypy-hack/rsre/
pypy/branch/rsre2/pypy/rlib/rsre/rsre.py
- copied, changed from r75765, user/arigo/hack/pypy-hack/rsre/rsre.py
pypy/branch/rsre2/pypy/rlib/rsre/rsre_char.py
- copied unchanged from r75706, user/arigo/hack/pypy-hack/rsre/rsre_char.py
pypy/branch/rsre2/pypy/rlib/rsre/test/test_match.py
- copied, changed from r75765, user/arigo/hack/pypy-hack/rsre/test/test_match.py
pypy/branch/rsre2/pypy/rlib/rsre/test/test_search.py
- copied unchanged from r75762, user/arigo/hack/pypy-hack/rsre/test/test_search.py
Log:
Copy the current rsre from my working copy.
Copied: pypy/branch/rsre2/pypy/rlib/rsre/rsre.py (from r75765, user/arigo/hack/pypy-hack/rsre/rsre.py)
==============================================================================
--- user/arigo/hack/pypy-hack/rsre/rsre.py (original)
+++ pypy/branch/rsre2/pypy/rlib/rsre/rsre.py Fri Jul 2 18:21:18 2010
@@ -9,6 +9,8 @@
OPCODE_ASSERT_NOT = 5
OPCODE_AT = 6
OPCODE_BRANCH = 7
+#OPCODE_CALL = 8
+OPCODE_CATEGORY = 9
OPCODE_IN = 15
OPCODE_INFO = 17
OPCODE_JUMP = 18
@@ -121,6 +123,14 @@
ppos += ctx.pat(ppos)
return False
+ elif op == OPCODE_CATEGORY:
+ # match at given category (a single char)
+ # <CATEGORY> <code>
+ xxx #if (ptr >= end || !sre_category(pattern[0], ptr[0]))
+ # return 0;
+ #pattern++;
+ #ptr++;
+
elif op == OPCODE_INFO:
# optimization info block
# <INFO> <0=skip> <1=flags> <2=min> ...
Copied: pypy/branch/rsre2/pypy/rlib/rsre/test/test_match.py (from r75765, user/arigo/hack/pypy-hack/rsre/test/test_match.py)
==============================================================================
--- user/arigo/hack/pypy-hack/rsre/test/test_match.py (original)
+++ pypy/branch/rsre2/pypy/rlib/rsre/test/test_match.py Fri Jul 2 18:21:18 2010
@@ -87,3 +87,10 @@
assert rsre.match(r, "abc")
assert not rsre.match(r, "abcd")
assert not rsre.match(r, "ab")
+
+ def test_category(self):
+ r, _ = get_code(r"ab\dcd")
+ assert rsre.match(r, "ab0cd")
+ assert rsre.match(r, "ab9cd")
+ assert not rsre.match(r, "abXcd")
+ assert not rsre.match(r, "ab+cd")
More information about the Pypy-commit
mailing list