a
    ;@b                    @   s8  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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-m.Z. g dZ/G dd deZ0G dd deZ1G dd deZ2G dd deZ3G dd deZ4G dd deZ5G dd deZ6G dd deZ7G dd  d eZ8G d!d" d"eZ9G d#d$ d$eZ:G d%d& d&eZ;G d'd( 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Z@G d1d2 d2eZAG d3d4 d4eZBG d5d6 d6eZCG d7d8 d8eZDG d9d: d:eZEG d;d< d<eZFG d=d> d>eZGG d?d@ d@eZHG dAdB dBeZIG dCdD dDeZJG dEdF dFeZKG dGdH dHeZLG dIdJ dJeZMG dKdL dLeZNG dMdN dNeZOG dOdP dPeZPG dQdR dReZQG dSdT dTeZRG dUdV dVeZSG dWdX dXeZTG dYdZ dZeZUG d[d\ d\eZVG d]d^ d^eZWG d_d` d`eZXG dadb dbeZYG dcdd ddeZZG dedf dfeZ[G dgdh dheZ\G didj djeZ]G dkdl dleZ^G dmdn dneZ_G dodp dpeZ`G dqdr dreZaG dsdt dteZbG dudv dveZcG dwdx dxeZdG dydz dzeZeG d{d| d|eZfG d}d~ d~eZgG dd deZhG dd deZiG dd deZjG dd deZkG dd deZlG dd deZmG dd deZnG dd deZoG dd deZpG dd deZqG dd deZrG dd deZsdS )z
    pygments.lexers.templates
    ~~~~~~~~~~~~~~~~~~~~~~~~~

    Lexers for various template engines' markup.

    :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)	HtmlLexerXmlLexer)JavascriptLexer
LassoLexer)CssLexer)PhpLexer)PythonLexer)	PerlLexer)	JavaLexerTeaLangLexer)	YamlLexer)	LexerDelegatingLexer
RegexLexerbygroupsincludeusingthisdefaultcombined)ErrorPunctuation
WhitespaceTextCommentOperatorKeywordNameStringNumberOtherToken)html_doctype_matcheslooks_like_xml)?HtmlPhpLexerXmlPhpLexerCssPhpLexerJavascriptPhpLexerErbLexer
RhtmlLexerXmlErbLexerCssErbLexerJavascriptErbLexerSmartyLexerHtmlSmartyLexerXmlSmartyLexerCssSmartyLexerJavascriptSmartyLexerDjangoLexerHtmlDjangoLexerCssDjangoLexerXmlDjangoLexerJavascriptDjangoLexerGenshiLexerHtmlGenshiLexerGenshiTextLexerCssGenshiLexerJavascriptGenshiLexerMyghtyLexerMyghtyHtmlLexerMyghtyXmlLexerMyghtyCssLexerMyghtyJavascriptLexer
MasonLexer	MakoLexerMakoHtmlLexerMakoXmlLexerMakoJavascriptLexerMakoCssLexerJspLexerCheetahLexerCheetahHtmlLexerCheetahXmlLexerCheetahJavascriptLexerEvoqueLexerEvoqueHtmlLexerEvoqueXmlLexerColdfusionLexerColdfusionHtmlLexerColdfusionCFCLexerVelocityLexerVelocityHtmlLexerVelocityXmlLexerSspLexerTeaTemplateLexerLassoHtmlLexerLassoXmlLexerLassoCssLexerLassoJavascriptLexerHandlebarsLexerHandlebarsHtmlLexerYamlJinjaLexerLiquidLexer	TwigLexerTwigHtmlLexerAngular2LexerAngular2HtmlLexerc                   @   sF   e 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(   a  
    Generic `ERB <http://ruby-doc.org/core/classes/ERB.html>`_ (Ruby Templating)
    lexer.

    Just highlights ruby code between the preprocessor directives, other data
    is left untouched by the lexer.

    All options are also forwarded to the `RubyLexer`.
    ZERBZerbzapplication/x-ruby-templatingz*(<%%|%%>|<%=|<%#|<%-|<%|-%>|%>|^%[^%].*?$)c                 K   s2   ddl m} |f i || _tj| fi | d S )Nr   )	RubyLexer)Zpygments.lexers.rubyrc   
ruby_lexerr   __init__)selfoptionsrc    rh   8lib/python3.9/site-packages/pygments/lexers/templates.pyre   B   s    zErbLexer.__init__c                 c   s   | j |}|  d }}z|dkrN| }|t|fV  |t|7 }d}q |dkr| }|dv 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v r4|tj|fV  |t|7 }| }d}| j	|D ]\}}	}
|| |	|
fV  q|t|7 }d}n|dv 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vr|t|fV  n|tj|fV  |t|7 }d}q W n ty   Y d	S 0 d	S )
z
        Since ERB doesn't allow "<%" and other tags inside of ruby
        blocks we have to use a split approach here that fails for
        that too.
        r      )z<%%z%%>   z<%#   )<%z<%=z<%-)%>z-%>N)	_block_resplitreversepopr    lenr   Preprocrd   get_tokens_unprocessedr   
