U
    祡cP                     @   s>  d Z ddlZddl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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d	d
ddddgZ e!dZ"G dd deZ#e#Z$G dd
 d
eZ%G dd deZ&G dd	 d	eZ'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.python
    ~~~~~~~~~~~~~~~~~~~~~~

    Lexers for Python and related languages.

    :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)
Lexer
RegexLexerincludebygroupsusingdefaultwordscombineddo_insertionsthis)get_bool_optshebang_matches)TextCommentOperatorKeywordNameStringNumberPunctuationGenericOtherError)	unistringPythonLexerPythonConsoleLexerPythonTracebackLexerPython2LexerPython2TracebackLexerCythonLexerDgLexer
NumPyLexerz.*?
c                $   @   s8  e Zd ZdZdZdZdddddgZd	d
dddddddddddgZddddgZde	j
e	jf Zdd Zdd Zdefd eeejejfd!eeejejfd"ejfd#ejfd$efd%efed&ed'd(eeed)fd*eeed+fd,eejed-fd.eejed/fed0gd1eejejed2d3fd4eejejed2d5fd6eejejed2d7fd8eejejed2d9fd:eejejed;d3fd<eejejed;d5fd=eejejed;d7fd>eejejed;d9fd?eejejd@fdAeejejdBfdCeejejdDfdEeejejdFfdGeejejedHd@fdIeejejedHdBfdJeejejedHdDfdKeejejedHdFfdLeejejedMd@fdNeejejedMdBfdOeejejedMdDfdPeejejedMdFfdQefedRdSefdTefdUejfedVedWedXedYedZgd[ed\fd]ejd^fd_ejd^fd`efed0gd[ed\fdaed^fd`efed0ge dbdcddefe dedcddej!fge dfdcddefe dedcddej!fgdgdh"e#j$ di eeedjfgdkeee%e&efe'd^ge dldmdcdne(j)fdoe(j)j*fe dpdmdcdne(j+fge dqdcdde(j,j-fge drdcdde(j.j-fgdse/j0fdte/j0fdue/j1fdve/j2fdwe/j3fdxe/j4fgdye e(j5fdyefee(fgedXee(j,d^fe'd^gee(j6d^fgdzeeeefd{e(jfee(jfd|eeeefe'd^gd}eeejd^fd{e(jfd~e(j)j*d^fee(jfe'd^gdej7fdej7fged2edHgdej7fgdej7fedMgeejeejeejeejdejd^fdej7fedgdejd^fdej7fedgdejd^fdej7fedgdejd^fdej7fedgdejd^feddejfgdejd^feddejfgdejd^feddejfgdejd^feddejfgd!Z8dd Z9dS )r   z
    For Python source code (version 3.x).

    .. versionadded:: 0.10

    .. versionchanged:: 2.5
       This is now the default ``PythonLexer``.  It is still available as the
       alias ``Python3Lexer``.
    Pythonhttp://www.python.orgpythonpyZsagepython3Zpy3z*.pyz*.pywz*.jyz*.sagez*.scZ
