[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/TextIndexNG/queryparser - TextIndexGgen.py:1.1.2.4

Andreas Jung andreas@digicool.com
Wed, 16 Jan 2002 09:17:22 -0500


Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/TextIndexNG/queryparser
In directory cvs.zope.org:/tmp/cvs-serv14117

Modified Files:
      Tag: ajung-textindexng-branch
	TextIndexGgen.py 
Log Message:
changed parens to be non terminals


=== Zope/lib/python/Products/PluginIndexes/TextIndexNG/queryparser/TextIndexGgen.py 1.1.2.3 => 1.1.2.4 ===
 
        @R R6                 ::  term   >> str 
-       @R R7                 ::  term   >> ( expr )
+       @R R7                 ::  term   >> openp expr closep
 """
 
 
@@ -36,9 +36,13 @@
 ANDREGEX             = 'and'
 ORREGEX              = 'or'
 STRREGEX             = '[a-zA-Z]*'
+OPENPREGEX           = r'('
+CLOSEPREGEX          = r')'
 
 
 def DeclareTerminals(Grammar):
+    Grammar.Addterm("openp", OPENPREGEX,  '')
+    Grammar.Addterm("closep",CLOSEPREGEX, '')
     Grammar.Addterm("and",   ANDREGEX,    '')
     Grammar.Addterm("or",    ORREGEX,     '')
     Grammar.Addterm("str",   STRREGEX,    '')
@@ -56,7 +60,7 @@
     TextIndexG.SetCaseSensitivity(0) # grammar is not case sensitive for keywords
     DeclareTerminals(TextIndexG)
 #    TextIndexG.Keywords("and or")
-    TextIndexG.punct("()")
+#    TextIndexG.punct("()")
     TextIndexG.Nonterms("expr term factor wordlist")
     TextIndexG.Declarerules(GRAMMARSTRING)
     TextIndexG.Compile()