U
    luf                 @   @   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-2023 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                   @   sJ   e Zd ZdZdZdZdgZdg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ERBzhttps://github.com/ruby/erbZerbzapplication/x-ruby-templatingz*(<%%|%%>|<%=|<%#|<%-|<%|-%>|%>|^%[^%].*?$)c                 K   s*   ddl m} |f || _tj| f| d S )Nr   )	RubyLexer)Zpygments.lexers.rubyre   
ruby_lexerr   __init__)selfoptionsre    rj   =/tmp/pip-unpacked-wheel-7eq1ciah/pygments/lexers/templates.pyrg   D   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   Preprocrf   get_tokens_unprocessedr   
IndexError)rh   texttokensstateidxvaltagdataZr_idxZr_tokenZr_valuerj   rj   rk   rw   I   sf    





zErbLexer.get_tokens_unprocessedc                 C   s   d| krd| krdS d S )Nro   rp   皙?rj   ry   rj   rj   rk   analyse_text   s    zErbLexer.analyse_textN)__name__
__module____qualname____doc__nameurlaliases	mimetypesrecompileMrq   rg   rw   r   rj   rj   rj   rk   r)   3   s   	Dc                   @   s   e Zd ZdZdZdZdgZdgZdg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Smartyzhttps://www.smarty.net/smarty*.tplzapplication/x-smarty[^{]+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ry   rvrj   rj   rk   r      s    zSmartyLexer.analyse_textN)!r   r   r   r   r   r   r   	filenamesr   r   	MULTILINEDOTALLflagsr!   r   r   rv   r   r   r   Functionr   Variabler   r   Constantr    r   DoubleSingle	Attributerz   r   rj   rj   rj   rk   r.      sL    


c                   @   s  e Zd ZdZdZdZdgZddg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Velocityzhttps://velocity.apache.org/Zvelocity*.vm*.fhtmlr   z[^{#$]+z(#)(\*.*?\*)(#)z
(##)(.*?$)z(#\{?)(z)(\}?)(\s?\()directiveparamsz)(\}|\b)z\$!?\{?variablez\(
funcparamsz(\.)()r   r   r   z=(&&|\|\||==?|!=?|[-<>+*%&|^/])|\b(eq|ne|gt|lt|ge|le|not|in)\bz\[rangeoperatorz\bz\.\.z\]r   z[,:]r   r   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   rj   rj   rk   r     s    zVelocityLexer.analyse_textN)!r   r   r   r   r   r   r   r   r   r   r   r   
identifierr!   r   r   rv   r   r   r   r   r   r   r   r   r   r   r   r    r   r   rz   r   rj   rj   rj   rk   rS      sx   




 	4c                       s8   e Zd ZdZdZdgZddgZdgZ fddZ  Z	S )	rT   za
    Subclass of the `VelocityLexer` that highlights unlexed data
    with the `HtmlLexer`.

    zHTML+Velocityzhtml+velocity*.htmlr   ztext/html+velocityc                    s   t  jttf| d S N)superrg   r   rS   rh   ri   	__class__rj   rk   rg   *  s    zVelocityHtmlLexer.__init__)
