Commits

ebo  committed 2761f14

Added flags

  • Participants
  • Parent commits 0873f3e

Comments (0)

Files changed (1)

File llvmre.patch

 diff -r 37ecb109fa41 Lib/llvmre.py
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/Lib/llvmre.py	Tue May 25 22:46:17 2010 +0200
-@@ -0,0 +1,30 @@
++++ b/Lib/llvmre.py	Thu May 27 07:54:42 2010 +0200
+@@ -0,0 +1,50 @@
 +import sys
++import sre_compile
++
++I = IGNORECASE = sre_compile.SRE_FLAG_IGNORECASE # ignore case
++L = LOCALE = sre_compile.SRE_FLAG_LOCALE # assume current 8-bit locale
++U = UNICODE = sre_compile.SRE_FLAG_UNICODE # assume unicode locale
++M = MULTILINE = sre_compile.SRE_FLAG_MULTILINE # make anchors look for newline
++S = DOTALL = sre_compile.SRE_FLAG_DOTALL # make dot match newline
++X = VERBOSE = sre_compile.SRE_FLAG_VERBOSE # ignore whitespace and comments
++
++class error(Exception):
++    pass
 +
 +class RegexObject(object):
 +    def __init__(self, pattern, flags):
++        self.flags = flags
++        self.unicode = self.flags & U
++        if not self.unicode:
++            raise error("Not implemented.")
++
 +        from sre_parse import parse
 +        self.__parsed = parse(pattern, flags)
 +        flags = self.__parsed.pattern.flags
 +        from _llvmre import RegEx
 +        self.__re = RegEx(self.__parsed, flags, self.__parsed.pattern.groups-1)
 +
-+        self.flags = flags
 +        self.groups = self.__parsed.pattern.groups-1
 +        self.groupindex = self.__parsed.pattern.groupdict
 +        self.pattern = pattern
 +
 +    def match(self, string, pos=0, endpos=sys.maxint):
-+        if self.__re.match(unicode(string), pos, endpos):
++        if self.unicode:
++            string = unicode(string)
++        else:
++            raise error("Not implemented.")
++
++        if self.__re.match(string, pos, endpos):
 +            return MatchObject()
 +        else:
 +            return None
 +    return RegexObject(pattern, flags)
 diff -r 37ecb109fa41 Modules/Setup.dist
 --- a/Modules/Setup.dist	Mon May 03 18:00:25 2010 +0200
-+++ b/Modules/Setup.dist	Tue May 25 22:46:17 2010 +0200
++++ b/Modules/Setup.dist	Thu May 27 07:54:42 2010 +0200
 @@ -117,6 +117,8 @@
  pwd pwdmodule.c			# this is needed to find out the user's home dir
  				# if $HOME is not set
  # The zipimport module is always imported at startup. Having it as a
 diff -r 37ecb109fa41 Modules/_llvmre/llvmre.cc
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/Modules/_llvmre/llvmre.cc	Tue May 25 22:46:17 2010 +0200
++++ b/Modules/_llvmre/llvmre.cc	Thu May 27 07:54:42 2010 +0200
 @@ -0,0 +1,1048 @@
 +#include "Python.h"
 +
 +
 diff -r 37ecb109fa41 Modules/_llvmre/llvmre.h
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/Modules/_llvmre/llvmre.h	Tue May 25 22:46:17 2010 +0200
++++ b/Modules/_llvmre/llvmre.h	Thu May 27 07:54:42 2010 +0200
 @@ -0,0 +1,145 @@
 +// -*- C++ -*-
 +#ifndef MODULES_LLVMRE_H
 +#endif /* MODULES_LLVMRE_H */
 diff -r 37ecb109fa41 Modules/_llvmre/re_opcodes.cc
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/Modules/_llvmre/re_opcodes.cc	Tue May 25 22:46:17 2010 +0200
++++ b/Modules/_llvmre/re_opcodes.cc	Thu May 27 07:54:42 2010 +0200
 @@ -0,0 +1,153 @@
 +#include "Python.h"
 +
 +}
 diff -r 37ecb109fa41 configure
 --- a/configure	Mon May 03 18:00:25 2010 +0200
-+++ b/configure	Tue May 25 22:46:17 2010 +0200
++++ b/configure	Thu May 27 07:54:42 2010 +0200
 @@ -1,63 +1,86 @@
  #! /bin/sh
  # From configure.in Revision: 75132 .
    See PEP 11 for the gory details.
 diff -r 37ecb109fa41 configure.in
 --- a/configure.in	Mon May 03 18:00:25 2010 +0200
-+++ b/configure.in	Tue May 25 22:46:17 2010 +0200
++++ b/configure.in	Thu May 27 07:54:42 2010 +0200
 @@ -509,9 +509,9 @@
  
      LLVM_INC_DIR=`$LLVM_CONFIG --includedir`
          [], [AC_MSG_ERROR([Did not find clang in $LLVM_BIN_DIR])])
 diff -r 37ecb109fa41 proto.py
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/proto.py	Tue May 25 22:46:17 2010 +0200
++++ b/proto.py	Thu May 27 07:54:42 2010 +0200
 @@ -0,0 +1,132 @@
 +from sre_parse import parse
 +
 +    _main()
 diff -r 37ecb109fa41 pyconfig.h.in
 --- a/pyconfig.h.in	Mon May 03 18:00:25 2010 +0200
-+++ b/pyconfig.h.in	Tue May 25 22:46:17 2010 +0200
++++ b/pyconfig.h.in	Thu May 27 07:54:42 2010 +0200
 @@ -5,6 +5,9 @@
  #define Py_PYCONFIG_H
  
  
 diff -r 37ecb109fa41 recompile.py
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/recompile.py	Tue May 25 22:46:17 2010 +0200
++++ b/recompile.py	Thu May 27 07:54:42 2010 +0200
 @@ -0,0 +1,51 @@
 +import pickle
 +import llvmre
 +    _main()
 diff -r 37ecb109fa41 regex.py
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/regex.py	Tue May 25 22:46:17 2010 +0200
++++ b/regex.py	Thu May 27 07:54:42 2010 +0200
 @@ -0,0 +1,21 @@
 +import llvmre
 +from sre_parse import parse
 +
 diff -r 37ecb109fa41 regexes.pickle
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/regexes.pickle	Tue May 25 22:46:17 2010 +0200
++++ b/regexes.pickle	Thu May 27 07:54:42 2010 +0200
 @@ -0,0 +1,1112 @@
 +(lp0
 +(S'\\bnpgvingr\\b'
 \ No newline at end of file
 diff -r 37ecb109fa41 tests.py
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/tests.py	Tue May 25 22:46:17 2010 +0200
++++ b/tests.py	Thu May 27 07:54:42 2010 +0200
 @@ -0,0 +1,78 @@
 +import unittest
 +