a
    ;@bq                     @   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mZ ddlmZ ddlmZ ddlmZ g d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-2021 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
Whitespace)get_choice_opt)	unistring)XmlLexer)CSharpLexerNemerleLexerBooLexer
VbNetLexerCSharpAspxLexerVbNetAspxLexerFSharpLexerc                   @   s  e Zd ZdZdZg d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e D ](\ZZde d e d eeeeejeefdeeejfdefd ee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ej%eej%ej%efd+ee&ee&fd,e&fd-ee&efd.e&j'fd/ee&ed0fd1ee&ed2feefgeej(d3fe)d3gd4ed3fd5e d6 ej*d3fgd7ee< qd8d9 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#csz*.csztext/x-csharp@?[_a-zA-Z]\w*@?[_LuLlLtLmNl][NdPcCfMnMc]*	@?(?:_|[^Lo])[^ZnonebasicZfullT^([ \t]*)((?:(?:\[\])?\s+)+?)(
)(\s*)(\()^(\s*)(\[.*?\])[^\S\n]+(\\)(\n)//.*?\n/[*].*?[*]/\n[~!%^&*()+=|\[\]:;,.<>/?-][{}]@"(""|[^"])*"z!\$?"(\\\\|\\[^\\]|[^"\\\n])*["\n]'\\.'|'[^\\]'zA[0-9](\.[0-9]*)?([eE][+-][0-9]+)?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?zb(#)([ \t]*)(if|endif|else|elif|define|undef|line|error|warning|region|endregion|pragma)\b(.*?)(\n)\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)\b(global)(::)zk(bool|byte|char|decimal|double|dynamic|float|int|long|object|sbyte|short|string|uint|ulong|ushort|var)\b\??z(class|struct)(\s+)class(namespace|using)(\s+)	namespace#pop(?=\()(|\.)+)rootrD   rF   c                 K   sP   t |dt| jd}|| jvr.| j|| _n| j| | _tj| fi | d S NZunicodelevelr4   	r   listtokensZ_all_tokens	__class__Zprocess_tokendefZ_tokensr   __init__selfoptionslevel rV   5lib/python3.9/site-packages/pygments/lexers/dotnet.pyrQ      s
    
zCSharpLexer.__init__N),__name__
__module____qualname____doc__namealiases	filenames	mimetypesre	MULTILINEDOTALLUNICODEflagsunicombine	allexceptlevelsrO   token_variantsitems	levelnamecs_identr   r   r   r   r   Functionr
   	Attributer   r   Single	Multiliner   Charr   Preprocr   TypeClassr   	NamespacerQ   rV   rV   rV   rW   r      s   

.
8r   c                !   @   s0  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e D ]P\ZZde d e d eeeeejeefdeeejfdefd eeefd!ej fd"ej!fd#efd$ee"ee"d%fd&ee"ee"d'fd(e"d)fd*e d+ ee#e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ej&eej&d8fd9ee#ee#fd:e#fd;ee#efd<e#j'fd=e d> eeee#j'fd?ee#ed@fdAee#edBfeefgeej(dCfgdDej&fdEefd#edCfgdFedCfdGe dH ej)dCfgdIe"fd-e efd.eeed/fdJe"fdKe"dCfgdLe"fd-e efd.eeed/fd(e"dMfdNe"dCfgdOe"fd(e"dMfdNe"dCfgdPe#fdQefeefdRe%fdSedMfdTedCfgdUee< qdVdW Z*dXdY Z+dZS )[r   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-nemerler    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   Tr5   r6   r7   r8   r9   r:   r;   r<   r=   z(\$)(\s*)(")splice-stringz(\$)(\s*)(<#)splice-string2z<#recursive-stringz(<\[)(\s*)(z:)?z\]\>z\$z(\$)(\()splice-string-contentr>   r?   r@   z"(\\\\|\\[^\\]|[^"\\\n])*["\n]rA   z0[xX][0-9a-fA-F]+[Ll]?z*[0-9](\.[0-9]*)?([eE][+-][0-9]+)?[flFLdD]?zY(#)([ \t]*)(if|endif|else|elif|define|undef|line|error|warning|region|endregion|pragma)\bpreprocrB   a  (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)\brC   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+)rD   rE   rF   rG   z\w+z[ \t]+rH   rI   rJ   z[^"$]z\\""z[^#<>$]#pushz#>z[^#<>]zif|matchz[~!%^&*+=|\[\]:;,.<>/?-\\"$ ]\d+\(\))rK   rD   rz   rF   rv   rw   rx   ry   c                 K   sP   t |dt| jd}|| jvr.| j|| _n| j| | _tj| fi | d S rL   rM   rR   rV   rV   rW   rQ   (  s    
zNemerleLexer.__init__c                 C   s   d}d| v r|d7 }|S )zUNemerle is quite similar to Python, but @if is relatively uncommon
        elsewhere.r   z@ifg?rV   textresultrV   rV   rW   analyse_text3  s    zNemerleLexer.analyse_textN),rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   re   rf   rg   rh   rO   ri   rj   rk   rl   r   r   r   r   r   rm   r
   rn   r   r   ro   rp   r   r   rq   r   rr   rs   rt   ru   rQ   r   rV   rV   rV   rW   r      s  