r   r   r   r   r   r   alias_filenamesr   rg   __classcell__rj   rj   r   rk   rT     s   c                       s@   e Zd ZdZdZdgZddgZdg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+velocity*.xmlr   zapplication/xml+velocityc                    s   t  jttf| d S r   )r   rg   r   rS   r   r   rj   rk   rg   :  s    zVelocityXmlLexer.__init__c                 C   s"   t | d }t| r|d7 }|S Nr   r   )rS   r   r$   r   rj   rj   rk   r   =  s    zVelocityXmlLexer.analyse_textr   r   r   r   r   r   r   r   rg   r   r   rj   rj   r   rk   rU   .  s   c                   @   s|  e Zd ZdZdZddgZddg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 <http://www.djangoproject.com/documentation/templates/>`_
    and `jinja <https://jinja.pocoo.org/jinja/>`_ 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-jinjar   \{\{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   rj   rj   rk   r     s    zDjangoLexer.analyse_textN)r   r   r   r   r   r   r   r   r   Sr   r!   r   rv   r   r   r   r   r   r   PseudoBuiltinr   r   r   r   r    r   r   rz   r   rj   rj   rj   rk   r3   D  s   
         9c                   @   s   e Zd ZdZdZdZdgZddgZdg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=   z
    Generic myghty templates lexer. Code that isn't Myghty
    markup is yielded as `Token.Other`.

    .. versionadded:: 0.6
    ZMyghtyzhttp://www.myghty.org/Zmyghtyz*.mytZautodelegatezapplication/x-myghtyr   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   Tagr   r   r   r   r   r!   r   rz   rj   rj   rj   rk   r=     sN     	c                       s0   e Zd ZdZdZdgZdgZ fddZ  ZS )r>   zy
    Subclass of the `MyghtyLexer` that highlights unlexed data
    with the `HtmlLexer`.

    .. versionadded:: 0.6
    zHTML+Myghtyzhtml+myghtyztext/html+myghtyc                    s   t  jttf| d S r   )r   rg   r   r=   r   r   rj   rk   rg     s    zMyghtyHtmlLexer.__init__	r   r   r   r   r   r   r   rg   r   rj   rj   r   rk   r>     s
   c                       s0   e Zd ZdZdZdgZdgZ fddZ  ZS )r?   zx
    Subclass of the `MyghtyLexer` that highlights unlexed data
    with the `XmlLexer`.

    .. versionadded:: 0.6
    z
XML+Myghtyz
xml+myghtyzapplication/xml+myghtyc                    s   t  jttf| d S r   )r   rg   r   r=   r   r   rj   rk   rg     s    zMyghtyXmlLexer.__init__r   rj   rj   r   rk   r?     s
   c                       s6   e Zd ZdZdZddgZdddgZ fdd	Z  ZS )
rA   z
    Subclass of the `MyghtyLexer` that highlights unlexed data
    with the `JavascriptLexer`.

    .. versionadded:: 0.6
    zJavaScript+Myghtyzjavascript+myghtyz	js+myghtyzapplication/x-javascript+myghtyztext/x-javascript+myghtyztext/javascript+mygthyc                    s   t  jttf| d S r   )r   rg   r   r=   r   r   rj   rk   rg     s    zMyghtyJavascriptLexer.__init__r   rj   rj   r   rk   rA     s   c                       s0   e Zd ZdZdZdgZdgZ fddZ  ZS )r@   zx
    Subclass of the `MyghtyLexer` that highlights unlexed data
    with the `CssLexer`.

    .. versionadded:: 0.6
    z
CSS+Myghtyz
css+myghtyztext/css+myghtyc                    s   t  jttf| d S r   )r   rg   r   r=   r   r   rj   rk   rg     s    zMyghtyCssLexer.__init__r   rj   rj   r   rk   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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   z
    Generic mason templates lexer. Stolen from Myghty lexer. Code that isn't
    Mason markup is HTML.

    .. versionadded:: 1.4
    ZMasonzhttp://www.masonhq.com/Zmasonz*.mz*.mhtmlz*.mcz*.miZautohandlerZdhandlerzapplication/x-masonr   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   )ry   resultrj   rj   rk   r   6  s    zMasonLexer.analyse_text)r   r   r   r   r   r   r   r   r   r   r   r   r   r   	Multiliner   r   r   r	   r!   r   r   rz   r   rj   rj   rj   rk   rB     sP    	!c                   @   s<  e Zd ZdZdZdZdgZdgZdg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   z
    Generic mako templates lexer. Code that isn't Mako
    markup is yielded as `Token.Other`.

    .. versionadded:: 0.7
    ZMakozhttp://www.makotemplates.org/Zmakoz*.maozapplication/x-makoz(\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   ro   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   rv   r   r!   r   r   r   r   r   r   r   r   r   r   rz   rj   rj   rj   rk   rC   ?  sd    
"
c                       s0   e Zd ZdZdZdgZdgZ fddZ  ZS )rD   zw
    Subclass of the `MakoLexer` that highlights unlexed data
    with the `HtmlLexer`.

    .. versionadded:: 0.7
    z	HTML+Makoz	html+makoztext/html+makoc                    s   t  jttf| d S r   )r   rg   r   rC   r   r   rj   rk   rg     s    zMakoHtmlLexer.__init__r   rj   rj   r   rk   rD     s
   c                       s0   e Zd ZdZdZdgZdgZ fddZ  ZS )rE   zv
    Subclass of the `MakoLexer` that highlights unlexed data
    with the `XmlLexer`.

    .. versionadded:: 0.7
    zXML+Makozxml+makozapplication/xml+makoc                    s   t  jttf| d S r   )r   rg   r   rC   r   r   rj   rk   rg     s    zMakoXmlLexer.__init__r   rj   rj   r   rk   rE     s
   c                       s6   e Zd ZdZdZddgZdddgZ fdd	Z  ZS )
