Your IP : 216.73.216.213
B
ʽ�\� � ? @ 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-2019 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 �J/opt/alt/python37/lib/python3.7/site-packages/pygments/lexers/templates.pyre C s zErbLexer.__init__c c s. | j �|�}|�� d }}�y�x�|dkrR|�� }|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�r<|tj|fV |t|�7 }|�� }d}x,| j� |�D ]\}} }
|| | |
fV �q
W |t|�7 }d}n�|dk�rd|t
|fV |t|�7 }d}n`|tj|d fV d}x8| j� |dd � �D ] \}} }
|d | | |
fV �q�W |t|�7 }d}q$|dkr$|�� }|dk�r�|t|fV n|tj|fV |t|�7 }d}q$W W n tk
�r( 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<%-)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 rs H sh
zErbLexer.get_tokens_unprocessedc C s d| krd| krdS d S )Nz<%z%>g�������?rh )ru rh rh ri �analyse_text� s zErbLexer.analyse_textN)�__name__�
__module__�__qualname__�__doc__�name�aliases� mimetypes�re�compile�Mrm re rs 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�smartyz*.tplzapplication/x-smartyz[^{]+z(\{)(\*.*?\*)(\})z(\{php\})(.*?)(\{/php\})T)Zstartinlinez(\{)(/?[a-zA-Z_]\w*)(\s*)z\{z\s+z#pushz\}z#popz#[a-zA-Z_]\w*#z\$[a-zA-Z_]\w*(\.\w+)*z[~!%^&*()+=|\[\]:;,.<>/?@-]z(true|false|null)\bz>[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?z"(\\\\|\\"|[^"])*"z'(\\\\|\\'|[^'])*'z[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 )Ng z\{if\s+.*?\}.*?\{/if\}g333333�?z\{include\s+file=.*?\}z \{foreach\s+.*?\}.*?\{/foreach\}z \{\$.*?\}g{�G�z�?)r� �search)ru �rvrh rh ri r| � s zSmartyLexer.analyse_textN) r} r~ r r� r� r� � filenamesr� r� � MULTILINE�DOTALL�flagsr r r rr r r r �Functionr �Variabler r �Constantr r �Double�Single� Attributerv r| rh rh rh ri r- � s8
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.
ZVelocityZvelocityz*.vmz*.fhtmlz[a-zA-Z_]\w*z[^{#$]+z(#)(\*.*?\*)(#)z
(##)(.*?$)z(#\{?)(z
)(\}?)(\s?\()�directiveparamsz)(\}|\b)z\$\{?�variablez\(�
funcparamsz(\.)(�)z#pushz\}z#popz=(&&|\|\||==?|!=?|[-<>+*%&|^/])|\b(eq|ne|gt|lt|ge|le|not|in)\bz\[�
rangeoperatorz\bz\.\.z\]z\s+z[,:]z"(\\\\|\\"|[^"])*"z'(\\\\|\\'|[^'])*'z0[xX][0-9a-fA-F]+[Ll]?z
\b[0-9]+\bz(true|false|null)\bz\)z\{)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 ) Ng z #\{?macro\}?\(.*?\).*?#\{?end\}?g �?z#\{?if\}?\(.+?\).*?#\{?end\}?g333333�?z"#\{?foreach\}?\(.+?\).*?#\{?end\}?z4\$\{?[a-zA-Z_]\w*(\([^)]*\))?(\.\w+(\([^)]*\))?)*\}?g{�G�z�?)r� r� )ru r� rh rh ri r|
s zVelocityLexer.analyse_textN) r} r~ r r� r� r� r� r� r� r� r� �
identifierr r r rr r r� r r� r r r r r r� r� r r r� rv r| rh rh rh ri rR � s\
c 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+velocityz*.htmlz*.fhtmlztext/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+velocityz*.xmlz*.vmzapplication/xml+velocityc s t t| �jttf|� d S )N)r� rT re r rR )rf rg )r� rh ri re 8 s zVelocityXmlLexer.__init__c C s"