@


	

	kr   c                   @   sR  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e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-boo\s+z	(#|//).*$z/[*]commentz[]{}:(),.;[]r:   z\\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+)rF   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+Lr}   r|   z[*]/rG   z[^/*]z[*/]z[a-zA-Z_][\w.]*)rK   r   r   r   rF   N)!rX   rY   rZ   r[   r\   r]   r^   r_   r   r   ro   rp   r
   r   r   r   Wordr   ZRegexr   r   BuiltinDoubler   FloatOctHexIntegerZLongrm   rt   ru   rO   rV   rV   rV   rW   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	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eefdeeefdejfdefdeejeeje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ee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-   r.   z	^\s*<.*?>r   r=   z(rem\b.*?)(\n)z
('.*?)(\n)z#If\s.*?\sThen|#ElseIf\s.*?\sThen|#Else|#End\s+If|#Const|#ExternalSource.*?\n|#End\s+ExternalSource|#Region.*?\n|#End\s+Region|#ExternalChecksumz[(){}!#,.:]z?(Option)(\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Error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OptionOptionalZ	OverloadsZOverridableZ	OverridesZ
ParamArrayZPartialZPrivateZ	ProtectedZPublicZ
RaiseEventZReadOnlyZReDimZRemoveHandlerZResumeZReturnZSelectSetZShadowsZSharedro   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+)rF   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(_)(\n)z	[%&@!#$]?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"C?rG   [^"]+\.z?(Function|Sub|Property|Class|Structure|Enum|Module|Namespace)\b)rK   r   r   r   r   rF   r   c                 C   s   t d| t jrdS d S )Nz^\s*(#If|Module|Namespace)g      ?)r`   searchra   r   rV   rV   rW   r     s    zVbNetLexer.analyse_textN)*rX   rY   rZ   r[   r\   r]   r^   r_   re   rf   Zuni_namer`   ra   
IGNORECASErd   r   rn   r   r   r   rr   r
   r   ZDeclarationr	   rs   r   r   r   r   r   ZDater   r   r   Variabler   rm   rt   ru   rO   r   rV   rV   rV   rW   r     s   




<


Xr   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-genrK   z(<%[@=#]?)(.*?)(%>)z(<script.*?>)(.*?)(</script>)z
(.+?)(?=<)z.+N)rX   rY   rZ   r[   r\   r^   r_   r`   rb   rd   r   r   ZTagr   r   r   rO   rV   rV   rV   rW   r     s   


r   c                       s>   e Zd ZdZdZdgZg dZg Z fddZdd Z	  Z
S )r   z9
    Lexer for highlighting C# within ASP.NET pages.
    zaspx-csz*.aspxz*.asaxz*.ascxz*.ashxz*.asmxz*.axdc                    s   t  jttfi | d S N)superrQ   r   r   rS   rT   rP   rV   rW   rQ     s    zCSharpAspxLexer.__init__c                 C   s4   t d| t jd urdS t d| t jd ur0dS d S )NzPage\s*Language="C#"皙?zscript[^>]+language=["\']C#333333?r`   r   Ir   rV   rV   rW   r     s    zCSharpAspxLexer.analyse_textrX   rY   rZ   r[   r\   r]   r^   r_   rQ   r   __classcell__rV   rV   r   rW   r     s   r   c                       s>   e Zd ZdZdZdgZg d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-vbr   c                    s   t  jttfi | d S r   )r   rQ   r   r   r   r   rV   rW   rQ   %  s    zVbNetAspxLexer.__init__c                 C   s4   t d| t jd urdS t d| t jd ur0dS d S )NzPage\s*Language="Vb"r   zscript[^>]+language=["\']vbr   r   r   rV   rV   rW   r   (  s    zVbNetAspxLexer.analyse_textr   rV   rV   r   rW   r     s   r   c                "   @   s  e Zd ZdZdZddgZddgZdgZg dZeg d	7 Zg d
Z	dZ
g dZdZdZg dZdejfdejfdejfdejfgdefdejjfdejdfdefdeejefdeejefdedfdedfded fd!ed"fd#eeeejfd$eeeejfd%eeeejfd&eeeeeejfd'd(e efd)efd*d(e	 e fd+eee
f e fd'd(e e j!fd'd(e ej"fd,eej#eej#ej#efd-efd.e$j%fd/e$j&fd0e$j'fd1e$j(fd2e$j)fd3ej*fd4ej*fd5efd6ej+d"fd7ejfg defd8efd9ejfd:ed;fd<ed;fe,d;gd=efd>ed?fd@ed;fdedfded fd!ed"fdAefgdBefe-dCdDefdEefdFed;fgdGefdEefdHefdFed;fgdGefdEefdIed;fd!efgdJZ.dKdL Z/dMS )Nr   z`
    For the `F# language <https://fsharp.org/>`_ (version 3.0).

    .. versionadded:: 1.5
    zF#Zfsharpzf#z*.fsz*.fsiztext/x-fsharp)BZabstractasassertbaseZbeginrD   r   Zdelegatezdo!ZdoZdoneZdowncastZdowntoelifelser   	exceptionZexternZfalsefinallyforfunctionZfunglobalifZinheritZinlineZ	interfaceZinternalinZlazyzlet!ZletmatchmembermoduleZmutablerF   newZnullZofopenoverrideZprivateZpublicZreczreturn!returnZselectZstaticstructZthentotruetrytypeZupcastzuse!ZusevalZvoidZwhenwhilewithzyield!yield)ZatomicbreakcheckedZ	componentconstZ
constraintconstructorcontinueZeagerZeventZexternalfixedZfunctorr   methodZmixinobjectZparallelZprocessZ	protectedZpureZsealedZtailcallZtraitZvirtualZvolatile)+z!=#z&&&r~   r   z\*z\+,z-\.z->-z\.\.r   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uint64decimalZunitboolr   rN   Zexnobjenumz\\[\\"\'ntbrafv]z
\\[0-9]{3}z\\u[0-9a-fA-F]{4}z\\U[0-9a-fA-F]{8}r   z	\(\)|\[\]z \b(?<!\.)([A-Z][\w\']*)(?=\s*\.)dottedz\b([A-Z][\w\']*)z(///.*?)(\n)z(//.*?)(\n)z
\(\*(?!\))r   z@"lstringz"""tqsr{   r   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)?%sz;(#)([ \t]*)(if|endif|else|line|nowarn|light|\d+)\b(.*?)(\n)z[^\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\']*:r   z[A-Z][\w\']*(?=\s*\.)z[A-Z][\w\']*rG   z[a-z_][\w\']*z	[^(*)@"]+z\(\*r|   z\*\)z[(*)@]z[^\\"]+escape-sequencez\\\nr=   z"B?r   r   z"""B?)r   rK   r   r   r   r   r   c                 C   s(   d}d| v r|d7 }d| v r$|d7 }|S )zSF# doesn't have that many unique features -- |> and <| are weak
        indicators.r   z|>g?z<|rV   r   rV   rV   rW   r     s    zFSharpLexer.analyse_textN)0rX   rY   rZ   r[   r\   r]   r^   r_   keywordsZkeyoptsZ	operatorsZword_operatorsZprefix_symsZ
infix_symsZ
primitivesr   ZEscaper   r   r   ZPseudoru   r   ZDocr   ro   r   r   rt   r
   rm   joinr   r   rs   rr   r   r   r   r   ZBinr   rq   r   r   r   rO   r   rV   rV   rV   rW   r   0  s   

3
ar   )'r[   r`   Zpygments.lexerr   r   r   r   r   r   r   r	   Zpygments.tokenr
   r   r   r   r   r   r   r   r   r   r   Zpygments.utilr   Zpygmentsr   re   Zpygments.lexers.htmlr   __all__r   r   r   r   r   r   r   r   rV   rV   rV   rW   <module>   s    	(4t 2Cn