rF   z}
    Subclass of the `MakoLexer` that highlights unlexed data
    with the `JavascriptLexer`.

    .. versionadded:: 0.7
    zJavaScript+Makozjavascript+makozjs+makozapplication/x-javascript+makoztext/x-javascript+makoztext/javascript+makoc                    s   t  jttf| d S r   )r   rg   r   rC   r   r   rj   rk   rg     s    zMakoJavascriptLexer.__init__r   rj   rj   r   rk   rF     s   c                       s0   e Zd ZdZdZdgZdgZ fddZ  ZS )rG   zv
    Subclass of the `MakoLexer` that highlights unlexed data
    with the `CssLexer`.

    .. versionadded:: 0.7
    zCSS+Makozcss+makoztext/css+makoc                    s   t  jttf| d S r   )r   rg   r   rC   r   r   rj   rk   rg     s    zMakoCssLexer.__init__r   rj   rj   r   rk   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   ri   rw   r"   r   r   rv   )rh   ry   Zpylexerpostype_valuerj   rj   rk   rw     s
    z)CheetahPythonLexer.get_tokens_unprocessedN)r   r   r   r   rw   rj   rj   rj   rk   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
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Cheetahzhttp://www.cheetahtemplate.org/ZcheetahZspitfirez*.tmplz*.sptzapplication/x-cheetahzapplication/x-spitfirer   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   rv   r   r   r!   r   rz   rj   rj   rj   rk   rI     s@   c                       s6   e Zd ZdZdZdddgZddg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+spitfirec                    s   t  jttf| d S r   )r   rg   r   rI   r   r   rj   rk   rg   	  s    zCheetahHtmlLexer.__init__r   rj   rj   r   rk   rJ     s
   
c                       s4   e Zd ZdZdZddgZddg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+spitfirec                    s   t  jttf| d S r   )r   rg   r   rI   r   r   rj   rk   rg     s    zCheetahXmlLexer.__init__r   rj   rj   r   rk   rK     s
   c                       s@   e Zd ZdZdZddddgZddd	d
ddg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+spitfirec                    s   t  jttf| d S r   )r   rg   r   rI   r   r   rj   rk   rg   +  s    zCheetahJavascriptLexer.__init__r   rj   rj   r   rk   rL     s    c                
   @   s   e Zd ZdZdZdZdgZddg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 Textzhttp://genshi.edgewall.org/Z
genshitextzapplication/x-genshi-textztext/x-genshiz[^#$\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   rv   r   r   r   r   r   r   rz   rj   rj   rj   rk   r:   /  s8    	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   rv   r   r   r   r   r   r   r   r   r   rz   rj   rj   rj   rk   r   R  s`   






r   c                       sD   e Zd ZdZdZddgZdddgZdgZ fd	d
Zdd Z	  Z
S )r9   z
    A lexer that highlights `genshi <http://genshi.edgewall.org/>`_ and
    `kid <http://kid-templating.org/>`_ kid HTML templates.
    zHTML+Genshizhtml+genshizhtml+kidr   *.htm*.xhtmlztext/html+genshic                    s   t  jttf| d S r   )r   rg   r   r   r   r   rj   rk   rg     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   rj   rj   rk   r     s    zHtmlGenshiLexer.analyse_textr   rj   rj   r   rk   r9     s   
c                       sL   e Zd ZdZdZddddgZdgZdgZd	d
gZ fddZ	dd Z
  ZS )r8   z
    A lexer that highlights `genshi <http://genshi.edgewall.org/>`_ and
    `kid <http://kid-templating.org/>`_ kid XML templates.
    ZGenshigenshiZkidz
