U
    ]g'                 @   @   s  d Z ddlZddlmZmZ ddlmZmZ ddlm	Z	 ddl
mZ ddlmZ ddlmZ dd	lmZmZ dd
lmZ ddlmZ ddlmZmZmZmZmZmZmZmZm Z  dd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- ddl.m/Z/m0Z0 dddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNg@Z1G dOd deZ2G dPd deZ3G dQd= d=eZ4G dRd> d>e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]d/ d/eZ@G d^d0 d0eZAG d_d1 d1eZBG d`da daeZCG dbd3 d3eZDG dcd4 d4eZEG ddd5 d5eZFG ded6 d6eZGG dfd$ d$eZHG dgdh dheZIG did# d#eZJG djd" d"eZKG dkd& d&eZLG dld% d%eZMG dmd deZNG dnd deZOG dod deZPG dpd deZQG dqd deZRG drd deZSG dsd deZTG dtd deZUG dud deZVG dvd deZWG dwd deZXG dxd deZYG dyd deZZG dzd  d eZ[G d{d deZ\G d|d! d!eZ]G d}d~ d~eZ^G dd2 d2eZ_G dd7 d7eZ`G dd8 d8eZaG dd9 d9eZbG dd: d:eZcG dd deZdG dd; d;eZeG dd< d<eZfG dd@ d@eZgG dd deZhG ddA dAeZiG ddB dBeZjG ddC dCeZkG ddD dDeZlG ddE dEeZmG ddF dFeZnG ddG dGeZoG ddH dHeZpG ddI dIeZqG ddJ dJeZrG ddK dKeZsG ddL dLeZtG ddM dMeZuG ddN dNeZvdS )z
    pygments.lexers.templates
    ~~~~~~~~~~~~~~~~~~~~~~~~~

    Lexers for various template engines' markup.

    :copyright: Copyright 2006-2025 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 Zd ZdZdZdZdgZdgZdZe	
de	jZdd	 Zd
d Zdd ZdS )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`.
    ZERBhttps://github.com/ruby/erbZerbzapplication/x-ruby-templating z*(<%%|%%>|<%=|<%#|<%-|<%|-%>|%>|^%[^%].*?$)c                 K   s*   ddl m} |f || _tj| f| d S )Nr   )	RubyLexer)Zpygments.lexers.rubyrg   
ruby_lexerr   __init__)selfoptionsrg    rl   =/tmp/pip-unpacked-wheel-zak7uw41/pygments/lexers/templates.pyri   E   s    zErbLexer.__init__c                 c   s"  | j |}|  d }}z|dkrN| }|t|fV  |t|7 }d}q |dkr| }|dkr|t|fV  |d7 }d}q |dkr|tj|fV  | }|d t|fV  |dt| 7 }d}n|dkr4|tj|fV  |t|7 }| }d}| j	|D ]\}}	}
|| |	|
fV  q|t|7 }d}n|dkr\|t
|fV  |t|7 }d}n\|tj|d fV  d}| j	|dd	 D ] \}}	}
|d | |	|
fV  q|t|7 }d}q |dkr | }|dkr|t|fV  n|tj|fV  |t|7 }d}q W n tk
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   Preprocrh   get_tokens_unprocessedr   
IndexError)rj   texttokensstateidxvaltagdataZr_idxZr_tokenZr_valuerl   rl   rm   ry   J   sf    





zErbLexer.get_tokens_unprocessedc                 C   s   d| krd| krdS d S )Nrq   rr   皙?rl   r{   rl   rl   rm   analyse_text   s    zErbLexer.analyse_textN)__name__
__module____qualname____doc__nameurlaliases	mimetypesversion_addedrecompileMrs   ri   ry   r   rl   rl   rl   rm   r)   3   s   	Dc                   @   s   e Zd ZdZdZdZdgZdgZdgZdZ	e
je
jB Zdefd	eejeejfd
eejeeddejfdeejejedfdejdfgdefdejdfdejdfdejfdejfdefdejfdefdejfdejfdejfgdZ dd Z!dS )r.   z
    Generic Smarty template lexer.

    Just highlights smarty code between the preprocessor directives, other
    data is left untouched by the lexer.
    ZSmartyhttps://www.smarty.net/smarty*.tplzapplication/x-smartyrf   [^{]+z(\{)(\*.*?\*)(\})z(\{php\})(.*?)(\{/php\})T)Zstartinlinez(\{)(/?[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|d7 }t d| r,|d7 }t d| r@|d7 }t d| rT|d7 }|S )N        z\{if\s+.*?\}.*?\{/if\}333333?z\{include\s+file=.*?\}z \{foreach\s+.*?\}.*?\{/foreach\}z	\{\$.*?\}{Gz?r   searchr{   rvrl   rl   rm   r      s    zSmartyLexer.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   rl   rl   rl   rm   r.      sN    


c                   @   s  e Zd ZdZdZdZdgZddgZdZe	j
e	jB ZdZd	efd
eejeejfdeejefde d eejejejedfde d eejejejfdedfgeejfdedfde d eeejdfdedfedgdefdedfde d ejfedgdefeddedfgdedfdefd efd!ejfd"ejfd#efd$efd%ejfdedfd&edfd'edfdedfdedfdedfgd(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.
    ZVelocityhttps://velocity.apache.org/Zvelocity*.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   z0[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|d7 }t d| t jr4|d7 }t d| t jrL|d7 }t d| r`|d7 }|S )	Nr   z #\{?macro\}?\(.*?\).*?#\{?end\}?      ?z#\{?if\}?\(.+?\).*?#\{?end\}?r   z"#\{?foreach\}?\(.+?\).*?#\{?end\}?z6\$!?\{?[a-zA-Z_]\w*(\([^)]*\))?(\.\w+(\([^)]*\))?)*\}?r   r   r   r   r   rl   rl   rm   r     s    zVelocityLexer.analyse_textN)"r   r   r   r   r   r   r   r   r   r   r   r   r   
identifierr!   r   r   rx   r   r   r   r   r   r   r   r   r   r   r   r    r   r   r|   r   rl   rl   rl   rm   rS      sz   




 	4c                       s@   e Zd ZdZdZdgZdZddgZdgZdZ	 fd	d
Z
  ZS )rT   za
    Subclass of the `VelocityLexer` that highlights unlexed data
    with the `HtmlLexer`.

    zHTML+Velocityzhtml+velocityrf   *.htmlr   ztext/html+velocityr   c                    s   t  jttf| d S N)superri   r   rS   rj   rk   	__class__rl   rm   ri   /  s    zVelocityHtmlLexer.__init__)r   r   r   r   r   r   r   alias_filenamesr   r   ri   __classcell__rl   rl   r   rm   rT   !  s   c                       sH   e Zd ZdZdZdgZdZddgZdgZdZ	 fd	d