IndexError)rf   texttokensstateidxvaltagdataZr_idxZr_tokenZr_valuerh   rh   ri   ru   G   sf    





zErbLexer.get_tokens_unprocessedc                 C   s   d| v rd| v rdS d S )Nrm   rn   皙?rh   rw   rh   rh   ri   analyse_text   s    zErbLexer.analyse_textN)__name__
__module____qualname____doc__namealiases	mimetypesrecompileMro   re   ru   r   rh   rh   rh   ri   r(   1   s   
Dr(   c                   @   s   e 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 <http://smarty.php.net/>`_ template lexer.

    Just highlights smarty code between the preprocessor directives, other
    data is left untouched by the lexer.
    ZSmarty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rw   rvrh   rh   ri   r      s    zSmartyLexer.analyse_textN) r   r   r   r   r   r   	filenamesr   r   	MULTILINEDOTALLflagsr    r   r   rt   r   r   r   Functionr   Variabler   r   Constantr   r   DoubleSingle	Attributerx   r   rh   rh   rh   ri   r-      sH   


r-   c                   @   s  e 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 )*rR   z
    Generic `Velocity <http://velocity.apache.org/>`_ template lexer.

    Just highlights velocity directives and variable references, other
    data is left untouched by the lexer.
    ZVelocityZ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\}?g      ?z#\{?if\}?\(.+?\).*?#\{?end\}?r   z"#\{?foreach\}?\(.+?\).*?#\{?end\}?z6\$!?\{?[a-zA-Z_]\w*(\([^)]*\))?(\.\w+(\([^)]*\))?)*\}?r   r   r   r   r   rh   rh   ri   r     s    zVelocityLexer.analyse_textN) r   r   r   r   r   r   r   r   r   r   r   Z
identifierr    r   r   rt   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rx   r   rh   rh   rh   ri   rR      st   



	4rR   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 )	rS   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i | d S N)superre   r   rR   rf   rg   	__class__rh   ri   re   &  s    zVelocityHtmlLexer.__init__)
