HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/jinja2/__pycache__/lexer.cpython-310.pyc
o

�N�gZt�@sLUdZddlZddlZddlmZddlmZddlm	Z	ddl
mZddl
mZdd	lmZejr<ddlZdd
lmZed�Zejejdfed
<e�d�Ze�d�Ze�dej�Ze�dejej B�Z!e�dejej B�Z"e	d�Z#e	d�Z$e	d�Z%e	d�Z&e	d�Z'e	d�Z(e	d�Z)e	d�Z*e	d�Z+e	d�Z,e	d�Z-e	d�Z.e	d�Z/e	d �Z0e	d!�Z1e	d"�Z2e	d#�Z3e	d$�Z4e	d%�Z5e	d&�Z6e	d'�Z7e	d(�Z8e	d)�Z9e	d*�Z:e	d+�Z;e	d,�Z<e	d-�Z=e	d.�Z>e	d/�Z?e	d0�Z@e	d1�ZAe	d2�ZBe	d3�ZCe	d4�ZDe	d5�ZEe	d6�ZFe	d7�ZGe	d8�ZHe	d9�ZIe	d:�ZJe	d;�ZKe	d<�ZLe	d=�ZMe	d>�ZNe	d?�ZOe	d@�ZPe	dA�ZQe	dB�ZRe	dC�ZSidDe#�dEe;�dFe'�dGe*�dHe3�dIe2�dJe6�dKe<�dLe.�dMe8�dNe/�dOe9�dPe-�dQe7�dRe)�dSe4�dTe+�e,e0e1e$e(e%e5e&e:dU�	�ZTdVdW�eT�U�D�ZVeWeT�eWeV�k�s�JdX��e�dNdY�XdZd[�eYeTd\d]�d^�D���dO��ZZe[eIeKeJe=eNeOePg�Z\e[e=eQeKePg�Z]d_e^d`e^fdadb�Z_dcddd`e^fdedf�Z`dge^d`e^fdhdi�Zadje^d`ebfdkdl�Zcdmdnd`ejdeje^e^ffdodp�ZeGdqdr�dr�ZfGdsdd�ddejg�ZhGdtdu�du�ZiGdvdw�dw�Zjddxdy�ZkGdzd{�d{el�ZmGd|d}�d}ejg�ZnGd~d�d�ZodS)�z�Implements a Jinja / Python combination lexer. The ``Lexer`` class
is used to do some preprocessing. It filters out invalid operators like
the bitshift operators we don't allow in templates. It separates
template code and python code in expressions.
�N)�literal_eval)�deque)�intern�)�pattern)�TemplateSyntaxError)�LRUCache)�Environment�2�Lexer�_lexer_cachez\s+z(\r\n|\r|\n)z7('([^'\\]*(?:\\.[^'\\]*)*)'|"([^"\\]*(?:\\.[^"\\]*)*)")z�
    (
        0b(_?[0-1])+ # binary
    |
        0o(_?[0-7])+ # octal
    |
        0x(_?[\da-f])+ # hex
    |
        [1-9](_?\d)* # decimal
    |
        0(_?0)* # decimal zero
    )
    z�
    (?<!\.)  # doesn't start with a .
    (\d+_)*\d+  # digits, possibly _ separated
    (
        (\.(\d+_)*\d+)?  # optional fractional part
        e[+\-]?(\d+_)*\d+  # exponent part
    |
        \.(\d+_)*\d+  # required fractional part
    )
    �addZassign�colonZcommaZdiv�dot�eq�floordiv�gtZgteqZlbraceZlbracketZlparen�ltZlteq�mod�mul�ne�pipe�pow�rbraceZrbracketZrparenZ	semicolon�sub�tilde�
whitespace�float�integer�name�string�operatorZblock_beginZ	block_endZvariable_beginZvariable_endZ	raw_beginZraw_endZ
comment_beginZcomment_end�commentZlinestatement_beginZlinestatement_endZlinecomment_beginZlinecomment_endZlinecomment�data�initial�eof�+�-�/z//�*�%z**�~�[�]�(�)�{�}z==z!=�>)	z>=�<z<=�=�.�:�|�,�;cCsi|]\}}||�qS�r:)�.0�k�vr:r:�@/opt/saltstack/salt/lib/python3.10/site-packages/jinja2/lexer.py�
<dictcomp>�sr?zoperators droppedr7ccs�|]}t�|�VqdS�N)�re�escape�r;�xr:r:r>�	<genexpr>���rEcCs
t|�Sr@)�len�rDr:r:r>�<lambda>�s
rI)�key�
token_type�returncCsL|tvrt|Stdtdtdtdtdtdtdtdt	dt
d	td
tdi�
||�S)Nzbegin of commentzend of commentr"zbegin of statement blockzend of statement blockzbegin of print statementzend of print statementzbegin of line statementzend of line statementztemplate data / textzend of template)�reverse_operators�TOKEN_COMMENT_BEGIN�TOKEN_COMMENT_END�
TOKEN_COMMENT�TOKEN_LINECOMMENT�TOKEN_BLOCK_BEGIN�TOKEN_BLOCK_END�TOKEN_VARIABLE_BEGIN�TOKEN_VARIABLE_END�TOKEN_LINESTATEMENT_BEGIN�TOKEN_LINESTATEMENT_END�
TOKEN_DATA�	TOKEN_EOF�get)rKr:r:r>�_describe_token_type�s"�
�r[�token�TokencCs|jtkr|jSt|j�S)z#Returns a description of the token.)�type�
TOKEN_NAME�valuer[)r\r:r:r>�describe_token�s