Z
dd Z  ZS )rU   z`
    Subclass of the `VelocityLexer` that highlights unlexed data
    with the `XmlLexer`.

    zXML+Velocityzxml+velocityrf   *.xmlr   zapplication/xml+velocityr   c                    s   t  jttf| d S r   )r   ri   r   rS   r   r   rl   rm   ri   A  s    zVelocityXmlLexer.__init__c                 C   s"   t | d }t| r|d7 }|S Nr   r   )rS   r   r$   r   rl   rl   rm   r   D  s    zVelocityXmlLexer.analyse_textr   r   r   r   r   r   r   r   r   r   ri   r   r   rl   rl   r   rm   rU   3  s   c                   @   s  e Zd ZdZdZddgZddgZdZdZe	j
e	jB Zd	efd
ejdfdefdeejeeeejeejeeeejfdeejeeeejeejeeeejfdeejeeeejdfdeejeedfdefgdeeeejfdeeeeeejfdejfdefdejfdejfdejfdejfdejfdefdefgdefdeeejd fed!gdefd"eeejd fed!d#efgd$Zd%d& Z d'S )(r3   a  
    Generic `Django <https://www.djangoproject.com/documentation/templates/>`_
    and `Jinja <https://jinja.palletsprojects.com>`_ template lexer.

    It just highlights django/jinja code between the preprocessor directives,
    other data is left untouched by the lexer.
    zDjango/JinjaZdjangoZjinjazapplication/x-django-templatingzapplication/x-jinja5https://www.djangoproject.com/documentation/templatesrf   r   \{\{varz	\{#.*?#\}zJ(\{%)(-?\s*)(comment)(\s*-?)(%\})(.*?)(\{%)(-?\s*)(endcomment)(\s*-?)(%\})B(\{%)(-?\s*)(raw)(\s*-?)(%\})(.*?)(\{%)(-?\s*)(endraw)(\s*-?)(%\})z'(\{%)(-?\s*)(filter)(\s+)([a-zA-Z_]\w*)block(\{%)(-?\s*)([a-zA-Z_]\w*)r   z(\|)(\s*)([a-zA-Z_]\w*)z#(is)(\s+)(not)?(\s+)?([a-zA-Z_]\w*)z%(_|true|false|none|True|False|None)\bzm(in|as|reversed|recursive|not|and|or|is|if|else|import|with(?:(?:out)?\s*context)?|scoped|ignore\s+missing)\bz(loop|block|super|forloop)\bz[a-zA-Z_][\w-]*z\.\w+:?"(\\\\|\\[^\\]|[^"\\])*":?'(\\\\|\\[^\\]|[^'\\])*'z ([{}()\[\]+\-*/%,:~]|[><=]=?|!=)r   r   
(-?)(\}\})r   varnames	(-?)(%\}).)r   r   r   r   c                 C   sP   d}t d| d k	r|d7 }t d| d k	r4|d7 }t d| d k	rL|d7 }|S )Nr   z\{%\s*(block|extends)r   z\{%\s*if\s*.*?%\}皙?z\{\{.*?\}\}r   r   rl   rl   rm   r     s    zDjangoLexer.analyse_textN)!r   r   r   r   r   r   r   r   r   r   r   Sr   r!   r   rx   r   r   r   r   r   r   PseudoBuiltinr   r   r   r   r    r   r   r|   r   rl   rl   rl   rm   r3   K  s   
         9c                   @   s   e Zd ZdZdZdZdgZddgZdgZdZ	d	d
e
fdeeje
ejejeeejfdeejejejeeejfdeejejeeejfdeejejeeejfdejfdeejeeejfdefdeejeeefdeeefg
iZdS )r=   zh
    Generic myghty templates lexer. Code that isn't Myghty
    markup is yielded as `Token.Other`.
    ZMyghtyhttp://www.myghty.org/Zmyghtyz*.mytZautodelegatezapplication/x-myghty0.6r   r   3(?s)(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)z#(?s)(<%\w+)(.*?)(>)(.*?)(</%\2\s*>)z(<&[^|])(.*?)(,.*?)?(&>)(?s)(<&\|)(.*?)(,.*?)?(&>)</&>(?s)(<%!?)(.*?)(%>)(?<=^)#[^\n]*(\n|\Z)(?<=^)(%)([^\n]*)(\n|\Z)  (?sx)
                 (.+?)               # anything, followed by:
                 (?:
                  (?<=\n)(?=[%#]) |  # an eval or comment line
                  (?=</?[%&]) |      # a substitution or block or
                                     # call start or end
                                     # - don't consume
                  (\\\n) |           # an escaped newline
                  \Z                 # end of string
                 )N)r   r   r   r   r   r   r   r   r   r   r   r   r   Tagr   r   r   r   r   r!   r   r|   rl   rl   rl   rm   r=     sP     	c                       s8   e Zd ZdZdZdgZdgZdZdZ fddZ	  Z
S )	r>   z^
    Subclass of the `MyghtyLexer` that highlights unlexed data
    with the `HtmlLexer`.
    zHTML+Myghtyzhtml+myghtyztext/html+myghtyr   r   c                    s   t  jttf| d S r   )r   ri   r   r=   r   r   rl   rm   ri     s    zMyghtyHtmlLexer.__init__r   r   r   r   r   r   r   r   r   ri   r   rl   rl   r   rm   r>     s   c                       s8   e Zd ZdZdZdgZdgZdZdZ fddZ	  Z
S )	r?   z]
    Subclass of the `MyghtyLexer` that highlights unlexed data
    with the `XmlLexer`.
    z
XML+Myghtyz
xml+myghtyzapplication/xml+myghtyr   r   c                    s   t  jttf| d S r   )r   ri   r   r=   r   r   rl   rm   ri     s    zMyghtyXmlLexer.__init__r   rl   rl   r   rm   r?     s   c                       s>   e Zd ZdZdZddgZdddgZdZd	Z fd
dZ	  Z
S )rA   zd
    Subclass of the `MyghtyLexer` that highlights unlexed data
    with the `JavascriptLexer`.
    zJavaScript+Myghtyzjavascript+myghtyz	js+myghtyzapplication/x-javascript+myghtyztext/x-javascript+myghtyztext/javascript+mygthyr   r   c                    s   t  jttf| d S r   )r   ri   r   r=   r   r   rl   rm   ri     s    zMyghtyJavascriptLexer.__init__r   rl   rl   r   rm   rA     s   c                       s8   e Zd ZdZdZdgZdgZdZdZ fddZ	  Z
S )	r@   z]
    Subclass of the `MyghtyLexer` that highlights unlexed data
    with the `CssLexer`.
    z
CSS+Myghtyz
css+myghtyztext/css+myghtyr   r   c                    s   t  jttf| d S r   )r   ri   r   r=   r   r   rl   rm   ri     s    zMyghtyCssLexer.__init__r   rl   rl   r   rm   r@      s   c                   @   s  e Zd ZdZdZdZdgZddddd	d
gZdgZdZ	dde
fdeejejejfdeeje
ejejeeejfdeejdddeeejfdeejejeeejfdeejejeeejfdejfdeejeeejfdefdeejeeefdeeeefgiZdd ZdS )rB   zl
    Generic mason templates lexer. Stolen from Myghty lexer. Code that isn't
    Mason markup is HTML.
    ZMasonzhttp://www.masonhq.com/Zmasonz*.mz*.mhtmlz*.mcz*.miZautohandlerZdhandlerzapplication/x-mason1.4r   r   z(?s)(<%doc>)(.*?)(</%doc>)r   z%(?s)(<%(\w+)(.*?)(>))(.*?)(</%\2\s*>)Nz(?s)(<&[^|])(.*?)(,.*?)?(&>)r   r   r   r   r   r   c                 C   s6   d}t d| d k	rd}nt d| t jd k	r2d}|S )Nr   z</%(class|doc|init)>g      ?z<&.+&>g)\(?r   )r{   resultrl   rl   rm   r   =  s    zMasonLexer.analyse_text)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   	Multiliner   r   r   r	   r!   r   r   r|   r   rl   rl   rl   rm   rB     sR    	!c                   @   s@  e Zd ZdZdZdZdgZdgZdgZdZ	de
