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

andreas@serenade.digicool.com andreas@serenade.digicool.com
Tue, 5 Jun 2001 08:59:02 -0400


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

Modified Files:
	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:09:12	1.48
+++ UnTextIndex.py	2001/06/05 12:59:01	1.49
@@ -700,13 +700,16 @@
     return q
 
 
-def parens(s, parens_re=re.compile(r'(\|)').search):
+def parens(s, parens_re=re.compile('[\(\)]').search):
 
     index = open_index = paren_count = 0
 
     while 1:
-        index = parens_re(s, index)
-        if index is None : 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,)):