a
    W_                     @   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
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 g d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-2020 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)	Lexer
RegexLexerincludebygroupsusingdefaultwordscombineddo_insertions)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                    @   sP  e Zd ZdZdZg dZg dZg dZej	ej
B 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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g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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d0fd1eejejed2d*fd3eejejed2d,fd4eejejed2d.fd5eejejed2d0fd6efd7efd8e fd9ej!fed:ed;ed<ed=ed>ed?gd@e dAfdBej"dCfdDej"dCfdEefedgd@e dAfdFe dCfdEefedge#dGdHdIefe#dJdHdIej$fge#dKdHdIefe#dJdHdIej$fge#dLdMdHdNe%j&fdOe%j&j'fe#dPdMdHdNe%j(fge#dQdHdIe%j)j*fge#dRdHdIe%j+j*fgdSe,j-fdTe,j-fdUe,j.fdVe,j/fdWe,j0fdXe,j1fgdYe e%j2fdYefee%fged<ee%j)dCfe3dCgee%j4dCfgdZeeeefd[e%jfee%jfd\eeeefe3dCgd]eeejdCfd[e%jfd^e%j&j'dCfee%jfe3dCgd_ej5fd`ej5fed2gdaej5fgeejeejeejeejdbejdCfdcej5feddgdeejdCfdfej5fedggdbejdCfdcej5fedhgdeejdCfdfej5fedigdjejdCfedddejfgdkejdCfedgdejfgdjejdCfedhdejfgdkejdCfedidejfgdlZ6dmdn Z7doS )pr   z
    For `Python <http://www.python.org>`_ 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)pythonpyZsagepython3Zpy3)z*.pyz*.pywz*.jyz*.sagez*.scZ
SConstructZ
SConscriptz*.bzlZBUCKZBUILDzBUILD.bazelZ	WORKSPACEz*.tac)z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Zttype r)   8/usr/lib/python3/dist-packages/pygments/lexers/python.pyinnerstring_rulesD   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_rulesX   s
    
zPythonLexer.fstring_rules\n&^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")&^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')\A#!.+$#.*$\\\n\\keywords(def)((?:\s|\\\s)+)funcname(class)((?:\s|\\\s)+)	classname(from)((?:\s|\\\s)+)
fromimport(import)((?:\s|\\\s)+)importexprz(?i)(rf|fr)(""")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)(')sqs([uUbB]?)(""")stringescape([uUbB]?)(''')([uUbB]?)(")([uUbB]?)(')[^\S\n]+z!=|==|<<|>>|:=|[-~+/*%=<>&^|.][]{}:(),;[](in|is|and|or|not)\bexpr-keywordsbuiltins
magicfuncs	magicvarsnamenumbersz[{([]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asyncrY   breakcontinuedelelifrZ   exceptfinallyr[   globalr\   r]   passraisenonlocalreturntrywhiler^   r_   aswith)@
__import__absallanybinbool	bytearray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(?<!\.)prefixrb   z+(?<!\.)(self|Ellipsis|NotImplemented|cls)\b)D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RecursionError)^__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\}\}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})"\\\\|\\"|\\\nfstrings-double'\\\\|\\'|\\\nfstrings-singlestrings-doublestrings-single"""''')rootr>   r,   rV   rP   r5   rQ   rR   rS   rU   rT   r7   r9   r=   r;   rC   rI   rz  rw  r|  r{  rA   rB   rF   rG   r?   r@   rD   rE   c                 C   s
   t | dS )Npythonw?(3(\.\d)?)?r   textr)   r)   r*   analyse_textv  s    zPythonLexer.analyse_textN)8rj  rh  rl  rc  rT   aliases	filenames	mimetypesre	MULTILINEUNICODEflagsuniZ	xid_startZxid_continueZuni_namer+   r-   r   r   r   AffixDocr   HashbangSingler   r   	NamespaceDoubler	   r   r   Wordr'   r   ZConstantr   BuiltinPseudor   FunctionMagicVariabler   FloatOctBinHexInteger	Decoratorr   ClassEscapetokensr  r)   r)   r)   r*   r      s  
