Your IP : 3.12.147.12


Current Path : /opt/alt/python37/lib/python3.7/site-packages/jinja2/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/jinja2/__pycache__/parser.cpython-37.pyc

B

�˝`W��
@sUdZddlZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
ejrlddlZ
dd	lmZe�d
ejej�Ze�dejej�Zedd
ddddddddddg�Zeddddddg�Zejejejejejejd�Z ej!e"ej#ej$fe%d<Gd d!�d!�Z&dS)"z8Parse tokens from the lexer into nodes for the compiler.�N�)�nodes)�TemplateAssertionError)�TemplateSyntaxError)�describe_token)�describe_token_expr)�Environment�_ImportInclude�
_MacroCall�for�if�blockZextends�print�macro�include�from�import�set�with�
autoescape�eq�ne�ltZlteq�gtZgteq)�add�sub�mul�div�floordiv�mod�_math_nodesc
@s
eZdZdZd�deejeejeejedd�dd�Zdefeeje	ej
edd�d	d
�Zejeejej
edfeje	dd�d
d�Zd�eeje	dd�dd�Zd�ejej
edfeje	dd�dd�Zd�ejej
edfed�dd�Zd�eje	ejd�dd�Zejejejejfd�dd�Zd�ej
edfeejejd�d d!�Zejejejfd�d"d#�Zejd�d$d%�Zejd�d&d'�Z ej!d�d(d)�Z"ej#d�d*d+�Z$ej%d�d,d-�Z&ej'd�d.d/�Z(e)ee)d0�d1d2�Z*ej+d�d3d4�Z,ej-d�d5d6�Z.ej/d�d7d8�Z0e1dd9�d:d;�Z2ej3d�d<d=�Z4ej5d�d>d?�Z6ej7d�d@dA�Z8ej9d�dBdC�Z:e;j<d�edDej=dE�dFdG��Z>e;j<d�eeejej
edfeejej?ej=ej
fdI�dJdG��Z>d�eeejej
edfeejej?ej=ej
fdI�dKdG�Z>d�eej@dL�dMdN�ZAej@d�dOdP�ZBej@d�dQdR�ZCej@d�dSdT�ZDej@d�dUdV�ZEej@d�dWdX�ZFej@d�dYdZ�ZGej@d�d[d\�ZHej@d�d]d^�ZIej@d�d_d`�ZJd�eej@da�dbdc�ZKej@d�ddde�ZLd�eeejej
edfeejej
ej@fdf�dgdh�ZMejd�didj�ZNejOd�dkdl�ZPej@ej@d9�dmdn�ZQej@ej@d9�dodp�ZRej@ejejSejTfd9�dqdr�ZUej@d�dsdt�ZVej
d�dudv�ZWej@ejXd9�dwdx�ZYd�ejej@eejej@dy�dzd{�ZZej@ej@d9�d|d}�Z[d�ejej
edfejejd~�dd��Z\ej]d�d�d��Z^dS)��Parserz�This is the central parsing class Jinja uses.  It's passed to
    extensions and can be used to parse expressions or statements.
    Nr)�environment�source�name�filename�state�returncCst||_|�||||�|_||_||_d|_i|_x,|��D] }x|jD]}|j	|j|<qFWq:Wd|_
g|_g|_dS)NFr)
r"�	_tokenize�streamr$r%�closed�
extensionsZiter_extensionsZtags�parse�_last_identifier�
_tag_stack�_end_token_stack)�selfr"r#r$r%r&�	extension�tag�r3�>/opt/alt/python37/lib/python3.7/site-packages/jinja2/parser.py�__init__3szParser.__init__zte.NoReturn)�msg�lineno�excr'cCs(|dkr|jjj}||||j|j��dS)z�Convenience method that raises `exc` with the message, passed
        line number or last line number as well as the current name and
        filename.
        N)r)�currentr7r$r%)r0r6r7r8r3r3r4�failJs

