]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
- changed sre.Scanner to use lastindex instead of index.
authorFredrik Lundh <fredrik@pythonware.com>
Sun, 2 Jul 2000 22:59:57 +0000 (22:59 +0000)
committerFredrik Lundh <fredrik@pythonware.com>
Sun, 2 Jul 2000 22:59:57 +0000 (22:59 +0000)
Lib/sre.py

index 79f12a1b0f45c37990bbfa69e3d940600336552d..fbf44a5f3b8d22bc34958fa3e8e3c434ffde580f 100644 (file)
@@ -165,7 +165,7 @@ class Scanner:
         p = []
         for phrase, action in lexicon:
             p.append("(?:%s)(?P#%d)" % (phrase, len(p)))
-        self.scanner = sre.compile("|".join(p))
+        self.scanner = _compile("|".join(p))
     def scan(self, string):
         result = []
         append = result.append
@@ -178,7 +178,7 @@ class Scanner:
             j = m.end()
             if i == j:
                 break
-            action = self.lexicon[m.index][1]
+            action = self.lexicon[m.lastindex][1]
             if callable(action):
                 self.match = match
                 action = action(self, m.group())