r   r   r   r   r   r   alias_filenamesr   re   __classcell__rh   rh   r   ri   rS     s   rS   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 )rT   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i | d S r   )r   re   r   rR   r   r   rh   ri   re   6  s    zVelocityXmlLexer.__init__c                 C   s"   t | d }t| r|d7 }|S Nr   r~   )rR   r   r#   r   rh   rh   ri   r   9  s    zVelocityXmlLexer.analyse_textr   r   r   r   r   r   r   r   re   r   r   rh   rh   r   ri   rT   *  s   rT   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 )&r2   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 ur|d7 }t d| d ur4|d7 }t d| d urL|d7 }|S )Nr   z\{%\s*(block|extends)r~   z\{%\s*if\s*.*?%\}皙?z\{\{.*?\}\}r   r   rh   rh   ri   r     s    zDjangoLexer.analyse_textN)r   r   r   r   r   r   r   r   r   Sr   r    r   rt   r   r   r   r   r   r   PseudoBuiltinr   r   r   r   r   r   r   rx   r   rh   rh   rh   ri   r2   @  sx   
9r2   c                   @   s   e 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

    .. _myghty templates: http://www.myghty.org/
    ZMyghtyZ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   Tagr   r   r   r   r   r    r   rx   rh   rh   rh   ri   r<     sH   	

	r<   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i | d S r   )r   re   r   r<   r   r   rh   ri   re     s    zMyghtyHtmlLexer.__init__	r   r   r   r   r   r   r   re   r   rh   rh   r   ri   r=     s
   r=   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i | d S r   )r   re   r   r<   r   r   rh   ri   re     s    zMyghtyXmlLexer.__init__r   rh   rh   r   ri   r>     s
   r>   c                       s4   e Zd ZdZdZddgZg dZ fddZ  ZS )r@   z
    Subclass of the `MyghtyLexer` that highlights unlexed data
    with the `JavascriptLexer`.

    .. versionadded:: 0.6
    zJavaScript+Myghtyzjavascript+myghtyz	js+myghty)zapplication/x-javascript+myghtyztext/x-javascript+myghtyztext/javascript+mygthyc                    s   t  jttfi | d S r   )r   re   r   r<   r   r   rh   ri   re     s    zMyghtyJavascriptLexer.__init__r   rh   rh   r   ri   r@     s
   r@   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i | d S r   )r   re   r   r<   r   r   rh   ri   re     s    zMyghtyCssLexer.__init__r   rh   rh   r   ri   r?     s
   r?   c                   @   s
  e Zd ZdZdZdgZg d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 )rA   z
    Generic `mason templates`_ lexer. Stolen from Myghty lexer. Code that isn't
    Mason markup is HTML.

    .. _mason templates: http://www.masonhq.com/

    .. versionadded:: 1.4
    ZMasonZmason)z*.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 urd}nt d| t jd ur2d}|S )Nr   z</%(class|doc|init)>g      ?z<&.+&>g)\(?r   )rw   resultrh   rh   ri   r   4  s    zMasonLexer.analyse_text)r   r   r   r   r   r   r   r   r   r   r   r   r   	Multiliner   r   r   r	   r    r   r   rx   r   rh   rh   rh   ri   rA     sL   
	!rA   c                   @   s8  e 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 )rB   z
    Generic `mako templates`_ lexer. Code that isn't Mako
    markup is yielded as `Token.Other`.

    .. versionadded:: 0.7

    .. _mako templates: http://www.makotemplates.org/
    ZMakoZ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   rm   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   rt   r   r    r   r   r   r   r   r   r   r   r   r   rx   rh   rh   rh   ri   rB   =  s`   	
"
rB   c                       s0   e Zd ZdZdZdgZdgZ fddZ  ZS )rC   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i | d S r   )r   re   r   rB   r   r   rh   ri   re     s    zMakoHtmlLexer.__init__r   rh   rh   r   ri   rC     s
   rC   c                       s0   e Zd ZdZdZdgZdgZ fddZ  ZS )rD   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i | d S r   )r   re   r   rB   r   r   rh   ri   re     s    zMakoXmlLexer.__init__r   rh   rh   r   ri   rD     s
   rD   c                       s4   e Zd ZdZdZddgZg dZ fddZ  ZS )rE   z}
    Subclass of the `MakoLexer` that highlights unlexed data
    with the `JavascriptLexer`.

    .. versionadded:: 0.7
    zJavaScript+Makozjavascript+makozjs+mako)zapplication/x-javascript+makoztext/x-javascript+makoztext/javascript+makoc                    s   t  jttfi | d S r   )r   re   r   rB   r   r   rh   ri   re     s    zMakoJavascriptLexer.__init__r   rh   rh   r   ri   rE     s
   rE   c                       s0   e Zd ZdZdZdgZdgZ fddZ  ZS )rF   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i | d S r   )r   re   r   rB   r   r   rh   ri   re     s    zMakoCssLexer.__init__r   rh   rh   r   ri   rF     s
   rF   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   sN   t f i | j}||D ].\}}}|tjkr<|dkr<tj}|||fV  qd S )N$)r   rg   ru   r!   r   r   rt   )rf   rw   Zpylexerpostype_valuerh   rh   ri   ru     s
    z)CheetahPythonLexer.get_tokens_unprocessedN)r   r   r   r   ru   rh   rh   rh   ri   r     s   r   c                   @   s   e 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 )rH   a2  
    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.

    .. _cheetah templates: http://www.cheetahtemplate.org/
    .. _spitfire templates: http://code.google.com/p/spitfire/
    ZCheetahZ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   rt   r   r   r    r   rx   rh   rh   rh   ri   rH     s>   	rH   c                       s4   e Zd ZdZdZg dZddgZ fddZ  ZS )rI   z_
    Subclass of the `CheetahLexer` that highlights unlexed data
    with the `HtmlLexer`.
    zHTML+Cheetah)zhtml+cheetahzhtml+spitfireZhtmlcheetahztext/html+cheetahztext/html+spitfirec                    s   t  jttfi | d S r   )r   re   r   rH   r   r   rh   ri   re     s    zCheetahHtmlLexer.__init__r   rh   rh   r   ri   rI     s
   rI   c                       s4   e Zd ZdZdZ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 `XmlLexer`.
    zXML+Cheetahzxml+cheetahzxml+spitfirezapplication/xml+cheetahzapplication/xml+spitfirec                    s   t  jttfi | d S r   )r   re   r   rH   r   r   rh   ri   re     s    zCheetahXmlLexer.__init__r   rh   rh   r   ri   rJ     s
   rJ   c                       s4   e Zd ZdZdZg dZg dZ fddZ  ZS )rK   ze
    Subclass of the `CheetahLexer` that highlights unlexed data
    with the `JavascriptLexer`.
    zJavaScript+Cheetah)zjavascript+cheetahz
js+cheetahzjavascript+spitfirezjs+spitfire)z 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i | d S r   )r   re   r   rH   r   r   rh   ri   re   *  s    zCheetahJavascriptLexer.__init__r   rh   rh   r   ri   rK     s
   rK   c                
   @   s   e 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 )r9   z]
    A lexer that highlights `genshi <http://genshi.edgewall.org/>`_ text
    templates.
    zGenshi TextZ
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   rt   r   r   r   r   r   r   rx   rh   rh   rh   ri   r9   .  s4   	r9   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   rt   r   r   r   r   r   r   r   r   r   rx   rh   rh   rh   ri   r   Q  s`   






r   c                       sB   e Zd ZdZdZddgZg dZ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 HTML templates.
    zHTML+Genshizhtml+genshizhtml+kidr   *.htm*.xhtmlztext/html+genshic                    s   t  jttfi | d S r   )r   re   r   r   r   r   rh   ri   re     s    zHtmlGenshiLexer.__init__c                 C   sF   d}t d| d ur|d7 }t d| d ur4|d7 }|t|  d S Nr   z	\$\{.*?\}皙?zpy:(.*?)=["\']r   )r   r   r   r   r   rh   rh   ri   r     s    zHtmlGenshiLexer.analyse_textr   rh   rh   r   ri   r8     s   r8   c                       sH   e Zd ZdZdZg dZdgZdgZddgZ fdd	Z	d
d Z
  ZS )r7   z
    A lexer that highlights `genshi <http://genshi.edgewall.org/>`_ and
    `kid <http://kid-templating.org/>`_ kid XML templates.
    ZGenshi)ZgenshiZkidz