zParser.fail.)r$�end_token_stackr7r'cCs�t�}x|D]}|�tt|��qW|rDd�tttt|d���}nd}|dkrXdg}nd|�d�g}|r�|dk	r�||kr�|�d|�d��n|�d|�d��|jr�|�d|jd�d��|�d	�|�|�dS)
Nz or ���zUnexpected end of template.zEncountered unknown tag �.z\You probably made a nesting mistake. Jinja is expecting this tag, but currently looking for z*Jinja was looking for the following tags: z/The innermost block that needs to be closed is � )	r�update�mapr�join�repr�appendr.r:)r0r$r;r7Zexpected�exprsZcurrently_looking�messager3r3r4�_fail_ut_eofXs(
zParser._fail_ut_eof)r$r7r'cCs|�||j|�dS)z�Called if the parser encounters an unknown tag.  Tries to fail
        with a human readable error message that could help to identify
        the problem.
        N)rFr/)r0r$r7r3r3r4�fail_unknown_tag�szParser.fail_unknown_tag)�
end_tokensr7r'cCs.t|j�}|dk	r|�|�|�d||�dS)z9Like fail_unknown_tag but for end of template situations.N)�listr/rCrF)r0rHr7�stackr3r3r4�fail_eof�s

zParser.fail_eof)�extra_end_rulesr'cCs,|jjjdkrdS|dk	r(|jj�|�SdS)zAre we at the end of a tuple?)�variable_end�	block_end�rparenTNF)r)r9�type�test_any)r0rLr3r3r4�is_tuple_end�s
zParser.is_tuple_end)r7r'cCs8|jd7_t�tj�}tjj|d|j��|d�|S)zDReturn a new free identifier as :class:`~jinja2.nodes.InternalName`.r�fi)r7)r-�object�__new__r�InternalName�Noder5)r0r7�rvr3r3r4�free_identifier�szParser.free_identifier)r'cCs�|jj}|jdkr |�d|j�|j�|j�d}z�|jtkrZt	|d|jjj���}|�S|jdkrl|�
�S|jdkr~|��S|j�
|j�}|dk	r�||�S|j��d}|�|j|j�Wd|r�|j��XdS)	zParse a single statement.r$ztag name expectedTZparse_�call�filterNF)r)r9rPr:r7r.rC�value�_statement_keywords�getattr�parse_call_block�parse_filter_blockr+�get�poprG)r0�tokenZpop_tag�f�extr3r3r4�parse_statement�s*




zParser.parse_statementF)rH�drop_needler'cCsL|j�d�|j�d�|�|�}|jjjdkr:|�|�|rHt|j�|S)aRParse multiple statements into a list until one of the end tokens
        is reached.  This is used to parse the body of statements as it also
        parses template data if appropriate.  The parser checks first if the
        current token is a colon and skips it if there is one.  Then it checks
        for the block end and parses until if one of the `end_tokens` is
        reached.  Per default the active token in the stream at the end of
        the call is the matched end token.  If this is not wanted `drop_needle`
        can be set to `True` and the end token is removed.
        �colonrN�eof)r)�skip_if�expect�subparser9rPrK�next)r0rHrg�resultr3r3r4�parse_statements�s



zParser.parse_statementscCsft|j�j}|jdd�}|j�d�r<|��}tj|||d�S|�d�}|j	ddd�}tj
||||d�S)zParse an assign statement.T)�with_namespace�assign)r7N)zname:endset)rg)rmr)r7�parse_assign_targetrj�parse_tupler�Assign�parse_filterro�AssignBlock)r0r7�target�exprZfilter_node�bodyr3r3r4�	parse_set�s
zParser.parse_setc	Cs�|j�d�j}|jdd�}|j�d�|jddd�}d}|j�d	�rL|��}|j�d
�}|�d�}t|j�j	dkrxg}n|jd
dd�}t
j|||||||d�S)zParse a for loop.zname:for)zname:in)rLzname:inF)zname:recursive)�
with_condexprrLNzname:ifzname:recursive)zname:endforz	name:elseZendfor)zname:endforT)rg)r7)r)rkr7rrrsrj�parse_expressionrormr\r�For)r0r7rw�iter�test�	recursivery�else_r3r3r4�	parse_for�s

