[pypy-svn] r64183 - pypy/trunk/pypy/rlib/rsre

fijal at codespeak.net fijal at codespeak.net
Thu Apr 16 20:16:58 CEST 2009


Author: fijal
Date: Thu Apr 16 20:16:57 2009
New Revision: 64183

Modified:
   pypy/trunk/pypy/rlib/rsre/_rsre_platform.py
   pypy/trunk/pypy/rlib/rsre/rsre_char.py
Log:
missing part of locale support (at least enough to pass tests, probably
we need more at some point)


Modified: pypy/trunk/pypy/rlib/rsre/_rsre_platform.py
==============================================================================
--- pypy/trunk/pypy/rlib/rsre/_rsre_platform.py	(original)
+++ pypy/trunk/pypy/rlib/rsre/_rsre_platform.py	Thu Apr 16 20:16:57 2009
@@ -11,4 +11,6 @@
 
 tolower = external('tolower', [lltype.Signed], lltype.Signed,
                                       oo_primitive='tolower')
-
+isalnum = external('isalnum', [lltype.Signed], lltype.Signed,
+                   oo_primitive='isalnum')
+                   

Modified: pypy/trunk/pypy/rlib/rsre/rsre_char.py
==============================================================================
--- pypy/trunk/pypy/rlib/rsre/rsre_char.py	(original)
+++ pypy/trunk/pypy/rlib/rsre/rsre_char.py	Thu Apr 16 20:16:57 2009
@@ -2,7 +2,7 @@
 Character categories and charsets.
 """
 import sys
-from pypy.rlib.rsre._rsre_platform import tolower
+from pypy.rlib.rsre._rsre_platform import tolower, isalnum
 
 # Note: the unicode parts of this module require you to call
 # rsre.set_unicode_db() first, to select one of the modules
@@ -103,7 +103,11 @@
 def is_uni_word(code):
     return unicodedb.isalnum(code) or code == underline
 
-is_loc_word = is_word      # XXX no support for platform locales anyway
+def is_loc_alnum(code):
+    return code < 256 and isalnum(code)
+
+def is_loc_word(code):
+    return code == underline or is_loc_alnum(code)
 
 def is_linebreak(code):
     return code == linebreak



More information about the Pypy-commit mailing list