xml+genshizxml+kidz*.kidr   zapplication/x-genshizapplication/x-kidc                    s   t  jttfi | d S r   )r   re   r   r   r   r   rh   ri   re     s    zGenshiLexer.__init__c                 C   sF   d}t d| d ur|d7 }t d| d ur4|d7 }|t|  d S r   )r   r   r   r   r   rh   rh   ri   r     s    zGenshiLexer.analyse_textr   r   r   r   r   r   r   r   r   re   r   r   rh   rh   r   ri   r7     s   r7   c                       sB   e Zd ZdZdZg dZdgZg 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 Text)zjs+genshitextz	js+genshizjavascript+genshitextzjavascript+genshi*.js)zapplication/x-javascript+genshiztext/x-javascript+genshiztext/javascript+genshic                    s   t  jttfi | d S r   )r   re   r   r9   r   r   rh   ri   re     s    zJavascriptGenshiLexer.__init__c                 C   s   t | d S N皙?r7   r   r   rh   rh   ri   r     s    z"JavascriptGenshiLexer.analyse_textr   rh   rh   r   ri   r;     s   r;   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i | d S r   )r   re   r   r9   r   r   rh   ri   re     s    zCssGenshiLexer.__init__c                 C   s   t | d S r   r   r   rh   rh   ri   r     s    zCssGenshiLexer.analyse_textr   rh   rh   r   ri   r:     s   r:   c                       sH   e Zd ZdZdZg dZdgZg d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RHTML)Zrhtmlzhtml+erbz	html+rubyz*.rhtmlr   ztext/html+rubyc                    s   t  jttfi | d S r   )r   re   r   r(   r   r   rh   ri   re     s    zRhtmlLexer.__init__c                 C   s"   t | d }t| r|d7 }|S Nr   g      ?)r(   r   r"   r   rh   rh   ri   r     s    zRhtmlLexer.analyse_textr   rh   rh   r   ri   r)     s   r)   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i | d S r   )r   re   r   r(   r   r   rh   ri   re   	  s    zXmlErbLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r(   r   r#   r   rh   rh   ri   r     s    zXmlErbLexer.analyse_textr   rh   rh   r   ri   r*     s   r*   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i | d S r   )r   re   r   r(   r   r   rh   ri   re     s    zCssErbLexer.__init__c                 C   s   t | d S r   r(   r   r   rh   rh   ri   r      s    zCssErbLexer.analyse_textr   rh   rh   r   ri   r+     s   r+   c                       sB   e Zd ZdZdZg dZdgZg 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+Ruby)z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i | d S r   )r   re   r   r(   r   r   rh   ri   re   1  s    zJavascriptErbLexer.__init__c                 C   s   t | d S r   r   r   rh   rh   ri   r   4  s    zJavascriptErbLexer.analyse_textr   rh   rh   r   ri   r,   $  s   r,   c                       sH   e Zd ZdZdZdgZdgZg dZg 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*.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i | d S r   )r   re   r   r   r   r   rh   ri   re   H  s    zHtmlPhpLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r   r   r"   r   rh   rh   ri   r   K  s    zHtmlPhpLexer.analyse_textr   rh   rh   r   ri   r$   8  s   r$   c                       s@   e Zd ZdZdZdgZg d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+php)r   r   r   zapplication/xml+phpc                    s   t  jttfi | d S r   )r   re   r   r   r   r   rh   ri   re   \  s    zXmlPhpLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r   r   r#   r   rh   rh   ri   r   _  s    zXmlPhpLexer.analyse_textr   rh   rh   r   ri   r%   R  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 )
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i | d S r   )r   re   r   r   r   r   rh   ri   re   p  s    zCssPhpLexer.__init__c                 C   s   t | d S r   r   r   r   rh   rh   ri   r   s  s    zCssPhpLexer.analyse_textr   rh   rh   r   ri   r&   f  s   r&   c                       sB   e Zd ZdZdZddgZdgZg 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+phpr   )zapplication/x-javascript+phpztext/x-javascript+phpztext/javascript+phpc                    s   t  jttfi | d S r   )r   re   r   r   r   r   rh   ri   re     s    zJavascriptPhpLexer.__init__c                 C   s
   t | S r   r   r   rh   rh   ri   r     s    zJavascriptPhpLexer.analyse_textr   rh   rh   r   ri   r'   w  s   r'   c                       s@   e Zd ZdZdZdgZg d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+smarty)r   r   r   r   ztext/html+smartyc                    s   t  jttfi | d S r   )r   re   r   r-   r   r   rh   ri   re     s    zHtmlSmartyLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r-   r   r"   r   rh   rh   ri   r     s    zHtmlSmartyLexer.analyse_textr   rh   rh   r   ri   r.     s   r.   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 )r/   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i | d S r   )r   re   r   r-   r   r   rh   ri   re     s    zXmlSmartyLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r-   r   r#   r   rh   rh   ri   r     s    zXmlSmartyLexer.analyse_textr   rh   rh   r   ri   r/     s   r/   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
    `CssLexer`.
    z