ra�exprcCs8d|vr|�dd�\}}|tkr|St|�S|}t|�S)z0Like `describe_token` but for token expressions.r6r)�splitr_r[)rbr^r`r:r:r>�describe_token_expr�s�rdr`cCstt�|��S)zsCount the number of newline characters in the string.  This is
    useful for extensions that filter a stream.
    )rG�
newline_re�findall)r`r:r:r>�count_newlines��rg�environmentr	cCs�tj}t|j�t||j�ft|j�t||j�ft|j�t||j�fg}|j	dur8|�
t|j	�td||j	�f�|jdurM|�
t|j�t
d||j�f�dd�t|dd�D�S)zACompiles all the rules from the environment into a list of rules.Nz	^[ \t\v]*z(?:^|(?<=\S))[^\S\r\n]*cSsg|]}|dd��qS)rNr:rCr:r:r>�
<listcomp>�sz!compile_rules.<locals>.<listcomp>T)�reverse)rArBrG�comment_start_stringrN�block_start_stringrR�variable_start_stringrT�line_statement_prefix�appendrV�line_comment_prefix�TOKEN_LINECOMMENT_BEGIN�sorted)ri�e�rulesr:r:r>�
compile_rules�s:����
��
��rvc@sLeZdZdZefdedejeddfdd�Zde	d	ej
edd
fdd�ZdS)
�FailurezjClass that raises a `TemplateSyntaxError` if called.
    Used by the `Lexer` to specify known errors.
    �message�clsrLNcCs||_||_dSr@)rx�error_class)�selfrxryr:r:r>�__init__s
zFailure.__init__�lineno�filenamezte.NoReturncCs|�|j||��r@)rzrx)r{r}r~r:r:r>�__call__	szFailure.__call__)�__name__�
__module__�__qualname__�__doc__r�str�tZTyper|�int�Optionalrr:r:r:r>rw�s���
� rwc@sXeZdZUeed<eed<eed<defdd�Zdedefdd	�Zd
edefdd�Z	d
S)r]r}r^r`rLcC�t|�Sr@)ra�r{r:r:r>�__str__�z
Token.__str__rbcCs2|j|krdSd|vr|�dd�|j|jgkSdS)z�Test a token against a token expression.  This can either be a
        token type or ``'token_type:token_value'``.  This can only test
        against string values and types.
        Tr6rF)r^rcr`�r{rbr:r:r>�tests

z
Token.test�iterablecst�fdd�|D��S)z(Test against multiple token expressions.c3s�|]}��|�VqdSr@)r�)r;rbr�r:r>rE&rFz!Token.test_any.<locals>.<genexpr>)�any)r{r�r:r�r>�test_any$szToken.test_anyN)
r�r�r�r��__annotations__r�r��boolr�r�r:r:r:r>r]
s
c@s2eZdZdZddd�Zd
dd	�Zdefd
d�ZdS)�TokenStreamIteratorz`The iterator for tokenstreams.  Iterate over the stream
    until the eof token is reached.
    �stream�TokenStreamrLNcCs
