3 ��X�x � @ s� d Z ddlZddlmZmZmZmZmZ ddlm Z m Z mZmZm Z mZmZmZmZmZ ddgZG dd� de�ZG dd� de�ZdS ) z� pygments.lexers.haxe ~~~~~~~~~~~~~~~~~~~~ Lexers for Haxe and related stuff. :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. � N)�ExtendedRegexLexer� RegexLexer�include�bygroups�default) �Text�Comment�Operator�Keyword�Name�String�Number�Punctuation�Generic� Whitespace� HaxeLexer� HxmlLexerc n @ s� e Zd ZdZdZdddgZddgZdd d gZdZdZ d e d Z dZde d e Ze je jB Zg Zdd� Zed�ed�dejd�fdejd�fdejd�fdejfdejdfd ejd!fd"ejd#fd$ejd%fd&ed'fgd(efd)ejfd*ejfd+efgd,ejd�fd/ejfd0e d ejd1fed2�gd3ejd4fd5ejfd6ejfgd7ejd4fd5ejfd6ejfgd8e ejfd9ejd4fged�e ejfd:e d;fe!d4�ged�e ejfd<efd:e d;fd=ejd1fe!d4�ged�d<ed4fe ejd4fged�e ejfd:e d;fe!d4�gd(ej"fd3ejd�fd7ejd�fe!d4�gd(ej"fd?ej"fd@ej"d�fe ej"d4fdBe#j$fdCe#j$fdDe#j$fdEe#j$fdFe dG e#j$fdHe#j%fdIe#j&fd3ejd�fd7ejd�fg d(ej"fdJej"d4fe!dK�gd(ej"feej"d�fe!d4�gd(ej"fd?ej"fd@ej"d�fe ej"d�fdBe#j$d�fdCe#j$d�fdDe#j$d�fdEe#j$d�fdFe dG e#j$d�fdHe#j%d�fdIe#j&d�fd3ejd�fd7ejd�fg ed�e!d�ged�dRe d�fged�d@e d�fe!d4�ged�dVejdUfdWe fe!d4�ged�dXej'd�fged�d\ej'd4fe!d4�ged�e ej'd4fged�d@ej'd�fe!d4�ged�dJej'd4fe!d�ged�dJej'd4fdWe d�fged�e!d�ged�d`e(d�fged�e!d�ged�ed�d9e d4feed�fged�d@e d�fe!d��ged�e!d��ged�dhejdUfdWe fe!d4�ged�dRe d4fged�d9e d4fged�ed�d9e d4fdiejfe!dj�ged�dkejd�fdmejd�fged�eej)d�fe!d��ged�ed.�e!d4�ged�e ej)d�fged�dJe d4fdqe feed�fged�dJe d4fdWe d�fged�d@e d�fe!d4�ged�dved4feed4fged�e!d��ged�dXej'�d fdwe(fd@e �dfdzejfd{ej�dfdRe �dfd~ej*�dfde�dfd�e�dfd�e�dfd�ej�dfd�e�d fd�e�d fd�e�dfd�e�dfd�e�d fd�e�dfd�efd�e�dfd�e�dfd�ed4fd�e d� e�dfee�dfdBe#j$�dfdCe#j$�dfdDe#j$�dfdEe#j$�dfdFe dG e#j$�dfdHe#j%�dfdIe#j&�dfd3ej�dfd7ej�dfd�ej+�dfd�e �dfg#ed�d�e(fee(�dfd�e�dfdqe(�d fd�e d e,e e�fd�e d�fd@e d�fe!d4�g ed�ed�d\e �d!fdejfdej�d"fd ej�d#fd"ej�d$fd$ej�d%fe!�d&�g dRe �d'fed!�ged�d@e �d(fe!�d)�ged�dWe �d*fe!d4�ged�d�e�d+fe!d4�ged�e!�d,�ged�d�e�d-fged�d@e �d.fged�d@e �d/fged�d@e �d0fged�d�e�d1fe!d4�ged�e!�d2�ged�d�e�d3fd9e d4fged�d\e d4fe!�d4�ged�d\e d4fdWe �d5fged�d�e�d6fe!d4�ged�d�ed'fe!d4�ged�e!�d7�ged�d�e d4fe!�d8�ged�d�e d4fdWe �d9fged�e!�d:�ged�d�e d4fged�dWe d4fged�d\e d4fged�d�e d4fged�d�e d4fe!d4�ged�e ed4fged�dRe �d;fe!�d<�ged�e ed4fged�d:e d1fe!d4�ged�dqe fe e�d=fdRe �d>fd@e �d?fged�e!�d@�ged�d�e �dAfd�e d�fe!d4�ged�d9e d4fdqe fd�e �dBfee�dCfedS�ged�d9e d4fdWe �dDfgdBe#j$d4fdCe#j$d4fdDe#j$d4fdEe#j$d4fdFe dG e#j$d4fdHe#j%d4fdIe#j&d4fd3ej�dEfd7ej�dFfd�ej+d4fd�e(�dGfedU�ged�e!�dH�ged�d�e d4fdWe �dIfged�d�e �dJfe!d4�ged�d�e d4fdWe �dKfged�d\e �dLfe!d4�ged�d@e �dMfe!�dN�ged�dJe d4fdWe dUfged�e!�dO�ged�d@e d4fged�dJe d4fged�ee�dPfged�dWe �dQfe!d4�ged�d`e(�dRfe!d4�ged�d\e �dSfe!d4�ged�d\e(d4fged�dJe d4fe!�dT�ged�dJe d4fdWe �dUfged�d�e d� e e�dVfd3ej�dWfd7ej�dXfe!�dY�ged�d\e �dZfe!�d[�ged�d9e d4fe!d'�ged�d9e d4fe!�d\�ged�eed4fd3ej�d]fd7ej�d^fged�d9e d4fdWe �d_fgdМiZ-d�d҄ Z.d�S (` r zM For Haxe source code (http://haxe.org/). .. versionadded:: 1.3 ZHaxe�hxZhaxeZhxslz*.hxz*.hxslz text/haxeztext/x-haxez text/x-hxa (?:function|class|static|var|if|else|while|do|for|break|return|continue|extends|implements|import|switch|case|default|public|private|try|untyped|catch|new|this|throw|extern|enum|in|interface|cast|override|dynamic|typedef|package|inline|using|null|true|false|abstract)\bz _*[A-Z]\w*z(?:_*[a-z]\w*|_+[0-9]\w*|z |_+|\$\w+)z�(?:%=|&=|\|=|\^=|\+=|\-=|\*=|/=|<<=|>\s*>\s*=|>\s*>\s*>\s*=|==|!=|<=|>\s*=|&&|\|\||<<|>>>|>\s*>|\.\.\.|<|>|%|&|\||\^|\+|\*|/|\-|=>|=)z(?!�)c c s� |j d�}|dkr*| jj|jd d � � n<|dkrN| jrf| jd d d � |_n|dkrf| jrf| jj� |d krz|jjd� |dkr�|jjd � |j� tjd | fV |j� |_ d S )N� �if�else�elseif� �endzpreproc-expr�errorz preproc-error�#)r r ���)r r )r ) �group� preproc_stack�append�stack�pop�startr �Preprocr �pos)�self�matchZctx�proc� r) �/usr/lib/python3.6/haxe.py�preproc_callback; s zHaxeLexer.preproc_callback�spaces�metaz (?:package)\b� semicolon�packagez(?:import)\b�importz(?:using)\b�usingz(?:extern|private)\bz(?:abstract)\b�abstractz(?:class|interface)\b�classz (?:enum)\b�enumz (?:typedef)\b�typedefz(?=.)zexpr-statementz\s+z //[^\n\r]*z /\*.*?\*/z(#)(if|elseif|else|end|error)\bz\$\{�string-interpol-close�exprz\$\$z\$(?=�ident� string-single�'�#popz\\.�.�"z\$z\}z\.zimport-identz\*�in� string-doublez\!z\(�preproc-parenthesisz\.[0-9]+z[0-9]+[eE][+\-]?[0-9]+z[0-9]+\.[0-9]*[eE][+\-]?[0-9]+z[0-9]+\.[0-9]+z[0-9]+\.(?!z|\.\.)z0x[0-9a-fA-F]+z[0-9]+z\)�preproc-expr-in-parenthesis�preproc-expr-chain� abstract-body�abstract-relation�abstract-opaque�type-param-constraint� type-namez\{� class-body�parenthesis-close�typez(?:to|from)�,�@� meta-body� meta-ident� meta-colon�:� meta-call� meta-call-sep�typedef-body�=�optional-semicolon� enum-body�bracket-open�enum-member�flag�function-param�extendsz(?:extends|implements)\bz9(?:static|public|private|override|dynamic|inline|macro)\bzclass-memberz(var)\b�varz(function)\b�class-method� optional-expr�parenthesis-openz\?�function-param-sep�assign�prop-get-set-opt�commaz((?:default|null|never|dynamic|get|set)\bz(?:\+\+|\-\-|~(?!/)|!|\-)� expr-chain�parenthesisz3(?:static|public|private|override|dynamic|inline)\bz(?:function)\b�function-local�bracketz(?:true|false|null)\bz (?:this)\bz (?:cast)\b�castz (?:try)\b�catchz (?:var)\bz (?:new)\b�newz(?:switch)\b�switchz(?:if)\br z(?:do)\b�doz(?:while)\b�whilez (?:for)\b�forz(?:untyped|throw)\bz(?:return)\bz(?:macro)\b�macroz(?:continue|break)\bz(?:\$\s*[a-z]\b|\$(?!z))�dollar�string-single-interpolz~/(\\\\|\\/|[^/\n])*/[gimsu]*z\[� array-declz (?:\+\+|\-\-)z(?:in)\b�ternaryz(\.)(zarray-access�call�macro-class� cast-typez(?:catch)\b�do-whiler z (?:else)\b�switch-bodyz(?:case|default)\b� case-block�case�case-sep� case-guardz(?!(?:case|default)\b|\})z\]�array-decl-sep�array-access-close�;� bracket-close� type-check�type-full-name�type-struct�type-parenthesisz->z<(?!=)� type-param�>�type-struct-sep�colonz~/(\\\\|\\/|[^/\n])*/[gim]*�type-param-sep�type-param-type�type-param-constraint-sep�type-param-constraint-flag�type-param-constraint-flag-type�#type-param-constraint-flag-type-sep�var-sep�prop-get-set�call-sepz(?!(?:\$\s*[a-z]\b|\$(?!z)))� bracket-check�block� object-sep�ident-or-string�object)i�rootr, zstring-single-interpolz string-singlez string-doublezstring-interpol-closer/ r0 zimport-identr1 z preproc-errorzpreproc-exprzpreproc-parenthesiszpreproc-expr-chainzpreproc-expr-in-parenthesisr2 z abstract-bodyzabstract-opaquezabstract-relationr- z meta-colonz meta-identz meta-bodyz meta-callz meta-call-sepr5 ztypedef-bodyr4 z enum-bodyzenum-memberr3 r[ zbracket-openz bracket-closez class-bodyzclass-memberzfunction-localz optional-exprzclass-methodzfunction-paramzfunction-param-sepzprop-get-setzprop-get-set-optzexpr-statementr7 z expr-chainro zmacro-classrh z cast-typeri rl zdo-whilerm rn r r rk zswitch-bodyrz zcase-sepz case-guardz case-blockrj z array-declzarray-decl-sepzarray-accesszarray-access-closerc r� r. zoptional-semicolonr8 rp z type-nameztype-full-namerJ ztype-parenthesisz type-checkztype-structztype-struct-sepztype-param-typez type-paramztype-param-sepztype-param-constraintztype-param-constraint-sepztype-param-constraint-flagztype-param-constraint-flag-typez#type-param-constraint-flag-type-sepre zparenthesis-openzparenthesis-closer\ zvar-sepra rY rs rt zcall-seprg z bracket-checkr� r� zident-or-stringz object-sepc C s t jd| �rdS d S )Nz\w+\s*:\s*\wg333333�?)�rer'