CSS+Smartyz
css+smartyr   r   ztext/css+smartyc                    s   t  jttfi | d S r   )r   re   r   r-   r   r   rh   ri   re     s    zCssSmartyLexer.__init__c                 C   s   t | d S r   r-   r   r   rh   rh   ri   r     s    zCssSmartyLexer.analyse_textr   rh   rh   r   ri   r0     s   r0   c                       sD   e Zd ZdZdZddgZddgZg dZ fdd	Zd
d Z	  Z
S )r1   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i | d S r   )r   re   r   r-   r   r   rh   ri   re     s    zJavascriptSmartyLexer.__init__c                 C   s   t | d S r   r   r   rh   rh   ri   r     s    z"JavascriptSmartyLexer.analyse_textr   rh   rh   r   ri   r1     s   r1   c                       sD   e Zd ZdZdZg dZg dZddgZ fddZd	d
 Z	  Z
S )r3   z
    Subclass of the `DjangoLexer` that highlights unlexed data with the
    `HtmlLexer`.

    Nested Javascript and CSS is highlighted too.
    zHTML+Django/Jinja)zhtml+djangoz
html+jinjaZ
htmldjangor   ztext/html+djangoztext/html+jinjac                    s   t  jttfi | d S r   )r   re   r   r2   r   r   rh   ri   re     s    zHtmlDjangoLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r2   r   r"   r   rh   rh   ri   r     s    zHtmlDjangoLexer.analyse_textr   rh   rh   r   ri   r3     s   r3   c                       sB   e Zd ZdZd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
    `XmlLexer`.
    zXML+Django/Jinjaz
