U
    YSh'                 @   @   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`.
    ERBhttps://github.com/ruby/erberbzapplication/x-ruby-templating z*(<%%|%%>|<%=|<%#|<%-|<%|-%>|%>|^%[^%].*?$)c                 K   s*   ddl m} |f || _tj| f| d S )Nr   )	RubyLexer)Zpygments.lexers.rubyri   
ruby_lexerr   __init__)selfoptionsri    rn   L/root/rtd-docs/venv/lib/python3.8/site-packages/pygments/lexers/templates.pyrk   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   Preprocrj   get_tokens_unprocessedr   
IndexError)rl   texttokensstateidxvaltagdataZr_idxZr_tokenZr_valuern   rn   ro   r{   J   sf    





zErbLexer.get_tokens_unprocessedc                 C   s   d| krd| krdS d S )Nrs   rt   皙?rn   r}   rn   rn   ro   analyse_text   s    zErbLexer.analyse_textN)__name__
__module____qualname____doc__nameurlaliases	mimetypesversion_addedrecompileMru   rk   r{   r   rn   rn   rn   ro   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.
    Smartyhttps://www.smarty.net/smarty*.tplzapplication/x-smartyrh   [^{]+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}   rvrn   rn   ro   r      s    zSmartyLexer.analyse_textN)"r   r   r   r   r   r   r   	filenamesr   r   r   	MULTILINEDOTALLflagsr!   r   r   rz   r   r   r   Functionr   Variabler   r   Constantr    r   DoubleSingle	Attributer~   r   rn   rn   rn   ro   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.
    Velocityhttps://velocity.apache.org/velocity*.vm*.fhtmlrh   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   rn   rn   ro   r     s    zVelocityLexer.analyse_textN)"r   r   r   r   r   r   r   r   r   r   r   r   r   
identifierr!   r   r   rz   r   r   r   r   r   r   r   r   r   r   r   r    r   r   r~   r   rn   rn   rn   ro   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+velocityrh   *.htmlr   ztext/html+velocityr   c                    s   t  jttf| d S N)superrk   r   rS   rl   rm   	__class__rn   ro   rk   /  s    zVelocityHtmlLexer.__init__)r   r   r   r   r   r   r   alias_filenamesr   r   rk   __classcell__rn   rn   r   ro   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+velocityrh   *.xmlr   zapplication/xml+velocityr   c                    s   t  jttf| d S r   )r   rk   r   rS   r   r   rn   ro   rk   A  s    zVelocityXmlLexer.__init__c                 C   s"   t | d }t| r|d7 }|S Nr   r   )rS   r   r$   r   rn   rn   ro   r   D  s    zVelocityXmlLexer.analyse_textr   r   r   r   r   r   r   r   r   r   rk   r   r   rn   rn   r   ro   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/Jinjadjangojinjazapplication/x-django-templatingzapplication/x-jinja5https://www.djangoproject.com/documentation/templatesrh   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   rn   rn   ro   r     s    zDjangoLexer.analyse_textN)!r   r   r   r   r   r   r   r   r   r   r   Sr   r!   r   rz   r   r   r   r   r   r   PseudoBuiltinr   r   r   r   r    r   r   r~   r   rn   rn   rn   ro   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`.
    Myghtyhttp://www.myghty.org/myghtyz*.myt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~   rn   rn   rn   ro   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   rk   r   r=   r   r   rn   ro   rk     s    zMyghtyHtmlLexer.__init__r   r   r   r   r   r   r   r   r   rk   r   rn   rn   r   ro   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   rk   r   r=   r   r   rn   ro   rk     s    zMyghtyXmlLexer.__init__r   rn   rn   r   ro   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   rk   r   r=   r   r   rn   ro   rk     s    zMyghtyJavascriptLexer.__init__r   rn   rn   r   ro   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   rk   r   r=   r   r   rn   ro   rk     s    zMyghtyCssLexer.__init__r   rn   rn   r   ro   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.
    Masonzhttp://www.masonhq.com/masonz*.mz*.mhtmlz*.mcz*.miautohandler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}   resultrn   rn   ro   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   rn   rn   rn   ro   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`.
    Makohttp://www.makotemplates.org/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   rs   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   rz   r   r!   r   r   r   r   r   r   r   r   r   r   r~   rn   rn   rn   ro   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   rk   r   rC   r   r   rn   ro   rk     s    zMakoHtmlLexer.__init__r   rn   rn   r   ro   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   rk   r   rC   r   r   rn   ro   rk     s    zMakoXmlLexer.__init__r   rn   rn   r   ro   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   rk   r   rC   r   r   rn   ro   rk     s    zMakoJavascriptLexer.__init__r   rn   rn   r   ro   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   rk   r   rC   r   r   rn   ro   rk     s    zMakoCssLexer.__init__r   rn   rn   r   ro   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   rm   r{   r"   r   r   rz   )rl   r}   Zpylexerpostype_valuern   rn   ro   r{     s
    z)CheetahPythonLexer.get_tokens_unprocessedN)r   r   r   r   r{   rn   rn   rn   ro   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/
    Cheetahhttp://www.cheetahtemplate.org/cheetahspitfirez*.tmplz*.sptzapplication/x-cheetahzapplication/x-spitfirerh   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   rz   r   r   r!   r   r~   rn   rn   rn   ro   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+spitfirehtmlcheetahztext/html+cheetahztext/html+spitfirer  rh   c                    s   t  jttf| d S r   )r   rk   r   rI   r   r   rn   ro   rk     s    zCheetahHtmlLexer.__init__r   rn   rn   r   ro   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  rh   c                    s   t  jttf| d S r   )r   rk   r   rI   r   r   rn   ro   rk   "  s    zCheetahXmlLexer.__init__r   rn   rn   r   ro   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  rh   c                    s   t  jttf| d S r   )r   rk   r   rI   r   r   rn   ro   rk   8  s    zCheetahJavascriptLexer.__init__r   rn   rn   r   ro   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/
genshitextzapplication/x-genshi-textztext/x-genshirh   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   rz   r   r   r   r   r   r   r~   rn   rn   rn   ro   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   rz   r   r   r   r   r   r   r   r   r   r~   rn   rn   rn   ro   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+kidrh   r   *.htm*.xhtmlztext/html+genshir  c                    s   t  jttf| d S r   )r   rk   r   r  r   r   rn   ro   rk     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   rn   rn   ro   r     s    zHtmlGenshiLexer.analyse_textr   rn   rn   r   ro   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.
    Genshigenshikidz