ejejeefd	e
ejejeeefd
e
ejejejfdejfde
ejejdfde
ejejejfdejdfde
ejeeejfde
ejeeejfde
eefdefgdejfdejfedgde
ejeefdejdfdefgdedfdedfdedfgdZdS )rC   zd
    Generic mako templates lexer. Code that isn't Mako
    markup is yielded as `Token.Other`.
    ZMakohttp://www.makotemplates.org/Zmakoz*.maozapplication/x-mako0.7z(\s*)(%)(\s*end(?:\w+))(\n|\Z)z(\s*)(%)([^\n]*)(\n|\Z)z(\s*)(##[^\n]*)(\n|\Z)z(?s)<%doc>.*?</%doc>z(<%)([\w.:]+)r   z(</%)([\w.:]+)(>)z<%(?=([\w.:]+))	ondeftagsz(?s)(<%(?:!?))(.*?)(%>)z(\$\{)(.*?)(\})a\  (?sx)
                (.+?)                # anything, followed by:
                (?:
                 (?<=\n)(?=%|\#\#) | # an eval or comment line
                 (?=\#\*) |          # multiline comment
                 (?=</?%) |          # a python block
                                     # call start or end
                 (?=\$\{) |          # a substitution
                 (?<=\n)(?=\s*%) |
                                     # - don't consume
                 (\\\n) |            # an escaped newline
                 \Z                  # end of string
                )
            r   rq   z'(?<=<%)(include|inherit|namespace|page)z((?:\w+)\s*=)(\s*)(".*?")/?\s*>r   ".*?"'.*?'[^\s>]+)r   r   r   attrN)r   r   r   r   r   r   r   r   r   r   r   r   r   r   rx   r   r!   r   r   r   r   r   r   r   r   r   r   r|   rl   rl   rl   rm   rC   F  sf    
"
c                       s8   e Zd ZdZdZdgZdgZdZdZ fddZ	  Z
S )	rD   z\
    Subclass of the `MakoLexer` that highlights unlexed data
    with the `HtmlLexer`.
    z	HTML+Makoz	html+makoztext/html+makor   r   c                    s   t  jttf| d S r   )r   ri   r   rC   r   r   rl   rm   ri     s    zMakoHtmlLexer.__init__r   rl   rl   r   rm   rD     s   c                       s8   e Zd ZdZdZdgZdgZdZdZ fddZ	  Z
S )	rE   z[
    Subclass of the `MakoLexer` that highlights unlexed data
    with the `XmlLexer`.
    zXML+Makozxml+makozapplication/xml+makor   r   c                    s   t  jttf| d S r   )r   ri   r   rC   r   r   rl   rm   ri     s    zMakoXmlLexer.__init__r   rl   rl   r   rm   rE     s   c                       s>   e Zd ZdZdZddgZdddgZdZd	Z fd
dZ	  Z
S )rF   zb
    Subclass of the `MakoLexer` that highlights unlexed data
    with the `JavascriptLexer`.
    zJavaScript+Makozjavascript+makozjs+makozapplication/x-javascript+makoztext/x-javascript+makoztext/javascript+makor   r   c                    s   t  jttf| d S r   )r   ri   r   rC   r   r   rl   rm   ri     s    zMakoJavascriptLexer.__init__r   rl   rl   r   rm   rF     s   c                       s8   e Zd ZdZdZdgZdgZdZdZ fddZ	  Z
S )	rG   z[
    Subclass of the `MakoLexer` that highlights unlexed data
    with the `CssLexer`.
    zCSS+Makozcss+makoztext/css+makor   r   c                    s   t  jttf| d S r   )r   ri   r   rC   r   r   rl   rm   ri     s    zMakoCssLexer.__init__r   rl   rl   r   rm   rG     s   c                   @   s   e Zd ZdZdd ZdS )CheetahPythonLexerzI
    Lexer for handling Cheetah's special $ tokens in Python syntax.
    c                 c   sJ   t f | j}||D ].\}}}|tjkr8|dkr8tj}|||fV  qd S )N$)r   rk   ry   r"   r   r   rx   )rj   r{   Zpylexerpostype_valuerl   rl   rm   ry     s
    z)CheetahPythonLexer.get_tokens_unprocessedN)r   r   r   r   ry   rl   rl   rl   rm   r     s   r   c                   @   s   e Zd ZdZdZdZddgZddgZdd	gZd
Z	dde
efdefdejfdejfde
ejeeejfde
ejeefde
ejeeejfdefdefg	iZdS )rI   z
    Generic cheetah templates lexer. Code that isn't Cheetah
    markup is yielded as `Token.Other`.  This also works for
    `spitfire templates`_ which use the same syntax.

    .. _spitfire templates: http://code.google.com/p/spitfire/
    ZCheetahhttp://www.cheetahtemplate.org/ZcheetahZspitfirez*.tmplz*.sptzapplication/x-cheetahzapplication/x-spitfirerf   r   z(##[^\n]*)$z#[*](.|\n)*?[*]#z#end[^#\n]*(?:#|$)z#slurp$z(#[a-zA-Z]+)([^#\n]*)(#|$)z(\$)([a-zA-Z_][\w.]*\w)z(?s)(\$\{!?)(.*?)(\})a  (?sx)
                (.+?)               # anything, followed by:
                (?:
                 (?=\#[#a-zA-Z]*) | # an eval comment
                 (?=\$[a-zA-Z_{]) | # a substitution
                 \Z                 # end of string
                )
            r   N)r   r   r   r   r   r   r   r   r   r   r   r   rx   r   r   r!   r   r|   rl   rl   rl   rm   rI     sB   c                       s>   e Zd ZdZdZdddgZddgZdZd	Z fd
dZ	  Z
S )rJ   z_
    Subclass of the `CheetahLexer` that highlights unlexed data
    with the `HtmlLexer`.
    zHTML+Cheetahzhtml+cheetahzhtml+spitfireZhtmlcheetahztext/html+cheetahztext/html+spitfirer   rf   c                    s   t  jttf| d S r   )r   ri   r   rI   r   r   rl   rm   ri     s    zCheetahHtmlLexer.__init__r   rl   rl   r   rm   rJ     s   
c                       s<   e Zd ZdZdZddgZddgZdZdZ fd	d
Z	  Z
S )rK   z^
    Subclass of the `CheetahLexer` that highlights unlexed data
    with the `XmlLexer`.
    zXML+Cheetahzxml+cheetahzxml+spitfirezapplication/xml+cheetahzapplication/xml+spitfirer   rf   c                    s   t  jttf| d S r   )r   ri   r   rI   r   r   rl   rm   ri   "  s    zCheetahXmlLexer.__init__r   rl   rl   r   rm   rK     s   c                       sH   e Zd ZdZdZddddgZddd	d
ddgZdZdZ fddZ	  Z
S )rL   ze
    Subclass of the `CheetahLexer` that highlights unlexed data
    with the `JavascriptLexer`.
    zJavaScript+Cheetahzjavascript+cheetahz
js+cheetahzjavascript+spitfirezjs+spitfirez application/x-javascript+cheetahztext/x-javascript+cheetahztext/javascript+cheetahz!application/x-javascript+spitfireztext/x-javascript+spitfireztext/javascript+spitfirer   rf   c                    s   t  jttf| d S r   )r   ri   r   rI   r   r   rl   rm   ri   8  s    zCheetahJavascriptLexer.__init__r   rl   rl   r   rm   rL   &  s     c                
   @   s   e Zd ZdZdZdZdgZddgZdZde	fd	e
eefd
e
eejdfedde	fgdedfdeedfde
eeeedfdedfde
eeedfgde
ejeeejfdejfgdZdS )r:   z8
    A lexer that highlights genshi text templates.
    zGenshi Texthttps://genshi.edgewall.org/Z