||_dSr@)r�)r{r�r:r:r>r|.s
zTokenStreamIterator.__init__cCs|Sr@r:r�r:r:r>�__iter__1szTokenStreamIterator.__iter__cCs.|jj}|jtur|j��t�t|j�|Sr@)r��currentr^rY�close�
StopIteration�next�r{r\r:r:r>�__next__4s


zTokenStreamIterator.__next__)r�r�rLN)rLr�)r�r�r�r�r|r�r]r�r:r:r:r>r�)s


r�c@s�eZdZdZdejedejedejefdd�Z	de
fdd	�Zdefd
d�Z
edefdd
��Zdeddfdd�Zdefdd�Zd#deddfdd�Zdedejefdd�Zdedefdd�Zdefdd�Zd$dd �Zdedefd!d"�ZdS)%r�z�A token stream is an iterable that yields :class:`Token`\s.  The
    parser however does not iterate over it but calls :meth:`next` to go
    one token ahead.  The current active token is stored as :attr:`current`.
    �	generatorrr~cCs>t|�|_t�|_||_||_d|_tdtd�|_	t
|�dS)NFr�)�iter�_iterr�_pushedrr~�closedr]�
TOKEN_INITIALr�r�)r{r�rr~r:r:r>r|Es
zTokenStream.__init__rLcCr�r@)r�r�r:r:r>r�Sr�zTokenStream.__iter__cCst|j�p
|jjtuSr@)r�r�r�r^rYr�r:r:r>�__bool__VszTokenStream.__bool__cCs|S)z Are we at the end of the stream?r:r�r:r:r>�eosYszTokenStream.eosr\NcCs|j�|�dS)z Push a token back to the stream.N)r�rpr�r:r:r>�push^szTokenStream.pushcCs"t|�}|j}|�|�||_|S)zLook at the next token.)r�r�r�)r{Z	old_token�resultr:r:r>�lookbs

zTokenStream.lookr�ncCst|�D]}t|�qdS)zGot n tokens ahead.N)�ranger�)r{r��_r:r:r>�skipjs
�zTokenStream.skiprbcCs|j�|�r
t|�SdS)zqPerform the token test and return the token if it matched.
        Otherwise the return value is `None`.
        N)r�r�r�r�r:r:r>�next_ifoszTokenStream.next_ifcCs|�|�duS)z8Like :meth:`next_if` but only returns `True` or `False`.N)r�r�r:r:r>�skip_ifxszTokenStream.skip_ifcCs\|j}|jr|j��|_|S|jjtur,z	t|j�|_W|Sty+|��Y|Sw|S)z|Go one token ahead and return the old one.

        Use the built-in :func:`next` instead of calling this directly.
        )	r�r��popleftr^rYr�r�r�r�)r{�rvr:r:r>r�|s��
�zTokenStream.__next__cCs&t|jjtd�|_td�|_d|_dS)zClose the stream.r�r:TN)r]r�r}rYr�r�r�r�r:r:r>r��s

zTokenStream.closecCsn|j�|�s3t|�}|jjturtd|�d�|jj|j|j��td|�dt	|j���|jj|j|j��t
|�S)z}Expect a given token type and return it.  This accepts the same
        argument as :meth:`jinja2.lexer.Token.test`.
        z%unexpected end of template, expected r5zexpected token z, got )r�r�rdr^rYrr}rr~rar�r�r:r:r>�expect�s 
��zTokenStream.expect)r)rLN)r�r�r�r�r��Iterabler]r�r�r|r�r�r�r��propertyr�r�r�r�r�r�r�r�r�r�r:r:r:r>r�?s*��
�	
r�cCsZ|j|j|j|j|j|j|j|j|j|j	|j
|jf}t�
|�}|dur+t|�t|<}|S)z(Return a lexer which is probably cached.N)rm�block_end_stringrn�variable_end_stringrl�comment_end_stringrorq�trim_blocks�
lstrip_blocks�newline_sequence�keep_trailing_newlinerrZr)rirJZlexerr:r:r>�	get_lexer�s"�
r�cs$eZdZdZdZ�fdd�Z�ZS)�OptionalLStripzWA special tuple for marking a point in the state that can have
    lstrip applied.
    r:cst��||�Sr@)�super�__new__)ry�members�kwargs��	__class__r:r>r��szOptionalLStrip.__new__)r�r�r�r��	__slots__r��
__classcell__r:r:r�r>r��sr�c@sNeZdZUejeed<ejeejedfeje	fed<ej
eed<dS)�_Ruler.�tokensZcommandN)r�r�r�r��Patternr�r��Union�Tuplerwr�r:r:r:r>r��s
$r�c@s�eZdZdZddd�Zdedefd	d
�Z			ddedejed
ejedejede	f
dd�Z
		ddejeje
eefdejed
ejedejefdd�Z		ddedejed
ejedejedejeje
eeff
dd�ZdS)ra
Class that implements a lexer for a given environment. Automatically
    created by the environment class, usually you don't have to do that.

    Note that the lexer is not automatically bound to an environment.
    Multiple environments can share the same lexer.
    rir	rLNc
Cs&tj}dtdtjtfdd�}tttd�ttt	d�tt
td�ttt
d�tttd�tttd�g}t|�}||j�}||j�}||j�}||j�}	|jrLdnd}
|j|_|j|_|j|_d|�d|�d	|�d
�}d�|gdd
�|D��}dt|d|�d��ttd�d�t|d�td�gtt|d|�d|�d	|�|
�d
��tt fd�t|d�t!d�fd�gt"t|d|�d|�d	|�|
�d��t#d�g|t$t|d|	�d	|	���t%d�g|t&t|d|�d|�d|�d	|�|
�d
�
�ttt'�d�t|d�t!d�fd�gt(t|d�t)d�g|t*t|d�t+t,fd�gi|_-dS)NrDrLcSst�|tjtjB�Sr@)rA�compile�M�SrHr:r:r>�c�szLexer.__init__.<locals>.cz\n?r�z(?P<raw_begin>z(\-|\+|)\s*raw\s*(?:\-z\s*|z))r7cSs"g|]
\}}d|�d|�d��qS)z(?P<r2z	(\-|\+|))r:)r;r��rr:r:r>rj
s"z"Lexer.__init__.<locals>.<listcomp>�rootz(.*?)(?:r/�#bygroupz.+z(.*?)((?:\+z|\-�#popz(.)zMissing end of comment tagz(?:\+z\-z	(.*?)((?:z(\-|\+|))\s*endraw\s*(?:\+zMissing end of raw directivez	\s*(\n|$)z(.*?)()(?=\n|$)).rArBr�r�r�r��
whitespace_re�TOKEN_WHITESPACE�float_re�TOKEN_FLOAT�
integer_re�
TOKEN_INTEGER�name_rer_�	string_re�TOKEN_STRING�operator_re�TOKEN_OPERATORrvrmr�r�r�r�r�r�r��joinr�rXrNrPrOrwrRrSrTrU�TOKEN_RAW_BEGIN�
TOKEN_RAW_ENDrVrWrrrQ�TOKEN_LINECOMMENT_ENDru)
r{rirtr�Z	tag_rulesZroot_tag_rulesZblock_start_reZblock_end_reZcomment_end_reZvariable_end_reZblock_suffix_reZroot_raw_reZ
root_parts_rer:r:r>r|�s�





�



����������������
����	������	�
����
�zLexer.__init__r`cCst�|j|�S)z`Replace all newlines with the configured sequence in strings
        and template data.
        )rerr�)r{r`r:r:r>�_normalize_newlinesVrhzLexer._normalize_newlines�sourcerr~�statecCs&|�||||�}t|�|||�||�S)z:Calls tokeniter + tokenize and wraps it in a token stream.)�	tokeniterr��wrap)r{r�rr~r�r�r:r:r>�tokenize\szLexer.tokenizer�c
csT�|D]�\}}}|tvr
q|}|tkrt}n�|tkrt}n�|ttfvr$q|tkr.|�|�}nr|dkr5|}nk|t	krG|}|�
�sFtd|||��nY|tkr}z|�|dd���
dd��d�}WnBty|}zt|��d�d��}	t|	|||�|�d	}~ww|tkr�t|�d
d�d�}n|tkr�t|�d
d��}n|tkr�t|}t|||�Vqd	S)
z�This is called with the stream as returned by `tokenize` and wraps
        every token in a :class:`Token` and converts the value.
        �keywordzInvalid character in identifierr����ascii�backslashreplacezunicode-escaper6Nr�r�r)�ignored_tokensrVrRrWrSr�r�rXr�r_�isidentifierrr��encode�decode�	Exceptionr�rc�stripr�r��replacer�rr��	operatorsr])
r{r�rr~r}r\Z	value_strr`rt�msgr:r:r>r�gsR�	������z
Lexer.wrapccs"�t�|�ddd�}|js|ddkr|d=d�|�}d}d}dg}|dur:|dkr:|d	vs3Jd
��|�|d�|j|d}	t|�}
g}d}d}
	|	D�]�\}}}|�||�}|dur_qN|ri|tt	t