xml+genshizxml+kidz*.kidrh   r   zapplication/x-genshizapplication/x-kidr  c                    s   t  jttf| d S r   )r   rk   r   r  r   r   rn   ro   rk     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   rn   rn   ro   r     s    zGenshiLexer.analyse_textr   r   r   r   r   r   r   r   r   r   r   rk   r   r   rn   rn   r   ro   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+genshirh   *.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   rk   r   r:   r   r   rn   ro   rk     s    zJavascriptGenshiLexer.__init__c                 C   s   t | d S N皙?r8   r   r   rn   rn   ro   r     s    z"JavascriptGenshiLexer.analyse_textr   rn   rn   r   ro   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+genshirh   *.cssztext/css+genshir  c                    s   t  jttf| d S r   )r   rk   r   r:   r   r   rn   ro   rk     s    zCssGenshiLexer.__init__c                 C   s   t | d S r  r   r   rn   rn   ro   r     s    zCssGenshiLexer.analyse_textr   rn   rn   r   ro   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.
    RHTMLrhtmlzhtml+erbz	html+rubyz*.rhtmlrh   r   r  r  ztext/html+rubyrf   c                    s   t  jttf| d S r   )r   rk   r   r)   r   r   rn   ro   rk     s    zRhtmlLexer.__init__c                 C   s"   t | d }t| r|d7 }|S Nr   g      ?)r)   r   r#   r   rn   rn   ro   r     s    zRhtmlLexer.analyse_textr  rn   rn   r   ro   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+erbrh   r   zapplication/xml+rubyrf   c                    s   t  jttf| d S r   )r   rk   r   r)   r   r   rn   ro   rk   %  s    zXmlErbLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r)   r   r$   r   rn   rn   ro   r   (  s    zXmlErbLexer.analyse_textr   rn   rn   r   ro   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+erbrh   r!  ztext/css+rubyrf   c                    s   t  jttf| d S r   )r   rk   r   r)   r   r   rn   ro   rk   ;  s    zCssErbLexer.__init__c                 C   s   t | d S r  r)   r   r   rn   rn   ro   r   >  s    zCssErbLexer.analyse_textr   rn   rn   r   ro   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+erbrh   r  zapplication/x-javascript+rubyztext/x-javascript+rubyztext/javascript+rubyrf   c                    s   t  jttf| d S r   )r   rk   r   r)   r   r   rn   ro   rk   Q  s    zJavascriptErbLexer.__init__c                 C   s   t | d S r  r%  r   rn   rn   ro   r   T  s    zJavascriptErbLexer.analyse_textr   rn   rn   r   ro   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*.phtmlrh   *.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   rk   r   r   r   r   rn   ro   rk   k  s    zHtmlPhpLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r$  )r   r   r#   r   rn   rn   ro   r   n  s    zHtmlPhpLexer.analyse_textr  rn   rn   r   ro   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+phprh   r   r&  r'  zapplication/xml+phpr(  c                    s   t  jttf| d S r   )r   rk   r   r   r   r   rn   ro   rk     s    zXmlPhpLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r   r   r$   r   rn   rn   ro   r     s    zXmlPhpLexer.analyse_textr   rn   rn   r   ro   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+phprh   r!  ztext/css+phpr(  c                    s   t  jttf| d S r   )r   rk   r   r   r   r   rn   ro   rk     s    zCssPhpLexer.__init__c                 C   s   t | d S r  r   r   r   rn   rn   ro   r     s    zCssPhpLexer.analyse_textr   rn   rn   r   ro   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+phprh   r  zapplication/x-javascript+phpztext/x-javascript+phpztext/javascript+phpr(  c                    s   t  jttf| d S r   )r   rk   r   r   r   r   rn   ro   rk     s    zJavascriptPhpLexer.__init__c                 C   s
   t | S r   r)  r   rn   rn   ro   r     s    zJavascriptPhpLexer.analyse_textr   rn   rn   r   ro   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+smartyrh   r   r  r  r   ztext/html+smartyr   c                    s   t  jttf| d S r   )r   rk   r   r.   r   r   rn   ro   rk     s    zHtmlSmartyLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r$  )r.   r   r#   r   rn   rn   ro   r     s    zHtmlSmartyLexer.analyse_textr   rn   rn   r   ro   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+smartyrh   r   r   zapplication/xml+smartyr   c                    s   t  jttf| d S r   )r   rk   r   r.   r   r   rn   ro   rk     s    zXmlSmartyLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r.   r   r$   r   rn   rn   ro   r     s    zXmlSmartyLexer.analyse_textr   rn   rn   r   ro   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+smartyrh   r!  r   ztext/css+smartyr   c                    s   t  jttf| d S r   )r   rk   r   r.   r   r   rn   ro   rk     s    zCssSmartyLexer.__init__c                 C   s   t | d S r  r.   r   r   rn   rn   ro   r     s    zCssSmartyLexer.analyse_textr   rn   rn   r   ro   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+smartyrh   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   rk   r   r.   r   r   rn   ro   rk     s    zJavascriptSmartyLexer.__init__c                 C   s   t | d S r  r*  r   rn   rn   ro   r   
  s    z"JavascriptSmartyLexer.analyse_textr   rn   rn   r   ro   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+jinja
