B
    `             ?   @   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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. 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.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLg?Z/G dMd deZ0G dNd de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]d0 d0eZ@G d^d_ d_eZAG d`d2 d2eZBG dad3 d3eZCG dbd4 d4eZDG dcd5 d5eZEG ddd# d#eZFG dedf dfeZGG dgd" d"eZHG dhd! d!eZIG did% d%eZJG djd$ d$eZKG dkd 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}d1 d1eZ]G d~d6 d6eZ^G dd7 d7eZ_G dd8 d8eZ`G dd9 d9eZaG dd deZbG dd: d:eZcG dd; d;eZdG dd? d?eZeG dd deZfG dd@ d@eZgG ddA dAeZhG ddB dBeZiG ddC dCeZjG ddD dDeZkG ddE dEeZlG ddF dFeZmG ddG dGeZnG ddH dHeZoG ddI dIeZpG ddJ dJeZqG ddK dKeZrG ddL dLe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   s*   ddl m} |f || _tj| f| d S )Nr   )	RubyLexer)Zpygments.lexers.rubyrc   
ruby_lexerr   __init__)selfoptionsrc    rh   a/home/kop/projects/devel/pgwui/test_venv/lib/python3.7/site-packages/pygments/lexers/templates.pyre   B   s    zErbLexer.__init__c             c   s.  | j |}|  d }}yx|dkrR| }|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r<|tj|fV  |t|7 }| }d}x,| j	|D ]\}}	}
|| |	|
fV  q
W |t|7 }d}n|dkrd|t
|fV  |t|7 }d}n`|tj|d fV  d}x8| j	|dd	 D ] \}}	}
|d | |	|
fV  qW |t|7 }d}q$|dkr$| }|dkr|t|fV  n|tj|fV  |t|7 }d}q$W W n tk
r(   d	S X d	S )
z
        Since ERB doesn't allow "<%" and other tags inside of ruby
        blocks we have to use a split approach here that fails for
        that too.
        r      )z<%%z%%>   z<%#   )z<%z<%=z<%-)z%>z-%>N)	_block_resplitreversepopr    lenr   Preprocrd   get_tokens_unprocessedr   
IndexError)rf   texttokensstateidxvaltagdataZr_idxZr_tokenZr_valuerh   rh   ri   rs   G   sh    



zErbLexer.get_tokens_unprocessedc             C   s   d| krd| krdS d S )Nz<%z%>g?rh   )ru   rh   rh   ri   analyse_text   s    zErbLexer.analyse_textN)__name__
__module____qualname____doc__namealiases	mimetypesrecompileMrm   re   rs   r|   rh   rh   rh   ri   r(   1   s   	Dc               @   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smartyz*.tplzapplication/x-smartyz[^{]+z(\{)(\*.*?\*)(\})z(\{php\})(.*?)(\{/php\})T)Zstartinlinez(\{)(/?[a-zA-Z_]\w*)(\s*)z\{z\s+z#pushz\}z#popz#[a-zA-Z_]\w*#z\$[a-zA-Z_]\w*(\.\w+)*z[~!%^&*()+=|\[\]:;,.<>/?@-]z(true|false|null)\bz>[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?z"(\\\\|\\[^\\]|[^"\\])*"z'(\\\\|\\[^\\]|[^'\\])*'z[a-zA-Z_]\w*)rootr   c             C   sX   d}t d| r|d7 }t d| r,|d7 }t d| r@|d7 }t d| rT|d7 }|S )Ng        z\{if\s+.*?\}.*?\{/if\}g333333?z\{include\s+file=.*?\}z \{foreach\s+.*?\}.*?\{/foreach\}z	\{\$.*?\}g{Gz?)r   search)ru   rvrh   rh   ri   r|      s    zSmartyLexer.analyse_textN) r}   r~   r   r   r   r   	filenamesr   r   	MULTILINEDOTALLflagsr    r   r   rr   r   r   r   Functionr   Variabler   r   Constantr   r   DoubleSingle	Attributerv   r|   rh   rh   rh   ri   r-      s8   

c               @   s  e 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velocityz*.vmz*.fhtmlz[a-zA-Z_]\w*z[^{#$]+z(#)(\*.*?\*)(#)z
(##)(.*?$)z(#\{?)(z)(\}?)(\s?\()directiveparamsz)(\}|\b)z\$!?\{?variablez\(
funcparamsz(\.)()z#pushz\}z#popz=(&&|\|\||==?|!=?|[-<>+*%&|^/])|\b(eq|ne|gt|lt|ge|le|not|in)\bz\[rangeoperatorz\bz\.\.z\]z\s+z[,:]z"(\\\\|\\[^\\]|[^"\\])*"z'(\\\\|\\[^\\]|[^'\\])*'z0[xX][0-9a-fA-F]+[Ll]?z
\b[0-9]+\bz(true|false|null)\bz\)z\{)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 )	Ng        z #\{?macro\}?\(.*?\).*?#\{?end\}?g      ?z#\{?if\}?\(.+?\).*?#\{?end\}?g333333?z"#\{?foreach\}?\(.+?\).*?#\{?end\}?z6\$!?\{?[a-zA-Z_]\w*(\([^)]*\))?(\.\w+(\([^)]*\))?)*\}?g{Gz?)r   r   r   )ru   r   rh   rh   ri   r|     s    zVelocityLexer.analyse_textN) r}   r~   r   r   r   r   r   r   r   r   r   
identifierr    r   r   rr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rv   r|   rh   rh   rh   ri   rR      s\   




c                   s8   e 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+velocityz*.htmlz*.fhtmlztext/html+velocityc                s   t  jttf| 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   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+velocityz*.xmlz*.vmzapplication/xml+velocityc                s   t  jttf| d S )N)r   re   r   rR   )rf   rg   )r   rh   ri   re   6  s    zVelocityXmlLexer.__init__c             C   s"   t | d }t| r|d7 }|S )Ng{Gz?g?)rR   r|   r#   )ru   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   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-jinjaz[^{]+z\{\{varz	\{#.*?#\}zJ(\{%)(-?\s*)(comment)(\s*-?)(%\})(.*?)(\{%)(-?\s*)(endcomment)(\s*-?)(%\})zB(\{%)(-?\s*)(raw)(\s*-?)(%\})(.*?)(\{%)(-?\s*)(endraw)(\s*-?)(%\})z'(\{%)(-?\s*)(filter)(\s+)([a-zA-Z_]\w*)blockz(\{%)(-?\s*)([a-zA-Z_]\w*)z\{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:?"(\\\\|\\[^\\]|[^"\\])*"z:?'(\\\\|\\[^\\]|[^'\\])*'z ([{}()\[\]+\-*/%,:~]|[><=]=?|!=)z>[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?z\s+z
(-?)(\}\})z#popvarnamesz	(-?)(%\}).)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 )Ng        z\{%\s*(block|extends)g?z\{%\s*if\s*.*?%\}g?z\{\{.*?\}\})r   r   )ru   r   rh   rh   ri   r|     s    zDjangoLexer.analyse_textN)r}   r~   r   r   r   r   r   r   r   Sr   r    r   rr   r   r   r   r   r   r   PseudoBuiltinr   r   r   r   r   r   r   rv   r|   rh   rh   rh   ri   r2   @  sZ   
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   z\s+z3(?s)(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)z#(?s)(<%\w+)(.*?)(>)(.*?)(</%\2\s*>)z(<&[^|])(.*?)(,.*?)?(&>)z(?s)(<&\|)(.*?)(,.*?)?(&>)z</&>z(?s)(<%!?)(.*?)(%>)z(?<=^)#[^\n]*(\n|\Z)z(?<=^)(%)([^\n]*)(\n|\Z)a  (?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   rv   rh   rh   rh   ri   r<     s0   
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 )N)r   re   r   r<   )rf   rg   )r   rh   ri   re     s    zMyghtyHtmlLexer.__init__)	r}   r~   r   r   r   r   r   re   r   rh   rh   )r   ri   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 )N)r   re   r   r<   )rf   rg   )r   rh   ri   re     s    zMyghtyXmlLexer.__init__)	r}   r~   r   r   r   r   r   re   r   rh   rh   )r   ri   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 )
r@   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 )N)r   re   r   r<   )rf   rg   )r   rh   ri   re     s    zMyghtyJavascriptLexer.__init__)	r}   r~   r   r   r   r   r   re   r   rh   rh   )r   ri   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 `CssLexer`.

    .. versionadded:: 0.6
    z
CSS+Myghtyz
css+myghtyztext/css+myghtyc                s   t  jttf| d S )N)r   re   r   r<   )rf   rg   )r   rh   ri   re     s    zMyghtyCssLexer.__init__)	r}   r~   r   r   r   r   r   re   r   rh   rh   )r   ri   r?     s
   c               @   s  e 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 )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masonz*.mz*.mhtmlz*.mcz*.miZautohandlerZdhandlerzapplication/x-masonr   z\s+z(?s)(<%doc>)(.*?)(</%doc>)z3(?s)(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)z%(?s)(<%(\w+)(.*?)(>))(.*?)(</%\2\s*>)Nz(?s)(<&[^|])(.*?)(,.*?)?(&>)z(?s)(<&\|)(.*?)(,.*?)?(&>)z</&>z(?s)(<%!?)(.*?)(%>)z(?<=^)#[^\n]*(\n|\Z)z(?<=^)(%)([^\n]*)(\n|\Z)a  (?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
                 )c             C   s6   d}t d| d k	rd}nt d| t jd k	r2d}|S )Ng        z</%(class|doc|init)>g      ?z<&.+&>g)\(?)r   r   r   )ru   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   rv   r|   rh   rh   rh   ri   rA     s4   
c               @   s0  e Zd ZdZdZdgZdgZdgZdee	e
jeefdee	e
jeeefdee	e
je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.:]+)rz   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
                )
            z\s+z<%z'(?<=<%)(include|inherit|namespace|page)z((?:\w+)\s*=)(\s*)(".*?")z/?\s*>z#popz".*?"z'.*?'z[^\s>]+)r   r   rz   attrN)r}   r~   r   r   r   r   r   r   r   r   r   rr   r   r    r   r   r   r   r   r   r   r   rv   rh   rh   rh   ri   rB   =  sB   

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| d S )N)r   re   r   rB   )rf   rg   )r   rh   ri   re     s    zMakoHtmlLexer.__init__)	r}   r~   r   r   r   r   r   re   r   rh   rh   )r   ri   rC     s
   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| d S )N)r   re   r   rB   )rf   rg   )r   rh   ri   re     s    zMakoXmlLexer.__init__)	r}   r~   r   r   r   r   r   re   r   rh   rh   )r   ri   rD     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 )
rE   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 )N)r   re   r   rB   )rf   rg   )r   rh   ri   re     s    zMakoJavascriptLexer.__init__)	r}   r~   r   r   r   r   r   re   r   rh   rh   )r   ri   rE     s   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| d S )N)r   re   r   rB   )rf   rg   )r   rh   ri   re     s    zMakoCssLexer.__init__)	r}   r~   r   r   r   r   r   re   r   rh   rh   )r   ri   rF     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   sN   t f | j}x<||D ].\}}}|tjkr:|dkr:tj}|||fV  qW d S )N$)r   rg   rs   r!   r   r   rr   )rf   ru   Zpylexerpostype_valuerh   rh   ri   rs     s
    z)CheetahPythonLexer.get_tokens_unprocessedN)r}   r~   r   r   rs   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
                )
            z\s+N)r}   r~   r   r   r   r   r   r   r   r   rr   r   r   r    r   rv   rh   rh   rh   ri   rH     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 )
rI   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 )N)r   re   r   rH   )rf   rg   )r   rh   ri   re     s    zCheetahHtmlLexer.__init__)	r}   r~   r   r   r   r   r   re   r   rh   rh   )r   ri   rI     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 )	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| d S )N)r   re   r   rH   )rf   rg   )r   rh   ri   re     s    zCheetahXmlLexer.__init__)	r}   r~   r   r   r   r   r   re   r   rh   rh   )r   ri   rJ     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 )rK   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 )N)r   re   r   rH   )rf   rg   )r   rh   ri   re   *  s    zCheetahJavascriptLexer.__init__)	r}   r~   r   r   r   r   r   re   r   rh   rh   )r   ri   rK     s   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\nz#popz(?:def|for|if)\s+.*z (choose|when|with)([^\S\n]+)(.*)z(choose|otherwise)\bz(end\w*)([^\S\n]*)(.*)z(?<!\$)(\$\{)(.+?)(\})z(?<!\$)(\$)([a-zA-Z_][\w.]*))r   r   r   N)r}   r~   r   r   r   r   r   r    r   r   r   rr   r   r   r   r   r   r   rv   rh   rh   rh   ri   r9   .  s&   c               @   sH  e Zd ZdZejZdefdee	j
eee	j
fdefdejdfdejdfed	d
efgdefdejdfdejdfgdeeeeedfdeeeeedfdedfgdefdejdfdejdfdejdfgdedfdedfdedfgdedfeddefgdedfeddefgdefed	gdee	j
eee	j
fdejfgd	ZdS ) GenshiMarkupLexerzX
    Base lexer for Genshi markup, used by `HtmlGenshiLexer` and
    `GenshiLexer`.
    z[^<$]+z(<\?python)(.*?)(\?>)z'<\s*(script|style)\s*.*?>.*?<\s*/\1\s*>z<\s*py:[a-zA-Z0-9]+pytagz<\s*[a-zA-Z0-9:.]+rz   r   z[<$]z\s+z[\w:-]+\s*=pyattrz/?\s*>z#popz(")(.*?)(")z(')(.*?)(')z[^\s>]+zpy:[\w-]+\s*=r   "zattr-dstring'zattr-sstringz[^\s>]*stringsz[^"'$]+z(?<!\$)(\$\{)(.+?)(\})z(?<!\$)(\$)([a-zA-Z_][\w\.]*))	r   r   r   rz   r   zattr-dstringzattr-sstringr   r   N)r}   r~   r   r   r   r   r   r    r   r   rr   r   r   r   r   r   r   r   r   r   rv   rh   rh   rh   ri   r   Q  sF   






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 )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+kidz*.htmlz*.htmz*.xhtmlztext/html+genshic                s   t  jttf| d S )N)r   re   r   r   )rf   rg   )r   rh   ri   re     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 )Ng        z	\$\{.*?\}g?zpy:(.*?)=["\']g{Gz?)r   r   r   r|   )ru   r   rh   rh   ri   r|     s    zHtmlGenshiLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   r8     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 )r7   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*.kidz*.xmlzapplication/x-genshizapplication/x-kidc                s   t  jttf| d S )N)r   re   r   r   )rf   rg   )r   rh   ri   re     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 )Ng        z	\$\{.*?\}g?zpy:(.*?)=["\']g{Gz?)r   r   r   r|   )ru   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   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+genshiz*.jszapplication/x-javascript+genshiztext/x-javascript+genshiztext/javascript+genshic                s   t  jttf| d S )N)r   re   r   r9   )rf   rg   )r   rh   ri   re     s    zJavascriptGenshiLexer.__init__c             C   s   t | d S )Ng?)r7   r|   )ru   rh   rh   ri   r|     s    z"JavascriptGenshiLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   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+genshiz*.cssztext/css+genshic                s   t  jttf| d S )N)r   re   r   r9   )rf   rg   )r   rh   ri   re     s    zCssGenshiLexer.__init__c             C   s   t | d S )Ng?)r7   r|   )ru   rh   rh   ri   r|     s    zCssGenshiLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   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*.rhtmlz*.htmlz*.htmz*.xhtmlztext/html+rubyc                s   t  jttf| d S )N)r   re   r   r(   )rf   rg   )r   rh   ri   re     s    zRhtmlLexer.__init__c             C   s"   t | d }t| r|d7 }|S )Ng{Gz?g      ?)r(   r|   r"   )ru   r   rh   rh   ri   r|     s    zRhtmlLexer.analyse_text)r}   r~   r   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   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+erbz*.xmlzapplication/xml+rubyc                s   t  jttf| d S )N)r   re   r   r(   )rf   rg   )r   rh   ri   re   	  s    zXmlErbLexer.__init__c             C   s"   t | d }t| r|d7 }|S )Ng{Gz?g?)r(   r|   r#   )ru   r   rh   rh   ri   r|     s    zXmlErbLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   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+erbz*.cssztext/css+rubyc                s   t  jttf| d S )N)r   re   r   r(   )rf   rg   )r   rh   ri   re     s    zCssErbLexer.__init__c             C   s   t | d S )Ng?)r(   r|   )ru   rh   rh   ri   r|      s    zCssErbLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   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+erbz*.jszapplication/x-javascript+rubyztext/x-javascript+rubyztext/javascript+rubyc                s   t  jttf| d S )N)r   re   r   r(   )rf   rg   )r   rh   ri   re   1  s    zJavascriptErbLexer.__init__c             C   s   t | d S )Ng?)r(   r|   )ru   rh   rh   ri   r|   4  s    zJavascriptErbLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   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*.phtmlz*.phpz*.htmlz*.htmz*.xhtmlz
*.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 )N)r   re   r   r   )rf   rg   )r   rh   ri   re   H  s    zHtmlPhpLexer.__init__c             C   s"   t | d }t| r|d7 }|S )Ng{Gz?g      ?)r   r|   r"   )ru   r   rh   rh   ri   r|   K  s    zHtmlPhpLexer.analyse_text)r}   r~   r   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   r$   8  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+phpz*.xmlz*.phpz
*.php[345]zapplication/xml+phpc                s   t  jttf| d S )N)r   re   r   r   )rf   rg   )r   rh   ri   re   \  s    zXmlPhpLexer.__init__c             C   s"   t | d }t| r|d7 }|S )Ng{Gz?g?)r   r|   r#   )ru   r   rh   rh   ri   r|   _  s    zXmlPhpLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   r%   R  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+phpz*.cssztext/css+phpc                s   t  jttf| d S )N)r   re   r   r   )rf   rg   )r   rh   ri   re   p  s    zCssPhpLexer.__init__c             C   s   t | d S )Ng?)r   r|   )ru   rh   rh   ri   r|   s  s    zCssPhpLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   r&   f  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+phpz*.jszapplication/x-javascript+phpztext/x-javascript+phpztext/javascript+phpc                s   t  jttf| d S )N)r   re   r   r   )rf   rg   )r   rh   ri   re     s    zJavascriptPhpLexer.__init__c             C   s
   t | S )N)r   r|   )ru   rh   rh   ri   r|     s    zJavascriptPhpLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   r'   w  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+smartyz*.htmlz*.htmz*.xhtmlz*.tplztext/html+smartyc                s   t  jttf| d S )N)r   re   r   r-   )rf   rg   )r   rh   ri   re     s    zHtmlSmartyLexer.__init__c             C   s"   t | d }t| r|d7 }|S )Ng{Gz?g      ?)r-   r|   r"   )ru   r   rh   rh   ri   r|     s    zHtmlSmartyLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   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 )r/   z]
    Subclass of the `SmartyLexer` that highlights unlexed data with the
    `XmlLexer`.
    z
XML+Smartyz
xml+smartyz*.xmlz*.tplzapplication/xml+smartyc                s   t  jttf| d S )N)r   re   r   r-   )rf   rg   )r   rh   ri   re     s    zXmlSmartyLexer.__init__c             C   s"   t | d }t| r|d7 }|S )Ng{Gz?g?)r-   r|   r#   )ru   r   rh   rh   ri   r|     s    zXmlSmartyLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   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
    `CssLexer`.
    z
CSS+Smartyz
css+smartyz*.cssz*.tplztext/css+smartyc                s   t  jttf| d S )N)r   re   r   r-   )rf   rg   )r   rh   ri   re     s    zCssSmartyLexer.__init__c             C   s   t | d S )Ng?)r-   r|   )ru   rh   rh   ri   r|     s    zCssSmartyLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   r0     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 )r1   zd
    Subclass of the `SmartyLexer` that highlights unlexed data with the
    `JavascriptLexer`.
    zJavaScript+Smartyzjavascript+smartyz	js+smartyz*.jsz*.tplzapplication/x-javascript+smartyztext/x-javascript+smartyztext/javascript+smartyc                s   t  jttf| d S )N)r   re   r   r-   )rf   rg   )r   rh   ri   re     s    zJavascriptSmartyLexer.__init__c             C   s   t | d S )Ng?)r-   r|   )ru   rh   rh   ri   r|     s    z"JavascriptSmartyLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   r1     s   c                   sH   e Zd ZdZdZdddgZdddg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/Jinjazhtml+djangoz
html+jinjaZ
htmldjangoz*.htmlz*.htmz*.xhtmlztext/html+djangoztext/html+jinjac                s   t  jttf| d S )N)r   re   r   r2   )rf   rg   )r   rh   ri   re     s    zHtmlDjangoLexer.__init__c             C   s"   t | d }t| r|d7 }|S )Ng{Gz?g      ?)r2   r|   r"   )ru   r   rh   rh   ri   r|     s    zHtmlDjangoLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   r3     s   

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+jinjaz*.xmlzapplication/xml+djangozapplication/xml+jinjac                s   t  jttf| d S )N)r   re   r   r2   )rf   rg   )r   rh   ri   re     s    zXmlDjangoLexer.__init__c             C   s"   t | d }t| r|d7 }|S )Ng{Gz?g?)r2   r|   r#   )ru   r   rh   rh   ri   r|     s    zXmlDjangoLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   r5     s   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+jinjaz*.cssztext/css+djangoztext/css+jinjac                s   t  jttf| d S )N)r   re   r   r2   )rf   rg   )r   rh   ri   re     s    zCssDjangoLexer.__init__c             C   s   t | d S )Ng?)r2   r|   )ru   rh   rh   ri   r|     s    zCssDjangoLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   r4   	  s   c                   sN   e Zd ZdZdZddddgZdgZdd	d
dddg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/Jinjazjavascript+djangoz	js+djangozjavascript+jinjazjs+jinjaz*.jsz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 )N)r   re   r   r2   )rf   rg   )r   rh   ri   re   ,  s    zJavascriptDjangoLexer.__init__c             C   s   t | d S )Ng?)r2   r|   )ru   rh   rh   ri   r|   /  s    z"JavascriptDjangoLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   r6     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
    z<%\S?seczC</?jsp:(forward|getProperty|include|plugin|setProperty|useBean).*?>z[^<]+<z%>z#popz[\w\W]+?(?=%>|\Z))r   r   N)	r}   r~   r   r   r   r    r   r
   rv   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| d S )N)r   re   r   r   )rf   rg   )r   rh   ri   re   W  s    zJspLexer.__init__c             C   s:   t | d }t| r|d7 }d| kr6d| kr6|d7 }|S )Ng{Gz?g?z<%z%>g?)r
   r|   r#   )ru   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   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[^\]#]z#pushz\]#z#popz[\]#])r   r   c             C   s   d| krdS dS )z.Evoque templates use $evoque, which is unique.z$evoquerj   Nrh   )ru   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   rv   r|   rh   rh   rh   ri   rL   c  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 )
rM   zy
    Subclass of the `EvoqueLexer` that highlights unlexed data with the
    `HtmlLexer`.

    .. versionadded:: 1.1
    zHTML+Evoquezhtml+evoquez*.htmlztext/html+evoquec                s   t  jttf| d S )N)r   re   r   rL   )rf   rg   )r   rh   ri   re     s    zEvoqueHtmlLexer.__init__c             C   s
   t | S )N)rL   r|   )ru   rh   rh   ri   r|     s    zEvoqueHtmlLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   rM     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   zx
    Subclass of the `EvoqueLexer` that highlights unlexed data with the
    `XmlLexer`.

    .. versionadded:: 1.1
    z
XML+Evoquez
xml+evoquez*.xmlzapplication/xml+evoquec                s   t  jttf| d S )N)r   re   r   rL   )rf   rg   )r   rh   ri   re     s    zEvoqueXmlLexer.__init__c             C   s
   t | S )N)rL   r|   )ru   rh   rh   ri   r|     s    zEvoqueXmlLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   rN     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 )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   stringz'.*?'z\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)\bz(true|false|null)\bzD(application|session|client|cookie|super|this|variables|arguments)\bz([a-z_$][\w.]*)(\s*)(\()z[a-z_$][\w.]*z[()\[\]{};:,.\\]z\s+z""z#.+?#z[^"#]+r   z#pop)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Interprv   rh   rh   rh   ri   rO     sB   
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cfz[^<]+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.*?>z#popz(?s)<[^<>]*r   z#pushz--->z([^<-]|<(?!!---)|-(?!-->))+)r   r   r   r   N)r}   r~   r   r   r   r   r   r   r    r   r   r   r   r   r   r   rO   r   rv   rh   rh   rh   ri   r     s2   




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| d S )N)r   re   r   r   )rf   rg   )r   rh   ri   re   )  s    zColdfusionHtmlLexer.__init__)
r}   r~   r   r   r   r   r   r   re   r   rh   rh   )r   ri   rP      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 )rQ   zH
    Coldfusion markup/script components

    .. versionadded:: 2.0
    zColdfusion CFCZcfcz*.cfcc                s   t  jttf| d S )N)r   re   rP   rO   )rf   rg   )r   rh   ri   re   8  s    zColdfusionCFCLexer.__init__)
r}   r~   r   r   r   r   r   r   re   r   rh   rh   )r   ri   rQ   -  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 )
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| d S )N)r   re   r   r   )rf   rg   )r   rh   ri   re   G  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 )Ng        zval \w+\s*:g333333?g?z<%z%>g?)r   r   r#   )ru   r   rh   rh   ri   r|   J  s    zSspLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   rU   <  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
    z<%\S?r   z[^<]+r   z%>z#popz[\w\W]+?(?=%>|\Z))r   r   N)	r}   r~   r   r   r   r    r   r   rv   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| d S )N)r   re   r   r   )rf   rg   )r   rh   ri   re   v  s    zTeaTemplateLexer.__init__c             C   s:   t | d }t| r|d7 }d| kr6d| kr6|d7 }|S )Ng{Gz?g?z<%z%>g?)r   r|   r#   )ru   r   rh   rh   ri   r|   y  s    zTeaTemplateLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   rV   k  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 )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+lassoz*.htmlz*.htmz*.xhtmlz*.lassoz*.lasso[89]z*.inclz*.incz*.lasztext/html+lassozapplication/x-httpd-lassozapplication/x-httpd-lasso[89]c                s   t  jttf| d S )N)r   re   r   r   )rf   rg   )r   rh   ri   re     s    zLassoHtmlLexer.__init__c             C   s"   t | d }t| r|d7 }|S )Ng{Gz?g      ?)r   r|   r"   )ru   r   rh   rh   ri   r|     s    zLassoHtmlLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   rW     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 )rX   zz
    Subclass of the `LassoLexer` which highlights unhandled data with the
    `XmlLexer`.

    .. versionadded:: 1.6
    z	XML+Lassoz	xml+lassoz*.xmlz*.lassoz*.lasso[89]z*.inclz*.incz*.laszapplication/xml+lassoc                s   t  jttf| d S )N)r   re   r   r   )rf   rg   )r   rh   ri   re     s    zLassoXmlLexer.__init__c             C   s"   t | d }t| r|d7 }|S )Ng{Gz?g?)r   r|   r#   )ru   r   rh   rh   ri   r|     s    zLassoXmlLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   rX     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 )
rY   zz
    Subclass of the `LassoLexer` which highlights unhandled data with the
    `CssLexer`.

    .. versionadded:: 1.6
    z	CSS+Lassoz	css+lassoz*.cssztext/css+lassoc                s   d|d< t  jttf| d S )NTrequiredelimiters)r   re   r   r   )rf   rg   )r   rh   ri   re     s    zLassoCssLexer.__init__c             C   s6   t | d }td| r"|d7 }d| kr2|d7 }|S )Ng?z
\w+:[^;]+;g?zpadding:)r   r|   r   r   )ru   r   rh   rh   ri   r|     s    zLassoCssLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   rY     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 )rZ   z
    Subclass of the `LassoLexer` which highlights unhandled data with the
    `JavascriptLexer`.

    .. versionadded:: 1.6
    zJavaScript+Lassozjavascript+lassozjs+lassoz*.jszapplication/x-javascript+lassoztext/x-javascript+lassoztext/javascript+lassoc                s   d|d< t  jttf| d S )NTr   )r   re   r   r   )rf   rg   )r   rh   ri   re     s    zLassoJavascriptLexer.__init__c             C   s   t | d }|S )Ng?)r   r|   )ru   r   rh   rh   ri   r|     s    z!LassoJavascriptLexer.analyse_text)r}   r~   r   r   r   r   r   r   re   r|   r   rh   rh   )r   ri   rZ     s   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
handlebarsz[^{]+z\{\{!.*\}\}z(\{\{\{)(\s*)rz   z(\{\{)([#~/]+)([^\s}]*)z(\{\{)(\s*)z\s+z\}\}\}z#popz
(~?)(\}\})z([^\s}]+)(=)z(>)(\s*)(@partial-block)z(#?>)(\s*)([\w-]+)z(>)(\s*)(\()zdynamic-partialgenericz\)z(lookup)(\s+)(\.|this)(\s+)z(lookup)(\s+)(\S+)r   )rw   z[\w-]+z[()/@a-zA-Z][\w-]*z\.[\w-]+z(this\/|\.\/|(\.\.\/)+)[\w-]+z:?"(\\\\|\\[^\\]|[^"\\])*"z:?'(\\\\|\\[^\\]|[^'\\])*'z>[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?)r   rz   zdynamic-partialr   r   N)r}   r~   r   r   r   r   r    r   r   Specialr   rr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rv   rh   rh   rh   ri   r[     sD   


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 )N)r   re   r   r[   )rf   rg   )r   rh   ri   re   A  s    zHandlebarsHtmlLexer.__init__)
r}   r~   r   r   r   r   r   r   re   r   rh   rh   )r   ri   r\   4  s   c                   s<   e Zd ZdZdZdddg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+Jinjaz
yaml+jinjaZsaltZslsz*.slsztext/x-yaml+jinjaz
text/x-slsc                s   t  jttf| d S )N)r   re   r   r2   )rf   rg   )r   rh   ri   re   T  s    zYamlJinjaLexer.__init__)
r}   r~   r   r   r   r   r   r   re   r   rh   rh   )r   ri   r]   E  s   
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*.liquidz[^{]+z
(\{%)(\s*)ztag-or-blockz(\{\{)(\s*)([^\s}]+)r   )rw   outputz\{z(if|unless|elsif|case)(?=\s+)	conditionz(when)(\s+)zend-of-block
whitespacez(else)(\s*)(%\})z#popz!(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*)zvariable-tag-markupz([^\s%]+)(\s*)z
tag-markupz\}\}z\|filters)z#popz#popz([^\s|:]+)(:?)(\s*)zfilter-markupz
end-of-tagzdefault-param-markupz/([^\s=!><]+)(\s*)([=!><]=?)(\s*)(\S+)(\s*)(%\})z\b!z\bnot\bz*([\w.\'"]+)(\s+)(contains)(\s+)([\w.\'"]+)zend-at-whitespacez(\s*)((=|!|>|<)=?)(\s*)z(\s*)(\bcontains\b)(\s*)z%\}z\s+z([^\s=:]+)(\s*)(=|:)z(\{\{)(\s*)([^\s}])(\s*)(\}\})r   numberkeyword,zparam-markupr   zvariable-param-markupz\b(false|true)\bz[a-zA-Z_]\w*z(?<=\w)\.(?=\w)z'[^']*'z"[^"]*"z\d+\.\d+z\d+z[ \t]+z (\{%)(\s*)(endcomment)(\s*)(%\})z(\{%)(\s*)(endraw)(\s*)(%\}))r   ztag-or-blockr   r   zfilter-markupr   zgeneric-valueoperatorz
end-of-tagzend-of-blockzend-at-whitespacezparam-markupzdefault-param-markupzvariable-param-markupz
tag-markupzvariable-tag-markupr   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   Wordr   r   r   r   r   r   r   ZFloatZIntegerr   rv   rh   rh   rh   ri   r^   X  s   








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)*z[^{]+z\{\{r   z\{\#.*?\#\}zB(\{%)(-?\s*)(raw)(\s*-?)(%\})(.*?)(\{%)(-?\s*)(endraw)(\s*-?)(%\})zL(\{%)(-?\s*)(verbatim)(\s*-?)(%\})(.*?)(\{%)(-?\s*)(endverbatim)(\s*-?)(%\})z(\{%%)(-?\s*)(filter)(\s+)(%s)rz   z(\{%)(-?\s*)([a-zA-Z_]\w*)z\{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]+z:?"(\\\\|\\[^\\]|[^"\\])*"z:?'(\\\\|\\[^\\]|[^'\\])*'z4([{}()\[\]+\-*/,:~%]|\.\.|\?|:|\*\*|\/\/|!=|[><=]=?)z>[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?z\s+z
(-?)(\}\})z#popr   z	(-?)(%\})r   )r   r   r   rz   N)"r}   r~   r   r   r   r   r   r   r   r   r   Z_ident_charZ_ident_beginZ
_ident_endZ_ident_innerr    r   rr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rv   rh   rh   rh   ri   r_   &  sb   
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| d S )N)r   re   r   r_   )rf   rg   )r   rh   ri   re     s    zTwigHtmlLexer.__init__)
r}   r~   r   r   r   r   r   r   re   r   rh   rh   )r   ri   r`   y  s   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	[^{([*#]+z(\{\{)(\s*)ngExpressionz&([([]+)([\w:.-]+)([\])]+)(\s*)(=)(\s*)r   z([([]+)([\w:.-]+)([\])]+)(\s*)z([*#])([\w:.-]+)(\s*)(=)(\s*)z([*#])([\w:.-]+)(\s*)z\s+(\|\s+)?z\}\}z#popz:?(true|false)z:?"(\\\\|\\[^\\]|[^"\\])*"z:?'(\\\\|\\[^\\]|[^'\\])*'z>[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?z[a-zA-Z][\w-]*(\(.*\))?z\.[\w-]+(\(.*\))?z-(\?)(\s*)([^}\s]+)(\s*)(:)(\s*)([^}\s]+)(\s*)z".*?"z'.*?'z[^\s>]+)r   r   r   N)r}   r~   r   r   r   r   r    r   r   rr   r   r   r   r   r   r   Booleanr   r   r   r   rv   rh   rh   rh   ri   ra     s8   
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| d S )N)r   re   r   ra   )rf   rg   )r   rh   ri   re     s    zAngular2HtmlLexer.__init__)	r}   r~   r   r   r   r   r   re   r   rh   rh   )r   ri   rb     s
   )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@