SConstructZ
SConscriptz*.bzlZBUCKBUILDzBUILD.bazelZ	WORKSPACEz*.tacztext/x-pythonzapplication/x-pythonztext/x-python3zapplication/x-python3z	[%s][%s]*c                 C   s&   dt jfdt jfd| fd| fd| fgS )NzH%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsaux%]zg\{((\w+)((\.\w+)|(\[[^\]]+\]))*)?(\![sra])?(\:(.?[<>=\^])?[-+ ]?#?0?(\d+)?,?(\.\d+)?[E-GXb-gnosx%]?)?\}z[^\\\'"%{\n]+[\'"\\]z%|(\{{1,2})r   Interpolttype r-   :/tmp/pip-unpacked-wheel-6wad6tea/pygments/lexers/python.pyinnerstring_rulesC   s    zPythonLexer.innerstring_rulesc                 C   s"   dt jfdt jdfd| fd| fgS )Nz\}z\{expr-inside-fstringz[^\\\'"{}\n]+r(   r)   r+   r-   r-   r.   fstring_rulesW   s
    
zPythonLexer.fstring_rules\n&^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")&^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')\A#!.+$#.*$\\\n\\keywordssoft-keywords(def)((?:\s|\\\s)+)funcname(class)((?:\s|\\\s)+)	classname(from)((?:\s|\\\s)+)
fromimport(import)((?:\s|\\\s)+)importexprz(?i)(rf|fr)(""")rfstringescapetdqfz(?i)(rf|fr)(''')tsqfz(?i)(rf|fr)(")dqfz(?i)(rf|fr)(')sqfz([fF])(""")fstringescapez([fF])(''')z	([fF])(")z	([fF])(')z(?i)(rb|br|r)(""")tdqsz(?i)(rb|br|r)(''')tsqsz(?i)(rb|br|r)(")dqsz(?i)(rb|br|r)(')sqsz([uU]?)(""")stringescapez([uU]?)(''')z
([uU]?)(")z
([uU]?)(')z([bB])(""")bytesescapez([bB])(''')z	([bB])(")z	([bB])(')[^\S\n]+numbersz!=|==|<<|>>|:=|[-~+/*%=<>&^|.][]{}:(),;[](in|is|and|or|not)\bexpr-keywordsbuiltins
magicfuncs	magicvarsnamez[{([]expr-inside-fstring-innerz(=\s*)?(\![sraf])?\}#popz(=\s*)?(\![sraf])?:\s+z[])}])z	async forawaitelseforiflambdayield
yield from\bsuffix)TrueFalseNone)assertasyncr\   breakcontinuedelelifr]   exceptfinallyr^   globalr_   r`   passraisenonlocalreturntrywhilera   rb   aswithz6(^[ \t]*)(match|case)\b(?![ \t]*(?:[:,;=^&|@~)\]}]|(?:|z)\b))soft-keywords-innerz(\s+)([^\n_]*)(_\b))A
__import__absallanybinbool	bytearray
breakpointbyteschrclassmethodcompilecomplexdelattrdictdirdivmod	enumerateevalfilterfloatformat	frozensetgetattrglobalshasattrhashhexidinputint
isinstance
issubclassiterlenlistlocalsmapmax
memoryviewminnextobjectoctopenordpowprintpropertyrangereprreversedroundsetsetattrslicesortedstaticmethodstrsumsupertupletypevarszip(?<!\.)prefixre   z+(?<!\.)(self|Ellipsis|NotImplemented|cls)\b)EArithmeticErrorAssertionErrorAttributeErrorBaseExceptionBufferErrorBytesWarningDeprecationWarningEOFErrorEnvironmentError	ExceptionFloatingPointErrorFutureWarningGeneratorExitIOErrorImportErrorImportWarningIndentationError
IndexErrorKeyErrorKeyboardInterruptLookupErrorMemoryError	NameErrorNotImplementedErrorOSErrorOverflowErrorPendingDeprecationWarningReferenceErrorResourceWarningRuntimeErrorRuntimeWarningStopIterationSyntaxErrorSyntaxWarningSystemError
SystemExitTabError	TypeErrorUnboundLocalErrorUnicodeDecodeErrorUnicodeEncodeErrorUnicodeErrorUnicodeTranslateErrorUnicodeWarningUserWarning
ValueErrorVMSErrorWarningWindowsErrorZeroDivisionErrorBlockingIOErrorChildProcessErrorConnectionErrorBrokenPipeErrorConnectionAbortedErrorConnectionRefusedErrorConnectionResetErrorFileExistsErrorFileNotFoundErrorInterruptedErrorIsADirectoryErrorNotADirectoryErrorPermissionErrorProcessLookupErrorTimeoutErrorStopAsyncIterationModuleNotFoundErrorRecursionErrorZEncodingWarning)^__abs____add__
__aenter__	__aexit__	__aiter____and__	__anext__	__await____bool__	__bytes____call____complex____contains____del____delattr__
__delete____delitem____dir__
__divmod__	__enter____eq____exit__	__float____floordiv__
__format____ge____get____getattr____getattribute____getitem____gt____hash____iadd____iand____ifloordiv____ilshift____imatmul____imod____imul__	__index____init____instancecheck____int__
__invert____ior____ipow____irshift____isub____iter____itruediv____ixor____le____len____length_hint__
__lshift____lt__
__matmul____missing____mod____mul____ne____neg____new____next____or____pos____pow____prepare____radd____rand____rdivmod____repr____reversed____rfloordiv____rlshift____rmatmul____rmod____rmul____ror__	__round____rpow____rrshift__
__rshift____rsub____rtruediv____rxor____set____setattr____setitem____str____sub____subclasscheck____truediv____xor__)__annotations__	__bases__	__class____closure____code____defaults____dict____doc____file____func____globals____kwdefaults__
__module____mro____name____objclass____qualname____self__	__slots____weakref__zT(\d(?:_?\d)*\.(?:\d(?:_?\d)*)?|(?:\d(?:_?\d)*)?\.\d(?:_?\d)*)([eE][+-]?\d(?:_?\d)*)?z!\d(?:_?\d)*[eE][+-]?\d(?:_?\d)*j?z0[oO](?:_?[0-7])+z0[bB](?:_?[01])+z0[xX](?:_?[a-fA-F0-9])+z\d(?:_?\d)*@(\s+)(as)(\s+)z\.(\s*)(,)(\s*)z(\s+)(import)\bNone\bz\{\{z\}\}z0\\([\\abfnrtv"\']|\n|x[a-fA-F0-9]{2}|[0-7]{1,3})z,\\(N\{.*?\}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8})"\\\\|\\"|\\\nfstrings-double'\\\\|\\'|\\\nfstrings-singlestrings-doublestrings-single"""''')!rootrC   r0   rY   rT   r9   r:   r{   rU   rV   rW   rQ   rX   r<   r>   rB   r@   rD   rI   rO   rN   r  r|  r  r  rG   rH   rL   rM   rE   rF   rJ   rK   c                 C   s   t | dpd| d d kS )Npythonw?(3(\.\d)?)?import   r   textr-   r-   r.   analyse_text  s    
zPythonLexer.analyse_textN):rp  rn  rr  ri  rX   urlaliases	filenames	mimetypesuniZ	xid_startZxid_continueZuni_namer/   r1   r   r   r   AffixDocr   HashbangSingler   r   	NamespaceDoubler	   r   r   Wordr*   r   Constantjoinkeywordkwlistr   r   r   r   BuiltinPseudor   FunctionMagicVariabler   FloatOctBinHexInteger	DecoratorClassEscapetokensr  r-   r-   r-   r.   r      s0  
     ?  	
 
 
 *












    6c                    @   sf  e Zd ZdZdZdZddgZg ZddgZdd	 Z	d
e
fdee
ejejfdee
ejejfde
fdejfdejfdefde
fde
fdejfdefeddeee
dfdeee
dfdeeje
dfdeeje
dfededed ed!d"eejejd#fd$eejejd%fd&eejejd'fd(eejejd)fd*eejejed+d#fd,eejejed+d%fd-eejejed+d'fd.eejejed+d)fed/ed0ged1d2d3efged4d5d2d6ejfd7ejjfed8d5d2d6ejfged9d2d3ejj fged:d2d3ej!j fgd;e"j#fd<e"j#fd=e"j$fd>e"j%fd?e"j&fd@e"j'j(fdAe"j'fgdBej)fgdCej*fdDefgeddDejdEfe+dEgdDej,dEfgdFe
fdGejfdHefdIejfe+dEgdFe
fdJejdEfdKejjdEfdLejfe+dEgdMej-fge	eje	ejdNejdEfdOej-fedPgdQejdEfdRej-fedSgdTejdEfedPd
ejfgdUejdEfedSd
ejfgdVZ.dWdX Z/dYS )Zr   a  
    For Python 2.x source code.

    .. versionchanged:: 2.5
       This class has been renamed from ``PythonLexer``.  ``PythonLexer`` now
       refers to the Python 3 variant.  File name patterns like ``*.py`` have
       been moved to Python 3 as well.
    z
Python 2.xr#   Zpython2Zpy2ztext/x-python2zapplication/x-python2c                 C   s   dt jfd| fd| fd| fgS )NG%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%][^\\\'"%\n]+r(   %r)   r+   r-   r-   r.   r/     s    zPython2Lexer.innerstring_rulesr2   r3   r4   rP   r5   r6   rR   r7   r8   rS   z!=|==|<<|>>|[-~+/*%=<>&^|.]r9   r;   r<   r=   r>   r?   r@   rA   rB   rU   rV   rW   backtickz!([rR]|[uUbB][rR]|[rR][uUbB])(""")rJ   z!([rR]|[uUbB][rR]|[rR][uUbB])(''')rK   z([rR]|[uUbB][rR]|[rR][uUbB])(")rL   z([rR]|[uUbB][rR]|[rR][uUbB])(')rM   z([uUbB]?)(""")rN   z([uUbB]?)(''')z([uUbB]?)(")z([uUbB]?)(')rX   rQ   )ri   rk   rl   rm   rn   r]   ro   execrp   r^   rq   r_   r`   rr   r   rs   ru   rv   rw   ra   rb   rx   ry   rc   rd   )Nr|   r}   r~   r   apply
basestringr   r   bufferr   r   callabler   r   cmpcoercer   r   r   r   r   r   r   r   execfileexitfiler   r   r   r   r   r   r   r   r   r   r   internr   r   r   r   r   r   longr   r   r   r   r   r   r   r   r   r   r   	raw_inputreducereloadr   r   r   r   r   r   r   r   r   r   r   r   r   unichrunicoder   xranger   r   r   z;(?<!\.)(self|None|Ellipsis|NotImplemented|False|True|cls)\b)1r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   OverflowWarningr   r   r   r   StandardErrorr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )_r  r  r	  r  Z__cmp__Z
__coerce__r  r  r  r  r  r  Z__delslice__Z__div__r  r  r  r  r  r  r  r  r  r   r!  Z__getslice__r"  r#  Z__hex__r$  r%  Z__idiv__r&  r'  r)  r*  r+  r,  r-  r.  r/  Z__iop__r0  r1  r2  r3  r4  r5  r6  r7  r8  Z__long__r:  r;  r=  r>  r?  r@  rA  rB  __nonzero__Z__oct__Z__op__rD  rE  rF  rH  rI  Z__rcmp__Z__rdiv__rJ  rK  rL  rM  rN  rP  rQ  Z__rop__rR  rT  rU  rV  rW  rX  rY  rZ  r[  r\  Z__setslice__r]  r^  r_  r`  __unicode__ra  )rc  rd  re  rf  rg  rh  ri  rj  rk  rl  __metaclass__rn  ro  rp  rs  rt  ru  z'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?z\d+[eE][+-]?[0-9]+j?z	0[0-7]+j?z
0[bB][01]+0[xX][a-fA-F0-9]+\d+Lz\d+j?`.*?`z@[\w.]+[a-zA-Z_]\w*rZ   z(?:[ \t]|\\\n)+as\b,[a-zA-Z_][\w.]*zimport\bry  [a-zA-Z_.][\w.]*Y\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})rz  r{  r  r}  r~  r  r  r  )r  r9   rU   rV   rW   rQ   r  rX   r<   r>   rB   r@   rN   r  r  rL   rM   rJ   rK   c                 C   s
   t | dS )Nzpythonw?2(\.\d)?r  r  r-   r-   r.   r  {  s    zPython2Lexer.analyse_textN)0rp  rn  rr  ri  rX   r  r  r  r  r/   r   r   r   r  r  r   r  r  r   r   r  r   r   r  r  r	   r   r   r  r  r   r  r  r  r   r  r  r  r  r  LongBacktickr  r   r  r  r  r  r-   r-   r-   r.   r     s:  	    -	  #









  >c                   @   s0   e Zd ZdZdZdgZdgZdd Zdd Zd	S )
