Fixes #1918030 [Manage tags shows wrong count](https://bugs.launchpad.net/calibre/+bug/1918030)
This commit is contained in:
Kovid Goyal 2021-03-07 16:53:22 +05:30
commit c20c140b52
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 9 additions and 7 deletions

View File

@ -217,7 +217,7 @@ General Program Mode replaces the template with a program written in the `templa
top_expression ::= or_expression
or_expression ::= and_expression [ '||' and_expression ]*
and_expression ::= not_expression [ '&&' not_expression ]*
not_expression ::= ['!' not_expression]* | compare_exp
not_expression ::= [ '!' not_expression ]* | compare_exp
compare_expr ::= add_sub_expr [ compare_op add_sub_expr ]
compare_op ::= '==' | '!=' | '>=' | '>' | '<=' | '<' | 'in' |
'==#' | '!=#' | '>=#' | '>#' | '<=#' | '<#'
@ -227,13 +227,13 @@ General Program Mode replaces the template with a program written in the `templa
times_div_op ::= '*' | '/'
unary_op_expr ::= [ add_sub_op unary_op_expr ]* | expression
expression ::= identifier | constant | function | assignment |
if_expression | for_expression | '(' top_expression ')'
if_expression | for_expression | '(' expression_list ')'
identifier ::= sequence of letters or ``_`` characters
constant ::= " string " | ' string ' | number
function ::= identifier '(' top_expression [ ',' top_expression ]* ')'
function ::= identifier '(' expression_list [ ',' expression_list ]* ')'
assignment ::= identifier '=' top_expression
if_expression ::= 'if' condition 'then' expression_list
[elif_expression] ['else' expression_list] 'fi'
[ elif_expression ] [ 'else' expression_list ] 'fi'
condition ::= top_expression
elif_expression ::= 'elif' condition 'then' expression_list elif_expression | ''
for_expression ::= 'for' identifier 'in' list_expression

View File

@ -319,7 +319,7 @@ class TagListEditor(QDialog, Ui_TagListEditor):
def search_for_books(self, item):
from calibre.gui2.ui import get_gui
get_gui().search.set_search_string('{0}:"{1}"'.format(self.category,
get_gui().search.set_search_string('{0}:"={1}"'.format(self.category,
unicode_type(item.text()).replace(r'"', r'\"')))
qv = get_quickview_action_plugin()

View File

@ -568,7 +568,7 @@ class _Parser(object):
def expr(self):
if self.token_op_is_lparen():
self.consume()
rv = self.top_expr()
rv = self.expression_list()
if not self.token_op_is_rparen():
self.error(_('Missing )'))
self.consume()
@ -598,7 +598,7 @@ class _Parser(object):
arguments = list()
while not self.token_op_is_rparen():
# evaluate the expression (recursive call)
arguments.append(self.top_expr())
arguments.append(self.expression_list())
if not self.token_op_is_comma():
break
self.consume()
@ -906,6 +906,8 @@ class _Interpreter(object):
def expr(self, prog):
try:
if isinstance(prog, list):
return self.expression_list(prog)
return self.NODE_OPS[prog.node_type](self, prog)
except ValueError as e:
raise e