zParser.parse_forcCs�tj|j�d�jd�}}x||jdd�|_|�d�|_g|_	g|_
t|j�}|�d�rxtj|jjjd�}|j	�
|�qn|�d�r�|jdd	d
�|_
PqW|S)zParse an if construct.zname:if)r7F)r{)z	name:elifz	name:elsez
name:endifz	name:elifz	name:else)z
name:endifT)rg)r�Ifr)rkr7rsrroryZelif_r�rmr9rC)r0�nodernrcr3r3r4�parse_if�s


zParser.parse_ifcCs�tjt|j�jd�}g}g}xX|jjjdkrt|r<|j�d�|��}|�	d�|�
|�|j�d�|�
|���qW||_||_
|jddd�|_|S)	N)r7rN�comma�paramrq)zname:endwithT)rg)r�Withrmr)r7r9rPrkrr�set_ctxrCr|�targets�valuesrory)r0r�r�r�rwr3r3r4�
parse_withs

zParser.parse_withcCsDtjt|j�jd�}t�d|���g|_|jddd�|_	t�
|g�S)N)r7r)zname:endautoescapeT)rg)rZScopedEvalContextModifierrmr)r7�Keywordr|�optionsrory�Scope)r0r�r3r3r4�parse_autoescape szParser.parse_autoescapecCs�tjt|j�jd�}|j�d�j|_|j�d�|_	|j�d�|_
|jjjdkrX|�
d�|jddd	�|_|j
r�td
d�|jD��s�|�
d�|j�d
|j�|S)N)r7r$zname:scopedz
name:requiredrzpBlock names in Jinja have to be valid Python identifiers and may not contain hyphens, use an underscore instead.)z
name:endblockT)rgcss0|](}|jD]}t|tj�o$|j��VqqdS)N)r�
isinstance�TemplateData�data�isspace)�.0ry�childr3r3r4�	<genexpr>;sz%Parser.parse_block.<locals>.<genexpr>z7Required blocks can only contain comments or whitespacezname:)r�Blockrmr)r7rkr\r$rjZscoped�requiredr9rPr:rory�all)r0r�r3r3r4�parse_block&s
zParser.parse_blockcCs"tjt|j�jd�}|��|_|S)N)r7)r�Extendsrmr)r7r|�template)r0r�r3r3r4�
parse_extendsDs
zParser.parse_extends)r��defaultr'cCsH|jj�dd�r>|j���d�r>t|j�jdk|_|j��n||_|S)Nz	name:withzname:withoutzname:contextr)	r)r9rQ�lookrrmr\�with_context�skip)r0r�r�r3r3r4�parse_import_contextIszParser.parse_import_contextcCsbtjt|j�jd�}|��|_|jj�d�rP|j�	��d�rPd|_
|j�d�nd|_
|�|d�S)N)r7zname:ignorezname:missingT�F)
r�Includermr)r7r|r�r9rr�Zignore_missingr�r�)r0r�r3r3r4�
parse_includeUs
zParser.parse_includecCsFtjt|j�jd�}|��|_|j�d�|jdd�j	|_
|�|d�S)N)r7zname:asT)�	name_onlyF)r�Importrmr)r7r|r�rkrrr$rwr�)r0r�r3r3r4�parse_importas

