mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-11 09:13:57 -04:00
Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
commit
a7b3271fb5
@ -258,7 +258,7 @@ General Program Mode
|
|||||||
times_div_op ::= '*' | '/'
|
times_div_op ::= '*' | '/'
|
||||||
unary_op_expr ::= [ add_sub_op unary_op_expr ]* | expression
|
unary_op_expr ::= [ add_sub_op unary_op_expr ]* | expression
|
||||||
expression ::= identifier | constant | function | assignment | field_reference |
|
expression ::= identifier | constant | function | assignment | field_reference |
|
||||||
if_expr | for_expr | break_expr | continue_expr |
|
if_expr | for_expr | break_expr | continue_expr | return_stmt
|
||||||
'(' expression_list ')' | function_def
|
'(' expression_list ')' | function_def
|
||||||
field_reference ::= '$' [ '$' ] [ '#' ] identifier
|
field_reference ::= '$' [ '$' ] [ '#' ] identifier
|
||||||
identifier ::= id_start [ id_rest ]*
|
identifier ::= id_start [ id_rest ]*
|
||||||
@ -282,6 +282,7 @@ General Program Mode
|
|||||||
list_expr ::= top_expression
|
list_expr ::= top_expression
|
||||||
break_expr ::= 'break'
|
break_expr ::= 'break'
|
||||||
continue_expr ::= 'continue'
|
continue_expr ::= 'continue'
|
||||||
|
return_stmt ::= 'return' top_expression
|
||||||
separator_expr ::= top_expression
|
separator_expr ::= top_expression
|
||||||
start_expr ::= top_expression
|
start_expr ::= top_expression
|
||||||
stop_expr ::= top_expression
|
stop_expr ::= top_expression
|
||||||
@ -380,6 +381,10 @@ If the original Genre is `History.Military, Science Fiction.Alternate History, R
|
|||||||
|
|
||||||
Note: the last line in the template, ``new_tags``, isn't strictly necessary in this case because ``for`` returns the value of the last top_expression in the expression list. The value of an assignment is the value of its expression, so the value of the ``for`` statement is what was assigned to ``new_tags``.
|
Note: the last line in the template, ``new_tags``, isn't strictly necessary in this case because ``for`` returns the value of the last top_expression in the expression list. The value of an assignment is the value of its expression, so the value of the ``for`` statement is what was assigned to ``new_tags``.
|
||||||
|
|
||||||
|
**Return stmt**
|
||||||
|
|
||||||
|
Return the value of the ``expression``. If executed in a function then it returns the value of the expression to the caller. If executed in the outermost context (the template) then it sets the value of the template to the value of the expression and exits the template.
|
||||||
|
|
||||||
**Function definition**
|
**Function definition**
|
||||||
|
|
||||||
If you have repeated code in a template then you can put that code into a local function. The ``def`` keyword starts the definition. It is followed by the function name, the argument list, then the code in the function. The function definition ends with the ``fed`` keyword.
|
If you have repeated code in a template then you can put that code into a local function. The ``def`` keyword starts the definition. It is followed by the function name, the argument list, then the code in the function. The function definition ends with the ``fed`` keyword.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user