This commit is contained in:
Kovid Goyal 2011-04-13 11:10:15 -06:00
commit d566f691bb

View File

@ -19,8 +19,8 @@ If this module is run, it will perform a series of unit tests.
import sys, string, operator import sys, string, operator
from calibre.utils.pyparsing import CaselessKeyword, Group, Forward, \ from calibre.utils.pyparsing import CaselessKeyword, Group, Forward, \
CharsNotIn, Suppress, OneOrMore, MatchFirst, CaselessLiteral, \ CharsNotIn, Suppress, OneOrMore, MatchFirst, alphas, alphanums, \
Optional, NoMatch, ParseException, QuotedString, Word Optional, ParseException, QuotedString, Word
from calibre.constants import preferred_encoding from calibre.constants import preferred_encoding
from calibre.utils.icu import sort_key from calibre.utils.icu import sort_key
@ -129,7 +129,8 @@ class SearchQueryParser(object):
self.optimize = optimize self.optimize = optimize
# Define a token # Define a token
self.standard_locations = locations self.standard_locations = locations
location = Optional(Word(string.ascii_letters+'#')+Suppress(':'), default='all') location = Optional(Word(alphas+'#', bodyChars=alphanums+'_')+Suppress(':'),
default='all')
word_query = CharsNotIn(string.whitespace + '()') word_query = CharsNotIn(string.whitespace + '()')
#quoted_query = Suppress('"')+CharsNotIn('"')+Suppress('"') #quoted_query = Suppress('"')+CharsNotIn('"')+Suppress('"')
quoted_query = QuotedString('"', escChar='\\') quoted_query = QuotedString('"', escChar='\\')