B
    `5m                 @   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 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-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)get_choice_opt)	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 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.   r/   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=   ^/home/kop/projects/devel/pgwui/test_venv/lib/python3.7/site-packages/pygments/lexers/dotnet.pyr9      s
    
zCSharpLexer.__init__N)+__name__
__module____qualname____doc__namealiases	filenames	mimetypesre	MULTILINEDOTALLUNICODEflagsunicombine	allexceptlevelsr4   token_variantsitems	levelnamecs_identr   r   r   r   Functionr   r
   	Attributer   Single	Multiliner   Charr   Preprocr   TypeClassr   	Namespacer9   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 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)dUdV Z*dWS )Xr   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+)r/   z#popz(?=\()r0   z|\.)+z[^"$]z\\""z[^#<>$]z#pushz#>z[^#<>]zif|matchz[~!%^&*+=|\[\]:;,.<>/?-\\"$ ]z\d+z\(z\))r1   r.   r/   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 )Nr2   r,   )	r   r3   r4   r5   r6   r7   r8   r   r9   )r:   r;   r<   r=   r=   r>   r9     s    
zNemerleLexer.__init__c             C   s   d}d| kr|d7 }|S )zUNemerle is quite similar to Python, but @if is relatively uncommon
        elsewhere.r   z@ifg?r=   )textresultr=   r=   r>   analyse_text)  s    zNemerleLexer.analyse_textN)+r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   r4   rP   rQ   rR   rS   r   r   r   r   rT   r   r
   rU   r   rV   rW   r   r   rX   r   rY   rZ   r[   r\   r9   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+)r/   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.]*)r1   ra   rb   rc   r/   N) r?   r@   rA   rB   rC   rD   rE   rF   r   r   rV   rW   r
   r   Wordr   Regexr   r   r   BuiltinDoubler   FloatOctHexIntegerZLongrT   r[   r\   r4   r=   r=   r=   r>   r   4  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CObjContinueZCSByteZCShortZCSngZCStrZCTypeZCUIntZCULngZCUShortZDeclareZDefaultZDelegateZ
DirectCastZDoEachZElseZElseIfZEndIfZEraseErrorEventZExitFalseZFinallyZForZFriendZGetZGlobalZGoSubZGoToZHandlesZIfZ
ImplementsZInheritsZ	InterfaceZLetLibZLoopZMeZMustInheritZMustOverrideZMyBaseZMyClassZ	NarrowingZNewZNextZNotZNothingZNotInheritableZNotOverridableZOfZOnr   Option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Throw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+)rb   z"(?<!\.)(Class|Structure|Enum)(\s+)rc   z&(?<!\.)(Module|Namespace|Imports)(\s+)r/   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)r1   r{   rz   rb   rc   r/   ry   c             C   s   t d| t jrdS d S )Nz^\s*(#If|Module|Namespace)g      ?)rG   searchrH   )r^   r=   r=   r>   r`     s    zVbNetLexer.analyse_textN))r?   r@   rA   rB   rC   rD   rE   rF   rL   rM   Zuni_namerG   rH   
IGNORECASErK   r   rU   r   r   rY   r
   r   ZDeclarationr	   r   rZ   r   rd   r   r   Dater   rh   rk   Variabler   rT   r[   r\   r4   r`   r=   r=   r=   r>   r   w  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-genr1   z(<%[@=#]?)(.*?)(%>)z(<script.*?>)(.*?)(</script>)z
(.+?)(?=<)z.+N)r?   r@   rA   rB   rC   rE   rF   rG   rI   rK   r   r   Tagr   r   r   r4   r=   r=   r=   r>   r     s   


r   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  jttf| d S )N)superr9   r   r   )r:   r;   )r6   r=   r>   r9     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?)rG   r|   I)r^   r=   r=   r>   r`   	  s    zCSharpAspxLexer.analyse_text)r?   r@   rA   rB   rC   rD   rE   rF   r9   r`   __classcell__r=   r=   )r6   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  jttf| d S )N)r   r9   r   r   )r:   r;   )r6   r=   r>   r9     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?)rG   r|   r   )r^   r=   r=   r>   r`     s    zVbNetAspxLexer.analyse_text)r?   r@   rA   rB   rC   rD   rE   rF   r9   r`   r   r=   r=   )r6   r>   r     s   c            B   @   s  e Zd ZdZdZd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/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIgBZedJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcg7 Zdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~ddddddddddddddddg+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dqe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.dd Z/dS )r   z`
    For the `F# language <https://fsharp.org/>`_ (version 3.0).

    .. versionadded:: 1.5
    zF#Zfsharpzf#z*.fsz*.fsiztext/x-fsharpZabstractasassertbasebeginr.   r   Zdelegatezdo!dodoneZdowncastZdowntoelifelsery   	exceptionZexternfalsefinallyforfunctionZfunglobalifZinheritinlineZ	interfaceZinternalinZlazyzlet!ZletmatchmembermoduleZmutabler/   newnullZofopenoverrideprivatepublicZreczreturn!returnselectZstaticstructZthentotruetrytypeZupcastzuse!Zusevalvoidwhenwhilewithzyield!yieldZatomicbreakchecked	componentconst
constraintconstructorcontinueeagereventZexternalZfixedZfunctorr   methodZmixinobjectparallel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sbytebytecharZ	nativeintZ
unativeintfloat32ZsinglefloatdoubleZint8Zuint8int16Zuint16int32Zuint32int64Zuint64decimalunitboolr{   r3   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
\(\*(?!\))ra   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-sequencer1   r   ra   r{   r   r   c             C   s(   d}d| kr|d7 }d| kr$|d7 }|S )zSF# doesn't have that many unique features -- |> and <| are weak
        indicators.r   z|>g?z<|r=   )r^   r_   r=   r=   r>   r`     s    zFSharpLexer.analyse_textN)0r?   r@   rA   rB   rC   rD   rE   rF   keywordsZkeyopts	operatorsZword_operatorsZprefix_symsZ
infix_symsZ
primitivesr   ZEscaper   r   rf   ZPseudor\   ZDocr   rV   r   r   r   r[   r
   rT   joinr   rd   rZ   rY   r   rk   rj   ri   ZBinrh   rX   rg   r   r   r4   r`   r=   r=   r=   r>   r   %  s   







)&rB   rG   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   Zpygmentsr   rL   Zpygments.lexers.htmlr   __all__r   r   r   r   r   r   r   r   r=   r=   r=   r>   <module>	   s"   (0
r *Cm