genshitextzapplication/x-genshi-textztext/x-genshirf   z[^#$\s]+z^(\s*)(##.*)$z	^(\s*)(#)	directiver   z[#$\s]z\nr   z(?:def|for|if)\s+.*z (choose|when|with)([^\S\n]+)(.*)z(choose|otherwise)\bz(end\w*)([^\S\n]*)(.*)(?<!\$)(\$\{)(.+?)(\})z(?<!\$)(\$)([a-zA-Z_][\w.]*))r   r   r   N)r   r   r   r   r   r   r   r   r   r!   r   r   r   rx   r   r   r   r   r   r   r|   rl   rl   rl   rm   r:   <  s:    	c                   @   sH  e Zd ZdZejZdefdee	j
eee	j
fdefdejdfdejdfed	d
efgdefdejdfdejdfgdeeeeedfdeeeeedfdedfgdefdejdfdejdfdejdfgdedfdedfdedfgdedfeddefgdedfeddefgdefed	gdee	j
eee	j
fdejfgd	ZdS ) GenshiMarkupLexerzX
    Base lexer for Genshi markup, used by `HtmlGenshiLexer` and
    `GenshiLexer`.
    z[^<$]+z(<\?python)(.*?)(\?>)z'<\s*(script|style)\s*.*?>.*?<\s*/\1\s*>z<\s*py:[a-zA-Z0-9]+pytagz<\s*[a-zA-Z0-9:.]+r   r   z[<$]r   z[\w:-]+\s*=pyattrr   r   z(")(.*?)(")z(')(.*?)(')r   zpy:[\w-]+\s*=r   "attr-dstring'attr-sstringz[^\s>]*stringsz[^"'$]+r   z(?<!\$)(\$)([a-zA-Z_][\w\.]*))	r   r   r   r   r   r   r   r   r   N)r   r   r   r   r   r   r   r!   r   r   rx   r   r   r   r   r   r   r   r   r   r|   rl   rl   rl   rm   r   `  s`   






r   c                       sL   e Zd ZdZdZddgZdZdddgZd	gZd
Z	 fddZ
dd Z  ZS )r9   z
    A lexer that highlights `genshi <https://genshi.edgewall.org/>`_ and
    `kid <http://kid-templating.org/>`_ kid HTML templates.
    zHTML+Genshizhtml+genshizhtml+kidrf   r   *.htm*.xhtmlztext/html+genshir   c                    s   t  jttf| d S r   )r   ri   r   r   r   r   rl   rm   ri     s    zHtmlGenshiLexer.__init__c                 C   sF   d}t d| d k	r|d7 }t d| d k	r4|d7 }|t|  d S Nr   z	\$\{.*?\}皙?zpy:(.*?)=["\']r   )r   r   r   r   r   rl   rl   rm   r     s    zHtmlGenshiLexer.analyse_textr   rl   rl   r   rm   r9     s   
c                       sT   e Zd ZdZdZddddgZdgZdZd	gZd
dgZ	dZ
 fddZdd Z  ZS )r8   z
    A lexer that highlights `genshi <https://genshi.edgewall.org/>`_ and
    `kid <http://kid-templating.org/>`_ kid XML templates.
    ZGenshigenshiZkidz
xml+genshizxml+kidz*.kidrf   r   zapplication/x-genshizapplication/x-kidr   c                    s   t  jttf| d S r   )r   ri   r   r   r   r   rl   rm   ri     s    zGenshiLexer.__init__c                 C   sF   d}t d| d k	r|d7 }t d| d k	r4|d7 }|t|  d S r  )r   r   r   r   r   rl   rl   rm   r     s    zGenshiLexer.analyse_textr   r   r   r   r   r   r   r   r   r   r   ri   r   r   rl   rl   r   rm   r8     s   c                       sP   e Zd ZdZdZddddgZdZdgZd	d
dgZdZ	 fddZ
dd Z  ZS )r<   zK
    A lexer that highlights javascript code in genshi text templates.
    zJavaScript+Genshi Textzjs+genshitextz	js+genshizjavascript+genshitextzjavascript+genshirf   *.jszapplication/x-javascript+genshiztext/x-javascript+genshiztext/javascript+genshihttps://genshi.edgewall.orgc                    s   t  jttf| d S r   )r   ri   r   r:   r   r   rl   rm   ri     s    zJavascriptGenshiLexer.__init__c                 C   s   t | d S N皙?r8   r   r   rl   rl   rm   r     s    z"JavascriptGenshiLexer.analyse_textr   rl   rl   r   rm   r<     s   c                       sH   e Zd ZdZdZddgZdZdgZdgZdZ	 fd	d
Z
dd Z  ZS )r;   zK
    A lexer that highlights CSS definitions in genshi text templates.
    zCSS+Genshi Textzcss+genshitextz
css+genshirf   *.cssztext/css+genshir  c                    s   t  jttf| d S r   )r   ri   r   r:   r   r   rl   rm   ri     s    zCssGenshiLexer.__init__c                 C   s   t | d S r  r	  r   rl   rl   rm   r     s    zCssGenshiLexer.analyse_textr   rl   rl   r   rm   r;     s   c                       sT   e Zd ZdZdZdddgZdgZdZdd	d
gZdgZ	dZ
 fddZdd Z  ZS )r*   z
    Subclass of the ERB lexer that highlights the unlexed data with the
    html lexer.

    Nested Javascript and CSS is highlighted too.
    ZRHTMLZrhtmlzhtml+erbz	html+rubyz*.rhtmlrf   r   r   r   ztext/html+rubyre   c                    s   t  jttf| d S r   )r   ri   r   r)   r   r   rl   rm   ri     s    zRhtmlLexer.__init__c                 C   s"   t | d }t| r|d7 }|S Nr   g      ?)r)   r   r#   r   rl   rl   rm   r     s    zRhtmlLexer.analyse_textr  rl   rl   r   rm   r*     s   

c                       sH   e Zd ZdZdZddgZdZdgZdgZdZ	 fd	d
Z
dd Z  ZS )r+   zo
    Subclass of `ErbLexer` which highlights data outside preprocessor
    directives with the `XmlLexer`.
    zXML+Rubyzxml+rubyzxml+erbrf   r   zapplication/xml+rubyre   c                    s   t  jttf| d S r   )r   ri   r   r)   r   r   rl   rm   ri   %  s    zXmlErbLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r)   r   r$   r   rl   rl   rm   r   (  s    zXmlErbLexer.analyse_textr   rl   rl   r   rm   r+     s   c                       sH   e Zd ZdZdZddgZdZdgZdgZdZ	 fd	d
Z
dd Z  ZS )r,   zS
    Subclass of `ErbLexer` which highlights unlexed data with the `CssLexer`.
    zCSS+Rubyzcss+rubyzcss+erbrf   r
  ztext/css+rubyre   c                    s   t  jttf| d S r   )r   ri   r   r)   r   r   rl   rm   ri   ;  s    zCssErbLexer.__init__c                 C   s   t | d S r  r)   r   r   rl   rl   rm   r   >  s    zCssErbLexer.analyse_textr   rl   rl   r   rm   r,   /  s   c                       sP   e Zd ZdZdZddddgZdZdgZd	d
dgZdZ	 fddZ
dd Z  ZS )r-   z^
    Subclass of `ErbLexer` which highlights unlexed data with the
    `JavascriptLexer`.
    zJavaScript+Rubyzjavascript+rubyzjs+rubyzjavascript+erbzjs+erbrf   r  zapplication/x-javascript+rubyztext/x-javascript+rubyztext/javascript+rubyre   c                    s   t  jttf| d S r   )r   ri   r   r)   r   r   rl   rm   ri   Q  s    zJavascriptErbLexer.__init__c                 C   s   t | d S r  r  r   rl   rl   rm   r   T  s    zJavascriptErbLexer.analyse_textr   rl   rl   r   rm   r-   B  s   c                       s\   e Zd ZdZdZdgZdgZdZdddd	d
gZdddddgZ	dZ
 fddZdd Z  ZS )r%   z
    Subclass of `PhpLexer` that highlights unhandled data with the `HtmlLexer`.

    Nested Javascript and CSS is highlighted too.
    zHTML+PHPzhtml+phpz*.phtmlrf   *.phpr   r   r   
*.php[345]zapplication/x-phpzapplication/x-httpd-phpzapplication/x-httpd-php3zapplication/x-httpd-php4zapplication/x-httpd-php5https://www.php.netc                    s   t  jttf| d S r   )r   ri   r   r   r   r   rl   rm   ri   k  s    zHtmlPhpLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r  )r   r   r#   r   rl   rl   rm   r   n  s    zHtmlPhpLexer.analyse_textr  rl   rl   r   rm   r%   X  s"     c                       sJ   e Zd ZdZdZdgZdZdddgZdgZd	Z	 fd
dZ
dd Z  ZS )r&   zT
    Subclass of `PhpLexer` that highlights unhandled data with the `XmlLexer`.
    zXML+PHPzxml+phprf   r   r  r  zapplication/xml+phpr  c                    s   t  jttf| d S r   )r   ri   r   r   r   r   rl   rm   ri     s    zXmlPhpLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r   r   r$   r   rl   rl   rm   r     s    zXmlPhpLexer.analyse_textr   rl   rl   r   rm   r&   u  s   
