[Zope-Checkins] CVS: Zope2 - UnTextIndex.py:1.33.2.16

andreas@serenade.digicool.com andreas@serenade.digicool.com
Tue, 5 Jun 2001 09:02:24 -0400


Update of /cvs-repository/Zope2/lib/python/SearchIndex
In directory serenade:/tmp/cvs-serv18668

Modified Files:
      Tag: zope-2_3-branch
	UnTextIndex.py 
Log Message:
Fixed (hopefully) a longtime outstanding problem in parens():         
- the former regex never matched any parentheses
- the parens() used old regex module API although 're' module was used



--- Updated File UnTextIndex.py in package Zope2 --
--- UnTextIndex.py	2001/05/03 11:10:14	1.33.2.15
+++ UnTextIndex.py	2001/06/05 13:02:24	1.33.2.16
@@ -700,13 +700,16 @@
     return q
 
 
-def parens(s, parens_re=regex.compile('(\|)').search):
+def parens(s, parens_re=re.compile('[\(\)]').search):
 
     index = open_index = paren_count = 0
 
     while 1:
-        index = parens_re(s, index)
-        if index < 0 : break
+
+        mo = parens_re(s, index)
+        if mo is None : break
+
+        index = mo.start(0)
     
         if s[index] == '(':
             paren_count = paren_count + 1
@@ -723,7 +726,6 @@
         return None
     else:
         raise QueryError, "Mismatched parentheses"      
-
 
 
 def quotes(s, ws=(string.whitespace,)):