xml+genshizxml+kidz*.kidr   zapplication/x-genshizapplication/x-kidc                    s   t  jttf| d S r   )r   rg   r   r   r   r   rj   rk   rg     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   rj   rj   rk   r     s    zGenshiLexer.analyse_textr   r   r   r   r   r   r   r   r   rg   r   r   rj   rj   r   rk   r8     s   c                       sH   e Zd ZdZdZddddgZdgZdd	d
g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+genshi*.jszapplication/x-javascript+genshiztext/x-javascript+genshiztext/javascript+genshic                    s   t  jttf| d S r   )r   rg   r   r:   r   r   rj   rk   rg     s    zJavascriptGenshiLexer.__init__c                 C   s   t | d S N皙?r8   r   r   rj   rj   rk   r     s    z"JavascriptGenshiLexer.analyse_textr   rj   rj   r   rk   r<     s   c                       s@   e Zd ZdZdZddgZdgZdg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+genshi*.cssztext/css+genshic                    s   t  jttf| d S r   )r   rg   r   r:   r   r   rj   rk   rg     s    zCssGenshiLexer.__init__c                 C   s   t | d S r   r   r   rj   rj   rk   r     s    zCssGenshiLexer.analyse_textr   rj   rj   r   rk   r;     s   c                       sL   e Zd ZdZdZdddgZdgZddd	gZd
g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*.rhtmlr   r   r   ztext/html+rubyc                    s   t  jttf| d S r   )r   rg   r   r)   r   r   rj   rk   rg     s    zRhtmlLexer.__init__c                 C   s"   t | d }t| r|d7 }|S Nr   g      ?)r)   r   r#   r   rj   rj   rk   r     s    zRhtmlLexer.analyse_textr   rj   rj   r   rk   r*     s   

c                       s@   e Zd ZdZdZddgZdgZdg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+erbr   zapplication/xml+rubyc                    s   t  jttf| d S r   )r   rg   r   r)   r   r   rj   rk   rg   
  s    zXmlErbLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r)   r   r$   r   rj   rj   rk   r     s    zXmlErbLexer.analyse_textr   rj   rj   r   rk   r+     s   c                       s@   e Zd ZdZdZddgZdgZdg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+erbr   ztext/css+rubyc                    s   t  jttf| d S r   )r   rg   r   r)   r   r   rj   rk   rg     s    zCssErbLexer.__init__c                 C   s   t | d S r   r)   r   r   rj   rj   rk   r   !  s    zCssErbLexer.analyse_textr   rj   rj   r   rk   r,     s   c                       sH   e Zd ZdZdZddddgZdgZdd	d