c                       sF   e Zd ZdZdZdgZdZdgZdgZdZ	 fdd	Z
d
d Z  ZS )r'   zU
    Subclass of `PhpLexer` which highlights unmatched data with the `CssLexer`.
    zCSS+PHPzcss+phprf   r
  ztext/css+phpr  c                    s   t  jttf| d S r   )r   ri   r   r   r   r   rl   rm   ri     s    zCssPhpLexer.__init__c                 C   s   t | d S r  r   r   r   rl   rl   rm   r     s    zCssPhpLexer.analyse_textr   rl   rl   r   rm   r'     s   c                       sL   e Zd ZdZdZddgZdZdgZddd	gZd
Z	 fddZ
dd Z  ZS )r(   z`
    Subclass of `PhpLexer` which highlights unmatched data with the
    `JavascriptLexer`.
    zJavaScript+PHPzjavascript+phpzjs+phprf   r  zapplication/x-javascript+phpztext/x-javascript+phpztext/javascript+phpr  c                    s   t  jttf| d S r   )r   ri   r   r   r   r   rl   rm   ri     s    zJavascriptPhpLexer.__init__c                 C   s
   t | S r   r  r   rl   rl   rm   r     s    zJavascriptPhpLexer.analyse_textr   rl   rl   r   rm   r(     s   c                       sL   e Zd ZdZdZdgZdZddddgZd	gZd
Z	 fddZ
dd Z  ZS )r/   z
    Subclass of the `SmartyLexer` that highlights unlexed data with the
    `HtmlLexer`.

    Nested Javascript and CSS is highlighted too.
    zHTML+Smartyzhtml+smartyrf   r   r   r   r   ztext/html+smartyr   c                    s   t  jttf| d S r   )r   ri   r   r.   r   r   rl   rm   ri     s    zHtmlSmartyLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r  )r.   r   r#   r   rl   rl   rm   r     s    zHtmlSmartyLexer.analyse_textr   rl   rl   r   rm   r/     s   c                       sH   e Zd ZdZdZdgZdZddgZdgZdZ	 fd	d
Z
dd Z  ZS )r0   z]
    Subclass of the `SmartyLexer` that highlights unlexed data with the
    `XmlLexer`.
    z
XML+Smartyz
xml+smartyrf   r   r   zapplication/xml+smartyr   c                    s   t  jttf| d S r   )r   ri   r   r.   r   r   rl   rm   ri     s    zXmlSmartyLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r.   r   r$   r   rl   rl   rm   r     s    zXmlSmartyLexer.analyse_textr   rl   rl   r   rm   r0     s   c                       sH   e Zd ZdZdZdgZdZddgZdgZdZ	 fd	d
Z
dd Z  ZS )r1   z]
    Subclass of the `SmartyLexer` that highlights unlexed data with the
    `CssLexer`.
    z
CSS+Smartyz
css+smartyrf   r
  r   ztext/css+smartyr   c                    s   t  jttf| d S r   )r   ri   r   r.   r   r   rl   rm   ri     s    zCssSmartyLexer.__init__c                 C   s   t | d S r  r.   r   r   rl   rl   rm   r     s    zCssSmartyLexer.analyse_textr   rl   rl   r   rm   r1     s   c                       sN   e Zd ZdZdZddgZdZddgZdd	d
gZdZ	 fddZ
dd Z  ZS )r2   zd
    Subclass of the `SmartyLexer` that highlights unlexed data with the
    `JavascriptLexer`.
    zJavaScript+Smartyzjavascript+smartyz	js+smartyrf   r  r   zapplication/x-javascript+smartyztext/x-javascript+smartyztext/javascript+smartyr   c                    s   t  jttf| d S r   )r   ri   r   r.   r   r   rl   rm   ri     s    zJavascriptSmartyLexer.__init__c                 C   s   t | d S r  r  r   rl   rl   rm   r   
  s    z"JavascriptSmartyLexer.analyse_textr   rl   rl   r   rm   r2     s   c                       s`   e Zd ZdZdZdddgZdddd	d
dgZdZdddgZddgZ	dZ
 fddZdd Z  ZS )r4   z
    Subclass of the `DjangoLexer` that highlights unlexed data with the
    `HtmlLexer`.

    Nested Javascript and CSS is highlighted too.
    zHTML+Django/Jinjazhtml+djangoz
html+jinjaZ
htmldjangoz	*.html.j2z*.htm.j2z
*.xhtml.j2z*.html.jinja2z*.htm.jinja2z*.xhtml.jinja2rf   r   r   r   ztext/html+djangoztext/html+jinjar   c                    s   t  jttf| d S r   )r   ri   r   r3   r   r   rl   rm   ri     s    zHtmlDjangoLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r  )r3   r   r#   r   rl   rl   rm   r   !  s    zHtmlDjangoLexer.analyse_textr  rl   rl   r   rm   r4     s   

c                       sR   e Zd ZdZdZddgZddgZdZdgZd	d
gZ	dZ
 fddZdd Z  ZS )r6   z]
    Subclass of the `DjangoLexer` that highlights unlexed data with the
    `XmlLexer`.
    zXML+Django/Jinjaz
xml+djangoz	xml+jinjaz*.xml.j2z*.xml.jinja2rf   r   zapplication/xml+djangozapplication/xml+jinjar   c                    s   t  jttf| d S r   )r   ri   r   r3   r   r   rl   rm   ri   6  s    zXmlDjangoLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r3   r   r$   r   rl   rl   rm   r   9  s    zXmlDjangoLexer.analyse_textr  rl   rl   r   rm   r6   (  s   c                       sR   e Zd ZdZdZddgZddgZdZdgZd	d
gZ	dZ
 fddZdd Z  ZS )r5   z]
    Subclass of the `DjangoLexer` that highlights unlexed data with the
    `CssLexer`.
    zCSS+Django/Jinjaz
css+djangoz	css+jinjaz*.css.j2z*.css.jinja2rf   r
  ztext/css+djangoztext/css+jinjar   c                    s   t  jttf| d S r   )r   ri   r   r3   r   r   rl   rm   ri   N  s    zCssDjangoLexer.__init__c                 C   s   t | d S r  r3   r   r   rl   rl   rm   r   Q  s    zCssDjangoLexer.analyse_textr  rl   rl   r   rm   r5   @  s   c                       s^   e Zd ZdZdZddddgZddgZd	Zd
gZddddddgZ	dZ
 fddZdd Z  ZS )r7   zd
    Subclass of the `DjangoLexer` that highlights unlexed data with the
    `JavascriptLexer`.
    zJavaScript+Django/Jinjazjavascript+djangoz	js+djangozjavascript+jinjazjs+jinjaz*.js.j2z*.js.jinja2rf   r  zapplication/x-javascript+djangozapplication/x-javascript+jinjaztext/x-javascript+djangoztext/x-javascript+jinjaztext/javascript+djangoztext/javascript+jinjar   c                    s   t  jttf| d S r   )r   ri   r   r3   r   r   rl   rm   ri   i  s    zJavascriptDjangoLexer.__init__c                 C   s   t | d S r  r  r   rl   rl   rm   r   l  s    z"JavascriptDjangoLexer.analyse_textr  rl   rl   r   rm   r7   U  s&    c                   @   sF   e Zd ZdZdedfdefdefdefgdedfd	eefgd
ZdS )JspRootLexerzt
    Base for the `JspLexer`. Yields `Token.Other` for area outside of
    JSP tags.

    .. versionadded:: 0.7
    <%\S?seczC</?jsp:(forward|getProperty|include|plugin|setProperty|useBean).*?>[^<]+<rr   r   [\w\W]+?(?=%>|\Z)r   r  N)	r   r   r   r   r   r!   r   r
   r|   rl   rl   rl   rm   r  p  s   		
