AlkantarClanX12

Your IP : 13.58.40.171


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

�

l��fL�����dZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
egd���Zegd	���Z
ejejejejejejd
�ZGd�de��Zd
S)z8Parse tokens from the lexer into nodes for the compiler.�)�nodes)�imap)�TemplateAssertionError)�TemplateSyntaxError)�describe_token��describe_token_expr)�for�if�block�extends�print�macro�include�from�import�set�with�
autoescape)�eq�ne�lt�lteq�gt�gteq)�add�sub�mul�div�floordiv�modc�l�eZdZdZd7d�Zdefd�Zd�Zd8d�Zd9d�Z	d8d�Z
d8d	�Zd
�Zd:d�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z				d;d�Zd<d�Zd �Z d!�Z!d"�Z"d#�Z#d$�Z$d%�Z%d&�Z&d'�Z'd(�Z(d<d)�Z)d*�Z*				d=d+�Z+d,�Z,d-�Z-d.�Z.d/�Z/d0�Z0d1�Z1d2�Z2d:d3�Z3d4�Z4d8d5�Z5d6�Z6dS)>�Parserz�This is the central parsing class Jinja uses.  It's passed to
    extensions and can be used to parse expressions or statements.
    Nc��||_|�||||��|_||_||_d|_i|_|���D]}|jD]}|j	|j|<��d|_
g|_g|_dS)NF�)
�environment�	_tokenize�stream�name�filename�closed�
extensions�iter_extensions�tags�parse�_last_identifier�
_tag_stack�_end_token_stack)�selfr&�sourcer)r*�state�	extension�tags        �m/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/jinja2/parser.py�__init__zParser.__init__+s���&���!�+�+�F�D�(�E�J�J�����	� ��
�������$�4�4�6�6�	7�	7�I� �~�
7�
7��'0�����$�$�
7� !������ "�����c�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(�current�linenor)r*)r3�msgr=�excs    r8�failzParser.fail9s0��
�>��[�(�/�F��c�#�v�t�y�$�-�8�8�8r:c���g}|D]*}|�tt|�����+|r&d�d�|dD����}nd}|�dg}nd|zg}|r7|�||vr|�d|z��n|�d|z��|jr#|�d|jdz��|�d	�|��|��dS)
Nz or c3�:K�|]}dt|��zV��dS)z'%s'Nr)�.0�exprs  r8�	<genexpr>z&Parser._fail_ut_eof.<locals>.<genexpr>GsA����,�,�7;��,�T�2�2�2�,�,�,�,�,�,r:���zUnexpected end of template.zEncountered unknown tag '%s'.z_You probably made a nesting mistake. Jinja is expecting this tag, but currently looking for %s.z-Jinja was looking for the following tags: %s.z4The innermost block that needs to be closed is '%s'.� )�extendrr	�join�appendr1r@)r3r)�end_token_stackr=�expected�exprs�currently_looking�messages        r8�_fail_ut_eofzParser._fail_ut_eofBs]����$�	>�	>�E��O�O�D�!4�e�<�<�=�=�=�=��	%� &���,�,�?N�r�?R�,�,�,�!�!���!%���<�4�5�G�G�6��=�>�G��	���D�H�$4�$4����� 1�2���������-�.����
�?�	��N�N�"�$(�O�B�$7�8�
�
�
�
	
�	�	�#�(�(�7�#�#�V�,�,�,�,�,r:c�:�|�||j|��S)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.
        )rPr2)r3r)r=s   r8�fail_unknown_tagzParser.fail_unknown_taggs��
� � ��t�'<�f�E�E�Er:c��t|j��}|�|�|��|�d||��S)z9Like fail_unknown_tag but for end of template situations.N)�listr2rJrP)r3�
end_tokensr=�stacks    r8�fail_eofzParser.fail_eofnsB���T�*�+�+���!��L�L��$�$�$�� � ��u�f�5�5�5r:c�r�|jjjdvrdS|�|jj�|��SdS)zAre we at the end of a tuple?)�variable_end�	block_end�rparenTNF)r(r<�type�test_any)r3�extra_end_ruless  r8�is_tuple_endzParser.is_tuple_endus?���;��#�'N�N�N��4�
�
(��;�&�/�/��@�@�@��ur:c���|xjdz
c_t�tj��}tj�|d|jz|���|S)zDReturn a new free identifier as :class:`~jinja2.nodes.InternalName`.rzfi%d�r=)r0�object�__new__r�InternalName�Noder9)r3r=�rvs   r8�free_identifierzParser.free_identifier}sT������"���
�^�^�E�.�
/�
/��
�
���B���)>� >�v��N�N�N��	r:c���|jj}|jdkr|�d|j��|j�|j��d}	|jtvrFt|d|jjjz����|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(r<r\r@r=r1rJ�value�_statement_keywords�getattr�pop�parse_call_block�parse_filter_blockr,�getrR)r3�token�pop_tag�exts    r8�parse_statementzParser.parse_statement�s����#���:�����I�I�)�5�<�8�8�8�����u�{�+�+�+���	&��{�1�1�1�J�w�t�X���0C�0I�%I�J�J�L�L� �
&���#�#�%�%�%�%�
&��{�f�$�$��,�,�.�.��
&���#�#�%�%�%�%�
&��{�h�&�&��.�.�0�0��
&���#�#�%�%�%�%�
&��/�%�%�e�k�2�2�C����s�4�y�y��
&���#�#�%�%�%�%�
&�	
�O���!�!�!��G��!�!�%�+�u�|�<�<�<��
&���#�#�%�%�%�%�%�
&�
&��w�
&���#�#�%�%�%�%�
&���s$�7G�)G�$G�+G�';G�GFc��|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.
        �colonrZ�eof)r(�skip_if�expect�subparser<r\rW�next)r3rU�drop_needle�results    r8�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�assignraN)zname:endset�r~)r}r(r=�parse_assign_targetrz�parse_tupler�Assign�parse_filterr��AssignBlock)r3r=�targetrD�filter_node�bodys      r8�	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)r^r�F)�name:recursive)�
