File: //usr/lib/python3/dist-packages/pygments/lexers/__pycache__/templates.cpython-38.pyc
U
�a`� � ? @ s� d Z ddlZddlmZmZ ddlmZmZ ddlm Z ddl
mZ ddlm
Z
ddlmZ dd lmZmZ dd
lmZ ddlmZmZmZmZmZmZmZmZmZ ddlm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+ dd
l,m-Z-m.Z. ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLg?Z/G dMd� de�Z0G dNd� de�Z1G dOd<� d<e�Z2G dPd=� d=e�Z3G dQd>� d>e�Z4G dRd� de�Z5G dSd&� d&e�Z6G dTd'� d'e�Z7G dUd(� d(e�Z8G dVd*� d*e�Z9G dWd)� d)e�Z:G dXd+� d+e�Z;G dYd,� d,e�Z<G dZd-� d-e�Z=G d[d.� d.e�Z>G d\d/� d/e�Z?G d]d0� d0e�Z@G d^d_� d_e�ZAG d`d2� d2e�ZBG dad3� d3e�ZCG dbd4� d4e�ZDG dcd5� d5e�ZEG ddd#� d#e�ZFG dedf� dfe�ZGG dgd"� d"e�ZHG dhd!� d!e�ZIG did%� d%e�ZJG djd$� d$e�ZKG dkd� de�ZLG dld� de�ZMG dmd� de�ZNG dnd� de�ZOG dod� de�ZPG dpd� de�ZQG dqd� de�ZRG drd� de�ZSG dsd� de�ZTG dtd� de�ZUG dud� de�ZVG dvd� de�ZWG dwd� de�ZXG dxd� de�ZYG dyd� de�ZZG dzd � d e�Z[G d{d|� d|e�Z\G d}d1� d1e�Z]G d~d6� d6e�Z^G dd7� d7e�Z_G d�d8� d8e�Z`G d�d9� d9e�ZaG d�d�� d�e�ZbG d�d:� d:e�ZcG d�d;� d;e�ZdG d�d?� d?e�ZeG d�d�� d�e�ZfG d�d@� d@e�ZgG d�dA� dAe�ZhG d�dB� dBe�ZiG d�dC� dCe�ZjG d�dD� dDe�ZkG d�dE� dEe�ZlG d�dF� dFe�ZmG d�dG� dGe�ZnG d�dH� dHe�ZoG d�dI� dIe�ZpG d�dJ� dJe�ZqG d�dK� dKe�ZrG d�dL� dLe�ZsdS )�z�
pygments.lexers.templates
~~~~~~~~~~~~~~~~~~~~~~~~~
Lexers for various template engines' markup.
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
� N)� HtmlLexer�XmlLexer)�JavascriptLexer�
LassoLexer)�CssLexer)�PhpLexer)�PythonLexer)� PerlLexer)� JavaLexer�TeaLangLexer)� YamlLexer) �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�Angular2HtmlLexerc @ sF e Zd ZdZdZdgZdgZe�dej �Z
dd� Zdd � Zd
d� Z
dS )
r( a
Generic `ERB <http://ruby-doc.org/core/classes/ERB.html>`_ (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`.
ZERBZerbzapplication/x-ruby-templatingz*(<%%|%%>|<%=|<%#|<%-|<%|-%>|%>|^%[^%].*?$)c K s* ddl m} |f |�| _tj| f|� d S )Nr )� RubyLexer)Zpygments.lexers.rubyrc �
ruby_lexerr
�__init__)�self�optionsrc � rh �;/usr/lib/python3/dist-packages/pygments/lexers/templates.pyre C s zErbLexer.__init__c c s" | j �|�}|�� d }}�z�|dkrN|�� }|t|fV |t|�7 }d}q |dk�r�|�� }|dkr�|t|fV |d7 }d}�q |dkr�|tj|fV |�� }|d t|fV |dt|� 7 }d}n�|dk�r4|tj|fV |t|�7 }|�� }d}| j� |�D ]\}} }
|| | |
fV �q|t|�7 }d}n�|dk�r\|t
|fV |t|�7 }d}n\|tj|d fV d}| j� |dd � �D ] \}} }
|d | | |
fV �q�|t|�7 }d}q |dkr |�� }|dk�r�|t|fV n|tj|fV |t|�7 }d}q W n tk
�r Y d S X d S )
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 � )z<%%z%%>� z<%#� )�<%z<%=z<%-)�%>z-%>N)� _block_re�split�reverse�popr �lenr �Preprocrd �get_tokens_unprocessedr �
IndexError)rf �text�tokens�state�idx�val�tag�dataZr_idxZr_tokenZr_valuerh rh ri ru H sf
�
�
zErbLexer.get_tokens_unprocessedc C s d| krd| krdS d S )Nrm rn 皙�����?rh �rw rh rh ri �analyse_text� s zErbLexer.analyse_textN)�__name__�
__module__�__qualname__�__doc__�name�aliases� mimetypes�re�compile�Mro re ru r� rh rh rh ri r( 2 s
Dc
@ s� e Zd ZdZdZdgZdgZdgZej ej
B Zdefde
ejeej�fde
ejeed d
�ej�fde
ejeje�dfdejdfgd
efdejdfdejdfdejfdejfdefdejfdefdejfdejfdejfgd�Zdd� ZdS )r- z�
Generic `Smarty <http://smarty.php.net/>`_ template lexer.
Just highlights smarty code between the preprocessor directives, other
data is left untouched by the lexer.
ZSmarty�smarty�*.tplzapplication/x-smarty�[^{]+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| �rT|d7 }|S )N� z\{if\s+.*?\}.*?\{/if\}�333333�?z\{include\s+file=.*?\}z \{foreach\s+.*?\}.*?\{/foreach\}z \{\$.*?\}�{�G�z�?�r� �search�rw �rvrh rh ri r� � s zSmartyLexer.analyse_textN) r� r� r� r� r� r� � filenamesr� r� � MULTILINE�DOTALL�flagsr r r rt r r r �Functionr �Variabler r �Constantr r �Double�Single� Attributerx r� rh rh rh ri r- � sJ ��� �
�
���c @ s� e Zd ZdZdZdgZddgZejej B Z
dZdefde
ejeej�fd e
eje�fd
e d e
ejejeje�dfd
e d
e
ejejej�fdedfgeejfdedfde d e
eej�dfdedfed�gdefdedfde d ejfed�gdefed�dedfgdedfdefdefdejfd ejfd!efd"efd#ejfdedfd$edfd%edfdedfdedfdedfgd&�Zd'd(� Zd)S )*rR z�
Generic `Velocity <http://velocity.apache.org/>`_ template lexer.
Just highlights velocity directives and variable references, other
data is left untouched by the lexer.
ZVelocityZvelocity�*.vm�*.fhtmlr� 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 sX d}t �d| �r|d7 }t �d| �r,|d7 }t �d| �r@|d7 }t �d| �rT|d7 }|S ) Nr� z #\{?macro\}?\(.*?\).*?#\{?end\}?g �?z#\{?if\}?\(.+?\).*?#\{?end\}?r� z"#\{?foreach\}?\(.+?\).*?#\{?end\}?z4\$\{?[a-zA-Z_]\w*(\([^)]*\))?(\.\w+(\([^)]*\))?)*\}?r� r� r� rh rh ri r�
s �zVelocityLexer.analyse_textN) r� r� r� r� r� r� r� r� r� r� r� Z
identifierr r r rt r r� r r� r r r r r r� r� r r r� rx r� rh rh rh ri rR � sv �
�
�
��
�� �����4c s8 e Zd ZdZdZdgZddgZdgZ� fdd�Z� Z S ) rS za
Subclass of the `VelocityLexer` that highlights unlexed data
with the `HtmlLexer`.
z
HTML+Velocityz
html+velocity�*.htmlr� ztext/html+velocityc s t t| �jttf|� d S �N)�superrS re r rR �rf rg �� __class__rh ri re ' s �zVelocityHtmlLexer.__init__)
r� r� r� r� r� r� �alias_filenamesr� re �
__classcell__rh rh r� ri rS s c s@ e Zd ZdZdZdgZddgZdgZ� fdd�Zd d
� Z � Z
S )rT z`
Subclass of the `VelocityLexer` that highlights unlexed data
with the `XmlLexer`.
zXML+Velocityzxml+velocity�*.xmlr� zapplication/xml+velocityc s t t| �jttf|� d S r� )r� rT re r rR r� r� rh ri re 8 s �zVelocityXmlLexer.__init__c C s"