r   a  
    For Python console output or doctests, such as:

    .. sourcecode:: pycon

        >>> a = 'foo'
        >>> print a
        foo
        >>> 1 / 0
        Traceback (most recent call last):
          File "<stdin>", line 1, in <module>
        ZeroDivisionError: integer division or modulo by zero

    Additional options:

    `python3`
        Use Python 3 lexer for code.  Default is ``True``.

        .. versionadded:: 1.0
        .. versionchanged:: 2.5
           Now defaults to ``True``.
    zPython console sessionZpyconztext/x-python-doctestc                 K   s    t |dd| _tj| f| d S )Nr&   T)r   r&   r   r,  )selfoptionsr-   r-   r.   r,    s    zPythonConsoleLexer.__init__c              	   c   s  | j r tf | j}tf | j}ntf | j}tf | j}d}g }d}d}d}t|D ]r}	|	 }
|
	dsx|
	drd}|
t|dtj|
d d fgf ||
dd  7 }qV|
 dkr|s|
t|dtjdfgf ||
dd  7 }qV|rt|||E d H  d}g }|
	ds.td	|
r@d
}|
}|	 }qV|
dkr^|	 tj|
fV  qV|r||
7 }|
	ds|
 dksd}||D ]\}}}|| ||fV  qd}qV|	 tj|