fvriqNt|t��r2|�
�}t|t�r�|d}td
d�|ddd�D��}|dkr�|��}|t|�d��d�}|g|dd��}n.|dkr�|jr�|���t�s�|�d�d}|dks�|
r�t�||�r�|d|�g|dd��}t|�D]W\}}t|t�r�|||��|dk�r|����D]\}}|du�r
|||fV||�d�7}nq�t|�d���q�||}|�s|tv�r%|||fV||�d�|7}d}q�ni|��}|tk�r�|dk�rF|�d�n@|dk�rQ|�d�n5|dk�r\|�d�n*|dv�r�|�sot d|�d�|||��|�!�}||k�r�t d|�d|�d�|||��|�s�|tv�r�|||fV||�d�7}|��dd�dk}
|�"�}|du�r�|dk�r�|�!�n*|dk�r�|����D]\}}|du�r�|�|�n	�q�t|�d���n|�|�|j|d}	n||k�r�t|�d���|}n||
k�rdSt d ||�d!|��|||��qL)"aThis method tokenizes the text and returns the tokens in a
        generator. Use this method if you just want to tokenize a template.

        .. versionchanged:: 3.0
            Only ``\n``, ``\r\n`` and ``\r`` are treated as line
            breaks.
        N�r�r��
rrr�)�variable�blockz
invalid stateZ_beginTcss�|]	}|dur|VqdSr@r:)r;�gr:r:r>rE�s�z"Lexer.tokeniter.<locals>.<genexpr>r'r&r�z= wanted to resolve the token dynamically but no group matchedr0r1r.r/r,r-)r1r/r-zunexpected '�'z
', expected 'r�zA wanted to resolve the new state dynamically but no group matchedz* yielded empty string without stack changezunexpected char z at )#rercr�r�rprurG�matchrUrSrW�
isinstance�tuple�groupsr�r��rstrip�countr��	groupdictrZrT�rfindr��	fullmatch�	enumeraterw�items�RuntimeError�ignore_if_empty�groupr�r�pop�end)r{r�rr~r��lines�posr}�stackZstatetokensZ
source_lengthZbalancing_stackZnewlines_strippedZ
line_startingZregexr�Z	new_state�mr��textZ
strip_sign�strippedZl_pos�idxr\rJr`r#Zexpected_opZpos2r:r:r>r��s��
�
��



����




�
�





���

�
���zLexer.tokeniter)rir	rLN)NNN)NN)r�r�r�r�r|r�r�r�r�r�r�r�r�r��Iteratorr]r�r�r:r:r:r>r�sT
w	�����
�����
�:������)rir	rLr)pr�rA�typingr��astr�collectionsr�sysrZ_identifierrr��
exceptionsr�utilsrZ
TYPE_CHECKINGZtyping_extensions�terir	r�MutableMappingr�r�r�r�rer�r��
IGNORECASE�VERBOSEr�r�Z	TOKEN_ADDZTOKEN_ASSIGNZTOKEN_COLONZTOKEN_COMMAZ	TOKEN_DIVZ	TOKEN_DOTZTOKEN_EQZTOKEN_FLOORDIVZTOKEN_GTZ
TOKEN_GTEQZTOKEN_LBRACEZTOKEN_LBRACKETZTOKEN_LPARENZTOKEN_LTZ
TOKEN_LTEQZ	TOKEN_MODZ	TOKEN_MULZTOKEN_NEZ
TOKEN_PIPEZ	TOKEN_POWZTOKEN_RBRACEZTOKEN_RBRACKETZTOKEN_RPARENZTOKEN_SEMICOLONZ	TOKEN_SUBZTOKEN_TILDEr�r�r�r_r�r�rRrSrTrUr�r�rNrOrPrVrWrrr�rQrXr�rYr�rrMrGr�rsr��	frozensetr�rr�r[rardr�rgZListrvrwZ
NamedTupler]r�r�r�r�r�r�rr:r:r:r>�<module>s.

�

�

���������	�
���
������&���
�
")
m