r  c                       sF   e Zd ZdZdZdgZdgZdgZdZdZ	 fdd	Z
d
d Z  ZS )rH   z&
    Lexer for Java Server Pages.
    zJava Server PageZjspz*.jspzapplication/x-jspz.https://projects.eclipse.org/projects/ee4j.jspr   c                    s   t  jttf| d S r   r   ri   r   r  r   r   rl   rm   ri     s    zJspLexer.__init__c                 C   s:   t | d }t| r|d7 }d| kr6d| kr6|d7 }|S Nr   r   rq   rr   r   )r
   r   r$   r   rl   rl   rm   r     s    zJspLexer.analyse_textr   r   r   r   r   r   r   r   r   r   ri   r   r   rl   rl   r   rm   rH     s   c                   @   s  e Zd ZdZdZdgZdgZdgZdZdZ	e
jZdefd	ejd
fdefdejfdeeejedeefdeeejedeeeefdeeejedeeefdeeejfdeedeeejddefdefg
dejfd	ejdfdejdfdejfgdZdd ZdS )rM   z7
    For files using the Evoque templating system.
    ZEvoqueZevoquez*.evoquezapplication/x-evoquehttps://gizmojo.org/templating1.1z[^#$]+z#\[commentz\$\$z\$\w+:[^$\n]*\$z'(\$)(begin|end)(\{(%)?)(.*?)((?(4)%)\})Nz>(\$)(evoque|overlay)(\{(%)?)(\s*[#\w\-"\'.]+)?(.*?)((?(4)%)\})z!(\$)(\w+)(\{(%)?)(.*?)((?(4)%)\})z(\$)(else|rof|fi)z%(\$\{(%)?)(.*?)((!)(.*?))?((?(2)%)\})#z[^\]#]r   z\]#r   z[\]#])r   r  c                 C   s   d| krdS dS )z.Evoque templates use $evoque, which is unique.z$evoquern   Nrl   r   rl   rl   rm   r     s    zEvoqueLexer.analyse_text)r   r   r   r   r   r   r   r   r   r   r   r   r   r!   r   r   r   r   r   r   r   r   r   r|   r   rl   rl   rl   rm   rM     sb   
       

'c                       sF   e Zd ZdZdZdgZdgZdgZdZdZ	 fdd	Z
d
d Z  ZS )rN   z^
    Subclass of the `EvoqueLexer` that highlights unlexed data with the
    `HtmlLexer`.
    zHTML+Evoquezhtml+evoquer   ztext/html+evoquer  r  c                    s   t  jttf| d S r   )r   ri   r   rM   r   r   rl   rm   ri     s    zEvoqueHtmlLexer.__init__c                 C   s
   t | S r   rM   r   r   rl   rl   rm   r     s    zEvoqueHtmlLexer.analyse_textr   r   r   r   r   r   r   r   r   r   ri   r   r   rl   rl   r   rm   rN     s   c                       sF   e Zd ZdZdZdgZdgZdgZdZdZ	 fdd	Z
d
d Z  ZS )rO   z]
    Subclass of the `EvoqueLexer` that highlights unlexed data with the
    `XmlLexer`.
    z
XML+Evoquez
xml+evoquer   zapplication/xml+evoquer  r  c                    s   t  jttf| d S r   )r   ri   r   rM   r   r   rl   rm   ri     s    zEvoqueXmlLexer.__init__c                 C   s
   t | S r   r!  r   rl   rl   rm   r     s    zEvoqueXmlLexer.analyse_textr"  rl   rl   r   rm   rO     s   c                   @   s   e Zd ZdZdZdgZg Zg ZdZdZ	e
jZdejfdejfdefd	efd
efdefdefdefdefdejdfdejfdefdefdejfdejfdeejeefdejfdefdefgdejfdejfdejfdejfdejdfgdZd S )!rP   z
    Coldfusion statements
    ZcfstatementZcfs5https://www.adobe.com/products/coldfusion-family.htmlrf   z//.*?\nz/\*(?:.|\n)*?\*/z\+\+|--z
[-+*/^&=!]z<=|>=|<|>|==zmod\bz"(eq|lt|gt|lte|gte|not|is|and|or)\bz\|\||&&z\?r   stringr   \d+z(if|else|len|var|xml|default|break|switch|component|property|function|do|try|catch|in|continue|for|return|while|required|any|array|binary|boolean|component|date|guid|numeric|query|string|struct|uuid|case)\br   zD(application|session|client|cookie|super|this|variables|arguments)\bz([a-z_$][\w.]*)(\s*)(\()z[a-z_$][\w.]*z[()\[\]{};:,.\\]r   z""z#.+?#z[^"#]+r   r   )r   r$  N)r   r   r   r   r   r   r   r   r   r   r   
IGNORECASEr   r   r   r   r   r   r   r    r   r   r   r   r   r   r   r   ZInterpr|   rl   rl   rl   rm   rP     sR   

c                
   @   s   e Zd ZdZdZdgZg Zg ZdZde	fe
dde	fgdejd	fd
efdejdfdeejeeejfdeejeeejfgde	fdeeeeefdejdfe
dde	fde	fgdejdfdejdfdejfgdZdS )ColdfusionMarkupLexerz 
    Coldfusion markup only
    Z
Coldfusioncfr#  r  tagsz<[^<>]*z<!---	cfcommentz(?s)<!--.*?-->z<cfoutput.*?>cfoutputz((?s)(<cfscript.*?>)(.+?)(</cfscript.*?>)z(?s)(</?cf(?:component|include|if|else|elseif|loop|return|dbinfo|dump|abort|location|invoke|throw|file|savecontent|mailpart|mail|header|content|zip|image|lock|argument|try|catch|break|directory|http|set|function|param)\b)(.*?)((?<!\\)>)z[^#<]+z(#)(.*?)(#)z</cfoutput.*?>r   z(?s)<[^<>]*r   r   z--->z([^<-]|<(?!!---)|-(?!-->))+)r   r)  r+  r*  N)r   r   r   r   r   r   r   r   r   r!   r   r   r   r   r   r   r   rP   r   r|   rl   rl   rl   rm   r'  2  sD   




r'  c                       s@   e Zd ZdZdZdgZddgZdgZdZdZ	 fd	d
Z
  ZS )rQ   z#
    Coldfusion markup in html
    zColdfusion HTMLZcfmz*.cfmz*.cfmlzapplication/x-coldfusionr#  rf   c                    s   t  jttf| d S r   )r   ri   r   r'  r   r   rl   rm   ri   l  s    zColdfusionHtmlLexer.__init__r   r   r   r   r   r   r   r   r   r   ri   r   rl   rl   r   rm   rQ   a  s   c                       s<   e Zd ZdZdZdgZdgZg ZdZdZ	 fddZ
  ZS )	rR   z-
    Coldfusion markup/script components
    zColdfusion CFCZcfcz*.cfcr#  2.0c                    s   t  jttf| d S r   )r   ri   rQ   rP   r   r   rl   rm   ri   {  s    zColdfusionCFCLexer.__init__r,  rl   rl   r   rm   rR   p  s   c                       sF   e Zd ZdZdZdgZdgZdgZdZdZ	 fdd	Z
d
d Z  ZS )rV   z)
    Lexer for Scalate Server Pages.
    zScalate Server PageZsspz*.sspzapplication/x-sspz"https://scalate.github.io/scalate/r   c                    s   t  jttf| d S r   r  r   r   rl   rm   ri     s    zSspLexer.__init__c                 C   sD   d}t d| r|d7 }t| r(|d7 }d| kr@d| kr@|d7 }|S )Nr   zval \w+\s*:g333333?r  rq   rr   r   )r   r   r$   r   rl   rl   rm   r     s    zSspLexer.analyse_textr  rl   rl   r   rm   rV     s   c                   @   s@   e Zd ZdZdedfdefdefgdedfdeefgd	Zd
S )TeaTemplateRootLexerz
    Base for the `TeaTemplateLexer`. Yields `Token.Other` for area outside of
    code blocks.

    .. versionadded:: 1.5
    r  r  r  r  rr   r   r  r  N)	r   r   r   r   r   r!   r   r   r|   rl   rl   rl   rm   r.    s   	
r.  c                       sF   e Zd ZdZdZdgZdgZdgZdZdZ	 fdd	Z
d
d Z  ZS )rW   z"
    Lexer for Tea Templates.
    ZTeaZteaz*.teaz
