← Back to team overview

team4alfanous team mailing list archive

[Branch ~team4alfanous/alfanous/alfanous-git] Rev 287: allow logical operations (+, -, |) to be used without spaces before and

 

------------------------------------------------------------
revno: 287
git commit: b9d49790fb8b4f71fb001f2dfafa4e8cd1937fd7
committer: Assem Chelli <assem.ch@xxxxxxxxx>
timestamp: Thu 2012-08-02 04:26:11 +0100
message:
  allow logical operations (+,-,|) to be used without spaces before and
  after
modified:
  src/alfanous/QueryProcessing.py


--
lp:alfanous
https://code.launchpad.net/~team4alfanous/alfanous/alfanous-git

Your team Alfanous team is subscribed to branch lp:alfanous.
To unsubscribe from this branch go to https://code.launchpad.net/~team4alfanous/alfanous/alfanous-git/+edit-subscription
=== modified file 'src/alfanous/QueryProcessing.py'
--- src/alfanous/QueryProcessing.py	2012-06-29 07:05:20 +0000
+++ src/alfanous/QueryProcessing.py	2012-08-02 03:26:11 +0000
@@ -71,7 +71,7 @@
                 األآإـتنمكطدجحخهعغفقثصضشسيبئءؤرىةوزظذ
                 """
 
-    wordtext = CharsNotIn( u'//*؟^():"{}[]$><%~#،,\' +-' )
+    wordtext = CharsNotIn( u'//*؟^():"{}[]$><%~#،,\' +-!' )
     escape = Suppress( escapechar ) \
              + ( Word( printables, exact = 1 ) | White( exact = 1 ) )
     wordtoken = Combine( OneOrMore( wordtext | escape ) )
@@ -185,13 +185,13 @@
     operatorNot = Group( Suppress( Keyword( u"ليس" ) | Keyword( u"NOT" ) ) + Suppress( White() ) + unit ).setResultsName( "Not" )
     generalUnit = operatorNot | unit
 
-    andToken = Keyword( u"و" ) | Keyword( u"AND" ) | Literal( u"+" )
-    orToken = Keyword( u"أو" ) | Keyword( u"او" ) | Keyword( u"OR" ) | Literal( u"|" )
-    andNotToken = Keyword( u"وليس" ) | Keyword( u"ANDNOT" ) | Literal( u"-" )
+    andToken = Keyword( u"و" ) | Keyword( u"AND" )
+    orToken = Keyword( u"أو" ) | Keyword( u"او" ) | Keyword( u"OR" )
+    andNotToken = Keyword( u"وليس" ) | Keyword( u"ANDNOT" )
 
-    operatorAnd = Group( generalUnit + Suppress( White() ) + Suppress( andToken ) + Suppress( White() ) + expression ).setResultsName( "And" )
-    operatorOr = Group( generalUnit + Suppress( White() ) + Suppress( orToken ) + Suppress( White() ) + expression ).setResultsName( "Or" )
-    operatorAndNot = Group( unit + Suppress( White() ) + Suppress( andNotToken ) + Suppress( White() ) + unit ).setResultsName( "AndNot" )
+    operatorAnd = Group( ( generalUnit + Suppress( White() ) + Suppress( andToken ) + Suppress( White() ) + expression ) | ( generalUnit + Suppress( Literal( u"+" ) ) + expression ) ).setResultsName( "And" )
+    operatorOr = Group( ( generalUnit + Suppress( White() ) + Suppress( orToken ) + Suppress( White() ) + expression ) | ( generalUnit + Suppress( Literal( u"|" ) ) + expression ) ).setResultsName( "Or" )
+    operatorAndNot = Group( ( unit + Suppress( White() ) + Suppress( andNotToken ) + Suppress( White() ) + unit ) | ( unit + Suppress( Literal( u"-" ) ) + unit ) ).setResultsName( "AndNot" )