with_condexprr^N�name:ifr�)�name:endfor�	name:else�endfor)r�Tr�ra)r(r{r=r�r�rz�parse_expressionr�r}rlr�For)r3r=r��iter�test�	recursiver��else_s        r8�	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�rarF�r�)�	name:elifr��
name:endifr�r�)r�Tr�)r�Ifr(r{r=r�r�r�r��elif_r�r}r<rJ)r3�noderrss    r8�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)	NrarZ�comma�paramr�)zname:endwithTr�)r�Withr}r(r=r<r\r{r��set_ctxrJr��targets�valuesr�r�)r3r�r�r�r�s     r8�
parse_withzParser.parse_with�s
���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)Nrar)zname:endautoescapeTr�)r�ScopedEvalContextModifierr}r(r=�Keywordr��optionsr�r��Scope�r3r�s  r8�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��tjt|j��j���}|j�d��j|_|j�d��|_	|jj
jdkr|�d��|�
dd���|_|j�d	|jz��|S)
Nrar)zname:scopedrzpBlock names in Jinja have to be valid Python identifiers and may not contain hyphens, use an underscore instead.)z
name:endblockTr�zname:)r�Blockr}r(r=r{rlr)rz�scopedr<r\r@r�r�r�s  r8�parse_blockzParser.parse_blocks����{�$�t�{�"3�"3�":�;�;�;���K�&�&�v�.�.�4��	��k�)�)�-�8�8���
�;��#�u�,�,��I�I�&�
�
�
��)�)�*<�$�)�O�O��	�����G�d�i�/�0�0�0��r:c��tjt|j��j���}|���|_|S)Nra)r�Extendsr}r(r=r��templater�s  r8�
parse_extendszParser.parse_extendss9���}�D���$5�$5�$<�=�=�=���-�-�/�/��
��r:c�$�|jj�dd��rh|j����d��r<t|j��jdk|_|j���n||_|S)Nz	name:withzname:without�name:contextr)	r(r<r]�lookr�r}rl�with_context�skip)r3r��defaults   r8�parse_import_contextzParser.parse_import_contexts����;��'�'���
�
�	(��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)Nrazname:ignorezname:missingT�F)
r�Includer}r(r=r�r�r<r�r��ignore_missingr�r�r�s  r8�
parse_includezParser.parse_include$s����}�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)Nra�name:asT��	name_onlyF)r�Importr}r(r=r�r�r{r�r)r�r�r�s  r8�parse_importzParser.parse_import0s{���|�4���#4�#4�#;�<�<�<���-�-�/�/��
�����9�%�%�%��.�.��.�>�>�C����(�(��u�5�5�5r:c����tjt�j��j���������_�j�d��g�_��fd�}	�jr�j�d���jj	j
dkr�|��r�n��d���}|j�
d	��r"��d
|jt����j�d��r=��d���}�j�|j|jf��n�j�|j��|��s�jj	j
dkrnn�j�d����Gt%�d
��sd�_�S)Nrazname:importc����jjjdvri�j����d��r=t�j��jdk�_�j���dSdS)N)r�withoutr�rTF)r(r<rlr�r�r}r�r�)r�r3s��r8�
parse_contextz(Parser.parse_from.<locals>.parse_context=s}����{�"�(�-����+�"�"�$�$�)�)�.�9�9��%)���$5�$5�$;�v�$E��!��� � �"�"�"��t��5r:rr�r)Tr��_z4names starting with an underline can not be imported)r?r�r�F)r�
FromImportr}r(r=r�r�r{�namesr<r\r�r)�
startswithr@rrzrJ�hasattrr�)r3r�r��aliasr�s`   @r8�
parse_fromzParser.parse_from7s�������t�D�K�'8�'8�'?�@�@�@���-�-�/�/��
�����=�)�)�)���
�	�	�	�	�	�	�	+��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{r<r\r�r�rzrJr�r@)r3r�r�r��args     r8�parse_signaturezParser.parse_signatureas$�����	�D�#%�%��
������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|jtj
��s|�d|j��|�dd���|_|S)Nrar�z
expected call)zname:endcallTr�)r�	CallBlockr}r(r=r<r\r�r�r�r�rj�
isinstance�Callr@r�r�r�s  r8rpzParser.parse_call_blockqs�����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)NraT)�start_inline)zname:endfilterr�)	r�FilterBlockr}r(r=r�rkr�r�r�s  r8rqzParser.parse_filter_blocks\��� ��T�[�(9�(9�(@�A�A�A���'�'��4�'�@�@����)�)�*=�4�)�P�P��	��r:c��tjt|j��j���}|�d���j|_|�|��|�dd���|_	|S)NraTr�)z
name:endmacror�)
r�Macror}r(r=r�r)r�r�r�r�s  r8�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)NrarZr�)
r�Outputr}r(r=r<r\r{rJr�r�s  r8�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:Tc���|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��|�
��s:|�d|jj���z|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)ra�storeT)�
simplifiedr^zcan't assign to %r)r(r�r\r{r}r�NSRefrlr=�Namer��
parse_primaryr��
can_assignr@�	__class__�__name__�lower)r3�
with_tupler�r^r�rs�attrr�s        r8r�zParser.parse_assign_target�sU���	$�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�$�v�'7�'@�'F�'F�'H�'H�H�&�-�
�
�
��
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)r3r�s  r8r�zParser.parse_expression�s,��
�	)��&�&�(�(�(��}�}���r:c��|jjj}|���}|j�d��r�|���}|j�d��r|���}nd}t
j||||���}|jjj}|j�d����|S)Nr�r�ra)r(r<r=r�rzr�r�CondExpr)r3r=�expr1�expr2�expr3s     r8r�zParser.parse_condexpr�s�����$�+���
�
�����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:orra)r(r<r=�	parse_andrzr�Or�r3r=�left�rights    r8r�zParser.parse_or�s�����$�+���~�~�����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:andra)r(r<r=�	parse_notrzr�Andrs    r8rzParser.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:notra)	r(r<r�r}r=r�Notr
�
parse_compare)r3r=s  r8r
zParser.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)Nrr��inr
r��notinra)r(r<r=�parse_math1r\�_compare_operatorsr}rJr�Operandrzr�r�r��Compare)r3r=rD�ops�
token_types     r8rzParser.parse_compare�s�����$�+�����!�!����	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)rrra)r(r<r=�parse_concatr\�_math_nodesr}�r3r=r�clsrs     r8rzParser.parse_math1�s�����$�+��� � �"�"���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�tilderr%ra)
r(r<r=�parse_math2r\r}rJ�lenr�Concat)r3r=r�s   r8rzParser.parse_concat
s�����$�+��� � �"�"�#���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)rrr r!ra)r(r<r=�	parse_powr\rr}rs     r8r zParser.parse_math2s�����$�+���~�~�����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�powra)r(r<r=�parse_unaryr\r}r�Powrs    r8r$zParser.parse_pows�����$�+�����!�!���k�!�&�%�/�/��������$�$�&�&�E��9�T�5��8�8�8�D��[�(�/�F�	�k�!�&�%�/�/�
�r:c���|jjj}|jjj}|dkr>t	|j��tj|�d��|���}nX|dkr>t	|j��tj|�d��|���}n|�	��}|�
|��}|r|�|��}|S)NrFrar)r(r<r\r=r}r�Negr'�Posr��
parse_postfix�parse_filter_expr)r3�with_filterrr=r�s     r8r'zParser.parse_unary)s����[�(�-�
���$�+�������������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!|��z|j��|S)Nr))�true�false�True�False)r0r2ra)�none�None�load�string�)�integer�floatr�T)�explicit_parenthesesr[�lbracket�lbracezunexpected '%s')r(r<r\rlr�Constr=r�r}rJrIr�r{�
parse_list�
parse_dictr@r)r3rsr��bufr=s     r8r�zParser.parse_primary9s$����#���:�����{�@�@�@��{�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�N�N��r:c����jjj}|r�j}n|r�j}n�fd�}g}d}	|r�j�d����|��rnH|�|�����jjjdkrd}nn�jjj}�z|s;|r|dS|s/��	dt�jj��z��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.
        c�0����d���S)NFr�)r�)r3s�r8r/z!Parser.parse_tuple.<locals>.parsezs����,�,�5�,�A�A�Ar:Frr�Tr%z Expected an expression, got '%s'r6ra)
r(r<r=r�r�r{r_rJr\r@rr�Tuple)	r3r�r�r^r;r=r/r��is_tuples	`        r8r�zParser.parse_tupleZsQ���2��$�+���	B��&�E�E�
�	B��)�E�E�
B�
B�
B�
B�
B�����
	0��
,���"�"�7�+�+�+�� � ��1�1�
���K�K����� � � ��{�"�'�7�2�2������[�(�/�F�
	0��	��
��A�w��(�
��	�	�6�$�T�[�%8�9�9�:����
�{�4���7�7�7�7r:c��|j�d��}g}|jjjdkrn|r|j�d��|jjjdkrn<|�|�����|jjjdk�n|j�d��t
j||j���S)Nr<�rbracketr�ra)	r(r{r<r\rJr�r�Listr=)r3rs�itemss   r8r?zParser.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)Nr=�rbracer�rxra)
r(r{r<r\r�rJr�Pairr=�Dict)r3rsrI�keyrls     r8r@zParser.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)Nrr�r<r�)r(r<r\�parse_subscript�
parse_call�r3r�rs   r8r,zParser.parse_postfix�sm��		���,�1�J��U�"�"�j�J�&>�&>��+�+�D�1�1����x�'�'����t�,�,����		��r:c��	|jjj}|dkr|�|��}nN|dkr+|jjjdkr|�|��}n|dkr|�|��}nn�||S)Nr�piper)�isr�)r(r<r\r�rl�
parse_testrQrRs   r8r-zParser.parse_filter_expr�s���	���,�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)
Nr�r)r6rar9zexpected name or numberr<rGr�rr%zexpected subscript expression)r}r(r\r<r�Getattrrlr=r@r>�Getitemr{rJ�parse_subscribedr!rD)r3r�rs�
attr_tokenr�r�s      r8rPzParser.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)Nrx)rGr�r=)	r(r<r=r\r}r�rJr�Slice)r3r=r�r�s    r8rZzParser.parse_subscribed�s~����$�+���;��#�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}dx}}d}��
fd�}�jjjdk�r�|r1�j�d���jjjdkr�n��jjjdkr;||duo|du��t	�j������}�n9�jjjdkr6||du��t	�j������}n�jjjdkr��j���jd	kr|||du���jjj}�j�d
������}	|�	tj||	|	j�����n;||duo|duo|��|�	������d}�jjjdk��ԉj�d��|�||||fStj
|||||�
j���S)
Nr�Fc�F��|s��d�j��dSdS)Nz+invalid syntax for function call expression)r@r=)rDr3rss ��r8�ensurez!Parser.parse_call.<locals>.ensures5����
W��	�	�G���V�V�V�V�V�
W�
Wr:r[r�rr&r)r�r�raT)r(r{r<r\r}r�r�rlr�rJrr�r=r�)r3r�r��kwargs�dyn_args�
dyn_kwargs�
require_commar`rNrlrss`         @r8rQzParser.parse_calls�������"�"�8�,�,������ $�$��:��
�	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�=�k�!�&�(�2�2�>	
����8�$�$�$��<����:�5�5��z�$��f�h�
�5�<�X�X�X�Xr:c	�P�|jjjdks|�r
|st|j��|j�d��}|j}|jjjdkrNt|j��|d|j�d��jzz
}|jjjdk�N|jjjdkr|�d��\}}}}ng}g}dx}}tj|||||||j	���}d}|jjjdk��
|��
|S)NrTr)r��.r�raF)
r(r<r\r}r{rlrQr�Filterr=)	r3r�r�rsr)r�rarbrcs	         r8r�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�_�_�T�5J�5J�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|�d��\}}}}n�|jjjdvr�|jj�d	d
d��sa|jj�d��r|�	d
��|�
��}	|�|	��}	|	g}ng}tj
|||||||j���}|rtj||j���}|S)Nr
TFr)r�rfr�)r)r7r9r:r�r<r=r�rr	zname:isz'You cannot chain multiple tests with isra)r}r(r<r�r{rlr\rQr]r@r�r,r�Testr=r)
r3r�rs�negatedr)rbrcrar��arg_nodes
          r8rVzParser.parse_testQs����T�[�!�!���;��#�#�J�/�/�	��������G�G��G��{�!�!�&�)�)�/���k�!�&�%�/�/��������C�$�+�,�,�V�4�4�:�:�:�D��k�!�&�%�/�/�!%�$��:����;��#�x�/�/�15����1F�1F�.�D�&�(�J�J�
�[�
 �
%�*
�
�
��+�%�.�.�{�I�z�R�R�
��{�"�'�'�	�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�6���g�g��j}|�|j�|����fd�}	|j�r�|jj}|jdkrF|jr)|t
j|j|j�����t|j���n4|jdkrNt|j��||�
d�����|j�d��n�|jdkr�|��t|j��|�2|jjj|�r�|�|j�
��SS|���}t|t ��r��|��n��|��|j�d	��nt%d
���|j���|��|�|j�
��n!#|�|j�
��wwxYw�S)Nc����rE�dj}��tj�dd�|������dd�=dSdS)Nr%ra)r=rJrr�)r=r��data_buffers ��r8�
flush_dataz#Parser.subparse.<locals>.flush_datasY����
#�$�Q��.�����E�L��Q�Q�Q���G�G�G�H�H�H�����N�N�N�
#�
#r:�datara�variable_beginTr�rY�block_beginrZzinternal parsing error)rJr2r(r<r\rlr�TemplateDatar=r}r�r{r]rorvr�rTrH�AssertionError)r3rU�add_datarorsrfr�rns      @@r8r|zParser.subparsewsU���������%���!��!�(�(��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>G8�BG8�8Hc��tj|���d���}|�|j��|S)z0Parse the whole template into a `Template` node.rra)r�Templater|�set_environmentr&)r3rs  r8r/zParser.parse�s:�����
�
����:�:�:�����t�/�0�0�0��
r:)NNN)N)NN)F)TFNF)T)FTNF)7r��
__module__�__qualname__�__doc__r9rr@rPrRrWr_rgrvr�r�r�r�r�r�r�r�r�r�r�r�r�rprqr�r�r�r�r�r�rr
rrrr r$r'r�r�r?r@r,r-rPrZrQr�rVr|r/�r:r8r#r#&s���������#�#�#�#� $�)<�9�9�9�9�#-�#-�#-�JF�F�F�F�6�6�6�6���������&�&�&�8����6	K�	K�	K�T�T�T�&���$���"#�#�#����&���
���
5�
5�
5�6�6�6�(�(�(�T%�%�%� ����������������#�#�#�#�J�������������$�$�$�7�7�7�.	�	�	�1�1�1�	�	�	�������� ���F���"�?8�?8�?8�?8�B
6�
6�
6�
6�
6�
6����
�
�
�A�A�A�61�1�1�>.Y�.Y�.Y�`����*$�$�$�L.�.�.�.�`����r:r#N)r{r8r�_compatr�
exceptionsrr�lexerrr	�	frozensetrmr�Add�Sub�Mul�Div�FloorDiv�Modrrbr#r|r:r8�<module>r�s��>�>�������������.�.�.�.�.�.�+�+�+�+�+�+�!�!�!�!�!�!�&�&�&�&�&�&��i�
�
�
���� �Y�G�G�G�H�H���9��9��9��9����9�
���E�E�E�E�E�V�E�E�E�E�Er: