AlkantarClanX12

Your IP : 3.138.114.140


Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/jinja2/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/jinja2/__pycache__/parser.cpython-311.pyc

�

�܋fW�����UdZddlZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
ejr
ddlZ
dd	lmZejd
ejej��Zejdejej��Zegd���Zegd
���Zejejejejejejd�Z ej!e"ej#ej$fe%d<Gd�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�block�extends�print�macro�include�from�import�set�with�
autoescape)�eq�ne�lt�lteq�gt�gteq)�add�sub�mul�div�floordiv�mod�_math_nodesc�l	�eZdZdZ			dUdddedejedejedejed	dfd
�Zdefdedeje	d
ej
ed	dfd�Zdejedejej
edfdeje	d	dfd�Z	dVdedeje	d	dfd�Z		dWdejej
edfdeje	d	dfd�Z	dVdejej
edfd	efd�ZdVdeje	d	ejfd�Zd	ejejejejffd�Z	dXdej
edfded	ejejfd�Zd	ejejejffd�Zd	ejfd�Zd	ejfd�Z d	ej!fd �Z"d	ej#fd!�Z$d	ej%fd"�Z&d	ej'fd#�Z(d$e)d%ed	e)fd&�Z*d	ej+fd'�Z,d	ej-fd(�Z.d	ej/fd)�Z0d$e1d	dfd*�Z2d	ej3fd+�Z4d	ej5fd,�Z6d	ej7fd-�Z8d	ej9fd.�Z:e;j<	dYd/ed0d1d	ej=fd2���Z>e;j<				dZd/ed0edejej
edfd4ed	ejej?ej=ej
ff
d5���Z>				dZd/ed0edejej
edfd4ed	ejej?ej=ej
ff
d6�Z>d[d7ed	ej@fd8�ZAd	ej@fd9�ZBd	ej@fd:�ZCd	ej@fd;�ZDd	ej@fd<�ZEd	ej@fd=�ZFd	ej@fd>�ZGd	ej@fd?�ZHd	ej@fd@�ZId	ej@fdA�ZJd[dBed	ej@fdC�ZKd	ej@fdD�ZL				d\dEed7edejej
edfdFed	ejej
ej@ff
dG�ZMd	ejfdH�ZNd	ejOfdI�ZPd$ej@d	ej@fdJ�ZQd$ej@d	ej@fdK�ZRd$ej@d	ejejSejTffdL�ZUd	ej@fdM�ZVd	ej
fdN�ZWd$ej@d	ejXfdO�ZY	dXd$ejej@dPed	ejej@fdQ�ZZd$ej@d	ej@fdR�Z[	dVdejej
edfd	ejejfdS�Z\d	ej]fdT�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.
    N�environmentr	�source�name�filename�state�returnc��||_|�||||��|_||_||_d|_i|_|���D]}|jD]}|j	|j|<��d|_
g|_g|_dS)NFr)
r'�	_tokenize�streamr)r*�closed�
extensions�iter_extensions�tags�parse�_last_identifier�
_tag_stack�_end_token_stack)�selfr'r(r)r*r+�	extension�tags        �D/opt/cloudlinux/venv/lib64/python3.11/site-packages/jinja2/parser.py�__init__zParser.__init__3s���'���!�+�+�F�D�(�E�J�J�����	� ��
����
�	
��%�4�4�6�6�	7�	7�I� �~�
7�
7��'0�����$�$�
7� !���')���;=������msg�lineno�exczte.NoReturnc�X�|�|jjj}||||j|j���)z�Convenience method that raises `exc` with the message, passed
        line number or last line number as well as the current name and
        filename.
        )r/�currentr?r)r*)r8r>r?r@s    r;�failzParser.failJs0���>��[�(�/�F��c�#�v�t�y�$�-�8�8�8r=�end_token_stack.c
�@�t��}|D]*}|�tt|�����+|rBd�tt
tt|d������}nd}|�dg}nd|�d�g}|r9|�||vr|�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�appendr6rC)r8r)rDr?�expected�exprs�currently_looking�messages        r;�_fail_ut_eofzParser._fail_ut_eofXs�� #�u�u��$�	=�	=�E��O�O�C� 3�U�;�;�<�<�<�<��	%�17����D�#�1�?�2�3F�G�G�H�H�2�2���!%���<�4�5�G�G�;�$�;�;�;�<�G��		���D�H�$4�$4����G�2C�G�G�G�����
���U�AR�U�U�U�����?�	��N�N�-��O�B�'�-�-�-�
�
�
�
	