htmldjangoz	*.html.j2z*.htm.j2z
*.xhtml.j2z*.html.jinja2z*.htm.jinja2z*.xhtml.jinja2rh   r   r  r  ztext/html+djangoztext/html+jinjar   c                    s   t  jttf| d S r   )r   rk   r   r3   r   r   rn   ro   rk     s    zHtmlDjangoLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r$  )r3   r   r#   r   rn   rn   ro   r   !  s    zHtmlDjangoLexer.analyse_textr  rn   rn   r   ro   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.jinja2rh   r   zapplication/xml+djangozapplication/xml+jinjar   c                    s   t  jttf| d S r   )r   rk   r   r3   r   r   rn   ro   rk   6  s    zXmlDjangoLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r3   r   r$   r   rn   rn   ro   r   9  s    zXmlDjangoLexer.analyse_textr  rn   rn   r   ro   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.jinja2rh   r!  ztext/css+djangoztext/css+jinjar   c                    s   t  jttf| d S r   )r   rk   r   r3   r   r   rn   ro   rk   N  s    zCssDjangoLexer.__init__c                 C   s   t | d S r  r3   r   r   rn   rn   ro   r   Q  s    zCssDjangoLexer.analyse_textr  rn   rn   r   ro   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.jinja2rh   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   rk   r   r3   r   r   rn   ro   rk   i  s    zJavascriptDjangoLexer.__init__c                 C   s   t | d S r  r,  r   rn   rn   ro   r   l  s    z"JavascriptDjangoLexer.analyse_textr  rn   rn   r   ro   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).*?>[^<]+<rt   r   [\w\W]+?(?=%>|\Z)r   r/  N)	r   r   r   r   r   r!   r   r
   r~   rn   rn   rn   ro   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 Pagejspz*.jspzapplication/x-jspz.https://projects.eclipse.org/projects/ee4j.jspr   c                    s   t  jttf| d S r   r   rk   r   r-  r   r   rn   ro   rk     s    zJspLexer.__init__c                 C   s:   t | d }t| r|d7 }d| kr6d| kr6|d7 }|S Nr   r   rs   rt   r   )r
   r   r$   r   rn   rn   ro   r     s    zJspLexer.analyse_textr   r   r   r   r   r   r   r   r   r   rk   r   r   rn   rn   r   ro   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.
    Evoque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$evoquerp   Nrn   r   rn   rn   ro   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   rn   rn   rn   ro   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   rk   r   rM   r   r   rn   ro   rk     s    zEvoqueHtmlLexer.__init__c                 C   s
   t | S r   rM   r   r   rn   rn   ro   r     s    zEvoqueHtmlLexer.analyse_textr   r   r   r   r   r   r   r   r   r   rk   r   r   rn   rn   r   ro   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   rk   r   rM   r   r   rn   ro   rk     s    zEvoqueXmlLexer.__init__c                 C   s
   t | S r   r>  r   rn   rn   ro   r     s    zEvoqueXmlLexer.analyse_textr?  rn   rn   r   ro   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
    cfstatementcfs5https://www.adobe.com/products/coldfusion-family.htmlrh   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   rC  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~   rn   rn   rn   ro   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cfrB  r0  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   rH  rJ  rI  N)r   r   r   r   r   r   r   r   r   r!   r   r   r   r   r   r   r   rP   r   r~   rn   rn   rn   ro   rF  2  sD   