1	


)












    r   c                    @   sb  e 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d/ged0d1d2efged3d4d1d5ejfd6ejjfed7d4d1d5ejfged8d1d2ejjfged9d1d2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d@e!j&fgdAej(fgdBej)fdCefgeddCejdDfe*dDgdCej+dDfgdEe	fdFejfdGefdHejfe*dDgdEe	fdIejdDfdJejjdDfdKejfe*dDgdLej,fgeejeejdMejdDfdNej,fedOgdPejdDfdQej,fedRgdSejdDfedOd	ejfgdTejdDfedRd	ejfgdUZ-dVdW Z.dXS )Yr   a   
    For `Python 2.x <http://www.python.org>`_ 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.xZ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_rulesr.   r/   r0   rM   r1   r2   rN   r3   r4   rO   z!=|==|<<|>>|[-~+/*%=<>&^|.]r5   r6   r7   r8   r9   r:   r;   r<   r=   rQ   rR   rS   backtickz!([rR]|[uUbB][rR]|[rR][uUbB])(""")rD   z!([rR]|[uUbB][rR]|[rR][uUbB])(''')rE   z([rR]|[uUbB][rR]|[rR][uUbB])(")rF   z([rR]|[uUbB][rR]|[rR][uUbB])(')rG   rH   rI   rJ   rK   rL   rT   rU   )rf   rh   ri   rj   rk   rZ   rl   execrm   r[   rn   r\   r]   ro   r   rp   rr   rs   rt   r^   r_   ru   rv   r`   ra   )Nrw   rx   ry   rz   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__r*  r+  r,  r-  r.  r/  r0  r1  r2  Z__long__r4  r5  r7  r8  r9  r:  r;  r<  Z__nonzero__Z__oct__Z__op__r>  r?  r@  rB  rC  Z__rcmp__Z__rdiv__rD  rE  rF  rG  rH  rJ  rK  Z__rop__rL  rN  rO  rP  rQ  rR  rS  rT  rU  rV  Z__setslice__rW  rX  rY  rZ  Z__unicode__r[  )r]  r^  r_  r`  ra  rb  rc  rd  re  rf  Z__metaclass__rh  ri  rj  rm  rn  ro  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*rW   z(?:[ \t]|\\\n)+as\b,[a-zA-Z_][\w.]*zimport\brs  [a-zA-Z_.][\w.]*rt  ru  rv  r{  rx  ry  r|  r}  r~  )r  r5   rQ   rR   rS   rU   r  rT   r7   r9   r=   r;   rI   r|  r{  rF   rG   rD   rE   c                 C   s   t | dpd| d d v S )Nzpythonw?2(\.\d)?import   r  r  r)   r)   r*   r  V  s    
zPython2Lexer.analyse_textN)/rj  rh  rl  rc  rT   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,  	-	#









  >r   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i | d S )Nr$   T)r   r$   r   r&  )selfoptionsr)   r)   r*   r&  v  s    zPythonConsoleLexer.__init__c              	   c   s.  | j r(tf i | j}tf i | j}n tf i | j}tf i | j}d}g }d}d}d}t|D ]v}	|	 }
|
	ds|
	drd}|
t|dtj|
d d fgf ||
dd  7 }qf|
 dkr|s|
t|dtjdfgf ||
dd  7 }qf|r(t|||E d H  d}g }|
	dsBtd	|
rTd
}|
}|	 }qf|
dkrr|	 tj|
fV  qf|r||
7 }|
	ds|
 dksd}||D ]\}}}|| ||fV  qd}qf|	 tj|
fV  qf|rt|||E d H  |r*||D ]\}}}|| ||fV  qd 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_unprocessedr  matchstartr   r  stripZOutput)r  r  ZpylexerZtblexerZcurcodeZ
insertionsZcurtbZtbindextbr  lineitvr)   r)   r*   r  z  sh    







z)PythonConsoleLexer.get_tokens_unprocessedN)	rj  rh  rl  rc  rT   r  r  r&  r  r)   r)   r)   r*   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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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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-tracebackr.   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)^([ \t]*)(\.\.\.)(\n)^([^:]+)(: )(.+)(\n)rW   ^([a-zA-Z_]\w*)(:?\n)r  r  N)rj  rh  rl  rc  rT   r  r  r  r   r   	Tracebackr   r   r   r  r   r   r   r   r   r  r)   r)   r)   r*   r     sH   



r   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	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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  r  r  rW   r  r  N)rj  rh  rl  rc  rT   r  r  r  r   r   r   r  r   r   r  r   r   r   r   r   r  r)   r)   r)   r*   r     s>   



r   c                !   @   sH  e Zd ZdZdZg dZg d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d+e
ed*d$fd,e
ed*d&fd-e
ed*d(fed.ed/ged0d1d2efd3ejfged4d5d1d6ejfd7ejjfed8d5d1d6ejfgd9ejfd:ejfd;ejfd<ejjfd=ejfgd>e
j fgd?ej!fd@efgd@ej"dAfgdBej#fdCefdDe	ej"edAfdEe	ej"eefdFedAfdGefdHedAfdIedAfd@ejfdJefg
d@ej$dAfgdKe	eeefdLej%fdMe	eeefe&dAgdNe	eedAfdOej%fe&dAgdPe
j'fgdQe
j(fdRe
fdSe
fdTe
fgde
fgdUe
dAfdVe
j'fedWgdXe
dAfdYe
j'fedWgdZe
dAfedWed[gd\e
dAfedWed[gd]Z)d^S )_r   z]
    For Pyrex and `Cython <http://cython.org>`_ source code.

    .. versionadded:: 1.1
    ZCython)ZcythonZpyxZpyrex)z*.pyxz*.pxdz*.pxiztext/x-cythonzapplication/x-cythonr.   z^(\s*)("""(?:.|\n)*?""")z^(\s*)('''(?:.|\n)*?''')rM   r2   rN   r3   r4   rO   z(<)([a-zA-Z0-9.?]+)(>)z!=|==|<<|>>|[-~+/*%=<>&^|.?]z(from)(\d+)(<=)(\s+)(<)(\d+)(:)r5   z(def|property)(\s+)r7   z(cp?def)(\s+)cdefz	(cdef)(:)z(class|struct)(\s+)r9   z(from)(\s+)r;   z(c?import)(\s+)r=   rQ   r  z(?:[rR]|[uU][rR]|[rR][uU])"""rD   z(?:[rR]|[uU][rR]|[rR][uU])'''rE   z(?:[rR]|[uU][rR]|[rR][uU])"rF   z(?:[rR]|[uU][rR]|[rR][uU])'rG   z[uU]?"""rI   z[uU]?'''z[uU]?"z[uU]?'rT   rU   )rf   rg   rY   rh   Zbyri   Zctypedefrj   rk   rZ   rl   zexcept?r  rm   r[   ZfusedZgilrn   r\   r   r]   Znogilro   r   rp   rr   rs   rt   r^   ru   rv   r`   ra   z(DEF|IF|ELIF|ELSE)\b)Orw   rx   ry   rz   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   r   r   r   r   r   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  rW   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	(?=["\']).rq  r  rr  z(\s+)(c?import)\br  rt  zP%(\([a-zA-Z0-9]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]r  r%   r  ru  rv  stringsrx  ry  r}  nlr~  )r  r5   rQ   rU   r  rT   r7   r  r9   r=   r;   rI   r  r  rF   rG   rD   rE   N)*rj  rh  rl  rc  rT   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  &
#


 r   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 <http://pyos.github.com/dg>`_,
    a functional and object-oriented programming language
    running on the CPython 3 VM.

    .. versionadded:: 1.6
    Zdgz*.dgz	text/x-dgrX   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?)'''rI   rE   stringz(?i)(br|r?b?)"""rD   z(?i)(br|r?b?)'rG   z(?i)(br|r?b?)"rF   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   )=rw   rx   ry   rz   r{   Zbindr   r  r   r   r   r   r   Zdrop	dropwhiler   r   Zexhaustr   Zflipzfoldl1?r   Zfstr   r   r   r   headr   r   Zinitr   r   r   r   ZiterateZ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  rt  r  r  r%   r  r.   ru  rW   rx  r}  r~  )r  rI   r  rF   rG   rD   rE   N)"rj  rh  rl  rc  rT   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r   c                   @   s:   e Zd ZdZdZdgZg Zg Zh dZdd Z	dd Z
d	S )
r    z[
    A Python lexer recognizing Numerical Python builtins.

    .. versionadded:: 0.10
    ZNumPyZnumpy>  dumpZediff1dZstandard_normalwhereZdigitizeZ	remainderZvsplitZsearchsortedZflattenZasfortranarrayZeyeZfromfileZnonzerory   Z	index_expZbyteswapZsetxor1dZasmatrixZfftshiftZ	row_stackZ
seterrcallZ
left_shiftZmaximum_sctypeZranfZcumsumZsolveZintersect1dcopyZmintypecodeZresizerealtolistZexpand_dimsndimZtrilZset_string_functionZvanderZpkgloaddotZsctype2charZ
geterrcallZndindexZpolysubZasscalarZmean	getbufferZaminZargsortZnanminZ
fromarraysZaverageZ	base_reprZ	piecewiseZcan_castZcoshZget_numarray_includeZarcsinZkronZblackmaninnerZ	tensordotZ
trim_zerosZhstackZ
reciprocalZset_numeric_opsZ
frombufferZrandintZdiagonalloadZmgridZfillZmodfZlog2Zpowerr~   repeatZabsoluteZget_array_wrapZsinZclipZlogspaceZequalZtostringZpoly1dZget_includeZarray_splitZgenericZset_printoptionsZweibulllogZtypeDictZ	seterrobjtypenamer   ZarctanZhammingZflipudZtofilesplitZaroundZastypesortZintersect1d_nuinfZlesscompressZbinomialZ	deprecatedeleteZcorrcoefZlinspaceZapply_over_axesuniqueZcumprodinsertZchoose	conjugateZascontiguousarrayZisrealZsetmember1dZdstackZfftZfloor_divideZconvolveZconjnanZ	vectorizeZarccoshZc_ZdsplitZsignbitZreshapeZsometrueZmay_share_memoryZunwrapsubtractZfliplrZamaxZlogical_xorZpolyderZbartlettZunique1dZvdotZbitwise_andZfinfoZs_Zcompare_chararraysZpolyaddZpolymulZisneginfZarctan2Zrot90ZplaceZget_printoptionsZ
zeros_likeZrandom_integersproductZinterpZ	nanargminZnewbyteorderZround_ZrollZ	isrealobjZi0ZhanningZfftfreqZlstsqZ
issubdtypeZexpm1extractZ
fromstringZpolydivrz   ZselectZlexsortZsampleZvstackZarray_equivZswapaxesr  Z	broadcastZfixZisscalarZfastCopyAndTransposeZalterdotZmaximumZlogical_notZnanmaxZflatnonzeroZangleZmeshgridZdiagZ	geterrobjZzerosZfmodZgreater_equalloadsZtanhZ
logical_orZseedZix_ZsignZtrivarZ
atleast_1dZ
obj2sctypeZmsortZsqrtinvZminimumZrinttestZasarrayiterableZidentityZ	newbufferZsqueezeZ
restoredotZallcloseZ
nan_to_numZ
cumproductZ	setdiff1dr   ZpolyfitZiscomplexobjZ
getbufsizemodZpolyvalZprodZlog1pZndenumerateZsvdZint_asbufferalenZputZisposinfZtanZmultiplyZpermutationZpinvZarangeZreal_if_closeZ
less_equalZisnanZpolyZrandom_sampleZ
atleast_2dZitemsetZasarray_chkfiniter   Ztrue_divideZlogical_andZrollaxisZget_numpy_includeZrankZgumbelZissubclass_Z
bitwise_orZ
setbufsizeZshow_configZsincZtileimagZ	transposeZapply_along_axisZsavetxtZasfarrayemptyZ
arrayrangeZ	iscomplexZbinary_reprZarrayZdiagflatZconcatenateZseterrZrecarrayrx   Zunion1dZhypotZviewZtraceZshuffleZldexpZcommon_typesourceZmatrixZsort_complexr  Zbitwise_xorZcrossZ	not_equaladdindicesZptpZarccosZonesZdivideZfromfunctionZarray2stringZgradientZrequireinvertZbincountZ
array_reprZargminZtriuZ
empty_likeZlog10rootsZogridZgeterrZkaiserZloadtxtsizeZarray_equalZgreaterZbetaZfloorZdtypeZnewaxisZ
frompyfuncZdispZissctypeshapeZr_ZvonmisesZargmaxZbyte_boundsZdiffZ	array_strZbmatZhistogram2dZ	correlateZisinfZbitwise_notZputmaskZifftZ
asanyarrayZ	nanargmaxZgetfield
accumulateZ
atleast_3dZ	histogramZalltrueZwhoZarcsinhZ	ones_likeZsinhZsquareZexpZmatZfromiterZouterr  ZarctanhZnansumZsetflagsZfrexpZceilZhsplitZ	isfortranitemZright_shiftnegativeZisfiniteZcovr   ZstdZuniformZflatZissubsctypeZhistogramddZpoissonZravelZsetfieldZmedianZfabsZtrapzZunravel_indexZcosZpolyintZargwheredumpsinfor   Zcolumn_stackc                 c   sJ   t | |D ]8\}}}|tu r8|| jv 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  t  s
    
z!NumPyLexer.get_tokens_unprocessedc                 C   s*   t | dsd| d d v o(d| v p(d| v S )Nr  r  r  zimport numpyzfrom numpy importr  r  r)   r)   r*   r  |  s
    
zNumPyLexer.analyse_textN)rj  rh  rl  rc  rT   r  r  r  r#  r  r  r)   r)   r)   r*   r    #  s   Cr    )+rc  r  Zpygments.lexerr   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*   
,4
  ` _X,+ 4c