fV  qV|rt|||E d H  |r||D ]\}}}|| ||fV  qd S )N r   z>>> z...    z...   z"Traceback (most recent call last):z  File "[^"]+", line \d+\n$   zKeyboardInterrupt
 )r&   r   r  r   r   r   line_refinditergroup
startswithappendr   r   ZPromptrstripr
   get_tokens_unprocessedrematchstartr   r  stripZOutput)r  r  ZpylexerZtblexerZcurcodeZ
insertionsZcurtbZtbindextbr  lineitvr-   r-   r.   r    sj    

 




z)PythonConsoleLexer.get_tokens_unprocessedN)	rp  rn  rr  ri  rX   r  r  r,  r  r-   r-   r-   r.   r     s   c                   @   s   e Zd ZdZdZddgZddgZddgZd	efd
e	j
dfde	j
fde	j
fde	j
dfdefgdeeejeeeeefdeeejeeefdeeeeedfdeeeefdee	jeeedfdee	jedfgdeeejedfedgdZdS )r   a   
    For Python 3.x tracebacks, with support for chained exceptions.

    .. versionadded:: 1.0

    .. versionchanged:: 2.5
       This is now the default ``PythonTracebackLexer``.  It is still available
       as the alias ``Python3TracebackLexer``.
    zPython TracebackZpytbZpy3tbz*.pytbz*.py3tbztext/x-python-tracebackztext/x-python3-tracebackr2   z'^Traceback \(most recent call last\):\nintbzH^During handling of the above exception, another exception occurred:\n\nzI^The above exception was the direct cause of the following exception:\n\n^(?=  File "[^"]+", line \d+)^.*\n0^(  File )("[^"]+")(, line )(\d+)(, in )(.+)(\n)%^(  File )("[^"]+")(, line )(\d+)(\n)^(    )(.+)(\n)markers^([ \t]*)(\.\.\.)(\n)^([^:]+)(: )(.+)(\n)rZ   z^([a-zA-Z_][\w.]*)(:?\n)z^( {4,})([~^]+)(\n))r  r  r  N)rp  rn  rr  ri  rX   r  r  r  r   r   	Tracebackr   r   r   r  r   r   r   r   r   r   Markerr   r  r-   r-   r-   r.   r     sZ   


 
 
 c                   @   s   e Zd ZdZdZdgZdgZdgZdee	e
