HEX
Server: Apache
System: Linux pdx1-shared-a1-29 6.18.39-grsec-noble+ #4 SMP Thu Jul 23 07:53:29 UTC 2026 x86_64
User: dh_bj99yp (22285841)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/genshi/template/__pycache__/interpolation.cpython-312.pyc
�

EMab6���dZddlmZddlZddlmZddlmZddlm	Z	m
Z
ddlmZdgZ
d	Zd
ZedzZdZej$d
d�de���Zdd�Zd�Zy)z�String interpolation routines, i.e. the splitting up a given text into some
parts that are literal strings, and others that are Python expressions.
�)�chainN)�PseudoToken)�TEXT)�TemplateSyntaxError�EXPR)�
Expression�interpolatezrestructuredtext en�5abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_z.0123456789�$z(?s)z)[uU]?[rR]?("""|\'\'\')((?<!\\)\\\1|.)*?\1�|c
#�K�|||g}g}d}tt|||�dg�D]�\}}	|r^|r!tdj|�|f��|dd�=d}|	rW	t	|	j�|d|d|��}
t|
t|�f��n|j|	�|�t|�}d|	vrC|	j�}|dxxt|�dz
z
cc<|dxxt|d	�z
cc<��|dxxt|	�z
cc<��y#t$r*}t|||d|d|jxsdz��d}~wwxYw�w)
a�Parse the given string and extract expressions.
    
    This function is a generator that yields `TEXT` events for literal strings,
    and `EXPR` events for expressions, depending on the results of parsing the
    string.
    
    >>> for kind, data, pos in interpolate("hey ${foo}bar"):
    ...     print('%s %r' % (kind, data))
    TEXT 'hey '
    EXPR Expression('foo')
    TEXT 'bar'
    
    :param text: the text to parse
    :param filepath: absolute path to the file in which the text was found
                     (optional)
    :param lineno: the line number at which the text was found (optional)
    :param offset: the column number at which the text starts in the source
                   (optional)
    :param lookup: the variable lookup mechanism; either "lenient" (the
                   default), "strict", or a custom lookup class
    :return: a list of `TEXT` and `EXPR` events
    :raise TemplateSyntaxError: when a syntax error in an expression is
                                encountered
    N)T�rr�)�lookup��
���)r�lexr�joinr�stripr�tuple�SyntaxErrorr�offset�append�
splitlines�len)
�text�filepath�linenorr�pos�textbuf�textpos�is_expr�chunk�expr�err�liness
             �?/usr/lib/python3/dist-packages/genshi/template/interpolation.pyr	r	'sU����2�V�V�
$�C��G��G���D�#�x� 8�:�,�G�!�������B�G�G�G�,�g�5�5��A�J����J�%�e�k�k�m�S��V�S��V�-3�5�D���e�C�j�0�0�

�N�N�5�!�����*���5�=��$�$�&�E���F�c�%�j�1�n�$�F���F�c�%��)�n�$�F���F�c�%�j� �F�1!��#�J�-�c�8�S��V�.1�!�f��
�
��a�.H�J�J��J�s+�AD>�7D�	A?D>�	D;�%D6�6D;�;D>c#�>K�dx}}t|�}d}	|r|jt|dz�}d}n|jt|�}|dks||dz
k(r�n5||dz}|dk(r�||kDr	d|||f��|dz}d}|rwtj	||�}	|	�|	j�st
d|g|dd����|	j�}|	jd\}
}||
|}|dk(r|dz
}n
|dk(r|dz}|r�wd	||dz|dz
f��n�|tvrN||kDrd|||f��|}|dz
}||kr||}
|
tvrn|dz
}||kr�d	||dz|j�f��n2|s|tk(r||kDr	d|||f��d	}|dz}nd|||dzf��|dz}��x||kr
d||df��yy�w)
NrFrr�{zinvalid syntax��}T)r�find�PREFIX�token_re�match�groupr�end�regs�	NAMESTART�	NAMECHARSr)rr"rrr r2�escaped�next�levelr0�tstart�tend�token�chars              r(rr_s=������F�S�

�d�)�C��G�
���Y�Y�v�v��z�2�F��G��Y�Y�v�s�+�F��A�:��3��7�*���F�Q�J����3�;���|��T�#�f�-�-�-��1�*�C��E�� ���t�S�1���=����
�.�.>��<�/6�q�r�{�<�<��i�i�k��$�z�z�!�}�����V�D�)���C�<��Q�J�E��c�\��Q�J�E����V�a�Z��a��0�0�0�
�Y�
���|��T�#�f�-�-�-����1�H�C���)��C�y���y�(���q���	��)�
��V�a�Z��,�2�2�4�4�4��T�V�^���|��T�#�f�-�-�-��G��1�*�C���c�&�1�*�-�-�-��1�*�C�g�j�S�y��T�#�$�Z����s�C0F�3A
F�>AF)Nrr�strict)�__doc__�	itertoolsr�re�tokenizer�genshi.corer�genshi.template.baserr�genshi.template.evalr�__all__�
__docformat__r4r5r.�compiler/r	r��r(�<module>rJsd����	� ��:�+��/��%�
�C�	��
�%�	�	���2�:�:�0�����5!�p; rI