�	�	�#�(�(�7�#�#�V�,�,�,�,�,r=c�>�|�||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)rRr7)r8r)r?s   r;�fail_unknown_tagzParser.fail_unknown_tag�s%��	
���$�� 5�v�>�>�>�>�>r=�
end_tokensc��t|j��}|�|�|��|�d||��dS)z9Like fail_unknown_tag but for end of template situations.N)�listr7rMrR)r8rUr?�stacks    r;�fail_eofzParser.fail_eof�sJ���T�*�+�+���!��L�L��$�$�$����$��v�.�.�.�.�.r=�extra_end_rulesc�r�|jjjdvrdS|�|jj�|��SdS)zAre we at the end of a tuple?)�variable_end�	block_end�rparenTNF)r/rB�type�test_any)r8rZs  r;�is_tuple_endzParser.is_tuple_end�sA���;��#�'N�N�N��4�
�
(��;�&�/�/��@�@�@��ur=c���|xjdz
c_t�tj��}tj�|d|j��|���|S)zDReturn a new free identifier as :class:`~jinja2.nodes.InternalName`.r�fi�r?)r5�object�__new__r�InternalName�Noder<)r8r?�rvs   r;�free_identifierzParser.free_identifier�sX������"���
�^�^�E�.�
/�
/��
�
���B� <�T�%:� <� <�V��L�L�L��	r=c���|jj}|jdkr|�d|j��|j�|j��d}	|jtvrHt|d|jjj����}|��|r|j�
��SS|jdkr0|���|r|j�
��SS|jdkr0|���|r|j�
��SS|j
�|j��}|�'||��|r|j�
��SS|j�
��d}|�|j|j��|r|j�
��dSdS#|r|j�
��wwxYw)	zParse a single statement.r)ztag name expectedT�parse_�call�filterNF)r/rBr_rCr?r6rM�value�_statement_keywords�getattr�pop�parse_call_block�parse_filter_blockr1�getrT)r8�token�pop_tag�f�exts     r;�parse_statementzParser.parse_statement�s����#���:�����I�I�)�5�<�8�8�8�����u�{�+�+�+���	&��{�1�1�1��D�"F�4�;�+>�+D�"F�"F�G�G���q�s�s� �
&���#�#�%�%�%�%�
&��{�f�$�$��,�,�.�.��
&���#�#�%�%�%�%�
&��{�h�&�&��.�.�0�0��
&���#�#�%�%�%�%�
&��/�%�%�e�k�2�2�C����s�4�y�y��
&���#�#�%�%�%�%�
&�	
�O���!�!�!��G��!�!�%�+�u�|�<�<�<��
&���#�#�%�%�%�%�%�
&�
&��w�
&���#�#�%�%�%�%�
&���s$�9G�+G�&G�!+G�);G�G!F�drop_needlec��|j�d��|j�d��|�|��}|jjjdkr|�|��|rt|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.
        �colonr]�eof)r/�skip_if�expect�subparserBr_rY�next)r8rUr{�results    r;�parse_statementszParser.parse_statements�s���	
����G�$�$�$�	
����;�'�'�'����z�*�*���;��#�u�,�,��M�M�*�%�%�%��	��������
r=c�r�t|j��j}|�d���}|j�d��r+|���}t
j|||���S|�d��}|�	dd���}t
j
||||���S)zParse an assign statement.T)�with_namespace�assignrdN)zname:endset�r{)r�r/r?�parse_assign_targetr�parse_tupler�Assign�parse_filterr��AssignBlock)r8r?�target�expr�filter_node�bodys      r;�	parse_setzParser.parse_set�s����d�k�"�"�)���)�)��)�>�>���;���x�(�(�	=��#�#�%�%�D��<���V�<�<�<�<��'�'��-�-���$�$�%5�4�$�H�H��� ���d�6�J�J�J�Jr=c	�0�|j�d��j}|�d���}|j�d��|�dd���}d}|j�d	��r|���}|j�d
��}|�d��}t|j��j	dkrg}n|�d
d���}tj|||||||���S)zParse a for loop.zname:for)�name:in)rZr�F)�name:recursive)�
with_condexprrZN�name:ifr�)�name:endfor�	name:else�endfor)r�Tr�rd)r/r�r?r�r�r�parse_expressionr�r�ror�For)r8r?r��iter�test�	recursiver��else_s        r;�	parse_forzParser.parse_for�s����#�#�J�/�/�6���)�)�,�)�G�G������9�%�%�%�����1D� �
�
�����;���y�)�)�	+��(�(�*�*�D��K�'�'�(8�9�9�	��$�$�%A�B�B�������"�h�.�.��E�E��)�)�*:��)�M�M�E��y���t�U�D�)�F�S�S�S�Sr=c�*�tj|j�d��j���x}}	|�d���|_|�d��|_g|_	g|_
t|j��}|�d��r?tj|jjj���}|j	�
|����|�d��r|�d	d�
��|_
	|S)zParse an if construct.r�rdTF�r�)�	name:elifr��
name:endifr�r�)r�r�)r�Ifr/r�r?r�r�r�r��elif_r�r�rBrM)r8�noder�rvs    r;�parse_ifzParser.parse_if�s�������(:�(:�9�(E�(E�(L�M�M�M�M��v�	��(�(�u�(�=�=�D�I��-�-�.V�W�W�D�I��D�J��D�J����%�%�E��z�z�+�&�&�
X��x�t�{�':�'A�B�B�B����#�#�D�)�)�)�����K�(�(�
X�#�4�4�_�RV�4�W�W�����
r=c�D�tjt|j��j���}g}g}|jjjdkr�|r|j�d��|���}|�	d��|�
|��|j�d��|�
|�����|jjjdk��||_||_
|�dd���|_|S)	Nrdr]�comma�paramr�)zname:endwithTr�)r�Withr�r/r?rBr_r�r��set_ctxrMr��targets�valuesr�r�)r8r�r�r�r�s     r;�
parse_withzParser.parse_withs
���z��d�k�!2�!2�!9�:�:�:��&(��%'���k�!�&�+�5�5��
,���"�"�7�+�+�+��-�-�/�/�F��N�N�7�#�#�#��N�N�6�"�"�"��K���x�(�(�(��M�M�$�/�/�1�1�2�2�2��k�!�&�+�5�5��������)�)�*;��)�N�N��	��r=c��tjt|j��j���}tjd|�����g|_|�dd���|_	tj
|g��S)Nrdr)zname:endautoescapeTr�)r�ScopedEvalContextModifierr�r/r?�Keywordr��optionsr�r��Scope�r8r�s  r;�parse_autoescapezParser.parse_autoescape sq���.�d�4�;�6G�6G�6N�O�O�O���
�l�D�4I�4I�4K�4K�L�L�M����)�)�*A�t�)�T�T��	��{�D�6�"�"�"r=c�f�tjt|j��j���}|j�d��j|_|j�d��|_	|j�d��|_
|jjjdkr|�
d��|�dd�	��|_|j
r3t!d
�|jD����s|�
d��|j�d|jz��|S)
Nrdr)zname:scopedz
name:requiredrzpBlock names in Jinja have to be valid Python identifiers and may not contain hyphens, use an underscore instead.)z
name:endblockTr�c3�K�|]A}|jD]7}t|tj��o|j���V��8�BdS�N)r�
isinstance�TemplateData�data�isspace)�.0r��childs   r;�	<genexpr>z%Parser.parse_block.<locals>.<genexpr>:so����%
�%
����%
�%
��
�u�e�0�1�1�J�e�j�6H�6H�6J�6J�%
�%
�%
�%
�%
�%
�%
r=z7Required blocks can only contain comments or whitespacezname:)r�Blockr�r/r?r�ror)r�scoped�requiredrBr_rCr�r��allr�s  r;�parse_blockzParser.parse_block&s*���{�$�t�{�"3�"3�":�;�;�;���K�&�&�v�.�.�4��	��k�)�)�-�8�8�����+�+�O�<�<��
�
�;��#�u�,�,��I�I�?�
�
�
�
�)�)�*<�$�)�O�O��	�
�=�	Q��%
�%
��	�%
�%
�%
�"
�"
�	Q�

�I�I�O�P�P�P�����G�d�i�/�0�0�0��r=c��tjt|j��j���}|���|_|S�Nrd)r�Extendsr�r/r?r��templater�s  r;�
parse_extendszParser.parse_extendsDs9���}�D���$5�$5�$<�=�=�=���-�-�/�/��
��r=r��defaultc�$�|jj�dd��rh|j����d��r<t|j��jdk|_|j���n||_|S)Nz	name:withzname:without�name:contextr)	r/rBr`�lookr�r�ro�with_context�skip)r8r�r�s   r;�parse_import_contextzParser.parse_import_contextIs����;��'�'���
�
�	(��k��� � �%�%�n�5�5�	(�!%�T�[� 1� 1� 7�6� A�D���K������� '�D���r=c��tjt|j��j���}|���|_|jj�d��rN|j�	���d��r"d|_
|j�d��nd|_
|�|d��S)Nrdzname:ignorezname:missingT�F)
r�Includer�r/r?r�r�rBr�r��ignore_missingr�r�r�s  r;�
parse_includezParser.parse_includeUs����}�D���$5�$5�$<�=�=�=���-�-�/�/��
��;��#�#�M�2�2�	(�t�{�7G�7G�7I�7I�7N�7N��8
�8
�	(�#'�D���K���Q�����"'�D���(�(��t�4�4�4r=c�,�tjt|j��j���}|���|_|j�d��|�d���j	|_
|�|d��S)Nrd�name:asT��	name_onlyF)r�Importr�r/r?r�r�r�r�r)r�r�r�s  r;�parse_importzParser.parse_importas{���|�4���#4�#4�#;�<�<�<���-�-�/�/��
�����9�%�%�%��.�.��.�>�>�C����(�(��u�5�5�5r=c����tjt�j��j���������_�j�d��g�_dtf��fd�}	�jr�j�d���jj
jdkr�|��r�n��d���}|j
�d	��r"��d
|jt ����j�d��r=��d���}�j�|j
|j
f��n�j�|j
��|��s�jj
jdkrnn�j�d����Gt'�d
��sd�_�S)Nrdzname:importr,c����jjjdvri�j����d��r=t�j��jdk�_�j���dSdS)N>r�withoutr�rTF)r/rBror�r�r�r�r�)r�r8s��r;�
parse_contextz(Parser.parse_from.<locals>.parse_contextns}�����#�)����
�K�$�$�&�&�+�+�N�;�;��%)���$5�$5�$;�v�$E��!��� � �"�"�"��t��5r=Tr�r)r��_z4names starting with an underline can not be imported)r@r�r�F)r�
FromImportr�r/r?r�r�r��names�boolrBr_r�r)�
startswithrCrrrM�hasattrr�)r8r�r��aliasr�s`   @r;�
parse_fromzParser.parse_fromhs�������t�D�K�'8�'8�'?�@�@�@���-�-�/�/��
�����=�)�)�)���
�	�t�	�	�	�	�	�	�	�	+��z�
,���"�"�7�+�+�+��{�"�'�6�1�1� �=�?�?����1�1�D�1�A�A���;�)�)�#�.�.���I�I�N��
�2�����
�;�&�&�y�1�1�3� �4�4�t�4�D�D�E��J�%�%�v�{�E�J�&?�@�@�@�@��J�%�%�f�k�2�2�2� �=�?�?��d�k�&9�&>�'�&I�&I��'J���"�"�6�*�*�*�+	+�,�t�^�,�,�	&� %�D���r=c�P�gx}|_gx}|_|j�d��|jjjdkr�|r|j�d��|�d���}|�d��|j�d��r(|�	|�
����n|r|�d��|�	|��|jjjdk��|j�d��dS)	N�lparenr^r�Tr�r�r�z-non-default argument follows default argument)�args�defaultsr/r�rBr_r�r�rrMr�rC)r8r�r�r��args     r;�parse_signaturezParser.parse_signature�s$�����t�y�#%�%��4�=�����8�$�$�$��k�!�&�(�2�2��
,���"�"�7�+�+�+��*�*�T�*�:�:�C��K�K�� � � ��{�"�"�8�,�,�
K����� 5� 5� 7� 7�8�8�8�8��
K��	�	�I�J�J�J��K�K������k�!�&�(�2�2�	
����8�$�$�$�$�$r=c��tjt|j��j���}|jjjdkr|�|��ng|_g|_	|�
��}t|tj��s|�
d|j��||_|�dd���|_|S)Nrdr�z
expected call)zname:endcallTr�)r�	CallBlockr�r/r?rBr_r�r�r�r�r��CallrCrmr�r�)r8r��	call_nodes   r;rszParser.parse_call_block�s�����d�4�;�&7�&7�&>�?�?�?���;��#�x�/�/�� � ��&�&�&�&��D�I��D�M��)�)�+�+�	��)�U�Z�0�0�	4��I�I�o�t�{�3�3�3���	��)�)�*;��)�N�N��	��r=c���tjt|j��j���}|�dd���|_|�dd���|_|S)NrdT)�start_inline)zname:endfilterr�)	r�FilterBlockr�r/r?r�rnr�r�r�s  r;rtzParser.parse_filter_block�s\��� ��T�[�(9�(9�(@�A�A�A���'�'��4�'�@�@����)�)�*=�4�)�P�P��	��r=c��tjt|j��j���}|�d���j|_|�|��|�dd���|_	|S)NrdTr�)z
name:endmacror�)
r�Macror�r/r?r�r)r�r�r�r�s  r;�parse_macrozParser.parse_macro�sp���{�$�t�{�"3�"3�":�;�;�;���,�,�t�,�<�<�A��	����T�"�"�"��)�)�*<�$�)�O�O��	��r=c�Z�tjt|j��j���}g|_|jjjdkrb|jr|j�d��|j�|�	����|jjjdk�b|S)Nrdr]r�)
r�Outputr�r/r?rBr_r�rMr�r�s  r;�parse_printzParser.parse_print�s����|�4���#4�#4�#;�<�<�<����
��k�!�&�+�5�5��z�
,���"�"�7�+�+�+��J���d�3�3�5�5�6�6�6��k�!�&�+�5�5��r=�
with_tupler�zte.Literal[True]c��dSr��)r8r�r�s   r;r�zParser.parse_assign_target�s	��	�r=Tr�c��dSr�r)r8r�r�rZr�s     r;r�zParser.parse_assign_target�s	��	�r=c���|r�|j���jdkro|j�d��}t	|j��|j�d��}tj|j|j|j���}n�|r<|j�d��}tj	|jd|j���}nC|r|�
d|���}n|���}|�d��|�
��sB|�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)rd�storeT)�
simplifiedrZzcan't assign to )r/r�r_r�r�r�NSRefror?�Namer��
parse_primaryr��
can_assignrC�__name__�lower)r8r�r�rZr�rv�attrr�s        r;r�zParser.parse_assign_target�s[��"�	$�d�k�.�.�0�0�5��>�>��K�&�&�v�.�.�E��������;�%�%�f�-�-�D��[���d�j���N�N�N�F�F�
�	$��K�&�&�v�.�.�E��Z���W�U�\�J�J�J�F�F��
.��)�)�#�_�*������+�+�-�-���N�N�7�#�#�#�� � �"�"�	��I�I�D�4��<�<�#8�#>�#>�#@�#@�D�D�f�m�
�
�
��
r=r�c�V�|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)r8r�s  r;r�zParser.parse_expressions,��
�	)��&�&�(�(�(��}�}���r=c��|jjj}|���}|j�d��r�|���}|j�d��r|���}nd}t
j||||���}|jjj}|j�d����|S)Nr�r�rd)r/rBr?rrrr�CondExpr)r8r?�expr1�expr2�expr3s     r;rzParser.parse_condexprs�����$�+���
�
�����k�!�!�)�,�,�	0��M�M�O�O�E��{�"�"�;�/�/�
��+�+�-�-������N�5�%��v�F�F�F�E��[�(�/�F��k�!�!�)�,�,�	0��r=c�0�|jjj}|���}|j�d��rV|���}tj|||���}|jjj}|j�d���V|S)N�name:orrd)r/rBr?�	parse_andrr�Or�r8r?�left�rights    r;rzParser.parse_ors�����$�+���~�~�����k�!�!�)�,�,�	0��N�N�$�$�E��8�D�%��7�7�7�D��[�(�/�F��k�!�!�)�,�,�	0��r=c�0�|jjj}|���}|j�d��rV|���}tj|||���}|jjj}|j�d���V|S)N�name:andrd)r/rBr?�	parse_notrr�Andrs    r;rzParser.parse_and&s�����$�+���~�~�����k�!�!�*�-�-�	0��N�N�$�$�E��9�T�5��8�8�8�D��[�(�/�F��k�!�!�*�-�-�	0��r=c���|jj�d��rAt|j��j}tj|���|���S|���S)N�name:notrd)	r/rBr�r�r?r�Notr�
parse_compare)r8r?s  r;rzParser.parse_not/s`���;��#�#�J�/�/�	>��$�+�&�&�-�F��9�T�^�^�-�-�f�=�=�=�=��!�!�#�#�#r=c�l�|jjj}|���}g}	|jjj}|t
vrOt
|j��|�tj	||�������n�|j�
d��r;|�tj	d|�������n�|jj�d��r�|j����d��rU|j�
d��|�tj	d|�������nn|jjj}��r|s|Stj|||���S)NTr��inr!r��notinrd)r/rBr?�parse_math1r_�_compare_operatorsr�rMr�Operandrr�r�r��Compare)r8r?r��ops�
token_types     r;r#zParser.parse_compare5s�����$�+�����!�!����	0���,�1�J��/�/�/��T�[�!�!�!��
�
�5�=��T�5E�5E�5G�5G�H�H�I�I�I�I���$�$�Y�/�/�
��
�
�5�=��t�/?�/?�/A�/A�B�B�C�C�C�C���$�)�)�*�5�5�
�$�+�:J�:J�:L�:L�:Q�:Q��;�;�
��� � ��#�#�#��
�
�5�=��$�2B�2B�2D�2D�E�E�F�F�F�F���[�(�/�F�	0��	��K��}�T�3�v�6�6�6�6r=c�b�|jjj}|���}|jjjdvrvt
|jjj}t
|j��|���}||||���}|jjj}|jjjdv�v|S)N)rrrd)r/rBr?�parse_concatr_r$r��r8r?r�clsrs     r;r'zParser.parse_math1Ls�����$�+��� � �"�"���k�!�&�.�8�8��d�k�1�6�7�C��������%�%�'�'�E��3�t�U�6�2�2�2�D��[�(�/�F��k�!�&�.�8�8��r=c�z�|jjj}|���g}|jjjdkrPt|j��|�|�����|jjjdk�Pt|��dkr|dStj	||���S)N�tilderrrd)
r/rBr?�parse_math2r_r�rM�lenr�Concat)r8r?r�s   r;r.zParser.parse_concatWs�����$�+��� � �"�"�#���k�!�&�'�1�1��������K�K��(�(�*�*�+�+�+��k�!�&�'�1�1��t�9�9��>�>���7�N��|�D��0�0�0�0r=c�b�|jjj}|���}|jjjdvrvt
|jjj}t
|j��|���}||||���}|jjj}|jjjdv�v|S)N)r r!r"r#rd)r/rBr?�	parse_powr_r$r�r/s     r;r3zParser.parse_math2as�����$�+���~�~�����k�!�&�*K�K�K��d�k�1�6�7�C��������N�N�$�$�E��3�t�U�6�2�2�2�D��[�(�/�F��k�!�&�*K�K�K��r=c�D�|jjj}|���}|jjjdkret|j��|���}t
j|||���}|jjj}|jjjdk�e|S)N�powrd)r/rBr?�parse_unaryr_r�r�Powrs    r;r7zParser.parse_powls�����$�+�����!�!���k�!�&�%�/�/��������$�$�&�&�E��9�T�5��8�8�8�D��[�(�/�F�	�k�!�&�%�/�/�
�r=�with_filterc���|jjj}|jjj}|dkr>t	|j��tj|�d��|���}nX|dkr>t	|j��tj|�d��|���}n|�	��}|�
|��}|r|�|��}|S)NrFrdr)r/rBr_r?r�r�Negr:�Posr�
parse_postfix�parse_filter_expr)r8r<r,r?r�s     r;r:zParser.parse_unaryvs����[�(�-�
���$�+�������������9�T�-�-�e�4�4�V�D�D�D�D�D�
�5�
 �
 ��������9�T�-�-�e�4�4�V�D�D�D�D�D��%�%�'�'�D��!�!�$�'�'���	0��)�)�$�/�/�D��r=c��|jj}|jdkr�|jdvr#t	j|jdv|j���}nF|jdvrt	jd|j���}n!t	j|jd|j���}t|j���n�|jdkr�t|j��|jg}|j}|jjjdkrM|�	|jjj��t|j��|jjjdk�Mt	jd�
|��|���}n�|jd	vr5t|j��t	j|j|j���}n�|jd
krEt|j��|�d���}|j�d
��nk|jdkr|�
��}nK|jdkr|���}n+|�dt!|����|j��|S)Nr))�true�false�True�False)rCrErd)�none�None�load�string�)�integer�floatr�T)�explicit_parenthesesr^�lbracket�lbracezunexpected )r/rBr_ror�Constr?rr�rMrKr�r��
parse_list�
parse_dictrCr)r8rvr��bufr?s     r;rzParser.parse_primary�s'����#���:�����{�@�@�@��{�5�;�2B�#B�5�<�X�X�X����� 0�0�0��{�4���=�=�=����z�%�+�v�e�l�K�K�K���������
�Z�8�
#�
#��������;�-�C��\�F��+�%�*�h�6�6��
�
�4�;�.�4�5�5�5��T�[�!�!�!��+�%�*�h�6�6��;�r�w�w�s�|�|�F�;�;�;�D�D�
�Z�/�
/�
/��������;�u�{�5�<�@�@�@�D�D�
�Z�8�
#�
#��������#�#��#�>�>�D��K���x�(�(�(�(�
�Z�:�
%�
%��?�?�$�$�D�D�
�Z�8�
#�
#��?�?�$�$�D�D��I�I�=�N�5�$9�$9�=�=�u�|�L�L�L��r=rrNc����jjj}|r�j}n|r�j}ndt
jf�fd�}g}d}	|r�j�d����|��rnH|�	|�����jjj
dkrd}nn�jjj}�z|s;|r|dS|s/��dt�jj������tj
|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,c�0����d���S)NFr�)r�)r8s�r;r4z!Parser.parse_tuple.<locals>.parse�s����,�,�5�,�A�A�Ar=FTr�rzExpected an expression, got rIrd)r/rBr?rr�r�Exprr�rarMr_rCr�Tuple)	r8rr�rZrNr?r4r��is_tuples	`        r;r�zParser.parse_tuple�sk���2��$�+���	B��&�E�E�
�	B��)�E�E�
B�5�:�
B�
B�
B�
B�
B�
B�$&����
	0��
,���"�"�7�+�+�+�� � ��1�1�
���K�K����� � � ��{�"�'�7�2�2������[�(�/�F�
	0��	��
��A�w��(�
��	�	�D�*�4�;�+>�?�?�D�D����
�{�4���7�7�7�7r=c��|j�d��}g}|jjjdkrn|r|j�d��|jjjdkrn<|�|�����|jjjdk�n|j�d��t
j||j���S)NrO�rbracketr�rd)	r/r�rBr_rMr�r�Listr?)r8rv�itemss   r;rRzParser.parse_list�s�����"�"�:�.�.��$&���k�!�&�*�4�4��
,���"�"�7�+�+�+��{�"�'�:�5�5���L�L��.�.�0�0�1�1�1��k�!�&�*�4�4�	
����:�&�&�&��z�%���5�5�5�5r=c�>�|j�d��}g}|jjjdkr�|r|j�d��|jjjdkrn�|���}|j�d��|���}|�t
j|||j�����|jjjdk��|j�d��t
j	||j���S)NrP�rbracer�r}rd)
r/r�rBr_r�rMr�Pairr?�Dict)r8rvr]�keyros     r;rSzParser.parse_dict�s����"�"�8�,�,��$&���k�!�&�(�2�2��
,���"�"�7�+�+�+��{�"�'�8�3�3���'�'�)�)�C��K���w�'�'�'��)�)�+�+�E��L�L���C��s�z�B�B�B�C�C�C��k�!�&�(�2�2�	
����8�$�$�$��z�%���5�5�5�5r=c��	|jjj}|dks|dkr|�|��}n|dkr|�|��}nn�Q|S)NTrrOr�)r/rBr_�parse_subscript�
parse_call�r8r�r,s   r;r@zParser.parse_postfixsm��		���,�1�J��U�"�"�j�J�&>�&>��+�+�D�1�1����x�'�'����t�,�,����		��r=c��	|jjj}|dkr|�|��}nN|dkr+|jjjdkr|�|��}n|dkr|�|��}nn�||S)NT�piper)�isr�)r/rBr_r�ro�
parse_testrerfs   r;rAzParser.parse_filter_exprs���	���,�1�J��V�#�#��(�(��.�.����v�%�%�$�+�*=�*C�t�*K�*K����t�,�,����x�'�'����t�,�,����	��r=c��t|j��}|jdkr�|jj}t|j��|jdkr"t	j||jd|j���S|jdkr|�d|j��t	j	|j|j���}t	j
||d|j���S|jdkr�g}|jjjdkrX|r|j�d	��|�|�
����|jjjdk�X|j�d��t|��d
kr	|d}nt	j|d|j���}t	j
||d|j���S|�d|j��dS)
Nrr)rIrdrLzexpected name or numberrOr[r�rrzexpected subscript expression)r�r/r_rBr�Getattrror?rCrQ�Getitemr�rM�parse_subscribedr4rX)r8r�rv�
attr_tokenr�r�s      r;rdzParser.parse_subscript#s����T�[�!�!���:������,�J���������&�(�(��}��*�*�F�5�<�������I�-�-��	�	�3�Z�5F�G�G�G��+�j�.�z�7H�I�I�I�C��=��s�F�5�<�H�H�H�H��:��#�#�')�D��+�%�*�j�8�8��0��K�&�&�w�/�/�/����D�1�1�3�3�4�4�4��+�%�*�j�8�8�
�K���z�*�*�*��4�y�y�A�~�~��1�g����k�$��u�|�D�D�D���=��s�F�5�<�H�H�H�H��	�	�1�5�<�@�@�@�@�@r=c�8�|jjj}|jjjdkrt	|j��dg}nB|���}|jjjdkr|St	|j��|g}|jjjdkr|�d��nP|jjjdvr(|�|�����n|�d��|jjjdkret	|j��|jjjdvr(|�|�����n+|�d��n|�d��tj|d|i�S)Nr})r[r�r?)	r/rBr?r_r�r�rMr�Slice)r8r?r�r�s    r;rnzParser.parse_subscribedBs�����$�+���;��#�w�.�.��������6�D�D��(�(�*�*�D��{�"�'�7�2�2����������6�D��;��#�w�.�.��K�K������
�[�
 �
%�-B�
B�
B��K�K��-�-�/�/�0�0�0�0��K�K������;��#�w�.�.��������{�"�'�/D�D�D����D�1�1�3�3�4�4�4�4����D�!�!�!�!��K�K������{�4�0�&�0�0�0r=c���	��j�d���	g}g}d}d}d}dtddf��	fd�}�jjjdk�r�|r1�j�d���jjjdkr�n��jjjdkr;||duo|du��t�j������}�n9�jjjd	kr6||du��t�j������}n�jjjd
kr��j���jdkr|||du���jjj}�j�	d������}|�
tj|||j
�
����n;||duo|duo|��|�
������d}�jjjdk��ԉj�d��||||fS)Nr�Fr�r,c�F��|s��d�j��dSdS)Nz+invalid syntax for function call expression)rCr?)r�r8rvs ��r;�ensurez&Parser.parse_call_args.<locals>.ensurejs5����
W��	�	�G���V�V�V�V�V�
W�
Wr=r^r�r r9r)r�r�rdT)r/r�r�rBr_r�r�r�ror�rMrr�r?)
r8r��kwargs�dyn_args�
dyn_kwargs�
require_commartrbrorvs
`        @r;�parse_call_argszParser.parse_call_argsbs�������"�"�8�,�,���������
��
�	W��	W�$�	W�	W�	W�	W�	W�	W�	W��k�!�&�(�2�2��
���"�"�7�+�+�+��;�&�+�x�7�7���{�"�'�5�0�0���x�4�'�>�J�$�,>�?�?�?��T�[�!�!�!��0�0�2�2�����$�)�U�2�2���z�T�)�*�*�*��T�[�!�!�!�!�2�2�4�4�
�
��K�'�,��6�6���(�(�*�*�/�8�;�;��F�:��-�.�.�.��+�-�3�C��K�$�$�Q�'�'�'� �1�1�3�3�E��M�M�%�-��U�5�<�"P�"P�"P�Q�Q�Q�Q��F�8�t�+�Q�
�d�0B�Q�6�z�R�R�R��K�K�� 5� 5� 7� 7�8�8�8� �M�A�k�!�&�(�2�2�D	
����8�$�$�$��V�X�z�1�1r=c��|jj}|���\}}}}tj||||||j���Sr�)r/rBryrr�r?)r8r�rvr�rurvrws       r;rezParser.parse_call�sG����#��-1�-A�-A�-C�-C�*��f�h�
��z�$��f�h�
�5�<�X�X�X�Xr=r�c	�N�|jjjdks|�r|st|j��|j�d��}|j}|jjjdkrNt|j��|d|j�d��jzz
}|jjjdk�N|jjjdkr|���\}}}}ng}g}dx}}tj|||||||j	���}d}|jjjdk��	|��|S)Nrhr)rrGr�rdF)
r/rBr_r�r�roryr�Filterr?)	r8r�r�rvr)r�rurvrws	         r;r�zParser.parse_filter�s>���k�!�&�&�0�0�L�0��
"��T�[�!�!�!��K�&�&�v�.�.�E��;�D��+�%�*�e�3�3��T�[�!�!�!���d�k�0�0��8�8�>�>�>���+�%�*�e�3�3��{�"�'�8�3�3�59�5I�5I�5K�5K�2��f�h�
�
�����(,�,��:��<��d�D�&�(�J�u�|����D�!�L�#�k�!�&�&�0�0�L�0�$�r=c	��t|j��}|jj�d��rt|j��d}nd}|j�d��j}|jjjdkrNt|j��|d|j�d��jzz
}|jjjdk�Ndx}}g}|jjjdkr|���\}}}}n�|jjjdvr�|jj�d	d
d��sa|jj�d��r|�	d
��|�
��}	|�|	��}	|	g}ng}tj
|||||||j���}|rtj||j���}|S)Nr!TFr)rrGr�>r)rMrPr�rJrLrOr�rrzname:isz'You cannot chain multiple tests with isrd)r�r/rBr�r�ror_ryr`rCrr@r�Testr?r")
r8r�rv�negatedr)rvrwrur��arg_nodes
          r;rjzParser.parse_test�s����T�[�!�!���;��#�#�J�/�/�	��������G�G��G��{�!�!�&�)�)�/���k�!�&�%�/�/��������C�$�+�,�,�V�4�4�:�:�:�D��k�!�&�%�/�/�!%�$��:����;��#�x�/�/�15�1E�1E�1G�1G�.�D�&�(�J�J��K��$��	
�	
��K�'�0�0��i��T�T�	
��{�"�'�'�	�2�2�
E��	�	�C�D�D�D��)�)�+�+�H��)�)�(�3�3�H��:�D�D��D��z��$��f�h�
�5�<�
�
�
���	8��9�T�%�,�7�7�7�D��r=c�8���g�g��j}|�|j�|��d��fd�}	|j�r�|jj}|jdkrF|jr)|t
j|j|j�����t|j���n4|jdkrNt|j��||�
d�����|j�d��n�|jd	kr�|��t|j��|�2|jjj|�r�|�|j�
��SS|���}t|t ��r��|��n��|��|j�d
��nt%d���|j���|��|�|j�
��n!#|�|j�
��wwxYw�S)
Nr,c����rE�dj}��tj�dd�|������dd�=dSdS)Nrrd)r?rMrr�)r?r��data_buffers ��r;�
flush_dataz#Parser.subparse.<locals>.flush_data�sY����
#�$�Q��.�����E�L��Q�Q�Q���G�G�G�H�H�H�����N�N�N�
#�
#r=r�rd�variable_beginTr�r\�block_beginr]zinternal parsing error)r,N)rMr7r/rBr_rorr�r?r�r�r�r`rrrzr�rW�extend�AssertionError)r8rU�add_datar�rvrir�r�s      @@r;r�zParser.subparse�sZ����$&��*,���%���!��!�(�(��4�4�4�	#�	#�	#�	#�	#�	#�	#�	,��+�
C���+���:��'�'��{�W� ���!3�E�K���!U�!U�!U�V�V�V����%�%�%�%��Z�#3�3�3����%�%�%��H�T�-�-�D�-�A�A�B�B�B��K�&�&�~�6�6�6�6��Z�=�0�0��J�L�L�L����%�%�%�!�-�2N�$�+�2E�2N�#�3�-� $��%��%�)�)�+�+�+�+�&��-�-�/�/�B�!�"�d�+�+�(����B��������B�����K�&�&�{�3�3�3�3�(�)A�B�B�B�1�+�
C�4
�J�L�L�L��%��%�)�)�+�+�+����%��%�)�)�+�+�+�+�&�����s�C>G9�
BG9�9Hc��tj|���d���}|�|j��|S)z0Parse the whole template into a `Template` node.rrd)r�Templater��set_environmentr')r8r�s  r;r4zParser.parses:�����
�
����:�:�:�����t�/�0�0�0��
r=)NNNr�)NN)F)..)TFNF)T)FTNF)_r
�
__module__�__qualname__�__doc__�str�t�Optionalr<r�int�TyperCr\rXrRrTrYr�rarrgrj�Unionrhrzr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r
r�r�r�r�r�r�r�rr�r�rsr�rtr�r�r�r��typing�overloadrr�rrWr�rrrrr#r'r.r3r7r:rr�rRrarSr@rArlrmrdrnryr�rer�rjr�r�r4rr=r;r&r&.s
��������!%�$(�!%�
>�>�"�>��>��j��o�	>�
�*�S�/�>��z�#��
>�
�>�>�>�>�4#'�+>�	9�9�
�9��
�3��9��V�'�
(�	9�

�9�9�9�9�&-��j��o�&-������S�� 1�2�&-��
�3��	&-�

�&-�&-�&-�&-�R48�?�?��?�!"��C��?�	�?�?�?�?�59�"&�	/�	/��J�q�w�s�C�x�0�1�	/��
�3��	/�
�		/�	/�	/�	/�@D��� �z�!�'�#�s�(�*;�<��	
�������a�j��o���AS�����&�����Q�V�E�J�5G�)G�!H�&�&�&�&�<BG����'�#�s�(�+��:>��	
���
�	�����:	K�1�7�5�<��1B�#B�C�	K�	K�	K�	K�T�5�9�T�T�T�T�&�%�(�����$�E�J�����"#�%�+�#�#�#�#��U�[�����<�u�}�����

�"�
�-1�
�	�
�
�
�
�
5�u�}�
5�
5�
5�
5�6�e�l�6�6�6�6�,�E�,�,�,�,�,�\%�J�%�4�%�%�%�%� 
�%�/�
�
�
�
��E�$5������U�[������U�\������_�FI�����1C��	������_��
�_� ��9=�$���������A�G�C��H�$5�6�	�
��
����e�j�%�+�5�	6�
����_�� ��9=�$�(�(��(��(���A�G�C��H�$5�6�	(�
�(�
����e�j�%�+�5�	6�
(�(�(�(�T��d��e�j�����
��
�
�
�
�
��%�*������5�:�����$�5�:�$�$�$�$�7�u�z�7�7�7�7�.	�U�Z�	�	�	�	�1�e�j�1�1�1�1�	�U�Z�	�	�	�	��5�:�������t��u�z�����$ �u�z� � � � �H!�"�9=�%*�@8�@8��@8��@8���A�G�C��H�$5�6�	@8�
#�@8�
����e�j�(�	)�
@8�@8�@8�@8�D
6�E�J�
6�
6�
6�
6�
6�E�J�
6�
6�
6�
6��%�*��������
�e�j�
�U�Z�
�
�
�
�A��J�A�	
�����
�-�	.�A�A�A�A�>1�%�*�1�1�1�1�@/2���/2�/2�/2�/2�bY�u�z�Y�e�j�Y�Y�Y�Y�BG����J�u�z�*��:>��	
��E�J�	�����.(�u�z�(�e�j�(�(�(�(�V;?�/�/��*�Q�W�S�#�X�%6�7�/�	
���
�	�/�/�/�/�b�u�~������r=r&)'r�r�r�rKr�
exceptionsrr�lexerrr�
TYPE_CHECKING�typing_extensions�ter'r	�TypeVarr�r�r
r�r�r�	frozensetrpr(�Add�Sub�Mul�Div�FloorDiv�Modr$rar�r�rW�__annotations__r&rr=r;�<module>r�s���>�>�>�
�
�
�
�����������.�.�.�.�.�.�+�+�+�+�+�+�!�!�!�!�!�!�&�&�&�&�&�&��?�)�"�"�"�"�(�(�(�(�(�(����+�U�\�5�=�I�I��
�Q�Y�|�U�[�%�/�
B�
B�
��i�
�
�
���� �Y�G�G�G�H�H���9��9��9��9����9�
0�0��Q�V�C����
�+�+�
,����b�b�b�b�b�b�b�b�b�br=