text/x-teaz$https://github.com/teatrove/teatrovez1.5c                    s   t  jttf| d S r   )r   ri   r   r.  r   r   rl   rm   ri     s    zTeaTemplateLexer.__init__c                 C   s:   t | d }t| r|d7 }d| kr6d| kr6|d7 }|S r  )r   r   r$   r   rl   rl   rm   r     s    zTeaTemplateLexer.analyse_textr  rl   rl   r   rm   rW     s   c                       sX   e Zd ZdZdZdgZdZddddd	d
ddgZdddgZdZ	 fddZ
dd Z  ZS )rX   z
    Subclass of the `LassoLexer` which highlights unhandled data with the
    `HtmlLexer`.

    Nested JavaScript and CSS is also highlighted.
    z
HTML+Lassoz
html+lasso1.6r   r   r   *.lasso*.lasso[89]*.incl*.inc*.lasztext/html+lassozapplication/x-httpd-lassozapplication/x-httpd-lasso[89]https://www.lassosoft.comc                    s   t  jttf| d S r   )r   ri   r   r   r   r   rl   rm   ri     s    zLassoHtmlLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r  )r   r   r#   r   rl   rl   rm   r     s    zLassoHtmlLexer.analyse_textr   rl   rl   r   rm   rX     s    
  c                       sP   e Zd ZdZdZdgZdZddddd	d
gZdgZdZ	 fddZ
dd Z  ZS )rY   z_
    Subclass of the `LassoLexer` which highlights unhandled data with the
    `XmlLexer`.
    z	XML+Lassoz	xml+lassor/  r   r0  r1  r2  r3  r4  zapplication/xml+lassor5  c                    s   t  jttf| d S r   )r   ri   r   r   r   r   rl   rm   ri     s    zLassoXmlLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r   r   r$   r   rl   rl   rm   r     s    zLassoXmlLexer.analyse_textr   rl   rl   r   rm   rY     s     c                       sF   e Zd ZdZdZdgZdZdgZdgZdZ	 fdd	Z
d
d Z  ZS )rZ   z_
    Subclass of the `LassoLexer` which highlights unhandled data with the
    `CssLexer`.
    z	CSS+Lassoz	css+lassor/  r
  ztext/css+lassor5  c                    s   d|d< t  jttf| d S NTZrequiredelimiters)r   ri   r   r   r   r   rl   rm   ri     s    zLassoCssLexer.__init__c                 C   s6   t | d }td| r"|d7 }d| kr2|d7 }|S )Nr  z
\w+:[^;]+;r   zpadding:)r   r   r   r   r   rl   rl   rm   r   
  s    zLassoCssLexer.analyse_textr   rl   rl   r   rm   rZ     s   c                       sL   e Zd ZdZdZddgZdZdgZddd	gZd
Z	 fddZ
dd Z  ZS )r[   zf
    Subclass of the `LassoLexer` which highlights unhandled data with the
    `JavascriptLexer`.
    zJavaScript+Lassozjavascript+lassozjs+lassor/  r  zapplication/x-javascript+lassoztext/x-javascript+lassoztext/javascript+lassor5  c                    s   d|d< t  jttf| d S r6  )r   ri   r   r   r   r   rl   rm   ri   "  s    zLassoJavascriptLexer.__init__c                 C   s   t | d }|S r  )r   r   r   rl   rl   rm   r   &  s    z!LassoJavascriptLexer.analyse_textr   rl   rl   r   rm   r[     s   c                   @   sN  e Zd ZdZdZdZdgZdZdefde	fde
e	jed	fd
e
e	jejejd	fde
e	jed	fgdefde	jdfde
ee	jdfde
ejefde
eeefde
eeejfde
eeedfedgdefdedfde
eeejefde
eeeeddfdejfedgdejfdejfdejfgeddejfd ejfd!efgd"Zd#S )$r\   z
    Generic handlebars template lexer.

    Highlights only the Handlebars template tags (stuff between `{{` and `}}`).
    Everything else is left for a delegating lexer.
    Z
Handlebarshttps://handlebarsjs.com/Z
handlebarsr-  r   z\{\{!.*\}\}z(\{\{\{)(\s*)r   z(\{\{)([#~/]+)([^\s}]*)(\{\{)(\s*)r   z\}\}\}r   z
(~?)(\}\})z([^\s}]+)(=)z(>)(\s*)(@partial-block)z(#?>)(\s*)([\w-]+)z(>)(\s*)(\()dynamic-partialgenericr   z(lookup)(\s+)(\.|this)(\s+)z(lookup)(\s+)(\S+)r   r}   z[\w-]+z[()/@a-zA-Z][\w-]*z\.[\w-]+z(this\/|\.\/|(\.\.\/)+)[\w-]+r   r   r   )r   r   r9  r   r:  N)r   r   r   r   r   r   r   r   r!   r   r   Specialr   rx   r    r   r   r   r   r   r   r   r   r   r   r   r   r   r|   rl   rl   rl   rm   r\   +  sb    
 
c                       sB   e Zd ZdZdZdgZddgZddgZdZd	Z	 fd
dZ
  ZS )r]   zb
    Subclass of the `HandlebarsLexer` that highlights unlexed data with the
    `HtmlLexer`.
    zHTML+Handlebarszhtml+handlebarsz*.handlebarsz*.hbsztext/html+handlebarsztext/x-handlebars-templater7  r-  c                    s   t  jttf| d S r   )r   ri   r   r\   r   r   rl   rm   ri     s    zHandlebarsHtmlLexer.__init__r,  rl   rl   r   rm   r]   w  s   c                       sL   e Zd ZdZdZdddgZdddd	d
gZddgZdZdZ	 fddZ
  ZS )r^   z
    Subclass of the `DjangoLexer` that highlights unlexed data with the
    `YamlLexer`.

    Commonly used in Saltstack salt states.
    z
YAML+Jinjaz
yaml+jinjasaltZslsz*.slsz	*.yaml.j2z*.yml.j2z*.yaml.jinja2z*.yml.jinja2ztext/x-yaml+jinjaz
text/x-sls!https://jinja.palletsprojects.comr-  c                    s   t  jttf| d S r   )r   ri   r   r3   r   r   rl   rm   ri     s    zYamlJinjaLexer.__init__r,  rl   rl   r   rm   r^     s   
c                   @   sr  e Zd ZdZdZdZdgZdgZdZde	fde
eedfd	e
eeeed
ddfde	fgdejdfde
ejeeddd
fde
ejeedfde
ejeeeddeedfde
ejeedfde
ejeedfde
ejdeedfde
ejdeedfde
ejeeed
deedfd e
ejed!fg
edd"edfd#ed$fgedd"ed%fd&e
ejeed'fgd#edfed(ed)gededd*e
eed
deeeeed
deefd+efd,ejfd-e
eed
deejeeed
dfed
edged
ed.gd/e
eededfd0e
eejedfgd"edfgd1ed%fgd2edfgedd3e
ejeefd4e
eeeeddeefed5ed6ed7d8efged9d:e	fged9edd:e	fgd1ed%fed)gd1ed%fed;gd<ejfgd=ejfd>efgd?ejfd@ejfgdAejfdBej fged7ed5ed6edgdCefgdDe
eeejeed%fd:e!fgde	fdEe
eeejeedfde	fgdFZ"dS )Gr_   z%
    Lexer for Liquid templates.
    Zliquidz.https://www.rubydoc.info/github/Shopify/liquidz*.liquidr-  r   z
