B
    G
\-l                 @   s"  d Z ddlZddl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 ddlmZmZ ddlmZ ddlmZ dd	d
ddddgZG dd deZG dd	 d	eZ G dd
 d
eZ!G dd deZ"G dd deZ#G dd deZ$G dd deZ%G dd deZ&dS )z
    pygments.lexers.dotnet
    ~~~~~~~~~~~~~~~~~~~~~~

    Lexers for .net languages.

    :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)
RegexLexerDelegatingLexerbygroupsincludeusingthisdefaultwords)
PunctuationTextCommentOperatorKeywordNameStringNumberLiteralOther)get_choice_opt	iteritems)	unistring)XmlLexerCSharpLexerNemerleLexerBooLexer
VbNetLexerCSharpAspxLexerVbNetAspxLexerFSharpLexerc               @   s  e Zd ZdZdZddgZdgZdgZej	ej
B ejB Zdded	d
ddd d d ed	d
dddddddd
 d ded	d
dddd d d ed	d
ddddddddd d dZi ZdZxeeD ]
\ZZde d e d eeeejeefdejfd efd!ef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!j"fd*e#fd+ej$fd,ee%ee%fd-e%fd.ee%efd/e%j&fd0ee%ed1fd2ee%ed3feefgeej'd4fe(d4gd5ed4fd6e d7 ej)d4fgd8ee< qW d9d: Z*d;S )<r   a  
    For `C# <http://msdn2.microsoft.com/en-us/vcsharp/default.aspx>`_
    source code.

    Additional options accepted:

    `unicodelevel`
      Determines which Unicode characters this lexer allows for identifiers.
      The possible values are:

      * ``none`` -- only the ASCII letters and numbers are allowed. This
        is the fastest selection.
      * ``basic`` -- all Unicode characters from the specification except
        category ``Lo`` are allowed.
      * ``full`` -- all Unicode characters as specified in the C# specs
        are allowed.  Note that this means a considerable slowdown since the
        ``Lo`` category has more than 40,000 characters in it!

      The default value is ``basic``.

      .. versionadded:: 0.8
    zC#Zcsharpzc#z*.csztext/x-csharpz@?[_a-zA-Z]\w*z@?[_LuLlLtLmNl][NdPcCfMnMcz]*z	@?(?:_|[^Loz])z[^)nonebasicfullTz^([ \t]*(?:z(?:\[\])?\s+)+?)(z
)(\s*)(\()z^\s*\[.*?\]z[^\S\n]+z\\\nz//.*?\nz/[*].*?[*]/z\nz[~!%^&*()+=|\[\]:;,.<>/?-]z[{}]z@"(""|[^"])*"z"(\\\\|\\"|[^"\n])*["\n]z'\\.'|'[^\\]'zA[0-9](\.[0-9]*)?([eE][+-][0-9]+)?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?zZ#[ \t]*(if|endif|else|elif|define|undef|line|error|warning|region|endregion|pragma)\b.*?\nz\b(extern)(\s+)(alias)\ba  (abstract|as|async|await|base|break|by|case|catch|checked|const|continue|default|delegate|do|else|enum|event|explicit|extern|false|finally|fixed|for|foreach|goto|if|implicit|in|interface|internal|is|let|lock|new|null|on|operator|out|override|params|private|protected|public|readonly|ref|return|sealed|sizeof|stackalloc|static|switch|this|throw|true|try|typeof|unchecked|unsafe|virtual|void|while|get|set|new|partial|yield|add|remove|value|alias|ascending|descending|from|group|into|orderby|select|thenby|where|join|equals)\bz(global)(::)zk(bool|byte|char|decimal|double|dynamic|float|int|long|object|sbyte|short|string|uint|ulong|ushort|var)\b\??z(class|struct)(\s+)classz(namespace|using)(\s+)	namespacez#popz(?=\()(z|\.)+)rootr/   r0   c             K   sL   t |dt| jd}|| jkr.| j|| _n| j| | _tj| f| d S )Nunicodelevelr-   )	r   listtokens_all_tokens	__class__process_tokendef_tokensr   __init__)selfoptionslevel r>   5lib/python3.7/site-packages/pygments/lexers/dotnet.pyr:      s
    
zCSharpLexer.__init__N)+__name__
__module____qualname____doc__namealiases	filenames	mimetypesre	MULTILINEDOTALLUNICODEflagsunicombine	allexceptlevelsr5   token_variantsr   	levelnamecs_identr   r   r   r   Functionr   r
   	Attributer   Single	Multiliner   Charr   Preprocr   TypeClassr   	Namespacer:   r>   r>   r>   r?   r      sX   <F
"c            !   @   s  e Zd ZdZdZdgZdgZdgZej	ej
B ejB Zddedd	d
dd d d edd	d
ddddddd
 d dedd	d
ddd d d edd	d
dddddddd d dZi ZdZxeeD ]\ZZde d e d eeeejeefdejfdefd efd!ejfd"ej fd#efd$e!d%fd&e!d'fd(e!d)fd*e d+ e"fd,e"fd-e efd.eeed/fd0efd1efd2e!fd3e!fd4e!j#fd5e$fd6e$fd7ej%fd8ee"ee"fd9e"fd:ee"efd;e"j&fd<e d= eee"j&fd>ee"ed?fd@ee"edAfeefgeej'dBfgdCedBfdDe dE ej(dBfgdFe!fd-e efd.eeed/fdGe!fdHe!dBfgdIe!fd-e efd.eeed/fd(e!dJfdKe!dBfgdLe!fd(e!dJfdKe!dBfgdMe"fdNefeefdOe$fdPedJfdQedBfgdRee< qW dSdT Z)dUS )Vr   a  
    For `Nemerle <http://nemerle.org>`_ source code.

    Additional options accepted:

    `unicodelevel`
      Determines which Unicode characters this lexer allows for identifiers.
      The possible values are:

      * ``none`` -- only the ASCII letters and numbers are allowed. This
        is the fastest selection.
      * ``basic`` -- all Unicode characters from the specification except
        category ``Lo`` are allowed.
      * ``full`` -- all Unicode characters as specified in the C# specs
        are allowed.  Note that this means a considerable slowdown since the
        ``Lo`` category has more than 40,000 characters in it!

      The default value is ``basic``.

    .. versionadded:: 1.5
    ZNemerleZnemerlez*.nztext/x-nemerlez@?[_a-zA-Z]\w*z@?[_r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   z]*z	@?(?:_|[^r+   z])z[^)r,   r-   r.   Tz^([ \t]*(?:z(?:\[\])?\s+)+?)(z
)(\s*)(\()z^\s*\[.*?\]z[^\S\n]+z\\\nz//.*?\nz/[*].*?[*]/z\nz\$\s*"zsplice-stringz\$\s*<#zsplice-string2z<#zrecursive-stringz	(<\[)\s*(z:)?z\]\>z\$z(\$)(\()zsplice-string-contentz[~!%^&*()+=|\[\]:;,.<>/?-]z[{}]z@"(""|[^"])*"z"(\\\\|\\"|[^"\n])*["\n]z'\\.'|'[^\\]'z0[xX][0-9a-fA-F]+[Ll]?z*[0-9](\.[0-9]*)?([eE][+-][0-9]+)?[flFLdD]?zZ#[ \t]*(if|endif|else|elif|define|undef|line|error|warning|region|endregion|pragma)\b.*?\nz\b(extern)(\s+)(alias)\ba  (abstract|and|as|base|catch|def|delegate|enum|event|extern|false|finally|fun|implements|interface|internal|is|macro|match|matches|module|mutable|new|null|out|override|params|partial|private|protected|public|ref|sealed|static|syntax|this|throw|true|try|type|typeof|virtual|volatile|when|where|with|assert|assert2|async|break|checked|continue|do|else|ensures|for|foreach|if|late|lock|new|nolate|otherwise|regexp|repeat|requires|return|surroundwith|unchecked|unless|using|while|yield)\bz(global)(::)zo(bool|byte|char|decimal|double|float|int|long|object|sbyte|short|string|uint|ulong|ushort|void|array|list)\b\??z	(:>?)\s*(z\??)z"(class|struct|variant|module)(\s+)r/   z(namespace|using)(\s+)r0   z#popz(?=\()r1   z|\.)+z[^"$]z\\""z[^#<>$]z#pushz#>z[^#<>]zif|matchz[~!%^&*+=|\[\]:;,.<>/?-\\"$ ]z\d+z\(z\))r2   r/   r0   zsplice-stringzsplice-string2zrecursive-stringzsplice-string-contentc             K   sL   t |dt| jd}|| jkr.| j|| _n| j| | _tj| f| d S )Nr3   r-   )	r   r4   r5   r6   r7   r8   r9   r   r:   )r;   r<   r=   r>   r>   r?   r:     s    
zNemerleLexer.__init__N)*r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   r5   rQ   r   rR   rS   r   r   r   r   rT   r   r
   rU   r   rV   rW   r   r   rX   r   rY   rZ   r[   r\   r:   r>   r>   r>   r?   r      s   <F










c               @   sL  e Zd ZdZdZdgZdgZdgZdefde	j
fde	jd	fd
efdefdefdejfdejfdejfdefdefdefdeeedfdeeedfdeeedfdejfdej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jfd#ejfgde	jd$fd%e	jd&fd'e	jfd(e	jfgdejd&fgdejd&fgd)ejd&fgd*Zd+S ),r   z<
    For `Boo <http://boo.codehaus.org/>`_ source code.
    ZBooZbooz*.booz
text/x-booz\s+z	(#|//).*$z/[*]commentz[]{}:(),.;[]z\\\nz\\z(in|is|and|or|not)\bz/(\\\\|\\/|[^/\s])/z@/(\\\\|\\/|[^/])*/z=~|!=|==|<<|>>|[-+/*%=<>&^|]aO  (as|abstract|callable|constructor|destructor|do|import|enum|event|final|get|interface|internal|of|override|partial|private|protected|public|return|set|static|struct|transient|virtual|yield|super|and|break|cast|continue|elif|else|ensure|except|for|given|goto|if|in|is|isa|not|or|otherwise|pass|raise|ref|try|unless|when|while|from|as)\bzdef(?=\s+\(.*?\))z
(def)(\s+)funcnamez(class)(\s+)	classnamez(namespace)(\s+)r0   z(?<!\.)(true|false|null|self|__eval__|__switch__|array|assert|checked|enumerate|filter|getter|len|lock|map|matrix|max|min|normalArrayIndexing|print|property|range|rawArrayIndexing|required|typeof|unchecked|using|yieldAll|zip)\bz"""(\\\\|\\"|.*?)"""z"(\\\\|\\"|[^"]*?)"z'(\\\\|\\'|[^']*?)'z[a-zA-Z_]\w*z%(\d+\.\d*|\d*\.\d+)([fF][+-]?[0-9]+)?z[0-9][0-9.]*(ms?|d|h|s)z0\d+z0x[a-fA-F0-9]+z\d+Lz\d+z#pushz[*]/z#popz[^/*]z[*/]z[a-zA-Z_][\w.]*)r2   r^   r_   r`   r0   N) r@   rA   rB   rC   rD   rE   rF   rG   r   r   rV   rW   r
   r   Wordr   ZRegexr   r   r   BuiltinDoubler   FloatOctHexIntegerZLongrT   r[   r\   r5   r>   r>   r>   r?   r   +  sP   





c               @   s  e Zd ZdZdZddgZddgZddgZd	e	d
ddd d d e	d
dddddddd	 d Z
ejejB Zdejfdefdefdefdefdejfdefdejfeddd d!efd"ed#fd$ed%fd&eeed'fd(eeed)fd*eeed+fd,ejfd-ejfd.efd/ed0fd1efe
d2 efd3ejfd4ej fd5ej!fd6ej!fd7ej!fgd8efd9ed:fd;efge
ej"d:fe#d:ge
ej$d:fge
ej%d:fge
ej&fd<ej&fe#d:gdefd=ed:fe#d:gd>Z'd?d@ Z(dAS )Br   zm
    For
    `Visual Basic.NET <http://msdn2.microsoft.com/en-us/vbasic/default.aspx>`_
    source code.
    zVB.netzvb.netZvbnetz*.vbz*.basztext/x-vbnetz
text/x-vbaz[_r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   z]*z	^\s*<.*?>z\s+z\nz
rem\b.*?\nz'.*?\nz#If\s.*?\sThen|#ElseIf\s.*?\sThen|#Else|#End\s+If|#Const|#ExternalSource.*?\n|#End\s+ExternalSource|#Region.*?\n|#End\s+Region|#ExternalChecksumz[(){}!#,.:]z9Option\s+(Strict|Explicit|Compare)\s+(On|Off|Binary|Text))lZ
AddHandlerZAliasZByRefZByValZCallZCaseZCatchZCBoolZCByteZCCharZCDateZCDecZCDblZCIntZCLngZCObjZContinueZCSByteZCShortZCSngZCStrZCTypeZCUIntZCULngZCUShortZDeclareZDefaultZDelegateZ
DirectCastZDoZEachZElseZElseIfZEndIfZEraseErrorZEventZExitFalseZFinallyZForZFriendZGetZGlobalZGoSubZGoToZHandlesZIfZ
ImplementsZInheritsZ	InterfaceZLetZLibZLoopZMeZMustInheritZMustOverrideZMyBaseZMyClassZ	NarrowingZNewZNextZNotZNothingZNotInheritableZNotOverridableZOfZOnr   ZOptionZOptionalZ	OverloadsZOverridableZ	OverridesZ
ParamArrayZPartialZPrivateZ	ProtectedZPublicZ
RaiseEventZReadOnlyZReDimZRemoveHandlerZResumeZReturnZSelectSetZShadowsZSharedrV   ZStaticZStepZStopZSyncLockZThenZThrowZToTrueZTryZTryCastZWendZUsingZWhenZWhileZWideningZWithZ
WithEventsZ	WriteOnlyz(?<!\.)z\b)prefixsuffixz(?<!\.)End\bendz(?<!\.)(Dim|Const)\bdimz#(?<!\.)(Function|Sub|Property)(\s+)r_   z"(?<!\.)(Class|Structure|Enum)(\s+)r`   z&(?<!\.)(Module|Namespace|Imports)(\s+)r0   z|(?<!\.)(Boolean|Byte|Char|Date|Decimal|Double|Integer|Long|Object|SByte|Short|Single|String|Variant|UInteger|ULong|UShort)\bzU(?<!\.)(AddressOf|And|AndAlso|As|GetType|In|Is|IsNot|Like|Mod|Or|OrElse|TypeOf|Xor)\bzE&=|[*]=|/=|\\=|\^=|\+=|-=|<<=|>>=|<<|>>|:=|<=|>=|<>|[-&*/\\^+=<>\[\]]r]   stringz_\nz	[%&@!#$]?z#.*?#z"(\d+\.\d*|\d*\.\d+)(F[+-]?[0-9]+)?z\d+([SILDFR]|US|UI|UL)?z&H[0-9a-f]+([SILDFR]|US|UI|UL)?z&O[0-7]+([SILDFR]|US|UI|UL)?z""z"C?z#popz[^"]+z\.z?(Function|Sub|Property|Class|Structure|Enum|Module|Namespace)\b)r2   rp   ro   r_   r`   r0   rn   c             C   s   t d| t jrdS d S )Nz^\s*(#If|Module|Namespace)g      ?)rH   searchrI   )textr>   r>   r?   analyse_text  s    zVbNetLexer.analyse_textN))r@   rA   rB   rC   rD   rE   rF   rG   rM   rN   Zuni_namerH   rI   
IGNORECASErL   r   rU   r   r   rY   r
   r   ZDeclarationr	   r   rZ   r   ra   r   r   ZDater   rd   rg   Variabler   rT   r[   r\   r5   rs   r>   r>   r>   r?   r   n  sr   :


c               @   sf   e Zd ZdZdZg Zg ZejZ	dde
ejeejfde
eeeeefdeefdeefgiZdS )	GenericAspxLexerz"
    Lexer for ASP.NET pages.
    zaspx-genr2   z(<%[@=#]?)(.*?)(%>)z(<script.*?>)(.*?)(</script>)z
(.+?)(?=<)z.+N)r@   rA   rB   rC   rD   rF   rG   rH   rJ   rL   r   r   ZTagr   r   r   r5   r>   r>   r>   r?   rv     s   


rv   c                   sF   e Zd ZdZdZdgZddddddgZg Z fd	d
Zdd Z	  Z
S )r   z9
    Lexer for highlighting C# within ASP.NET pages.
    zaspx-csz*.aspxz*.asaxz*.ascxz*.ashxz*.asmxz*.axdc                s   t t| jttf| d S )N)superr   r:   r   rv   )r;   r<   )r7   r>   r?   r:     s    zCSharpAspxLexer.__init__c             C   s4   t d| t jd k	rdS t d| t jd k	r0dS d S )NzPage\s*Language="C#"g?zscript[^>]+language=["\']C#g333333?)rH   rq   I)rr   r>   r>   r?   rs     s    zCSharpAspxLexer.analyse_text)r@   rA   rB   rC   rD   rE   rF   rG   r:   rs   __classcell__r>   r>   )r7   r?   r     s   c                   sF   e Zd ZdZdZdgZddddddgZg Z fd	d
Zdd Z	  Z
S )r   zG
    Lexer for highlighting Visual Basic.net within ASP.NET pages.
    zaspx-vbz*.aspxz*.asaxz*.ascxz*.ashxz*.asmxz*.axdc                s   t t| jttf| d S )N)rw   r   r:   r   rv   )r;   r<   )r7   r>   r?   r:     s    zVbNetAspxLexer.__init__c             C   s4   t d| t jd k	rdS t d| t jd k	r0dS d S )NzPage\s*Language="Vb"g?zscript[^>]+language=["\']vbg333333?)rH   rq   rx   )rr   r>   r>   r?   rs     s    zVbNetAspxLexer.analyse_text)r@   rA   rB   rC   rD   rE   rF   rG   r:   rs   ry   r>   r>   )r7   r?   r     s   c            B   @   s  e Zd ZdZdZdgZddgZdg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(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHgBZedIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbg7 Zdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dddddddddddddddg+Z	dZ
dddgZdZdZdddddddddddddddddddddddddgZdejfdejfdejfdejfgdefdejjfdejdfdefdejfdejfdedfdedfdedfdedfdeeeejfdeeeejfdeeeejfdeeeeeejfddĠe efdefddĠe	 e fdeee
f e fddĠe e j!fddĠe ej"fdej#fdefde$j%fde$j&fde$j'fde$j(fde$j)fdej*fdej*fdefdej+dfdejfg defdpefdejfdedfdedfe,dփgdefdedfdedfdedfdedfdedfdefgdefe-dރdefdefdedfgdefdefdefdedfgdefdefdedfdefgdZ.dS )r   z
    For the F# language (version 3.0).

    AAAAACK Strings
    http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/manual/spec.html#_Toc335818775

    .. versionadded:: 1.5
    ZFSharpZfsharpz*.fsz*.fsiztext/x-fsharpZabstractasassertbaseZbeginr/   r   Zdelegatezdo!ZdoZdoneZdowncastZdowntoelifelsern   Z	exceptionZexternZfalsefinallyforZfunctionZfunglobalifZinheritZinlineZ	interfaceZinternalinZlazyzlet!ZletmatchmembermoduleZmutabler0   newZnullZofopenoverrideZprivateZpublicZreczreturn!returnZselectZstaticZstructZthentotruetrytypeZupcastzuse!ZusevalZvoidZwhenwhilewithzyield!yieldZatomicbreakcheckedZ	componentZconstZ
constraintconstructorcontinueZeagerZeventZexternalZfixedZfunctorr   methodZmixinobjectZparallelZprocessZ	protectedZpureZsealedZtailcallZtraitZvirtualZvolatilez!=#z&&&z\(z\)z\*z\+,z-\.z->-z\.\.z\.z::z:=z:>:z;;;z<-z<\]<z>\]>z\?\?z\?z\[<z\[\|z\[z\]_`z\{z\|\]z\|z\}~z<@@z<@=z@>z@@>z[!$%&*+\./:<=>?@^|~-]andornotz[!?~]z[=<>@^|&+\*/$%-]ZsbyteZbytecharZ	nativeintZ
unativeintZfloat32ZsinglefloatZdoubleZint8Zuint8Zint16Zuint16Zint32Zuint32Zint64Zuint64ZdecimalZunitboolrp   r4   Zexnobjenumz\\[\\"\'ntbrafv]z
\\[0-9]{3}z\\u[0-9a-fA-F]{4}z\\U[0-9a-fA-F]{8}z\s+z	\(\)|\[\]z \b(?<!\.)([A-Z][\w\']*)(?=\s*\.)dottedz\b([A-Z][\w\']*)z///.*?\nz//.*?\nz
\(\*(?!\))r^   z@"lstringz"""tqsr]   z\b(open|module)(\s+)([\w.]+)z\b(let!?)(\s+)(\w+)z\b(type)(\s+)(\w+)z&\b(member|override)(\s+)(\w+)(\.)(\w+)z\b(%s)\b|z``([^`\n\r\t]|`[^`\n\r\t])+``z(%s)z
(%s|%s)?%sz3#[ \t]*(if|endif|else|line|nowarn|light|\d+)\b.*?\nz[^\W\d][\w']*z\d[\d_]*[uU]?[yslLnQRZINGmM]?z-0[xX][\da-fA-F][\da-fA-F_]*[uU]?[yslLn]?[fF]?z0[oO][0-7][0-7_]*[uU]?[yslLn]?z0[bB][01][01_]*[uU]?[yslLn]?z/-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)[fFmM]?z9'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'B?z'.''z@?"z[~?][a-z][\w\']*:z[A-Z][\w\']*(?=\s*\.)z[A-Z][\w\']*z#popz[a-z_][\w\']*z	[^(*)@"]+z\(\*z#pushz\*\)z[(*)@]z[^\\"]+zescape-sequencez\\\nz\nz"B?z[^"]+z""z"""B?)zescape-sequencer2   r   r^   rp   r   r   N)/r@   rA   rB   rC   rD   rE   rF   rG   keywordsZkeyoptsZ	operatorsZword_operatorsZprefix_symsZ
infix_symsZ
primitivesr   ZEscaper   r   rb   ZPseudor\   ZDocr   rV   r   r   ru   r[   r
   rT   joinr   ra   rZ   rY   r   rg   rf   re   ZBinrd   rX   rc   r   r   r5   r>   r>   r>   r?   r     s   







)'rC   rH   Zpygments.lexerr   r   r   r   r   r   r   r	   Zpygments.tokenr
   r   r   r   r   r   r   r   r   r   Zpygments.utilr   r   Zpygmentsr   rM   Zpygments.lexers.htmlr   __all__r   r   r   r   rv   r   r   r   r>   r>   r>   r?   <module>
   s"   (0
r  Cm