File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/pygments/lexers/__pycache__/templates.cpython-310.pyc
Back
o ;j�' � @ sT d Z ddlZddlmZmZ ddlmZmZ ddlm Z ddl mZ ddlm Z ddlmZ dd lmZmZ dd lmZ ddlmZ ddlmZmZmZmZmZmZmZmZm Z dd l!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z- ddl.m/Z/m0Z0 g d�Z1G dd� de�Z2G dd� de�Z3G dd� de�Z4G dd� de�Z5G dd� de�Z6G dd� de�Z7G dd� de�Z8G dd� de�Z9G d d!� d!e�Z:G d"d#� d#e�Z;G d$d%� d%e�Z<G d&d'� d'e�Z=G d(d)� d)e�Z>G d*d+� d+e�Z?G d,d-� d-e�Z@G d.d/� d/e�ZAG d0d1� d1e�ZBG d2d3� d3e�ZCG d4d5� d5e�ZDG d6d7� d7e�ZEG d8d9� d9e�ZFG d:d;� d;e�ZGG d<d=� d=e�ZHG d>d?� d?e�ZIG d@dA� dAe�ZJG dBdC� dCe�ZKG dDdE� dEe�ZLG dFdG� dGe�ZMG dHdI� dIe�ZNG dJdK� dKe�ZOG dLdM� dMe�ZPG dNdO� dOe�ZQG dPdQ� dQe�ZRG dRdS� dSe�ZSG dTdU� dUe�ZTG dVdW� dWe�ZUG dXdY� dYe�ZVG dZd[� d[e�ZWG d\d]� d]e�ZXG d^d_� d_e�ZYG d`da� dae�ZZG dbdc� dce�Z[G ddde� dee�Z\G dfdg� dge�Z]G dhdi� die�Z^G djdk� dke�Z_G dldm� dme�Z`G dndo� doe�ZaG dpdq� dqe�ZbG drds� dse�ZcG dtdu� due�ZdG dvdw� dwe�ZeG dxdy� dye�ZfG dzd{� d{e�ZgG d|d}� d}e�ZhG d~d� de�ZiG d�d�� d�e�ZjG d�d�� d�e�ZkG d�d�� d�e�ZlG d�d�� d�e�ZmG d�d�� d�e�ZnG d�d�� d�e�ZoG d�d�� d�e�ZpG d�d�� d�e�ZqG d�d�� d�e�ZrG d�d�� d�e�ZsG d�d�� d�e�ZtG d�d�� d�e�ZuG d�d�� d�e�ZvdS )�z� pygments.lexers.templates ~~~~~~~~~~~~~~~~~~~~~~~~~ Lexers for various template engines' markup. :copyright: Copyright 2006-present by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. � N)� HtmlLexer�XmlLexer)�JavascriptLexer� LassoLexer)�CssLexer)�PhpLexer)�PythonLexer)� PerlLexer)� JavaLexer�TeaLangLexer)� YamlLexer)�SqlLexer) �Lexer�DelegatingLexer� RegexLexer�bygroups�include�using�this�default�combined)�Error�Punctuation� Whitespace�Text�Comment�Operator�Keyword�Name�String�Number�Other�Token)�html_doctype_matches�looks_like_xml)@�HtmlPhpLexer�XmlPhpLexer�CssPhpLexer�JavascriptPhpLexer�ErbLexer� RhtmlLexer�XmlErbLexer�CssErbLexer�JavascriptErbLexer�SmartyLexer�HtmlSmartyLexer�XmlSmartyLexer�CssSmartyLexer�JavascriptSmartyLexer�DjangoLexer�HtmlDjangoLexer�CssDjangoLexer�XmlDjangoLexer�JavascriptDjangoLexer�GenshiLexer�HtmlGenshiLexer�GenshiTextLexer�CssGenshiLexer�JavascriptGenshiLexer�MyghtyLexer�MyghtyHtmlLexer�MyghtyXmlLexer�MyghtyCssLexer�MyghtyJavascriptLexer� MasonLexer� MakoLexer� MakoHtmlLexer�MakoXmlLexer�MakoJavascriptLexer�MakoCssLexer�JspLexer�CheetahLexer�CheetahHtmlLexer�CheetahXmlLexer�CheetahJavascriptLexer�EvoqueLexer�EvoqueHtmlLexer�EvoqueXmlLexer�ColdfusionLexer�ColdfusionHtmlLexer�ColdfusionCFCLexer� VelocityLexer�VelocityHtmlLexer�VelocityXmlLexer�SspLexer�TeaTemplateLexer�LassoHtmlLexer� LassoXmlLexer� LassoCssLexer�LassoJavascriptLexer�HandlebarsLexer�HandlebarsHtmlLexer�YamlJinjaLexer�LiquidLexer� TwigLexer� TwigHtmlLexer� Angular2Lexer�Angular2HtmlLexer� SqlJinjaLexerc @ sN e Zd ZdZdZdZdgZdgZdZe � de j�Zdd � Z d d� Zdd � ZdS )r) z� Generic ERB (Ruby Templating) lexer. Just highlights ruby code between the preprocessor directives, other data is left untouched by the lexer. All options are also forwarded to the `RubyLexer`. ZERB�https://github.com/ruby/erbZerbzapplication/x-ruby-templating� z*(<%%|%%>|<%=|<%#|<%-|<%|-%>|%>|^%[^%].*?$)c K s2 ddl m} |di |��| _tj| fi |�� d S )Nr )� RubyLexer� )Zpygments.lexers.rubyrg � ruby_lexerr �__init__)�self�optionsrg rh rh �M/opt/saltstack/salt/lib/python3.10/site-packages/pygments/lexers/templates.pyrj E s zErbLexer.__init__c c s � | j �|�}|�� d }}z� |dkr(|�� }|t|fV |t|�7 }d}n�|dkr�|�� }|dv rA|t|fV |d7 }d}n�|dkrc|tj|fV |�� }|d t|fV |dt|� 7 }d}n�|dv r�|tj|fV |t|�7 }|�� }d}| j� |�D ] \}} } || | | fV q�|t|�7 }d}nc|d v r�|t |fV |t|�7 }d}nP|tj|d fV d}| j� |dd � �D ]\}} } |d | | | fV q�|t|�7 }d}n"|dkr�|�� }|d vr�|t|fV n|tj|fV |t|�7 }d}q t�y Y d S w )z� Since ERB doesn't allow "<%" and other tags inside of ruby blocks we have to use a split approach here that fails for that too. r T� )z<%%z%%>� z<%#� )�<%z<%=z<%-)�%>z-%>N)� _block_re�split�reverse�popr! �lenr �Preprocri �get_tokens_unprocessedr � IndexError)rk �text�tokens�state�idx�val�tag�dataZr_idxZr_tokenZr_valuerh rh rm ry J sn � ���7�zErbLexer.get_tokens_unprocessedc C s d| v r d| v rdS d S d S )Nrq rr 皙�����?rh �r{ rh rh rm �analyse_text� s �zErbLexer.analyse_textN)�__name__� __module__�__qualname__�__doc__�name�url�aliases� mimetypes� version_added�re�compile�Mrs rj ry r� rh rh rh rm r) 3 s Dr) c @ s� e Zd ZdZdZdZdgZdgZdgZdZ e je jB Z defd eejeej�fd eejeedd�ej�fd eejeje�dfdejdfgdefdejdfdejdfdejfdejfdefdejfdefdejfdejfdejfgd�Z dd� Z!dS )r. z� Generic Smarty template lexer. Just highlights smarty code between the preprocessor directives, other data is left untouched by the lexer. ZSmarty�https://www.smarty.net/�smarty�*.tplzapplication/x-smartyrf �[^{]+z(\{)(\*.*?\*)(\})z(\{php\})(.*?)(\{/php\})T)Zstartinlinez(\{)(/?[a-zA-Z_]\w*)(\s*)�\{�\s+�#push�\}�#popz#[a-zA-Z_]\w*#z\$[a-zA-Z_]\w*(\.\w+)*z[~!%^&*()+=|\[\]:;,.<>/?@-]�(true|false|null)\b�>[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?�"(\\\\|\\[^\\]|[^"\\])*"�'(\\\\|\\[^\\]|[^'\\])*'�[a-zA-Z_]\w*)�rootr� c C sX d}t �d| �r|d7 }t �d| �r|d7 }t �d| �r |d7 }t �d| �r*|d7 }|S )N� z\{if\s+.*?\}.*?\{/if\}�333333�?z\{include\s+file=.*?\}z \{foreach\s+.*?\}.*?\{/foreach\}z \{\$.*?\}�{�G�z�?�r� �search�r{ �rvrh rh rm r� � s zSmartyLexer.analyse_textN)"r� r� r� r� r� r� r� � filenamesr� r� r� � MULTILINE�DOTALL�flagsr! r r rx r r r �Functionr �Variabler r �Constantr r �Double�Single� Attributer| r� rh rh rh rm r. � sN ���� � ���r. c @ s� e Zd ZdZdZdZdgZddgZdZe j e jB ZdZ d efd eejeej�fdeeje�fde d eejejeje�dfde d eejejej�fdedfge ejfdedfde d eeej�dfdedfed�gdefdedfde d ejfed�gdefed�dedfgdedfdefd efd!ejfd"ejfd#efd$efd%ejfdedfd&edfd'edfdedfdedfdedfgd(�Z d)d*� Z!d+S ),rS z� Generic Velocity template lexer. Just highlights velocity directives and variable references, other data is left untouched by the lexer. ZVelocity�https://velocity.apache.org/Zvelocity�*.vm�*.fhtmlrf r� z[^{#$]+z(#)(\*.*?\*)(#)z (##)(.*?$)z(#\{?)(z )(\}?)(\s?\()�directiveparamsz)(\}|\b)z\$!?\{?�variablez\(� funcparamsz(\.)(�)r� r� r� z=(&&|\|\||==?|!=?|[-<>+*%&|^/])|\b(eq|ne|gt|lt|ge|le|not|in)\bz\[� rangeoperatorz\bz\.\.z\]r� z[,:]r� r� z0[xX][0-9a-fA-F]+[Ll]?z \b[0-9]+\br� �\)r� )r� r� r� r� r� c C sd d}t �d| t j�r|d7 }t �d| t j�r|d7 }t �d| t j�r&|d7 }t �d| �r0|d7 }|S ) Nr� z #\{?macro\}?\(.*?\).*?#\{?end\}?� �?z#\{?if\}?\(.+?\).*?#\{?end\}?r� z"#\{?foreach\}?\(.+?\).*?#\{?end\}?z6\$!?\{?[a-zA-Z_]\w*(\([^)]*\))?(\.\w+(\([^)]*\))?)*\}?r� �r� r� r� r� rh rh rm r� s �zVelocityLexer.analyse_textN)"r� r� r� r� r� r� r� r� r� r� r� r� r� Z identifierr! r r rx r r� r r� r r r r r r� r� r r r� r| r� rh rh rh rm rS � sz � � � �� �� �����4rS c s@ e Zd ZdZdZdgZdZddgZdgZdZ � fd d �Z � ZS )rT za Subclass of the `VelocityLexer` that highlights unlexed data with the `HtmlLexer`. z HTML+Velocityz html+velocityrf �*.htmlr� ztext/html+velocityr� c � t � jttfi |�� d S �N)�superrj r rS �rk rl �� __class__rh rm rj / � zVelocityHtmlLexer.__init__)r� r� r� r� r� r� r� �alias_filenamesr� r� rj � __classcell__rh rh r� rm rT ! s rT c �H e Zd ZdZdZdgZdZddgZdgZdZ � fd d �Z dd� Z� ZS ) rU z` Subclass of the `VelocityLexer` that highlights unlexed data with the `XmlLexer`. zXML+Velocityzxml+velocityrf �*.xmlr� zapplication/xml+velocityr� c r� r� )r� rj r rS r� r� rh rm rj A r� zVelocityXmlLexer.__init__c C �"