g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+erbr   zapplication/x-javascript+rubyztext/x-javascript+rubyztext/javascript+rubyc                    s   t  jttf| d S r   )r   rg   r   r)   r   r   rj   rk   rg   2  s    zJavascriptErbLexer.__init__c                 C   s   t | d S r   r   r   rj   rj   rk   r   5  s    zJavascriptErbLexer.analyse_textr   rj   rj   r   rk   r-   %  s   c                       sT   e Zd ZdZdZdgZdgZddddd	gZd
ddddg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*.phtml*.phpr   r   r   
*.php[345]zapplication/x-phpzapplication/x-httpd-phpzapplication/x-httpd-php3zapplication/x-httpd-php4zapplication/x-httpd-php5c                    s   t  jttf| d S r   )r   rg   r   r   r   r   rj   rk   rg   I  s    zHtmlPhpLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r   r   r#   r   rj   rj   rk   r   L  s    zHtmlPhpLexer.analyse_textr   rj   rj   r   rk   r%   9  s     c                       sB   e Zd ZdZdZdgZdddgZdg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+phpr   r   r   zapplication/xml+phpc                    s   t  jttf| d S r   )r   rg   r   r   r   r   rj   rk   rg   ]  s    zXmlPhpLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r   r   r$   r   rj   rj   rk   r   `  s    zXmlPhpLexer.analyse_textr   rj   rj   r   rk   r&   S  s   
c                       s>   e Zd ZdZdZdgZdgZdg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+phpr   ztext/css+phpc                    s   t  jttf| d S r   )r   rg   r   r   r   r   rj   rk   rg   q  s    zCssPhpLexer.__init__c                 C   s   t | d S r   r   r   r   rj   rj   rk   r   t  s    zCssPhpLexer.analyse_textr   rj   rj   r   rk   r'   g  s   c                       sD   e Zd ZdZdZddgZdgZdddg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+phpr   zapplication/x-javascript+phpztext/x-javascript+phpztext/javascript+phpc                    s   t  jttf| d S r   )r   rg   r   r   r   r   rj   rk   rg     s    zJavascriptPhpLexer.__init__c                 C   s
   t | S r   r  r   rj   rj   rk   r     s    zJavascriptPhpLexer.analyse_textr   rj   rj   r   rk   r(   x  s   c                       sD   e Zd ZdZdZdgZddddgZdg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+smartyr   r   r   r   ztext/html+smartyc                    s   t  jttf| d S r   )r   rg   r   r.   r   r   rj   rk   rg     s    zHtmlSmartyLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r.   r   r#   r   rj   rj   rk   r     s    zHtmlSmartyLexer.analyse_textr   rj   rj   r   rk   r/     s   c                       s@   e Zd ZdZdZdgZddgZdg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+smartyr   r   zapplication/xml+smartyc                    s   t  jttf| d S r   )r   rg   r   r.   r   r   rj   rk   rg     s    zXmlSmartyLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r.   r   r$   r   rj   rj   rk   r     s    zXmlSmartyLexer.analyse_textr   rj   rj   r   rk   r0     s   c                       s@   e Zd ZdZdZdgZddgZdg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+smartyr   r   ztext/css+smartyc                    s   t  jttf| d S r   )r   rg   r   r.   r   r   rj   rk   rg     s    zCssSmartyLexer.__init__c                 C   s   t | d S r   r.   r   r   rj   rj   rk   r     s    zCssSmartyLexer.analyse_textr   rj   rj   r   rk   r1     s   c                       sF   e Zd ZdZdZddgZddgZddd	g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+smartyr   r   zapplication/x-javascript+smartyztext/x-javascript+smartyztext/javascript+smartyc                    s   t  jttf| d S r   )r   rg   r   r.   r   r   rj   rk   rg     s    zJavascriptSmartyLexer.__init__c                 C   s   t | d S r   r  r   rj   rj   rk   r     s    z"JavascriptSmartyLexer.analyse_textr   rj   rj   r   rk   r2     s   c                       sX   e Zd ZdZdZdddgZdddd	d
dgZdddgZddg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.jinja2r   r   r   ztext/html+djangoztext/html+jinjac                    s   t  jttf| d S r   )r   rg   r   r3   r   r   rj   rk   rg     s    zHtmlDjangoLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r3   r   r#   r   rj   rj   rk   r     s    zHtmlDjangoLexer.analyse_textr   rj   rj   r   rk   r4     s   

c                       sJ   e Zd ZdZdZddgZddgZdgZdd	g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.jinja2r   zapplication/xml+djangozapplication/xml+jinjac                    s   t  jttf| d S r   )r   rg   r   r3   r   r   rj   rk   rg     s    zXmlDjangoLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r3   r   r$   r   rj   rj   rk   r     s    zXmlDjangoLexer.analyse_textr   rj   rj   r   rk   r6     s   c                       sJ   e Zd ZdZdZddgZddgZdgZdd	g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.jinja2r   ztext/css+djangoztext/css+jinjac                    s   t  jttf| d S r   )r   rg   r   r3   r   r   rj   rk   rg     s    zCssDjangoLexer.__init__c                 C   s   t | d S r   r3   r   r   rj   rj   rk   r     s    zCssDjangoLexer.analyse_textr   rj   rj   r   rk   r5     s   c                       sV   e Zd ZdZdZddddgZddgZd	gZd
dddddg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.jinja2r   zapplication/x-javascript+djangozapplication/x-javascript+jinjaztext/x-javascript+djangoztext/x-javascript+jinjaztext/javascript+djangoztext/javascript+jinjac                    s   t  jttf| d S r   )r   rg   r   r3   r   r   rj   rk   rg   1  s    zJavascriptDjangoLexer.__init__c                 C   s   t | d S r   r  r   rj   rj   rk   r   4  s    z"JavascriptDjangoLexer.analyse_textr   rj   rj   r   rk   r7     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).*?>[^<]+<rp   r   [\w\W]+?(?=%>|\Z)r   r  N)	r   r   r   r   r   r!   r   r
   rz   rj   rj   rj   rk   r  8  s   		