xml+djangoz	xml+jinjar   zapplication/xml+djangozapplication/xml+jinjac                    s   t  jttfi | d S r   )r   re   r   r2   r   r   rh   ri   re     s    zXmlDjangoLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r2   r   r#   r   rh   rh   ri   r     s    zXmlDjangoLexer.analyse_textr   rh   rh   r   ri   r5     s   r5   c                       sB   e Zd ZdZdZddgZ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
    `CssLexer`.
    zCSS+Django/Jinjaz
css+djangoz	css+jinjar   ztext/css+djangoztext/css+jinjac                    s   t  jttfi | d S r   )r   re   r   r2   r   r   rh   ri   re     s    zCssDjangoLexer.__init__c                 C   s   t | d S r   r2   r   r   rh   rh   ri   r     s    zCssDjangoLexer.analyse_textr   rh   rh   r   ri   r4   	  s   r4   c                       sB   e Zd ZdZdZg dZdgZg dZ fddZdd	 Z	  Z
S )
r6   zd
    Subclass of the `DjangoLexer` that highlights unlexed data with the
    `JavascriptLexer`.
    zJavaScript+Django/Jinja)zjavascript+djangoz	js+djangozjavascript+jinjazjs+jinjar   )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i | d S r   )r   re   r   r2   r   r   rh   ri   re   ,  s    zJavascriptDjangoLexer.__init__c                 C   s   t | d S r   r   r   rh   rh   ri   r   /  s    z"JavascriptDjangoLexer.analyse_textr   rh   rh   r   ri   r6     s   r6   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).*?>[^<]+<rn   r   [\w\W]+?(?=%>|\Z)r   r  N)	r   r   r   r   r   r    r   r
   rx   rh   rh   rh   ri   r   3  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 )
rG   zA
    Lexer for Java Server Pages.

    .. versionadded:: 0.7
    zJava Server PageZjspz*.jspzapplication/x-jspc                    s   t  jttfi | d S r   r   re   r   r   r   r   rh   ri   re   W  s    zJspLexer.__init__c                 C   s:   t | d }t| r|d7 }d| v r6d| v r6|d7 }|S Nr   r~   rm   rn   r   )r
   r   r#   r   rh   rh   ri   r   Z  s    zJspLexer.analyse_textr   r   r   r   r   r   r   r   re   r   r   rh   rh   r   ri   rG   L  s   rG   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 )rL   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| v rdS dS )z.Evoque templates use $evoque, which is unique.z$evoquerj   Nrh   r   rh   rh   ri   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   rx   r   rh   rh   rh   ri   rL   c  sP   