rF  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 HTMLcfmz*.cfmz*.cfmlzapplication/x-coldfusionrB  rh   c                    s   t  jttf| d S r   )r   rk   r   rF  r   r   rn   ro   rk   l  s    zColdfusionHtmlLexer.__init__r   r   r   r   r   r   r   r   r   r   rk   r   rn   rn   r   ro   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 CFCcfcz*.cfcrB  2.0c                    s   t  jttf| d S r   )r   rk   rQ   rP   r   r   rn   ro   rk   {  s    zColdfusionCFCLexer.__init__rL  rn   rn   r   ro   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 Pagesspz*.sspzapplication/x-sspz"https://scalate.github.io/scalate/r   c                    s   t  jttf| d S r   r5  r   r   rn   ro   rk     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  rs   rt   r   )r   r   r$   r   rn   rn   ro   r     s    zSspLexer.analyse_textr7  rn   rn   r   ro   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/  r0  r1  rt   r   r2  r3  N)	r   r   r   r   r   r!   r   r   r~   rn   rn   rn   ro   rP    s   	
rP  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.
    Teateaz*.teaz
text/x-teaz$https://github.com/teatrove/teatrovez1.5c                    s   t  jttf| d S r   )r   rk   r   rP  r   r   rn   ro   rk     s    zTeaTemplateLexer.__init__c                 C   s:   t | d }t| r|d7 }d| kr6d| kr6|d7 }|S r6  )r   r   r$   r   rn   rn   ro   r     s    zTeaTemplateLexer.analyse_textr7  rn   rn   r   ro   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   rk   r   r   r   r   rn   ro   rk     s    zLassoHtmlLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r$  )r   r   r#   r   rn   rn   ro   r     s    zLassoHtmlLexer.analyse_textr   rn   rn   r   ro   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+lassorS  r   rT  rU  rV  rW  rX  zapplication/xml+lassorY  c                    s   t  jttf| d S r   )r   rk   r   r   r   r   rn   ro   rk     s    zLassoXmlLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r   r   r$   r   rn   rn   ro   r     s    zLassoXmlLexer.analyse_textr   rn   rn   r   ro   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+lassorS  r!  ztext/css+lassorY  c                    s   d|d< t  jttf| d S NTZrequiredelimiters)r   rk   r   r   r   r   rn   ro   rk     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   rn   rn   ro   r   
  s    zLassoCssLexer.analyse_textr   rn   rn   r   ro   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+lassorS  r  zapplication/x-javascript+lassoztext/x-javascript+lassoztext/javascript+lassorY  c                    s   d|d< t  jttf| d S rZ  )r   rk   r   r   r   r   rn   ro   rk   "  s    zLassoJavascriptLexer.__init__c                 C   s   t | d }|S r  )r   r   r   rn   rn   ro   r   &  s    z!LassoJavascriptLexer.analyse_textr   rn   rn   r   ro   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.
    