r  c                       s>   e Zd ZdZdZdgZdgZdgZ fddZdd	 Z	  Z
S )
rH   zA
    Lexer for Java Server Pages.

    .. versionadded:: 0.7
    zJava Server PageZjspz*.jspzapplication/x-jspc                    s   t  jttf| d S r   r   rg   r   r  r   r   rj   rk   rg   \  s    zJspLexer.__init__c                 C   s:   t | d }t| r|d7 }d| kr6d| kr6|d7 }|S Nr   r   ro   rp   r   )r
   r   r$   r   rj   rj   rk   r   _  s    zJspLexer.analyse_textr   r   r   r   r   r   r   r   rg   r   r   rj   rj   r   rk   rH   Q  s   c                   @   s   e Zd ZdZdZdgZdgZdg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   zR
    For files using the Evoque templating system.

    .. versionadded:: 1.1
    ZEvoqueZevoquez*.evoquezapplication/x-evoquez[^#$]+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$evoquerl   Nrj   r   rj   rj   rk   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   rz   r   rj   rj   rj   rk   rM   h  s^   
       

'c                       s>   e Zd ZdZdZdgZdgZdgZ fddZdd	 Z	  Z
S )
rN   zy
    Subclass of the `EvoqueLexer` that highlights unlexed data with the
    `HtmlLexer`.

    .. versionadded:: 1.1
    zHTML+Evoquezhtml+evoquer   ztext/html+evoquec                    s   t  jttf| d S r   )r   rg   r   rM   r   r   rj   rk   rg     s    zEvoqueHtmlLexer.__init__c                 C   s
   t | S r   rM   r   r   rj   rj   rk   r     s    zEvoqueHtmlLexer.analyse_textr  rj   rj   r   rk   rN     s   c                       s>   e Zd ZdZdZdgZdgZdgZ fddZdd	 Z	  Z
S )
rO   zx
    Subclass of the `EvoqueLexer` that highlights unlexed data with the
    `XmlLexer`.

    .. versionadded:: 1.1
    z
XML+Evoquez
xml+evoquer   zapplication/xml+evoquec                    s   t  jttf| d S r   )r   rg   r   rM   r   r   rj   rk   rg     s    zEvoqueXmlLexer.__init__c                 C   s
   t | S r   r  r   rj   rj   rk   r     s    zEvoqueXmlLexer.analyse_textr  rj   rj   r   rk   rO     s   c                   @   s   e Zd ZdZdZdgZg Zg 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cfsz//.*?\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   
IGNORECASEr   r   r   r   r   r   r   r    r   r   r   r   r   r   r   r   ZInterprz   rj   rj   rj   rk   rP     sN   

c                
   @   s   e Zd ZdZdZdgZg Zg 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  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   rP   r   rz   rj   rj   rj   rk   r    sB   




r  c                       s8   e Zd ZdZdZdgZddgZdgZ fddZ  Z	S )	rQ   z#
    Coldfusion markup in html
    zColdfusion HTMLZcfmz*.cfmz*.cfmlzapplication/x-coldfusionc                    s   t  jttf| d S r   )r   rg   r   r  r   r   rj   rk   rg   .  s    zColdfusionHtmlLexer.__init__
r   r   r   r   r   r   r   r   rg   r   rj   rj   r   rk   rQ   %  s   c                       s4   e Zd ZdZdZdgZdgZg Z fddZ  Z	S )rR   zH
    Coldfusion markup/script components

    .. versionadded:: 2.0
    zColdfusion CFCZcfcz*.cfcc                    s   t  jttf| d S r   )r   rg   rQ   rP   r   r   rj   rk   rg   =  s    zColdfusionCFCLexer.__init__r  rj   rj   r   rk   rR   2  s   c                       s>   e Zd ZdZdZdgZdgZdgZ fddZdd	 Z	  Z
S )
rV   zD
    Lexer for Scalate Server Pages.

    .. versionadded:: 1.4
    zScalate Server PageZsspz*.sspzapplication/x-sspc                    s   t  jttf| d S r   r  r   r   rj   rk   rg   L  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   ro   rp   r   )r   r   r$   r   rj   rj   rk   r   O  s    zSspLexer.analyse_textr  rj   rj   r   rk   rV   A  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  rp   r   r	  r
  N)	r   r   r   r   r   r!   r   r   rz   rj   rj   rj   rk   r  Z  s   	
