o a@s8dZddlZddlmZmZddlmZmZddlm Z ddl m Z ddl m Z ddlmZdd lmZmZdd lmZdd lmZmZmZmZmZmZmZmZmZdd lm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+dd l,m-Z-m.Z.gdZ/GdddeZ0GdddeZ1GdddeZ2GdddeZ3GdddeZ4GdddeZ5GdddeZ6GdddeZ7Gdd d eZ8Gd!d"d"eZ9Gd#d$d$eZ:Gd%d&d&eZ;Gd'd(d(eZGd-d.d.eZ?Gd/d0d0eZ@Gd1d2d2eZAGd3d4d4eZBGd5d6d6eZCGd7d8d8eZDGd9d:d:eZEGd;d<dd>eZGGd?d@d@eZHGdAdBdBeZIGdCdDdDeZJGdEdFdFeZKGdGdHdHeZLGdIdJdJeZMGdKdLdLeZNGdMdNdNeZOGdOdPdPeZPGdQdRdReZQGdSdTdTeZRGdUdVdVeZSGdWdXdXeZTGdYdZdZeZUGd[d\d\eZVGd]d^d^eZWGd_d`d`eZXGdadbdbeZYGdcddddeZZGdedfdfeZ[GdgdhdheZ\GdidjdjeZ]GdkdldleZ^GdmdndneZ_GdodpdpeZ`GdqdrdreZaGdsdtdteZbGdudvdveZcGdwdxdxeZdGdydzdzeZeGd{d|d|eZfGd}d~d~eZgGdddeZhGdddeZiGdddeZjGdddeZkGdddeZlGdddeZmGdddeZnGdddeZoGdddeZpGdddeZqGdddeZrGdddeZsdS)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) HtmlLexerXmlLexer)JavascriptLexer LassoLexer)CssLexer)PhpLexer) PythonLexer) PerlLexer) JavaLexer TeaLangLexer) YamlLexer) LexerDelegatingLexer RegexLexerbygroupsincludeusingthisdefaultcombined) Error Punctuation WhitespaceTextCommentOperatorKeywordNameStringNumberOtherToken)html_doctype_matcheslooks_like_xml)? HtmlPhpLexer XmlPhpLexer CssPhpLexerJavascriptPhpLexerErbLexer RhtmlLexer XmlErbLexer CssErbLexerJavascriptErbLexer SmartyLexerHtmlSmartyLexerXmlSmartyLexerCssSmartyLexerJavascriptSmartyLexer DjangoLexerHtmlDjangoLexerCssDjangoLexerXmlDjangoLexerJavascriptDjangoLexer GenshiLexerHtmlGenshiLexerGenshiTextLexerCssGenshiLexerJavascriptGenshiLexer MyghtyLexerMyghtyHtmlLexerMyghtyXmlLexerMyghtyCssLexerMyghtyJavascriptLexer MasonLexer MakoLexer MakoHtmlLexer MakoXmlLexerMakoJavascriptLexer MakoCssLexerJspLexer CheetahLexerCheetahHtmlLexerCheetahXmlLexerCheetahJavascriptLexer EvoqueLexerEvoqueHtmlLexerEvoqueXmlLexerColdfusionLexerColdfusionHtmlLexerColdfusionCFCLexer VelocityLexerVelocityHtmlLexerVelocityXmlLexerSspLexerTeaTemplateLexerLassoHtmlLexer LassoXmlLexer LassoCssLexerLassoJavascriptLexerHandlebarsLexerHandlebarsHtmlLexerYamlJinjaLexer LiquidLexer TwigLexer TwigHtmlLexer Angular2LexerAngular2HtmlLexerc@sFeZdZdZdZdgZdgZedej Z ddZ dd Z d d Z d S) r(a  Generic `ERB `_ (Ruby Templating) lexer. Just highlights ruby code between the preprocessor directives, other data is left untouched by the lexer. All options are also forwarded to the `RubyLexer`. ERBerbzapplication/x-ruby-templatingz*(<%%|%%>|<%=|<%#|<%-|<%|-%>|%>|^%[^%].*?$)cKs2ddlm}|di||_tj|fi|dS)Nr) RubyLexer)pygments.lexers.rubyre ruby_lexerr __init__)selfoptionsrerfrf;/usr/lib/python3/dist-packages/pygments/lexers/templates.pyriBs zErbLexer.__init__c cs |j|}|d}}z |dkr(|}|t|fV|t|7}d}n|dkr|}|dvrA|t|fV|d7}d}n|dkrc|tj|fV|}|dt|fV|dt|7}d}n|dvr|tj|fV|t|7}|}d}|j |D] \}} } ||| | fVq|t|7}d}nc|d vr|t |fV|t|7}d}nP|tj|dfVd}|j |dd D]\}} } |d|| | fVq|t|7}d}n"|dkr|}|d vr|t|fVn|tj|fV|t|7}d}qt yYd Sw) 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. rT)z<%%z%%>z<%#)<%z<%=z<%-)%>z-%>N) _block_resplitreversepopr lenrPreprocrhget_tokens_unprocessedr IndexError) rjtexttokensstateidxvaltagdatar_idxr_tokenr_valuerfrfrlrxGsn             7zErbLexer.get_tokens_unprocessedcCsd|vr d|vr dSdSdS)Nrprq皙?rfrzrfrfrl analyse_textszErbLexer.analyse_textN)__name__ __module__ __qualname____doc__namealiases mimetypesrecompileMrrrirxrrfrfrfrlr(1s  Dr(c @seZdZdZdZdgZdgZdgZej ej BZ de fde ejeejfde ejeed d ejfd e ejejedfd ejdfgd efd ejdfdejdfdejfdejfdefdejfdefdejfdejfdejfg dZddZdS)r-z Generic `Smarty `_ template lexer. Just highlights smarty code between the preprocessor directives, other data is left untouched by the lexer. Smartysmarty*.tplzapplication/x-smarty[^{]+z(\{)(\*.*?\*)(\})z(\{php\})(.*?)(\{/php\})T) 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*)rootrcCsXd}td|r |d7}td|r|d7}td|r |d7}td|r*|d7}|S)Nz\{if\s+.*?\}.*?\{/if\}333333?z\{include\s+file=.*?\}z \{foreach\s+.*?\}.*?\{/foreach\}z \{\$.*?\}{Gz?rsearchrzrvrfrfrlrs    zSmartyLexer.analyse_textN) rrrrrr filenamesrr MULTILINEDOTALLflagsr rrrwrrrFunctionrVariablerrConstantrrDoubleSingle Attributer{rrfrfrfrlr-sJ     r-c@seZdZdZdZdgZddgZejej BZ dZ de fde ejeejfd e ejefd e d e ejejejed fd e d e ejejejfdedfge ejfdedfde de eejdfdedfedgdefdedfde dejfedgdefeddedfgdedfdefdefdejfd ejfd!efd"efd#ejfdedfd$edfd%edfdedfdedfdedfgd&Zd'd(Zd)S)*rRz Generic `Velocity `_ template lexer. Just highlights velocity directives and variable references, other data is left untouched by the lexer. Velocityvelocity*.vm*.fhtmlrz[^{#$]+z(#)(\*.*?\*)(#)z (##)(.*?$)z(#\{?)(z )(\}?)(\s?\()directiveparamsz)(\}|\b)z\$!?\{?variablez\( funcparamsz(\.)()rrrz=(&&|\|\||==?|!=?|[-<>+*%&|^/])|\b(eq|ne|gt|lt|ge|le|not|in)\bz\[ rangeoperatorz\bz\.\.z\]rz[,:]rrz0[xX][0-9a-fA-F]+[Ll]?z \b[0-9]+\br\)r)rrrrrcCsdd}td|tjr|d7}td|tjr|d7}td|tjr&|d7}td|r0|d7}|S) Nrz #\{?macro\}?\(.*?\).*?#\{?end\}?g?z#\{?if\}?\(.+?\).*?#\{?end\}?rz"#\{?foreach\}?\(.+?\).*?#\{?end\}?z6\$!?\{?[a-zA-Z_]\w*(\([^)]*\))?(\.\w+(\([^)]*\))?)*\}?rrrrrrfrfrlr szVelocityLexer.analyse_textN) rrrrrrrrrrr identifierr rrrwrrrrrrrrrrrrrrr{rrfrfrfrlrRsv        4rRc8eZdZdZdZdgZddgZdgZfddZZ S) rSza Subclass of the `VelocityLexer` that highlights unlexed data with the `HtmlLexer`. z HTML+Velocityz html+velocity*.htmlrztext/html+velocityc tjttfi|dSN)superrirrRrjrk __class__rfrlri&zVelocityHtmlLexer.__init__) rrrrrralias_filenamesrri __classcell__rfrfrrlrSsrSc@eZdZdZdZdgZddgZdgZfddZd d Z Z S) rTz` Subclass of the `VelocityLexer` that highlights unlexed data with the `XmlLexer`. z XML+Velocityz xml+velocity*.xmlrzapplication/xml+velocityc rr)rrirrRrrrfrlri6rzVelocityXmlLexer.__init__cC"t|d}t|r|d7}|SNrr)rRrr#rrfrfrlr9zVelocityXmlLexer.analyse_text rrrrrrrrrirrrfrfrrlrT*s rTc@s|eZdZdZdZddgZddgZejej BZ de fde j d fd e fd ee j eeee j e e j eeee j fd ee j eeee j ee j eeee j fd ee j eeeejdfdee j eedfde fgdeeeejfdeeeeeejfdejfdefdejfdejfdejfdejfdejfdefdefg defdeee j dfedgdefd eee j dfedd!efgd"Zd#d$Zd%S)&r2a Generic `django `_ and `jinja `_ template lexer. It just highlights django/jinja code between the preprocessor directives, other data is left untouched by the lexer. z Django/Jinjadjangojinjazapplication/x-django-templatingzapplication/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*)rz(\|)(\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 ([{}()\[\]+\-*/%,:~]|[><=]=?|!=)rr (-?)(\}\})rvarnames (-?)(%\}).)rrrrcCsPd}td|dur|d7}td|dur|d7}td|dur&|d7}|S)Nrz\{%\s*(block|extends)rz\{%\s*if\s*.*?%\}皙?z \{\{.*?\}\}rrrfrfrlrszDjangoLexer.analyse_textN)rrrrrrrrrSrr rrwrrrrrrPseudoBuiltinrrrrrrrr{rrfrfrfrlr2@sz      9r2c@seZdZdZdZdgZddgZdgZddefd e e j ee j e j e ee j fd e e j e j e j e ee j fd e e j e j e ee j fd e e j e j e ee j fd e j fde e j e ee j fdefde e j e eefde eefg iZdS)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/ Myghtymyghtyz*.myt autodelegatezapplication/x-myghtyrr3(?s)(<%(?:def|method))(\s*)(.*?)(>)(.*?)()z#(?s)(<%\w+)(.*?)(>)(.*?)()z(<&[^|])(.*?)(,.*?)?(&>)(?s)(<&\|)(.*?)(,.*?)?(&>)(?s)(<%!?)(.*?)(%>)(?<=^)#[^\n]*(\n|\Z)(?<=^)(%)([^\n]*)(\n|\Z)(?sx) (.+?) # anything, followed by: (?: (?<=\n)(?=[%#]) | # an eval or comment line (?=zx Subclass of the `MyghtyLexer` that highlights unlexed data with the `XmlLexer`. .. versionadded:: 0.6 z XML+Myghtyz xml+myghtyzapplication/xml+myghtyc rr)rrirr<rrrfrlrirzMyghtyXmlLexer.__init__rrfrfrrlr>rr>c4eZdZdZdZddgZgdZfddZZS)r@z Subclass of the `MyghtyLexer` that highlights unlexed data with the `JavascriptLexer`. .. versionadded:: 0.6 zJavaScript+Myghtyzjavascript+myghtyz js+myghty)zapplication/x-javascript+myghtyztext/x-javascript+myghtyztext/javascript+mygthyc rr)rrirr<rrrfrlrirzMyghtyJavascriptLexer.__init__rrfrfrrlr@ r@cr)r?zx Subclass of the `MyghtyLexer` that highlights unlexed data with the `CssLexer`. .. versionadded:: 0.6 z CSS+Myghtyz css+myghtyztext/css+myghtyc rr)rrirr<rrrfrlrirzMyghtyCssLexer.__init__rrfrfrrlr?rr?c@s eZdZdZdZdgZgdZdgZddefde e j e j e j fd e e j ee je j eee j fd e e j d d d eee j fd e e j e jeee j fd e e j e jeee j fde j fde e j eee j fde fde e j eeefde eeefg iZddZd S)rAz 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 Masonmason)z*.mz*.mhtmlz*.mcz*.mi autohandlerdhandlerzapplication/x-masonrrz(?s)(<%doc>)(.*?)()rz%(?s)(<%(\w+)(.*?)(>))(.*?)()Nz(?s)(<&[^|])(.*?)(,.*?)?(&>)rrrrrrcCs8d}td|durd}|Std|tjdurd}|S)Nrzg?z<&.+&>g)\(?r)rzresultrfrfrlr4szMasonLexer.analyse_text)rrrrrrrrrrrrr Multilinerrrr r rrr{rrfrfrfrlrAsN   !rAc @s8eZdZdZdZdgZdgZdgZdee j e j e efdee j e j eeefdee j e je j fd e jfd ee j ejd fd ee j eje j fd e j dfdee j eee j fdee j eee j fdeeefde fg de j fdejfed gdeeje efde j dfde fgdedfdedfdedfgdZdS)rBz Generic `mako templates`_ lexer. Code that isn't Mako markup is yielded as `Token.Other`. .. versionadded:: 0.7 .. _mako templates: http://www.makotemplates.org/ Makomakoz*.maozapplication/x-makoz(\s*)(%)(\s*end(?:\w+))(\n|\Z)z(\s*)(%)([^\n]*)(\n|\Z)z(\s*)(##[^\n]*)(\n|\Z)z(?s)<%doc>.*?z (<%)([\w.:]+)rz()z<%(?=([\w.:]+)) ondeftagsz(?s)(<%(?:!?))(.*?)(%>)z(\$\{)(.*?)(\})a\(?sx) (.+?) # anything, followed by: (?: (?<=\n)(?=%|\#\#) | # an eval or comment line (?=\#\*) | # multiline comment (?=r".*?"'.*?'[^\s>]+)rrrattrN)rrrrrrrrrrrrrwrr rrrrrrrrrrr{rfrfrfrlrB=sb   "   rBcr)rCzw Subclass of the `MakoLexer` that highlights unlexed data with the `HtmlLexer`. .. versionadded:: 0.7 z HTML+Makoz html+makoztext/html+makoc rr)rrirrBrrrfrlrirzMakoHtmlLexer.__init__rrfrfrrlrCrrCcr)rDzv Subclass of the `MakoLexer` that highlights unlexed data with the `XmlLexer`. .. versionadded:: 0.7 zXML+Makozxml+makozapplication/xml+makoc rr)rrirrBrrrfrlrirzMakoXmlLexer.__init__rrfrfrrlrDrrDcr)rEz} Subclass of the `MakoLexer` that highlights unlexed data with the `JavascriptLexer`. .. versionadded:: 0.7 zJavaScript+Makozjavascript+makozjs+mako)zapplication/x-javascript+makoztext/x-javascript+makoztext/javascript+makoc rr)rrirrBrrrfrlrirzMakoJavascriptLexer.__init__rrfrfrrlrErrEcr)rFzv Subclass of the `MakoLexer` that highlights unlexed data with the `CssLexer`. .. versionadded:: 0.7 zCSS+Makozcss+makoz text/css+makoc rr)rrirrBrrrfrlrirzMakoCssLexer.__init__rrfrfrrlrFrrFc@seZdZdZddZdS)CheetahPythonLexerzI Lexer for handling Cheetah's special $ tokens in Python syntax. ccsPtdi|j}||D]\}}}|tjkr|dkrtj}|||fVqdS)N$rf)rrkrxr!rrrw)rjrzpylexerpostype_valuerfrfrlrxsz)CheetahPythonLexer.get_tokens_unprocessedN)rrrrrxrfrfrfrlrs rc @seZdZdZdZddgZddgZddgZd d ee fd e fd e j fd e j fdee j e e e j fdee j e e fdee j e e e j fde fdefg iZdS)rHa2 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/ Cheetahcheetahspitfirez*.tmplz*.sptzapplication/x-cheetahzapplication/x-spitfirerz (##[^\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 ) rN)rrrrrrrrrrrwrrr rr{rfrfrfrlrHs@   rHcs4eZdZdZdZgdZddgZfddZZS)rIz_ Subclass of the `CheetahLexer` that highlights unlexed data with the `HtmlLexer`. z HTML+Cheetah)z html+cheetahz html+spitfire htmlcheetahztext/html+cheetahztext/html+spitfirec rr)rrirrHrrrfrlrirzCheetahHtmlLexer.__init__rrfrfrrlrI rIcs4eZdZdZdZddgZddgZfddZZS) rJz^ Subclass of the `CheetahLexer` that highlights unlexed data with the `XmlLexer`. z XML+Cheetahz xml+cheetahz xml+spitfirezapplication/xml+cheetahzapplication/xml+spitfirec rr)rrirrHrrrfrlrirzCheetahXmlLexer.__init__rrfrfrrlrJ rrJcs4eZdZdZdZgdZgdZfddZZS)rKze Subclass of the `CheetahLexer` that highlights unlexed data with the `JavascriptLexer`. zJavaScript+Cheetah)zjavascript+cheetahz js+cheetahzjavascript+spitfirez js+spitfire)z application/x-javascript+cheetahztext/x-javascript+cheetahztext/javascript+cheetahz!application/x-javascript+spitfireztext/x-javascript+spitfireztext/javascript+spitfirec rr)rrirrHrrrfrlri*rzCheetahJavascriptLexer.__init__rrfrfrrlrKs rKc @seZdZdZdZdgZddgZdefdee e fdee e j d fe d d efgd e d fde ed fdeee e ed fded fdeee e d fgdee j e ee j fdejfgdZdS)r9z] A lexer that highlights `genshi `_ text templates. z Genshi Text genshitextzapplication/x-genshi-textz text/x-genshiz[^#$\s]+z ^(\s*)(##.*)$z ^(\s*)(#) directiverz[#$\s]z\nrz(?:def|for|if)\s+.*z (choose|when|with)([^\S\n]+)(.*)z(choose|otherwise)\bz(end\w*)([^\S\n]*)(.*)(?)z'<\s*(script|style)\s*.*?>.*?<\s*/\1\s*>z<\s*py:[a-zA-Z0-9]+pytagz<\s*[a-zA-Z0-9:.]+rrz[<$]rz [\w:-]+\s*=pyattrrrz (")(.*?)(")z (')(.*?)(')rz py:[\w-]+\s*=r" attr-dstring' attr-sstringz[^\s>]*stringsz[^"'$]+r z(?`_ and `kid `_ kid HTML templates. z HTML+Genshiz html+genshizhtml+kidr*.htm*.xhtmlztext/html+genshic rr)rrirr rrrfrlrirzHtmlGenshiLexer.__init__cCFd}td|dur|d7}td|dur|d7}|t|dSNrz \$\{.*?\}皙?zpy:(.*?)=["\']r)rrrrrrfrfrlr zHtmlGenshiLexer.analyse_textrrfrfrrlr8s r8csHeZdZdZdZgdZdgZdgZddgZfdd Z d d Z Z S) r7z A lexer that highlights `genshi `_ and `kid `_ kid XML templates. Genshi)genshikidz xml+genshizxml+kidz*.kidrzapplication/x-genshizapplication/x-kidc rr)rrirr rrrfrlrirzGenshiLexer.__init__cCrr)rrrrrrfrfrlrrzGenshiLexer.analyse_text rrrrrrrrrrirrrfrfrrlr7s r7cBeZdZdZdZgdZdgZgdZfddZdd Z Z S) r;zK A lexer that highlights javascript code in genshi text templates. zJavaScript+Genshi Text)z js+genshitextz js+genshizjavascript+genshitextzjavascript+genshi*.js)zapplication/x-javascript+genshiztext/x-javascript+genshiztext/javascript+genshic rr)rrirr9rrrfrlrirzJavascriptGenshiLexer.__init__cCt|dSN皙?r7rrrfrfrlrz"JavascriptGenshiLexer.analyse_textrrfrfrrlr;s r;c@eZdZdZdZddgZdgZdgZfddZd d Z Z S) r:zK A lexer that highlights CSS definitions in genshi text templates. zCSS+Genshi Textzcss+genshitextz css+genshi*.cssztext/css+genshic rr)rrirr9rrrfrlrirzCssGenshiLexer.__init__cCr!r"r$rrfrfrlrr%zCssGenshiLexer.analyse_textrrfrfrrlr: r:csHeZdZdZdZgdZdgZgdZdgZfddZ d d Z Z S) r)z Subclass of the ERB lexer that highlights the unlexed data with the html lexer. Nested Javascript and CSS is highlighted too. RHTML)rhtmlzhtml+erbz html+rubyz*.rhtmlrztext/html+rubyc rr)rrirr(rrrfrlrirzRhtmlLexer.__init__cCrNrg?)r(rr"rrfrfrlrszRhtmlLexer.analyse_textrrfrfrrlr)s r)cr&) r*zo Subclass of `ErbLexer` which highlights data outside preprocessor directives with the `XmlLexer`. zXML+Rubyzxml+rubyzxml+erbrzapplication/xml+rubyc rr)rrirr(rrrfrlri rzXmlErbLexer.__init__cCrr)r(rr#rrfrfrlr rzXmlErbLexer.analyse_textrrfrfrrlr*s r*cr&) r+zS Subclass of `ErbLexer` which highlights unlexed data with the `CssLexer`. zCSS+Rubyzcss+rubyzcss+erbr'z text/css+rubyc rr)rrirr(rrrfrlrirzCssErbLexer.__init__cCr!r"r(rrrfrfrlr r%zCssErbLexer.analyse_textrrfrfrrlr+r(r+cr) r,z^ Subclass of `ErbLexer` which highlights unlexed data with the `JavascriptLexer`. zJavaScript+Ruby)zjavascript+rubyzjs+rubyzjavascript+erbzjs+erbr )zapplication/x-javascript+rubyztext/x-javascript+rubyztext/javascript+rubyc rr)rrirr(rrrfrlri1rzJavascriptErbLexer.__init__cCr!r"r,rrfrfrlr4r%zJavascriptErbLexer.analyse_textrrfrfrrlr,$ r,csHeZdZdZdZdgZdgZgdZgdZfddZ d d Z Z S) r$z Subclass of `PhpLexer` that highlights unhandled data with the `HtmlLexer`. Nested Javascript and CSS is highlighted too. zHTML+PHPzhtml+phpz*.phtml)*.phprrr *.php[345])zapplication/x-phpzapplication/x-httpd-phpzapplication/x-httpd-php3zapplication/x-httpd-php4zapplication/x-httpd-php5c rr)rrirrrrrfrlriHrzHtmlPhpLexer.__init__cCrr+)rrr"rrfrfrlrKrzHtmlPhpLexer.analyse_textrrfrfrrlr$8s r$c@eZdZdZdZdgZgdZdgZfddZdd Z Z S) r%zT Subclass of `PhpLexer` that highlights unhandled data with the `XmlLexer`. zXML+PHPzxml+php)rr.r/zapplication/xml+phpc rr)rrirrrrrfrlri\rzXmlPhpLexer.__init__cCrr)rrr#rrfrfrlr_rzXmlPhpLexer.analyse_textrrfrfrrlr%Rs r%c>eZdZdZdZdgZdgZdgZfddZdd Z Z S) r&zU Subclass of `PhpLexer` which highlights unmatched data with the `CssLexer`. zCSS+PHPzcss+phpr'z text/css+phpc rr)rrirrrrrfrlriprzCssPhpLexer.__init__cCr!r"rrrrfrfrlrsr%zCssPhpLexer.analyse_textrrfrfrrlr&fs r&cBeZdZdZdZddgZdgZgdZfddZd d Z Z S) r'z` Subclass of `PhpLexer` which highlights unmatched data with the `JavascriptLexer`. zJavaScript+PHPzjavascript+phpzjs+phpr )zapplication/x-javascript+phpztext/x-javascript+phpztext/javascript+phpc rr)rrirrrrrfrlrirzJavascriptPhpLexer.__init__cC t|Srr2rrfrfrlr zJavascriptPhpLexer.analyse_textrrfrfrrlr'wr-r'cr0) 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)rrrrztext/html+smartyc rr)rrirr-rrrfrlrirzHtmlSmartyLexer.__init__cCrr+)r-rr"rrfrfrlrrzHtmlSmartyLexer.analyse_textrrfrfrrlr.s r.cr) r/z] Subclass of the `SmartyLexer` that highlights unlexed data with the `XmlLexer`. z XML+Smartyz xml+smartyrrzapplication/xml+smartyc rr)rrirr-rrrfrlrirzXmlSmartyLexer.__init__cCrr)r-rr#rrfrfrlrrzXmlSmartyLexer.analyse_textrrfrfrrlr/ r/cr) r0z] Subclass of the `SmartyLexer` that highlights unlexed data with the `CssLexer`. z CSS+Smartyz css+smartyr'rztext/css+smartyc rr)rrirr-rrrfrlrirzCssSmartyLexer.__init__cCr!r"r-rrrfrfrlrr%zCssSmartyLexer.analyse_textrrfrfrrlr0r6r0csDeZdZdZdZddgZddgZgdZfdd Zd d Z Z S) r1zd Subclass of the `SmartyLexer` that highlights unlexed data with the `JavascriptLexer`. zJavaScript+Smartyzjavascript+smartyz js+smartyr r)zapplication/x-javascript+smartyztext/x-javascript+smartyztext/javascript+smartyc rr)rrirr-rrrfrlrirzJavascriptSmartyLexer.__init__cCr!r"r7rrfrfrlrr%z"JavascriptSmartyLexer.analyse_textrrfrfrrlr1s r1csDeZdZdZdZgdZgdZddgZfddZd d Z Z S) r3z Subclass of the `DjangoLexer` that highlights unlexed data with the `HtmlLexer`. Nested Javascript and CSS is highlighted too. zHTML+Django/Jinja)z html+djangoz html+jinja htmldjangorztext/html+djangoztext/html+jinjac rr)rrirr2rrrfrlrirzHtmlDjangoLexer.__init__cCrr+)r2rr"rrfrfrlrrzHtmlDjangoLexer.analyse_textrrfrfrrlr3s r3cBeZdZdZdZddgZdgZddgZfdd Zd d Z Z S) r5z] Subclass of the `DjangoLexer` that highlights unlexed data with the `XmlLexer`. zXML+Django/Jinjaz xml+djangoz xml+jinjarzapplication/xml+djangozapplication/xml+jinjac rr)rrirr2rrrfrlrirzXmlDjangoLexer.__init__cCrr)r2rr#rrfrfrlrrzXmlDjangoLexer.analyse_textrrfrfrrlr5 r5cr9) r4z] Subclass of the `DjangoLexer` that highlights unlexed data with the `CssLexer`. zCSS+Django/Jinjaz css+djangoz css+jinjar'ztext/css+djangoztext/css+jinjac rr)rrirr2rrrfrlrirzCssDjangoLexer.__init__cCr!r"r2rrrfrfrlrr%zCssDjangoLexer.analyse_textrrfrfrrlr4 r:r4cr) r6zd Subclass of the `DjangoLexer` that highlights unlexed data with the `JavascriptLexer`. zJavaScript+Django/Jinja)zjavascript+djangoz js+djangozjavascript+jinjazjs+jinjar )zapplication/x-javascript+djangozapplication/x-javascript+jinjaztext/x-javascript+djangoztext/x-javascript+jinjaztext/javascript+djangoztext/javascript+jinjac rr)rrirr2rrrfrlri,rzJavascriptDjangoLexer.__init__cCr!r"r;rrfrfrlr/r%z"JavascriptDjangoLexer.analyse_textrrfrfrrlr6s r6c@sFeZdZdZdedfdefdefdefgdedfd eefgd Zd S) JspRootLexerzt Base for the `JspLexer`. Yields `Token.Other` for area outside of JSP tags. .. versionadded:: 0.7 <%\S?seczC[^<]+|\Z)rr>N) rrrrrr rr r{rfrfrfrlr<3s   r<cr1) rGzA Lexer for Java Server Pages. .. versionadded:: 0.7 zJava Server Pagejspz*.jspzapplication/x-jspc rrrrirr<rrrfrlriWrzJspLexer.__init__cC:t|d}t|r|d7}d|vrd|vr|d7}|SNrrrprqr)r rr#rrfrfrlrZ zJspLexer.analyse_text rrrrrrrrrirrrfrfrrlrGL rGc@seZdZdZdZdgZdgZdgZej Z de fde j dfd e fd e j fd eeejed eefd eeejed eeeefdeeejed eeefdeeejfdeed eeejd d efde fg de j fde j dfde j dfde j fgdZddZd S)rLzR For files using the Evoque templating system. .. versionadded:: 1.1 Evoqueevoquez*.evoquezapplication/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[^\]#]rz\]#rz[\]#])rrLcCsd|vrdSdS)z.Evoque templates use $evoque, which is unique.z$evoquermNrfrrfrfrlrszEvoqueLexer.analyse_text)rrrrrrrrrrrr rrrrrrrrrr{rrfrfrfrlrLcsR          'rLcr1) rMzy Subclass of the `EvoqueLexer` that highlights unlexed data with the `HtmlLexer`. .. versionadded:: 1.1 z HTML+Evoquez html+evoquerztext/html+evoquec rr)rrirrLrrrfrlrirzEvoqueHtmlLexer.__init__cCr4rrLrrrfrfrlrr5zEvoqueHtmlLexer.analyse_textrHrfrfrrlrM rMcr1) rNzx Subclass of the `EvoqueLexer` that highlights unlexed data with the `XmlLexer`. .. versionadded:: 1.1 z XML+Evoquez xml+evoquerzapplication/xml+evoquec rr)rrirrLrrrfrlrirzEvoqueXmlLexer.__init__cCr4rrNrrfrfrlrr5zEvoqueXmlLexer.analyse_textrHrfrfrrlrNrOrNc@seZdZdZdZdgZgZgZej Z de j fde j fdefdefdefd efd efd efd efd ejdfdej fdefdefdejfdejfdeejeefdejfdefdefgdejfdejfdejfdejfd ejdfgdZdS)rOz Coldfusion statements cfstatementcfsz//.*?\nz/\*(?:.|\n)*?\*/z\+\+|--z [-+*/^&=!]z <=|>=|<|>|==zmod\bz"(eq|lt|gt|lte|gte|not|is|and|or)\bz\|\||&&z\?rstringr\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)\brzD(application|session|client|cookie|super|this|variables|arguments)\bz([a-z_$][\w.]*)(\s*)(\()z [a-z_$][\w.]*z[()\[\]{};:,.\\]rz""z#.+?#z[^"#]+rMr)rrRN)rrrrrrrrr IGNORECASErrrrrrrrrrrrrrrrInterpr{rfrfrfrlrOsP    rOc @seZdZdZdZdgZgZgZdefe ddefgde j dfd e fd e j d fd ee j eee j fd ee j eee j fgdefdeeeeefde j dfe ddefdefgde j dfde j dfde j fgdZdS)ColdfusionMarkupLexerz Coldfusion markup only Coldfusioncfr?tagsz<[^<>]*zz cfoutputz((?s)()(.+?)()z(?s)()z[^#<]+z (#)(.*?)(#)zrz (?s)<[^<>]*rMrz--->z([^<-]|<(?!!---)|-(?!-->))+)rrYr[rZN)rrrrrrrrr rrrrrrrrOrr{rfrfrfrlrVsD      rVcr) rPz# Coldfusion markup in html zColdfusion HTMLcfmz*.cfmz*.cfmlzapplication/x-coldfusionc rr)rrirrVrrrfrlri)rzColdfusionHtmlLexer.__init__ rrrrrrrrrirrfrfrrlrP srPcs4eZdZdZdZdgZdgZgZfddZZ S)rQzH Coldfusion markup/script components .. versionadded:: 2.0 zColdfusion CFCcfcz*.cfcc rr)rrirPrOrrrfrlri8rzColdfusionCFCLexer.__init__r]rfrfrrlrQ-srQcr1) rUzD Lexer for Scalate Server Pages. .. versionadded:: 1.4 zScalate Server Pagesspz*.sspzapplication/x-sspc rrrDrrrfrlriGrzSspLexer.__init__cCsDd}td|r |d7}t|r|d7}d|vr d|vr |d7}|S)Nrz val \w+\s*:g333333?rrprqr)rrr#rrfrfrlrJs zSspLexer.analyse_textrHrfrfrrlrU<rIrUc@s@eZdZdZdedfdefdefgdedfdeefgd Zd S) TeaTemplateRootLexerz Base for the `TeaTemplateLexer`. Yields `Token.Other` for area outside of code blocks. .. versionadded:: 1.5 r=r>r?r@rqrrArBN) rrrrrr rr r{rfrfrfrlr`Us   r`cr1) rVzW Lexer for `Tea Templates `_. .. versionadded:: 1.5 Teateaz*.teaz text/x-teac rr)rrirr`rrrfrlrivrzTeaTemplateLexer.__init__cCrErF)r rr#rrfrfrlryrGzTeaTemplateLexer.analyse_textrHrfrfrrlrVkrIrVcsBeZdZdZdZdgZgdZgdZfddZdd Z Z S) rWz 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)rrr*.lasso *.lasso[89]*.incl*.inc*.las)ztext/html+lassozapplication/x-httpd-lassozapplication/x-httpd-lasso[89]c rr)rrirrrrrfrlrirzLassoHtmlLexer.__init__cCrr+)rrr"rrfrfrlrrzLassoHtmlLexer.analyse_textrrfrfrrlrWs  rWcr0) rXzz Subclass of the `LassoLexer` which highlights unhandled data with the `XmlLexer`. .. versionadded:: 1.6 z XML+Lassoz xml+lasso)rrcrdrerfrgzapplication/xml+lassoc rr)rrirrrrrfrlrirzLassoXmlLexer.__init__cCrr)rrr#rrfrfrlrrzLassoXmlLexer.analyse_textrrfrfrrlrXs rXcr1) rYzz Subclass of the `LassoLexer` which highlights unhandled data with the `CssLexer`. .. versionadded:: 1.6 z CSS+Lassoz css+lassor'ztext/css+lassoc "d|d<tjttfi|dSNTrequiredelimiters)rrirrrrrfrlrizLassoCssLexer.__init__cCs6t|d}td|r|d7}d|vr|d7}|S)Nr#z \w+:[^;]+;rzpadding:)rrrrrrfrfrlrs  zLassoCssLexer.analyse_textrrfrfrrlrYs rYcr3) rZz Subclass of the `LassoLexer` which highlights unhandled data with the `JavascriptLexer`. .. versionadded:: 1.6 zJavaScript+Lassozjavascript+lassozjs+lassor )zapplication/x-javascript+lassoztext/x-javascript+lassoztext/javascript+lassoc rhri)rrirrrrrfrlrirkzLassoJavascriptLexer.__init__cCst|d}|Sr")rrrrfrfrlrsz!LassoJavascriptLexer.analyse_textrrfrfrrlrZs rZc @sFeZdZdZdZdgZdefdefdeej e dfdeej e j e j dfd eej e dfgd e fd ej d fd ee ej d fdeej efdeee efdeee ejfdeee edfedgd e fded fdeee eje fdeee eeddfdejfedgdejfdejfdejfgeddejfdejfde fgd Zd!S)"r[z Generic `handlebars ` template lexer. Highlights only the Handlebars template tags (stuff between `{{` and `}}`). Everything else is left for a delegating lexer. .. versionadded:: 2.0 Handlebars handlebarsrz \{\{!.*\}\}z (\{\{\{)(\s*)rz(\{\{)([#~/]+)([^\s}]*) (\{\{)(\s*)rz\}\}\}rz (~?)(\}\})z ([^\s}]+)(=)z(>)(\s*)(@partial-block)z(#?>)(\s*)([\w-]+)z (>)(\s*)(\()dynamic-partialgenericrz(lookup)(\s+)(\.|this)(\s+)z(lookup)(\s+)(\S+)rr|z[\w-]+z[()/@a-zA-Z][\w-]*z\.[\w-]+z(this\/|\.\/|(\.\.\/)+)[\w-]+rrr)rrrorrpN)rrrrrrr rrSpecialrrwrrrrrrrrrrrrrrr{rfrfrfrlr[s\      r[cs:eZdZdZdZdgZddgZddgZfdd ZZ S) r\z} Subclass of the `HandlebarsLexer` that highlights unlexed data with the `HtmlLexer`. .. versionadded:: 2.0 zHTML+Handlebarszhtml+handlebarsz *.handlebarsz*.hbsztext/html+handlebarsztext/x-handlebars-templatec rr)rrirr[rrrfrlriArzHandlebarsHtmlLexer.__init__r]rfrfrrlr\4sr\cs:eZdZdZdZgdZdgZddgZfddZZ 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+jinjasaltslsz*.slsztext/x-yaml+jinjaz text/x-slsc rr)rrir r2rrrfrlriTrzYamlJinjaLexer.__init__r]rfrfrrlr]Es r]c@seZdZdZdZdgZdgZiddefdee e dfdee e e e d d d fd efgdd e jdfdee je eddd fdee je e dfdeeje e e dd e e dfdeeje e dfdeeje e dfdee jde e dfdeejde e dfdeeje e e d d e e dfdeeje d fg d edd!e dfd"e d#fgd#edd!e d$fd%eeje e d&fgd&d"e dfed'ed(gdededd)ee e d d e ee e e d d e e fd*efd+ejfd,ee e d d e eje e e d d fed edgd-ed ed.gd/d0ee ede dfd1ee eje dfgd'd!e dfgdd2e d$fgd.d3e dfgd4edd5eeje efd6ee e e e dd e e fed7ed8ed9d:e fgd(ed4d;efgdejfd?e fgd@ejfdAejfgdBejfdCejfged9ed7ed8edgdDe fgdEee e eje e d$fd;efgdefdFee e eje e dfd efgdGZ dS)Hr^zw Lexer for `Liquid templates `_. .. versionadded:: 2.0 liquidz*.liquidrrz (\{%)(\s*)z tag-or-blockz(\{\{)(\s*)([^\s}]+)rprqoutputrz(if|unless|elsif|case)(?=\s+) conditionz (when)(\s+)z end-of-block whitespacez(else)(\s*)(%\})rz!(capture)(\s+)([^\s%]+)(\s*)(%\})rz(comment)(\s*)(%\})rLz(raw)(\s*)(%\})rawz(end(case|unless|if))(\s*)(%\})Nz(end([^\s%]+))(\s*)(%\})z"(cycle)(\s+)(?:([^\s:]*)(:))?(\s*)zvariable-tag-markupz([^\s%]+)(\s*)z tag-markup\}\}z\|filters)rrz([^\s|:]+)(:?)(\s*)z filter-markupz end-of-tagzdefault-param-markupz/([^\s=!><]+)(\s*)([=!><]=?)(\s*)(\S+)(\s*)(%\})z\b!z\bnot\bz*([\w.\'"]+)(\s+)(contains)(\s+)([\w.\'"]+)z generic-valuezend-at-whitespaceoperatorz(\s*)((=|!|>|<)=?)(\s*)z(\s*)(\bcontains\b)(\s*)z%\}rz param-markupz([^\s=:]+)(\s*)(=|:)z(\{\{)(\s*)([^\s}])(\s*)(\}\})rRnumberkeyword,rzvariable-param-markupz\b(false|true)\brz(?<=\w)\.(?=\w)z'[^']*'z"[^"]*"z\d+\.\d+rSz[ \t]+z (\{%)(\s*)(endcomment)(\s*)(%\})z(\{%)(\s*)(endraw)(\s*)(%\}))rrRr}rprxrLry)!rrrrrrrrrrrrrrReservedrrrrrrWordrrrrrrrFloatIntegerrr{rfrfrfrlr^Xs   -4<B TY`dhm }    r^c@seZdZdZdZdgZdgZejej BZ dZ dZ de dZ e e Zd efd ejd fd efd eejeeeejeejeeeej fdeejeeeejeejeeeej fdeeejeeeejdfdeejeedfdefgdeeeeejfdeeeeeeejfdejfdefdejfeejfdeejfdefdejfdejfdefdefg defdeeejd fed!gdefd"eeejd fed!d#e fgd$Z!d%S)&r_z `Twig `_ template lexer. It just highlights Twig code between the preprocessor directives, other data is left untouched by the lexer. .. versionadded:: 2.0 Twigtwigzapplication/x-twigz[\\\w-]|[^\x00-\x7f]z(?:[\\_a-z]|[^\x00-\x7f])z(?:z)*rrrz \{\#.*?\#\}rzL(\{%)(-?\s*)(verbatim)(\s*-?)(%\})(.*?)(\{%)(-?\s*)(endverbatim)(\s*-?)(%\})z(\{%%)(-?\s*)(filter)(\s+)(%s)rrrz (\|)(\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]+rrz4([{}()\[\]+\-*/,:~%]|\.\.|\?|:|\*\*|\/\/|!=|[><=]=?)rrrrrrr)rrrrN)"rrrrrrrrrrr _ident_char _ident_begin _ident_end _ident_innerr rrwrrrrrrrrrrrrrrrr{rfrfrfrlr_&s         r_cs6eZdZdZdZdgZdgZdgZfddZZ S)r`zw Subclass of the `TwigLexer` that highlights unlexed data with the `HtmlLexer`. .. versionadded:: 2.0 z HTML+Twigz html+twigz*.twigztext/html+twigc rr)rrirr_rrrfrlrirzTwigHtmlLexer.__init__r]rfrfrrlr`ysr`c@seZdZdZdZdgZdefdeej e dfdee e j e e ee dfd ee e j e e fd ee e j e ee dfd ee e j e fgd e fd ej dfdejfdejfdejfdefde jfde jfdeee ee ee ee fg dedfdedfdedfgdZdS)raad Generic `angular2 `_ template lexer. Highlights only the Angular template tags (stuff between `{{` and `}}` and special attributes: '(event)=', '[property]=', '[(twoWayBinding)]='). Everything else is left for a delegating lexer. .. versionadded:: 2.1 Angular2ng2z [^{([*#]+rn ngExpressionz&([([]+)([\w:.-]+)([\])]+)(\s*)(=)(\s*)rz([([]+)([\w:.-]+)([\])]+)(\s*)z([*#])([\w:.-]+)(\s*)(=)(\s*)z([*#])([\w:.-]+)(\s*)z \s+(\|\s+)?rzrz:?(true|false)rrrz[a-zA-Z][\w-]*(\(.*\))?z\.[\w-]+(\(.*\))?z-(\?)(\s*)([^}\s]+)(\s*)(:)(\s*)([^}\s]+)(\s*)rrr)rrrN)rrrrrrr rrrwrrrrrrBooleanrrrrr{rfrfrfrlrasN    racr)rbz{ Subclass of the `Angular2Lexer` that highlights unlexed data with the `HtmlLexer`. .. versionadded:: 2.0 zHTML + Angular2zhtml+ng2z*.ng2c rr)rrirrarrrfrlrirzAngular2HtmlLexer.__init__) rrrrrrrrirrfrfrrlrbrrb)trrpygments.lexers.htmlrrpygments.lexers.javascriptrrpygments.lexers.cssrpygments.lexers.phprpygments.lexers.pythonrpygments.lexers.perlr pygments.lexers.jvmr r pygments.lexers.datar pygments.lexerr rrrrrrrrpygments.tokenrrrrrrrrrrr r! pygments.utilr"r#__all__r(r-rRrSrTr2r<r=r>r@r?rArBrCrDrErFrrHrIrJrKr9r r8r7r;r:r)r*r+r,r$r%r&r'r.r/r0r1r3r5r4r6r<rGrLrMrNrOrVrPrQrUr`rVrWrXrYrZr[r\r]r^r_r`rarbrfrfrfrls      ,8_8RS08D ,#@90. LOS@