zParser.parse_importcstjt�j�jd������_�j�d�g�_t	d���fdd�}x��jrX�j�d��jj
jdkr�|�rnP�jdd	�}|j
�d
�r��jd|jtd��j�d
�rƈjdd	�}�j�|j
|j
f�n�j�|j
�|�s�jj
jdkr�PqF�j�d�qFWt�d��sd�_�S)N)r7zname:import)r'csB�jjjdkr>�j���d�r>t�j�jdk�_�j��dSdS)N>�withoutrzname:contextrTF)r)r9r\r�rrmr�r�r3)r�r0r3r4�
parse_contextns
z(Parser.parse_from.<locals>.parse_contextr�r$T)r��_z4names starting with an underline can not be imported)r8zname:asr�F)r�
FromImportrmr)r7r|r�rk�names�boolr9rPrrr$�
startswithr:rrjrC�hasattrr�)r0r�rw�aliasr3)r�r0r4�
parse_fromhs6
zParser.parse_from)r�r'cCs�g}|_g}|_|j�d�xl|jjjdkr�|r@|j�d�|jdd�}|�d�|j�d�rr|�	|�
��n|r�|�d�|�	|�q"W|j�d�dS)	N�lparenrOr�T)r�r�rqz-non-default argument follows default argument)�args�defaultsr)rkr9rPrrr�rjrCr|r:)r0r�r�r��argr3r3r4�parse_signature�s



zParser.parse_signaturecCsvtjt|j�jd�}|jjjdkr.|�|�ng|_g|_	|�
�}t|tj�s\|�
d|j�||_|jddd�|_|S)N)r7r�z
expected call)zname:endcallT)rg)r�	CallBlockrmr)r7r9rPr�r�r�r|r��Callr:rZrory)r0r�Z	call_noder3r3r4r_�szParser.parse_call_blockcCs8tjt|j�jd�}|jddd�|_|jddd�|_|S)N)r7T)�start_inline)zname:endfilter)rg)	r�FilterBlockrmr)r7rur[rory)r0r�r3r3r4r`�szParser.parse_filter_blockcCsBtjt|j�jd�}|jdd�j|_|�|�|jddd�|_	|S)N)r7T)r�)z
name:endmacro)rg)
r�Macrormr)r7rrr$r�rory)r0r�r3r3r4�parse_macro�s

zParser.parse_macrocCsTtjt|j�jd�}g|_x4|jjjdkrN|jr<|j�d�|j�|�	��qW|S)N)r7rNr�)
r�Outputrmr)r7r9rPrkrCr|)r0r�r3r3r4�parse_print�szParser.parse_printzte.Literal[True])�
with_tupler�r'cCsdS)Nr3)r0r�r�r3r3r4rr�szParser.parse_assign_targetT)r�r�rLrpr'cCsdS)Nr3)r0r�r�rLrpr3r3r4rr�scCs�|rN|j��jdkrN|j�d�}t|j�|j�d�}tj|j|j|jd�}nL|rt|j�d�}tj	|jd|jd�}n&|r�|j
d|d�}n|��}|�d�|�
�s�|�dt|�j����|j�|S)aParse an assignment target.  As Jinja allows assignments to
        tuples, this function can parse all allowed assignment targets.  Per
        default assignments to tuples are parsed, that can be disable however
        by setting `with_tuple` to `False`.  If only assignments to names are
        wanted `name_only` can be set to `True`.  The `extra_end_rules`
        parameter is forwarded to the tuple parsing function.  If
        `with_namespace` is enabled, a namespace assignment may be parsed.
        �dotr$)r7�storeT)�
simplifiedrLzcan't assign to )r)r�rPrkrmr�NSRefr\r7�Namers�
parse_primaryr�Z
can_assignr:�__name__�lower)r0r�r�rLrprc�attrrwr3r3r4rr�s"

)r{r'cCs|r|��S|��S)z�Parse an expression.  Per default all expressions are parsed, if
        the optional `with_condexpr` parameter is set to `False` conditional
        expressions are not parsed.
        )�parse_condexpr�parse_or)r0r{r3r3r4r|szParser.parse_expressioncCsf|jjj}|��}xN|j�d�r`|��}|j�d�r>|��}nd}tj||||d�}|jjj}qW|S)Nzname:ifz	name:else)r7)r)r9r7r�rjr�rZCondExpr)r0r7Zexpr1Zexpr2Zexpr3r3r3r4r�s

zParser.parse_condexprcCsJ|jjj}|��}x2|j�d�rD|��}tj|||d�}|jjj}qW|S)Nzname:or)r7)r)r9r7�	parse_andrjr�Or)r0r7�left�rightr3r3r4r�s
zParser.parse_orcCsJ|jjj}|��}x2|j�d�rD|��}tj|||d�}|jjj}qW|S)Nzname:and)r7)r)r9r7�	parse_notrjr�And)r0r7r�r�r3r3r4r�&s
zParser.parse_andcCs4|jj�d�r,t|j�j}tj|��|d�S|��S)Nzname:not)r7)	r)r9rrmr7r�Notr��
parse_compare)r0r7r3r3r4r�/szParser.parse_notcCs�|jjj}|��}g}x�|jjj}|tkrLt|j�|�t�	||����nh|j�
d�rp|�t�	d|����nD|jj�d�r�|j���d�r�|j�
d�|�t�	d|����nP|jjj}qW|s�|Stj|||d�S)Nzname:in�inzname:notr�Znotin)r7)r)r9r7�parse_math1rP�_compare_operatorsrmrCrZOperandrjrr�r��Compare)r0r7rxZops�
token_typer3r3r4r�5s&


zParser.parse_comparecCsb|jjj}|��}xJ|jjjdkr\t|jjj}t|j�|��}||||d�}|jjj}qW|S)N)rr)r7)r)r9r7�parse_concatrPr rm)r0r7r��clsr�r3r3r4r�Ls

zParser.parse_math1cCsb|jjj}|��g}x*|jjjdkr>t|j�|�|���qWt|�dkrT|dStj	||d�S)N�tilderr)r7)
r)r9r7�parse_math2rPrmrC�lenrZConcat)r0r7r�r3r3r4r�Ws


zParser.parse_concatcCsb|jjj}|��}xJ|jjjdkr\t|jjj}t|j�|��}||||d�}|jjj}qW|S)N)rrrr)r7)r)r9r7�	parse_powrPr rm)r0r7r�r�r�r3r3r4r�as

zParser.parse_math2cCsV|jjj}|��}x>|jjjdkrPt|j�|��}tj|||d�}|jjj}qW|S)N�pow)r7)r)r9r7�parse_unaryrPrmr�Pow)r0r7r�r�r3r3r4r�ls

zParser.parse_pow)�with_filterr'cCs�|jjj}|jjj}|dkr<t|j�tj|�d�|d�}n0|dkrdt|j�tj|�d�|d�}n|�	�}|�
|�}|r�|�|�}|S)NrF)r7r)r)r9rPr7rmrZNegr�ZPosr��
parse_postfix�parse_filter_expr)r0r�r�r7r�r3r3r4r�vs





zParser.parse_unarycCsz|jj}|jdkrr|jdkr4tj|jdk|jd�}n0|jdkrPtjd|jd�}ntj|jd|jd�}t|j��n|jdkr�t|j�|jg}|j}x,|jjjdkr�|�	|jjj�t|j�q�Wtjd�
|�|d�}n�|jd	k�rt|j�tj|j|jd�}nt|jd
k�r2t|j�|jdd�}|j�d
�nD|jdk�rH|�
�}n.|jdk�r^|��}n|�dt|���|j�|S)Nr$)�true�false�True�False)r�r�)r7)Znone�None�load�string�)�integer�floatr�T)�explicit_parenthesesrO�lbracket�lbracezunexpected )r)r9rPr\r�Constr7r�rmrCrArsrk�
parse_list�
parse_dictr:r)r0rcr��bufr7r3r3r4r��s:








zParser.parse_primary)r�r{rLr�r'c	s��jjj}|r�j}n |r"�j}ntjd��fdd�}g}d}xL|rP�j�d���|�r\P|�	|���jjj
dkr|d}nP�jjj}q@W|s�|r�|dS|s���dt�jj����tj
|d	|d
�S)a�Works like `parse_expression` but if multiple expressions are
        delimited by a comma a :class:`~jinja2.nodes.Tuple` node is created.
        This method could also return a regular expression instead of a tuple
        if no commas where found.

        The default parsing mode is a full tuple.  If `simplified` is `True`
        only names and literals are parsed.  The `no_condexpr` parameter is
        forwarded to :meth:`parse_expression`.

        Because tuples do not require delimiters and may end in a bogus comma
        an extra hint is needed that marks the end of a tuple.  For example
        for loops support tuples between `for` and `in`.  In that case the
        `extra_end_rules` is set to ``['name:in']``.

        `explicit_parentheses` is true if the parsing was triggered by an
        expression in parentheses.  This is used to figure out if an empty
        tuple is a valid expression or not.
        )r'cs�jdd�S)NF)r{)r|r3)r0r3r4r,�sz!Parser.parse_tuple.<locals>.parseFr�TrzExpected an expression, got r�)r7)r)r9r7r�r|r�ExprrkrRrCrPr:r�Tuple)	r0r�r{rLr�r7r,r�Zis_tupler3)r0r4rs�s2

zParser.parse_tuplecCsn|j�d�}g}x@|jjjdkrP|r0|j�d�|jjjdkr@P|�|���qW|j�d�tj||jd�S)Nr��rbracketr�)r7)	r)rkr9rPrCr|r�Listr7)r0rc�itemsr3r3r4r��szParser.parse_listcCs�|j�d�}g}xf|jjjdkrv|r0|j�d�|jjjdkr@P|��}|j�d�|��}|�tj|||jd��qW|j�d�tj	||jd�S)Nr��rbracer�rh)r7)
r)rkr9rPr|rCrZPairr7�Dict)r0rcr��keyr\r3r3r4r��szParser.parse_dictcCsFx@|jjj}|dks|dkr(|�|�}q|dkr<|�|�}qPqW|S)Nr�r�r�)r)r9rP�parse_subscript�
parse_call)r0r�r�r3r3r4r�s
zParser.parse_postfixcCs`xZ|jjj}|dkr |�|�}q|dkrB|jjjdkrB|�|�}q|dkrV|�|�}qPqW|S)N�piper$�isr�)r)r9rPrur\�
parse_testr)r0r�r�r3r3r4r�s
zParser.parse_filter_exprcCs t|j�}|jdkr�|jj}t|j�|jdkrFtj||jd|jd�S|jdkr^|�d|j�tj	|j|jd�}tj
||d|jd�S|jdk�rg}x0|jjjdkr�|r�|j�d	�|�|�
��q�W|j�d�t|�d
kr�|d}ntj|d|jd�}tj
||d|jd�S|�d|j�dS)
Nr�r$r�)r7r�zexpected name or numberr�r�r�rrzexpected subscript expression)rmr)rPr9r�Getattrr\r7r:r��GetitemrkrC�parse_subscribedr�r�)r0r�rcZ
attr_tokenr�r�r3r3r4r�#s.





zParser.parse_subscriptcCs�|jjj}|jjjdkr*t|j�dg}n*|��}|jjjdkrD|St|j�|g}|jjjdkrn|�d�n(|jjjdkr�|�|���n
|�d�|jjjdkr�t|j�|jjjdkr�|�|���q�|�d�n
|�d�tj|d|i�S)Nrh)r�r�r7)	r)r9r7rPrmr|rCr�Slice)r0r7r�r�r3r3r4rBs*





zParser.parse_subscribedc	s��j�d��g}g}d}d}d}tdd���fdd�}�x.�jjjdk�rf|rj�j�d��jjjdkrjP�jjjdkr�||dko�|dk�t�j����}n��jjjd	kr�||dk�t�j����}n��jjjd
k�r4�j��jdk�r4||dk��jjj}�j�	d����}|�
tj|||j
d
��n,||dk�oN|dk�oN|�|�
����d}q:W�j�d�||||fS)Nr�F)rxr'cs|s��d�j�dS)Nz+invalid syntax for function call expression)r:r7)rx)r0rcr3r4�ensurejsz&Parser.parse_call_args.<locals>.ensurerOr�rr�r$rqr�)r7T)r)rkr�r9rPrmr|r�r\r�rCrr�r7)	r0r��kwargs�dyn_args�
dyn_kwargsZ
require_commarr�r\r3)r0rcr4�parse_call_argsbs@




zParser.parse_call_argscCs0|jj}|��\}}}}tj||||||jd�S)N)r7)r)r9rrr�r7)r0r�rcr�r	r
rr3r3r4r�szParser.parse_call)r�r�r'c		Cs�x�|jjjdks|r�|s"t|j�|j�d�}|j}x2|jjjdkrft|j�|d|j�d�j7}q6W|jjjdkr�|��\}}}}ng}g}d}}tj|||||||j	d�}d}qW|S)Nrr$r�r=r�)r7F)
r)r9rPrmrkr\rr�Filterr7)	r0r�r�rcr$r�r	r
rr3r3r4ru�s"

zParser.parse_filterc
	Cs$t|j�}|jj�d�r(t|j�d}nd}|j�d�j}x2|jjjdkrlt|j�|d|j�d�j7}q<Wd}}g}|jjjdkr�|��\}}}}nV|jjjdkr�|jj�d	d
d�s�|jj�d�r�|�	d
�|�
�}	|�|	�}	|	g}ng}tj
|||||||jd�}|�r tj||jd�}|S)Nzname:notTFr$r�r=r�>r�r�r�r�r$r�r�z	name:elsezname:orzname:andzname:isz'You cannot chain multiple tests with is)r7)rmr)r9rrkr\rPrrQr:r�r�rZTestr7r�)
r0r�rcZnegatedr$r
rr	r�Zarg_noder3r3r4r�s6


	

zParser.parse_test)rHr'csLg�g��j}|dk	r"|j�|�dd���fdd�}z�x�|j�r&|jj}|jdkr||jrp|tj|j|jd��t	|j�q:|jdkr�t	|j�||j
dd��|j�d	�q:|jd
k�r|�t	|j�|dk	r�|jjj|�r�S|�
�}t|t��r��|�n
��|�|j�d�q:td��q:W|�Wd|dk	�rF|j��X�S)
N)r'cs8�r4�dj}��tj�dd�|d���dd�=dS)Nr)r7)r7rCrr�)r7)ry�data_bufferr3r4�
flush_data�s
z#Parser.subparse.<locals>.flush_datar�)r7Zvariable_beginT)r{rMZblock_beginrNzinternal parsing error)rCr/r)r9rPr\rr�r7rmrsrkrQrfr�rI�extend�AssertionErrorrb)r0rHZadd_datarrcrXr3)ryrr4rl�sB







zParser.subparsecCs"tj|��dd�}|�|j�|S)z0Parse the whole template into a `Template` node.r)r7)r�TemplaterlZset_environmentr")r0rnr3r3r4r,szParser.parse)NNN)N)NN)N)N)F)..)TFNF)TFNF)T)T)FTNF)F)N)_r��
__module__�__qualname__�__doc__�str�t�Optionalr5r�int�Typer:r�r�rFrGrKr�rRrrVrY�UnionrWrfrortrvrzr}r�r�r�r�r�r�r�r�r�r�r�r	r�r�r�r�r�r�r�r
r�r�r_r�r`r�r�r�r��typing�overloadr�rrr�r�r|r�r�r�r�r�r�r�r�r�r�r�rsr�r�r�r�r�rrr�rrr�rrurrlrr,r3r3r3r4r!.s�$	"
.	" $			

$<
 1+/r!)'rrrr�r�
exceptionsrrZlexerrr�
TYPE_CHECKINGZtyping_extensions�ter"r�TypeVarr�r�r	r�r�r
�	frozensetr]r��Add�SubZMul�Div�FloorDiv�Modr r�rrr��__annotations__r!r3r3r3r4�<module>sB$

?>