r  c                       s>   e Zd ZdZdZdgZdgZdgZ fddZdd	 Z	  Z
S )
rW   zW
    Lexer for `Tea Templates <http://teatrove.org/>`_.

    .. versionadded:: 1.5
    ZTeaZteaz*.teaz
text/x-teac                    s   t  jttf| d S r   )r   rg   r   r  r   r   rj   rk   rg   {  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   rj   rj   rk   r   ~  s    zTeaTemplateLexer.analyse_textr  rj   rj   r   rk   rW   p  s   c                       sP   e Zd ZdZdZdgZdddddd	d
dgZdddg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.

    .. versionadded:: 1.6
    z
HTML+Lassoz
html+lassor   r   r   *.lasso*.lasso[89]*.incl*.inc*.lasztext/html+lassozapplication/x-httpd-lassozapplication/x-httpd-lasso[89]c                    s   t  jttf| d S r   )r   rg   r   r   r   r   rj   rk   rg     s    zLassoHtmlLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r   r   r#   r   rj   rj   rk   r     s    zLassoHtmlLexer.analyse_textr   rj   rj   r   rk   rX     s   	
  c                       sH   e Zd ZdZdZdgZdddddd	gZd
gZ fddZdd Z	  Z
S )rY   zz
    Subclass of the `LassoLexer` which highlights unhandled data with the
    `XmlLexer`.

    .. versionadded:: 1.6
    z	XML+Lassoz	xml+lassor   r  r  r  r  r  zapplication/xml+lassoc                    s   t  jttf| d S r   )r   rg   r   r   r   r   rj   rk   rg     s    zLassoXmlLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r   r   r$   r   rj   rj   rk   r     s    zLassoXmlLexer.analyse_textr   rj   rj   r   rk   rY     s     c                       s>   e Zd ZdZdZdgZdgZdgZ fddZdd	 Z	  Z
S )
rZ   zz
    Subclass of the `LassoLexer` which highlights unhandled data with the
    `CssLexer`.

    .. versionadded:: 1.6
    z	CSS+Lassoz	css+lassor   ztext/css+lassoc                    s   d|d< t  jttf| d S NTZrequiredelimiters)r   rg   r   r   r   r   rj   rk   rg     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   rj   rj   rk   r     s    zLassoCssLexer.analyse_textr   rj   rj   r   rk   rZ     s   c                       sD   e Zd ZdZdZddgZdgZdddgZ fd	d