jdfde
jdfd	efgd
ee	eje	ee	ee	fdee	eje	ee	fdee	eee	dfdee	ee	fdee
je	ee	dfdee
je	dfgdee	ejdfedgdZdS )r   z
    For Python tracebacks.

    .. versionadded:: 0.7

    .. versionchanged:: 2.5
       This class has been renamed from ``PythonTracebackLexer``.
       ``PythonTracebackLexer`` now refers to the Python 3 variant.
    zPython 2.x TracebackZpy2tbz*.py2tbztext/x-python2-tracebackz^(\^C)?(Traceback.*\n)r  r  r  r  r  r  markerr  r  rZ   z^([a-zA-Z_]\w*)(:?\n)z( {4,})(\^))r  r  r  N)rp  rn  rr  ri  rX   r  r  r  r   r   r   r  r   r   r  r   r   r   r   r   r   r  r   r  r-   r-   r-   r.   r     sL   

 

 
 
 c                !   @   sP  e Zd ZdZdZdZdddgZddd	gZd
dgZde	fde
e	ejfde
e	ejfde	fdefdefde	fde	fdejfde
eejefdefde
eejeeeeefedde
ee	dfde
ee	dfde
eefde
ee	dfd e
ee	d!fd"e
ee	d#fed$ed%d&ed'fd(ed)fd*ed+fd,ed-fd.eed/d'fd0eed/d)fd1eed/d+fd2eed/d-fed3ed4ged5d6d7efd8ejfged9d:d6d;ejfd<ejjfed=d:d6d;ejfgd>ejfd?ejfd@ejfdAejj fdBejfgdCej!fgdDej"fdEefgdEej#dFfgdGej$fdHefdIe
ej#e	dFfdJe
ej#e	efdKedFfdLefdMedFfdNe	dFfdEejfdOe	fg
dEej%dFfgdPe
e	ee	fdQej&fdRe
e	ee	fe'dFgdSe
e	edFfdTej&fe'dFgdUej(fgdVej)fdWefdXefdYefgdefgdZedFfd[ej(fed\gd]edFfd^ej(fed\gd_edFfed\ed`gdaedFfed\ed`gdbZ*dcS )dr   zF
    For Pyrex and Cython source code.

    .. versionadded:: 1.1
    ZCythonzhttp://cython.orgZcythonZpyxZpyrexz*.pyxz*.pxdz*.pxiztext/x-cythonzapplication/x-cythonr2   z^(\s*)("""(?:.|\n)*?""")z^(\s*)('''(?:.|\n)*?''')rP   r6   rR   r7   r8   rS   z(<)([a-zA-Z0-9.?]+)(>)z!=|==|<<|>>|[-~+/*%=<>&^|.?]z(from)(\d+)(<=)(\s+)(<)(\d+)(:)r9   z(def|property)(\s+)r<   z(cp?def)(\s+)cdefz	(cdef)(:)z(class|struct)(\s+)r>   z(from)(\s+)r@   z(c?import)(\s+)rB   rU   r  z(?:[rR]|[uU][rR]|[rR][uU])"""rJ   z(?:[rR]|[uU][rR]|[rR][uU])'''rK   z(?:[rR]|[uU][rR]|[rR][uU])"rL   z(?:[rR]|[uU][rR]|[rR][uU])'rM   z[uU]?"""rN   z[uU]?'''z[uU]?"z[uU]?'rX   rQ   )ri   rj   r\   rk   Zbyrl   Zctypedefrm   rn   r]   ro   zexcept?r  rp   r^   ZfusedZgilrq   r_   r   r`   Znogilrr   r   rs   ru   rv   rw   ra   rx   ry   rc   rd   z(DEF|IF|ELIF|ELSE)\b)Qr|   r}   r~   r   r  r  r   Zbintr   r  r   r   r  r   r   r  r  r   r   r   r   r   r   r   r   r  r  r  r   r   r   r   r   r   r   r   r   r   r   r  r   r   r   r   r   r   r  r   r   r   r   r   r   r   r   r   r   Z