'rL   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 )
rM   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i | d S r   )r   re   r   rL   r   r   rh   ri   re     s    zEvoqueHtmlLexer.__init__c                 C   s
   t | S r   rL   r   r   rh   rh   ri   r     s    zEvoqueHtmlLexer.analyse_textr  rh   rh   r   ri   rM     s   rM   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   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i | d S r   )r   re   r   rL   r   r   rh   ri   re     s    zEvoqueXmlLexer.__init__c                 C   s
   t | S r   r  r   rh   rh   ri   r     s    zEvoqueXmlLexer.analyse_textr  rh   rh   r   ri   rN     s   rN   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 )rO   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Interprx   rh   rh   rh   ri   rO     sN   

rO   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   rO   r   rx   rh   rh   rh   ri   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 )	rP   z#
    Coldfusion markup in html
    zColdfusion HTMLZcfmz*.cfmz*.cfmlzapplication/x-coldfusionc                    s   t  jttfi | d S r   )r   re   r   r  r   r   rh   ri   re   )  s    zColdfusionHtmlLexer.__init__
r   r   r   r   r   r   r   r   re   r   rh   rh   r   ri   rP      s   rP   c                       s4   e Zd ZdZdZdgZdgZg Z fddZ  Z	S )rQ   zH
    Coldfusion markup/script components

    .. versionadded:: 2.0
    zColdfusion CFCZcfcz*.cfcc                    s   t  jttfi | d S r   )r   re   rP   rO   r   r   rh   ri   re   8  s    zColdfusionCFCLexer.__init__r  rh   rh   r   ri   rQ   -  s   rQ   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 )
rU   zD
    Lexer for Scalate Server Pages.

    .. versionadded:: 1.4
    zScalate Server PageZsspz*.sspzapplication/x-sspc                    s   t  jttfi | d S r   r  r   r   rh   ri   re   G  s    zSspLexer.__init__c                 C   sD   d}t d| r|d7 }t| r(|d7 }d| v r@d| v r@|d7 }|S )Nr   zval \w+\s*:g333333?r   rm   rn   r   )r   r   r#   r   rh   rh   ri   r   J  s    zSspLexer.analyse_textr  rh   rh   r   ri   rU   <  s   rU   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  rn   r   r  r  N)	r   r   r   r   r   r    r   r   rx   rh   rh   rh   ri   r  U  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 )
rV   zW
    Lexer for `Tea Templates <http://teatrove.org/>`_.

    .. versionadded:: 1.5
    ZTeaZteaz*.teaz
text/x-teac                    s   t  jttfi | d S r   )r   re   r   r  r   r   rh   ri   re   v  s    zTeaTemplateLexer.__init__c                 C   s:   t | d }t| r|d7 }d| v r6d| v r6|d7 }|S r  )r   r   r#   r   rh   rh   ri   r   y  s    zTeaTemplateLexer.analyse_textr  rh   rh   r   ri   rV   k  s   rV   c                       sB   e Zd ZdZdZdgZg dZg dZ fddZdd	 Z	  Z
S )
rW   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+lasso)r   r   r   *.lasso*.lasso[89]*.incl*.inc*.las)ztext/html+lassozapplication/x-httpd-lassozapplication/x-httpd-lasso[89]c                    s   t  jttfi | d S r   )r   re   r   r   r   r   rh   ri   re     s    zLassoHtmlLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r   r   r"   r   rh   rh   ri   r     s    zLassoHtmlLexer.analyse_textr   rh   rh   r   ri   rW     s   	rW   c                       s@   e Zd ZdZdZdgZg dZdgZ fddZdd	 Z	  Z
S )
rX   zz
    Subclass of the `LassoLexer` which highlights unhandled data with the
    `XmlLexer`.

    .. versionadded:: 1.6
    z	XML+Lassoz	xml+lasso)r   r  r  r  r  r  zapplication/xml+lassoc                    s   t  jttfi | d S r   )r   re   r   r   r   r   rh   ri   re     s    zLassoXmlLexer.__init__c                 C   s"   t | d }t| r|d7 }|S r   )r   r   r#   r   rh   rh   ri   r     s    zLassoXmlLexer.analyse_textr   rh   rh   r   ri   rX     s   rX   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 )
rY   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i | d S NTZrequiredelimiters)r   re   r   r   r   r   rh   ri   re     s    zLassoCssLexer.__init__c                 C   s6   t | d }td| r"|d7 }d| v r2|d7 }|S )Nr   z
\w+:[^;]+;r   zpadding:)r   r   r   r   r   rh   rh   ri   r     s    zLassoCssLexer.analyse_textr   rh   rh   r   ri   rY     s   rY   c                       sB   e Zd ZdZdZddgZdgZg dZ fddZd	d
 Z	  Z
S )rZ   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i | d S r  )r   re   r   r   r   r   rh   ri   re     s    zLassoJavascriptLexer.__init__c                 C   s   t | d }|S r   )r   r   r   rh   rh   ri   r     s    z!LassoJavascriptLexer.analyse_textr   rh   rh   r   ri   rZ     s   rZ   c                   @   sF  e 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 <http://handlebarsjs.com/>` template lexer.

    Highlights only the Handlebars template tags (stuff between `{{` and `}}`).
    Everything else is left for a delegating lexer.

    .. versionadded:: 2.0
    Z
HandlebarsZ
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   ry   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   Specialr   rt   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rx   rh   rh   rh   ri   r[     sZ   	

r[   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i | d S r   )r   re   r   r[   r   r   rh   ri   re   A  s    zHandlebarsHtmlLexer.__init__r  rh   rh   r   ri   r\   4  s   r\   c                       s:   e Zd ZdZdZg dZ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+Jinja)z
yaml+jinjaZsaltZslsz*.slsztext/x-yaml+jinjaz
text/x-slsc                    s   t  jttfi | d S r   )r   re   r   r2   r   r   rh   ri   re   T  s    zYamlJinjaLexer.__init__r  rh   rh   r   ri   r]   E  s   	r]   c                   @   sj  e 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d/e	d#fgd0e
dfgedd1eeje
efd2ee	e
eedd	e
e	fed3ed4ed5d6e	fged7d8efged7edd8efgd/e	d#fed'gd/e	d#fed9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d@ejfged5ed3ed4edgdAe
fgdBee	e
eje
e	d#fd8efgdefdCee	e
eje
e	dfdefgdDZ dS )Er^   zw
    Lexer for `Liquid templates
    <http://www.rubydoc.info/github/Shopify/liquid>`_.

    .. versionadded:: 2.0
    Z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*  r+  r#  zgeneric-valueoperatorr,  r$  r.  r2  r-  r3  r(  r'  r0  r   r  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   ZWordr   r   r   r   r   r   r   ZFloatZIntegerr   rx   rh   rh   rh   ri   r^   X  s:  

"	 r^   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 <http://twig.sensiolabs.org/>`_ 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   rt   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rx   rh   rh   rh   ri   r_   &  s   	
r_   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 )r`   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i | d S r   )r   re   r   r_   r   r   rh   ri   re     s    zTwigHtmlLexer.__init__r  rh   rh   r   ri   r`   y  s   r`   c                   @   s   e 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 )ra   ad  
    Generic
    `angular2 <http://victorsavkin.com/post/119943127151/angular-2-template-syntax>`_
    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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   r5  r   N)r   r   r   r   r   r   r    r   r   rt   r   r   r   r   r   r   ZBooleanr   r   r   r   rx   rh   rh   rh   ri   ra     sL   
ra   c                       s0   e Zd ZdZdZdgZdgZ fddZ  ZS )rb   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i | d S r   )r   re   r   ra   r   r   rh   ri   re     s    zAngular2HtmlLexer.__init__)	r   r   r   r   r   r   r   re   r   rh   rh   r   ri   rb     s
   rb   )tr   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.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-   rR   rS   rT   r2   r<   r=   r>   r@   r?   rA   rB   rC   rD   rE   rF   r   rH   rI   rJ   rK   r9   r   r8   r7   r;   r:   r)   r*   r+   r,   r$   r%   r&   r'   r.   r/   r0   r1   r3   r5   r4   r6   r   rG   rL   rM   rN   rO   r  rP   rQ   rU   r  rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rh   rh   rh   ri   <module>   s   
,8_8RS08D,#@90.L OS@