Zdd Z	  Z
S )r[   z
    Subclass of the `LassoLexer` which highlights unhandled data with the
    `JavascriptLexer`.

    .. versionadded:: 1.6
    zJavaScript+Lassozjavascript+lassozjs+lassor   zapplication/x-javascript+lassoztext/x-javascript+lassoztext/javascript+lassoc                    s   d|d< t  jttf| d S r   )r   rg   r   r   r   r   rj   rk   rg     s    zLassoJavascriptLexer.__init__c                 C   s   t | d }|S r   )r   r   r   rj   rj   rk   r     s    z!LassoJavascriptLexer.analyse_textr   rj   rj   r   rk   r[     s   c                   @   sJ  e Zd ZdZdZdZdg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.

    .. versionadded:: 2.0
    Z
Handlebarszhttps://handlebarsjs.com/Z
handlebarsr   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   Specialr   rv   r    r   r   r   r   r   r   r   r   r   r   r   r   r   rz   rj   rj   rj   rk   r\     s`   	 
 
c                       s:   e Zd ZdZdZdgZddgZddgZ fdd	Z  Z	S )
r]   z}
    Subclass of the `HandlebarsLexer` that highlights unlexed data with the
    `HtmlLexer`.

    .. versionadded:: 2.0
    zHTML+Handlebarszhtml+handlebarsz*.handlebarsz*.hbsztext/html+handlebarsztext/x-handlebars-templatec                    s   t  jttf| d S r   )r   rg   r   r\   r   r   rj   rk   rg   G  s    zHandlebarsHtmlLexer.__init__r  rj   rj   r   rk   r]   :  s   c                       sD   e Zd ZdZdZdddgZdddd	d
gZddg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.

    .. versionadded:: 2.0
    z
YAML+Jinjaz
yaml+jinjaZsaltZslsz*.slsz	*.yaml.j2z*.yml.j2z*.yaml.jinja2z*.yml.jinja2ztext/x-yaml+jinjaz
text/x-slsc                    s   t  jttf| d S r   )r   rg   r   r3   r   r   rj   rk   rg   Z  s    zYamlJinjaLexer.__init__r  rj   rj   r   rk   r^   K  s   	
c                   @   sn  e Zd ZdZdZdZdgZdg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d/e	eejedfgd!e
dfgd0e
d$fgd1edfgedd2e	ejeefd3e	e
eeedd
ee
fed4ed5ed6d7e
fged8d9efged8edd9efgd0e
d$fed(gd0e
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d@ejfdAejfged6ed4ed5edgdBefgdCe	e
eejee
d$fd9e fgdefdDe	e
eejee
dfdefgdEZ!dS )Fr_   z@
    Lexer for Liquid templates.

    .. versionadded:: 2.0
    Zliquidz.https://www.rubydoc.info/github/Shopify/liquidz*.liquidr   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'  r/  r0  r(  zgeneric-valueoperatorr1  r)  r3  r7  r2  r8  r-  r,  r5  r   r  r4  r#  r*  r  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   rz   rj   rj   rj   rk   r_   ^  sZ  

      
  " 	 
  
    c                   @   s  e Zd ZdZdZdgZdg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 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ejfde 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.

    .. versionadded:: 2.0
    ZTwigZtwigzapplication/x-twigz[\\\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+)(%s)r~   r   r   z(\|)(\s*)(%s)z(is)(\s+)(not)?(\s*)(%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   Z_ident_charZ_ident_beginZ
_ident_endZ_ident_innerr!   r   rv   r   r   r   r   r   r   r   r   r   r    r   r   r   r   r   rz   rj   rj   rj   rk   r`   ,  s   	
         c                       s6   e Zd ZdZdZdgZdgZdgZ fddZ  Z	S )ra   zw
    Subclass of the `TwigLexer` that highlights unlexed data with the
    `HtmlLexer`.

    .. versionadded:: 2.0
    z	HTML+Twigz	html+twigz*.twigztext/html+twigc                    s   t  jttf| d S r   )r   rg   r   r`   r   r   rj   rk   rg     s    zTwigHtmlLexer.__init__r  rj   rj   r   rk   ra     s   c                   @   s   e Zd ZdZdZdZdg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   a  
    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.

    .. versionadded:: 2.1
    ZAngular2z(https://angular.io/guide/template-syntaxZng2z	[^{([*#]+r!  ngExpressionz&([([]+)([\w:.-]+)([\])]+)(\s*)(=)(\s*)r   z([([]+)([\w:.-]+)([\])]+)(\s*)z([*#])([\w:.-]+)(\s*)(=)(\s*)z([*#])([\w:.-]+)(\s*)z\s+(\|\s+)?r.  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   rv   r   r   r   r   r   r   Booleanr   r   r    r   rz   rj   rj   rj   rk   rb     sP   
 
c                       s0   e Zd ZdZdZdgZdgZ fddZ  ZS )rc   z{
    Subclass of the `Angular2Lexer` that highlights unlexed data with the
    `HtmlLexer`.

    .. versionadded:: 2.0
    zHTML + Angular2zhtml+ng2z*.ng2c                    s   t  jttf| d S r   )r   rg   r   rb   r   r   rj   rk   rg     s    zAngular2HtmlLexer.__init__)	r   r   r   r   r   r   r   rg   r   rj   rj   r   rk   rc     s
   c                       s<   e Zd ZdZdZdgZdddgZ fddZd	d
 Z  Z	S )rd   z:
    Templated SQL lexer.

    .. versionadded:: 2.13
    z	SQL+Jinjaz	sql+jinjaz*.sqlz*.sql.j2z*.sql.jinja2c                    s   t  jttf| d S r   )r   rg   r   r3   r   r   rj   rk   rg     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   rj   rj   rk   r     s    zSqlJinjaLexer.analyse_text)
r   r   r   r   r   r   r   rg   r   r   rj   rj   r   rk   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   rj   rj   rj   rk   <module>   s$  
,8                                         _9SS/7C,#@90.M OS?