Py_ssize_tr   r  r  r  r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  Zunsignedr   r  r   r   r   z<(?<!\.)(self|None|Ellipsis|NotImplemented|False|True|NULL)\b)0r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   NotImplementedr   r   r   r  r   r   r   r   r  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   z&(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?z0\d+r  r  z\d+r  z@\w+r  rZ   z%(public|readonly|extern|api|inline)\bz(struct|enum|union|class)\bz([a-zA-Z_]\w*)(\s*)(?=[(:#=]|$)z([a-zA-Z_]\w*)(\s*)(,)zfrom\br  :z	(?=["\']).rw  r  rx  z(\s+)(c?import)\br  r  zP%(\([a-zA-Z0-9]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]r  r(   r  rz  r{  stringsr}  r~  r  nlr  )r  r9   rU   rQ   r  rX   r<   r  r>   rB   r@   rN   r  r  rL   rM   rJ   rK   N)+rp  rn  rr  ri  rX   r  r  r  r  r   r   r   r  r   r   r   r  r   Typer   r  r   r   r	   r   ZPreprocr  r  r   r  r  r  r  r  r  r  Reservedr  r  r   r  r*   r  r-   r-   r-   r.   r   ?  s  

 &
  #


 
 c                   @   sz  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fdejfd	ejfd
ejfdejfdejfdeedddfdeedddfdeedddfdeedddfdefdejfdefeddddejfeddddejfdej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fd'efgd(ejfgd)ej fd*efd+efd,efd-efgd.ed/fgd0ed/fgd1ed/fgd2ed/fgd3Z!d4S )5r    z
    Lexer for dg,
    a functional and object-oriented programming language
    running on the CPython 3 VM.

    .. versionadded:: 1.6
    Zdgz*.dgz	text/x-dgr[   z#.*?$z(?i)0b[01]+z(?i)0o[0-7]+z(?i)0x[0-9a-f]+z((?i)[+-]?[0-9]+\.[0-9]+(e[+-]?[0-9]+)?j?z(?i)[+-]?[0-9]+e[+-]?\d+j?z(?i)[+-]?[0-9]+j?z(?i)(br|r?b?)'''rN   rK   stringz(?i)(br|r?b?)"""rJ   z(?i)(br|r?b?)'rM   z(?i)(br|r?b?)"rL   z`\w+'*`z\b(and|in|is|or|where)\bz[!$%&*+\-./:<-@\\^|~;,]+)r   r   r   r   r   r   zdict'r   r   r   r   zlist'r   r   r   r   r   zset'r   r   r   r   r   ztuple'r   r   z
(?![\'\w])r   )=r|   r}   r~   r   r   bindr   r  r   r   r   r   r   Zdrop	dropwhiler   r   Zexhaustr   Zflipzfoldl1?r   Zfstr   r   r   r   headr   r   initr   r   r   r   Ziteratelastr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   zscanl1?Zsndr   r   tailtake	takewhiler   r   z>(?<!\.)(self|Ellipsis|NotImplemented|None|True|False)(?!['\w])z3(?<!\.)[A-Z]\w*(Error|Exception|Warning)'*(?!['\w])zT(?<!\.)(Exception|GeneratorExit|KeyboardInterrupt|StopIteration|SystemExit)(?!['\w])z_(?<![\w.])(except|finally|for|if|import|not|otherwise|raise|subclass|while|with|yield)(?!['\w])z[A-Z_]+'*(?!['\w])z[A-Z]\w+'*(?!['\w])z\w+'*z[()]r  r  r  r  r(   r  r2   rz  rZ   r}  r  r  )r  rN   r  rL   rM   rJ   rK   N)"rp  rn  rr  ri  rX   r  r  r  r   r   r  r   r  r  r  r  r  r   r	   r   r  r   r   r  r  r   r   r  r  r   r   r  r*   r  r-   r-   r-   r.   r      s    	 
9c                  @   sX  e Zd ZdZdZdZdgZg Z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-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd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(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~ddddddddhZ	dd Z
dd ZdS (  r!   z[
    A Python lexer recognizing Numerical Python builtins.

    .. versionadded:: 0.10
    ZNumPyzhttps://numpy.org/Znumpyr}   absolute
accumulateaddalenr~   ZallcloseZalltrueZalterdotZamaxZaminZangler   r  Zapply_along_axisZapply_over_axesZarangeZarccosZarccoshZarcsinZarcsinhZarctanZarctan2ZarctanhZargmaxZargminZargsortZargwhereZaroundarrayZarray2stringZarray_equalZarray_equivZ
array_reprZarray_splitZ	array_strZ
arrayrangeZ
asanyarrayZasarrayZasarray_chkfiniteZascontiguousarrayZasfarrayZasfortranarrayZasmatrixZasscalarZastypeZ
atleast_1dZ
atleast_2dZ
atleast_3dZaverageZbartlettZ	base_reprbetaZbinary_reprZbincountZbinomialZbitwise_andZbitwise_notZ
bitwise_orZbitwise_xorZblackmanZbmat	broadcastZbyte_boundsr   ZbyteswapZc_Zcan_castceilchooseZclipZcolumn_stackZcommon_typeZcompare_chararrayscompressZconcatenateZconj	conjugateZconvolvecopyZcorrcoefZ	correlatecoscoshZcovZcrossZcumprodZ
cumproductZcumsumdeleteZ	deprecateZdiagZdiagflatZdiagonalZdiffZdigitizeZdispdividedotZdsplitZdstackZdtypedumpdumpsZediff1demptyZ
empty_likeequalexpZexpand_dimsexpm1extractZeyefabsZfastCopyAndTransposeZfftZfftfreqZfftshiftfillZfinfoZfixZflatZflatnonzeroflattenZfliplrZflipudfloorZfloor_dividefmodfrexpZ
fromarraysZ
frombufferZfromfileZfromfunctionZfromiterZ
frompyfunc
fromstringZgenericZget_array_wrapZget_includeZget_numarray_includeZget_numpy_includeZget_printoptions	getbufferZ
getbufsizeZgeterrZ
geterrcallZ	geterrobjZgetfieldZgradientZgreaterZgreater_equalZgumbelZhammingZhanningZ	histogramZhistogram2dZhistogramddZhsplitZhstackhypotZi0identityZifftimagZ	index_expindicesinfinfoinnerinsertZint_asbufferZinterpZintersect1dZintersect1d_nuinvinvertZ	iscomplexZiscomplexobjisfiniteZ	isfortranisinfisnanZisneginfZisposinfZisrealZ	isrealobjZisscalarZissctypeZissubclass_Z
issubdtypeZissubsctypeitemZitemsetiterableZix_ZkaiserZkronldexpZ
left_shiftZlessZ
less_equalZlexsortZlinspaceloadloadsZloadtxtloglog10log1plog2logical_andZlogical_not
logical_orlogical_xorZlogspaceZlstsqmatZmatrixr   maximumZmaximum_sctypeZmay_share_memoryZmeanZmedianZmeshgridZmgridr   ZminimumZmintypecodemodmodfZmsortmultiplynanZ
nan_to_numZ	nanargmaxZ	nanargminZnanmaxZnanminZnansumZndenumeratendimZndindexnegativeZnewaxisZ	newbufferZnewbyteorderZnonzero	not_equalZ
obj2sctypeZogridZonesZ	ones_likeouterZpermutationZ	piecewiseZpinvZpkgloadZplaceZpoissonZpolyZpoly1dZpolyaddZpolyderZpolydivZpolyfitZpolyintZpolymulZpolysubZpolyvalpowerprodproductZptpputZputmaskZr_randintZrandom_integersZrandom_sampleZranfZrankZravelrealZreal_if_closeZrecarrayZ
reciprocalr  	remainderrepeatrequireZreshaperesizeZ
restoredotZright_shiftZrintZrollZrollaxisrootsZrot90r   Zround_Z	row_stackZs_sampleZsavetxtZsctype2charZsearchsortedseedselectZset_numeric_opsZset_printoptionsZset_string_functionZ
setbufsizeZ	setdiff1dZseterrZ
seterrcallZ	seterrobjZsetfieldZsetflagsZsetmember1dZsetxor1dshapeZshow_configshufflesignZsignbitsinZsincsinhsizer   ZsolveZsometruesortZsort_complexsourcesplitsqrtZsquareZsqueezeZstandard_normalZstdsubtractr   ZsvdZswapaxesr  tantanhZ	tensordottestZtileZtofiletolisttostringtraceZ	transposeZtrapzZtriZtrilZ
trim_zerosZtriuZtrue_divideZtypeDicttypenameuniformZunion1duniqueZunique1dZunravel_indexunwrapZvandervarZvdotZ	vectorizeviewZvonmisesZvsplitZvstackZweibullwhereZwhozerosZ
zeros_likec                 c   sJ   t | |D ]8\}}}|tkr8|| jkr8|tj|fV  q|||fV  qd S )N)r   r  r   EXTRA_KEYWORDSr   r  )r  r  indextokenvaluer-   r-   r.   r    s
    
z!NumPyLexer.get_tokens_unprocessedc                 C   s.   | d d }t | dsd|ko,d|kp,d|kS )Nr  r  r  zimport numpyzfrom numpy importr  )r  Zltextr-   r-   r.   r    s    
zNumPyLexer.analyse_textN)rp  rn  rr  ri  rX   r  r  r  r  rn  r  r  r-   r-   r-   r.   r!   V  s                                                                                                                                                                                                                                                                                                                                    C)-ri  r  r  Zpygments.lexerr   r   r   r   r   r   r   r	   r
   r   Zpygments.utilr   r   Zpygments.tokenr   r   r   r   r   r   r   r   r   r   r   Zpygmentsr   r  __all__r   r  r   ZPython3Lexerr   r   r   ZPython3TracebackLexerr   r   r    r!   r-   r-   r-   r.   <module>   s:   
04   
    _X50 5c