Handlebarshttps://handlebarsjs.com/
handlebarsrN  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   r_  r   r`  N)r   r   r   r   r   r   r   r   r!   r   r   Specialr   rz   r    r   r   r   r   r   r   r   r   r   r   r   r   r   r~   rn   rn   rn   ro   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-templater\  rN  c                    s   t  jttf| d S r   )r   rk   r   r\   r   r   rn   ro   rk     s    zHandlebarsHtmlLexer.__init__rL  rn   rn   r   ro   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saltslsz*.slsz	*.yaml.j2z*.yml.j2z*.yaml.jinja2z*.yml.jinja2ztext/x-yaml+jinjaz
text/x-sls!https://jinja.palletsprojects.comrN  c                    s   t  jttf| d S r   )r   rk   r   r3   r   r   rn   ro   rk     s    zYamlJinjaLexer.__init__rL  rn   rn   r   ro   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.
    liquidz.https://www.rubydoc.info/github/Shopify/liquidz*.liquidrN  r   z
(\{%)(\s*)tag-or-blockz(\{\{)(\s*)([^\s}]+)r`  ra  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*)(\}\})rC  numberkeyword,param-markupr   variable-param-markupz\b(false|true)\br   z(?<=\w)\.(?=\w)z'[^']*'z"[^"]*"z\d+\.\d+rD  z[ \t]+z (\{%)(\s*)(endcomment)(\s*)(%\})z(\{%)(\s*)(endraw)(\s*)(%\}))r   rg  rh  rp  rq  ri  zgeneric-valueoperatorrr  rj  rt  rx  rs  ry  rn  rm  rv  r   rC  ru  r`  rk  r<  rl  )#r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Reservedr   r   r   r   r   r   Wordr   r   r   r   r   r   r    FloatIntegerr   r~   rn   rn   rn   ro   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.
    Twigtwigzapplication/x-twighttps://twig.symfony.comrN  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   rz   r   r   r   r   r   r   r   r   r   r    r   r   r   r   r   r~   rn   rn   rn   ro   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+twigr  rN  c                    s   t  jttf| d S r   )r   rk   r   r`   r   r   rn   ro   rk     s    zTwigHtmlLexer.__init__rL  rn   rn   r   ro   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.
    Angular2(https://angular.io/guide/template-syntaxng2z2.1z	[^{([*#]+r^  ngExpressionz&([([]+)([\w:.-]+)([\])]+)(\s*)(=)(\s*)r   z([([]+)([\w:.-]+)([\])]+)(\s*)z([*#])([\w:.-]+)(\s*)(=)(\s*)z([*#])([\w:.-]+)(\s*)z\s+(\|\s+)?ro  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   r  r   N)r   r   r   r   r   r   r   r   r!   r   r   rz   r   r   r   r   r   r   Booleanr   r   r    r   r~   rn   rn   rn   ro   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*.ng2r  rN  c                    s   t  jttf| d S r   )r   rk   r   rb   r   r   rn   ro   rk   	  s    zAngular2HtmlLexer.__init__)r   r   r   r   r   r   r   r   r   rk   r   rn   rn   r   ro   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.jinja2re  z2.13c                    s   t  jttf| d S r   )r   rk   r   r3   r   r   rn   ro   rk   %	  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   rn   rn   ro   r   (	  s    zSqlJinjaLexer.analyse_text)r   r   r   r   r   r   r   r   r   rk   r   r   rn   rn   r   ro   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   rF  rQ   rR   rV   rP  rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   rn   rn   rn   ro   <module>   s$  
,8                                         `:TU.6B-$@93/L NS>