(\{%)(\s*)tag-or-blockz(\{\{)(\s*)([^\s}]+)r:  r;  outputr   z(if|unless|elsif|case)(?=\s+)	conditionz(when)(\s+)end-of-block
whitespacez(else)(\s*)(%\})r   z!(capture)(\s+)([^\s%]+)(\s*)(%\})r   z(comment)(\s*)(%\})r  z(raw)(\s*)(%\})rawz(end(case|unless|if))(\s*)(%\})Nz(end([^\s%]+))(\s*)(%\})z"(cycle)(\s+)(?:([^\s:]*)(:))?(\s*)variable-tag-markupz([^\s%]+)(\s*)
tag-markup\}\}z\|filters)r   r   z([^\s|:]+)(:?)(\s*)filter-markup
end-of-tagdefault-param-markupz/([^\s=!><]+)(\s*)([=!><]=?)(\s*)(\S+)(\s*)(%\})z\b!z\bnot\bz*([\w.\'"]+)(\s+)(contains)(\s+)([\w.\'"]+)end-at-whitespacez(\s*)((=|!|>|<)=?)(\s*)z(\s*)(\bcontains\b)(\s*)z%\}r   z([^\s=:]+)(\s*)(=|:)z(\{\{)(\s*)([^\s}])(\s*)(\}\})r$  numberkeyword,param-markupr   variable-param-markupz\b(false|true)\br   z(?<=\w)\.(?=\w)z'[^']*'z"[^"]*"z\d+\.\d+r%  z[ \t]+z (\{%)(\s*)(endcomment)(\s*)(%\})z(\{%)(\s*)(endraw)(\s*)(%\}))r   r?  r@  rH  rI  rA  zgeneric-valueoperatorrJ  rB  rL  rP  rK  rQ  rF  rE  rN  r   r$  rM  r:  rC  r  rD  )#r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   ZReservedr   r   r   r   r   r   Wordr   r   r   r   r   r   r    ZFloatZIntegerr   r|   rl   rl   rl   rm   r_     s\  

      
  " 	 
  
    c                   @   s  e Zd ZdZdZdgZdgZdZdZe	j
e	jB ZdZdZd	e d
 Zee Zdefdejdfdefdeejeeeejeejeeeejfdeejeeeejeejeeeejfde deejeeeejdfdeejeedfdefgde deeeejfde deeeeeejfdejfdefdejfeejfde ejfdefdejfdej fdefd efgd!efd"eeejd#fe!d$gd!efd%eeejd#fe!d$d&e"fgd'Z#d(S ))r`   z
    Twig template lexer.

    It just highlights Twig code between the preprocessor directives,
    other data is left untouched by the lexer.
    ZTwigZtwigzapplication/x-twighttps://twig.symfony.comr-  z[\\\w-]|[^\x00-\x7f]z(?:[\\_a-z]|[^\x00-\x7f])z(?:z)*r   r   r   z\{\#.*?\#\}r   zL(\{%)(-?\s*)(verbatim)(\s*-?)(%\})(.*?)(\{%)(-?\s*)(endverbatim)(\s*-?)(%\})z(\{%)(-?\s*)(filter)(\s+)(r   r   r   r   z
(\|)(\s*)(z(is)(\s+)(not)?(\s*)(z(?i)(true|false|none|null)\bz(in|not|and|b-and|or|b-or|b-xor|isif|elseif|else|importconstant|defined|divisibleby|empty|even|iterable|odd|sameasmatches|starts\s+with|ends\s+with)\bz(loop|block|parent)\bz\.z\.[0-9]+r   r   z4([{}()\[\]+\-*/,:~%]|\.\.|\?|:|\*\*|\/\/|!=|[><=]=?)r   r   r   r   r   r   r   )r   r   r   r   N)$r   r   r   r   r   r   r   r   r   r   r   r   r   Z_ident_charZ_ident_beginZ
_ident_endZ_ident_innerr!   r   rx   r   r   r   r   r   r   r   r   r   r    r   r   r   r   r   r|   rl   rl   rl   rm   r`   h  s   
        
 

c                       s>   e Zd ZdZdZdgZdgZdgZdZdZ	 fdd	Z
  ZS )
ra   z\
    Subclass of the `TwigLexer` that highlights unlexed data with the
    `HtmlLexer`.
    z	HTML+Twigz	html+twigz*.twigztext/html+twigrT  r-  c                    s   t  jttf| d S r   )r   ri   r   r`   r   r   rl   rm   ri     s    zTwigHtmlLexer.__init__r,  rl   rl   r   rm   ra     s   c                   @   s  e Zd ZdZdZdZdgZdZdefde	e
jedfd	e	eejeeeed
fde	eejeefde	eejeeed
fde	eejefgdefde
jdfdejfdejfdejfdefdejfdejfde	eeeeeeeefg	dedfdedfdedfgdZdS )rb   z
    Generic angular2 template lexer.

    Highlights only the Angular template tags (stuff between `{{` and `}}` and
    special attributes: '(event)=', '[property]=', '[(twoWayBinding)]=').
    Everything else is left for a delegating lexer.
    ZAngular2(https://angular.io/guide/template-syntaxZng2z2.1z	[^{([*#]+r8  ngExpressionz&([([]+)([\w:.-]+)([\])]+)(\s*)(=)(\s*)r   z([([]+)([\w:.-]+)([\])]+)(\s*)z([*#])([\w:.-]+)(\s*)(=)(\s*)z([*#])([\w:.-]+)(\s*)z\s+(\|\s+)?rG  r   z:?(true|false)r   r   r   z[a-zA-Z][\w-]*(\(.*\))?z\.[\w-]+(\(.*\))?z-(\?)(\s*)([^}\s]+)(\s*)(:)(\s*)([^}\s]+)(\s*)r   r   r   )r   rV  r   N)r   r   r   r   r   r   r   r   r!   r   r   rx   r   r   r   r   r   r   Booleanr   r   r    r   r|   rl   rl   rl   rm   rb     sR    
c                       s8   e Zd ZdZdZdgZdgZdZdZ fddZ	  Z
S )	rc   z`
    Subclass of the `Angular2Lexer` that highlights unlexed data with the
    `HtmlLexer`.
    zHTML + Angular2zhtml+ng2z*.ng2rU  r-  c                    s   t  jttf| d S r   )r   ri   r   rb   r   r   rl   rm   ri   	  s    zAngular2HtmlLexer.__init__)r   r   r   r   r   r   r   r   r   ri   r   rl   rl   r   rm   rc   
	  s   c                       sD   e Zd ZdZdZdgZdddgZdZdZ fd	d
Z	dd Z
  ZS )rd   z
    Templated SQL lexer.
    z	SQL+Jinjaz	sql+jinjaz*.sqlz*.sql.j2z*.sql.jinja2r>  z2.13c                    s   t  jttf| d S r   )r   ri   r   r3   r   r   rl   rm   ri   %	  s    zSqlJinjaLexer.__init__c                 C   sD   d}t d| r|d7 }t d| r,|d7 }t d| r@|d7 }|S )Nr   z\{\{\s*ref\(.*\)\s*\}\}r   z\{\{\s*source\(.*\)\s*\}\}r   z\{%-?\s*macro \w+\(.*\)\s*-?%\}r   r   r   rl   rl   rm   r   (	  s    zSqlJinjaLexer.analyse_text)r   r   r   r   r   r   r   r   r   ri   r   r   rl   rl   r   rm   rd   	  s   
)wr   r   Zpygments.lexers.htmlr   r   Zpygments.lexers.javascriptr   r   Zpygments.lexers.cssr   Zpygments.lexers.phpr   Zpygments.lexers.pythonr   Zpygments.lexers.perlr	   Zpygments.lexers.jvmr
   r   Zpygments.lexers.datar   Zpygments.lexers.sqlr   Zpygments.lexerr   r   r   r   r   r   r   r   r   Zpygments.tokenr   r   r   r   r   r   r   r   r   r    r!   r"   Zpygments.utilr#   r$   __all__r)   r.   rS   rT   rU   r3   r=   r>   r?   rA   r@   rB   rC   rD   rE   rF   rG   r   rI   rJ   rK   rL   r:   r   r9   r8   r<   r;   r*   r+   r,   r-   r%   r&   r'   r(   r/   r0   r1   r2   r4   r6   r5   r7   r  rH   rM   rN   rO   rP   r'  rQ   rR   rV   r.  rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   rl   rl   rl   rm   <module>   s$  
,8                                         `:TU.6B-$@93/L NS>