B
    `                 @   s2  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 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-2021 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            !   @   s  e 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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ed0d1fd2eejejed0d3fd4eejejed0d5fd6eejejed0d7fd8eejejed9d1fd:eejejed9d3fd;eejejed9d5fd<eejejed9d7fd=eejejd>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edFd>fdGeejejedFd@fdHeejejedFdBfdIeejejedFdDfdJefedKdLefdMe fdNej!fedOedPedQedRedSgdTe dUfdVej"dWfdXej"dWfdYefed.gdTe dUfdZe dWfdYefed.ge#d[d\d]efe#d^d\d]ej$fge#d_d\d]efe#d^d\d]ej$fge#d`dad\dbe%j&fdce%j&j'fe#dddad\dbe%j(fge#ded\d]e%j)j*fge#dfd\d]e%j+j*fgdge,j-fdhe,j-fdie,j.fdje,j/fdke,j0fdle,j1fgdme e%j2fdmefee%fgedQee%j)dWfe3dWgee%j4dWfgdneeeefdoe%jfee%jfdpeeeefe3dWgdqeeejdWfdoe%jfdre%j&j'dWfee%jfe3dWgdsej5fdtej5fged0edFgduej5fgeejeejeejeejdvejdWfdwej5fedxgdyejdWfdzej5fed{gdvejdWfdwej5fed|gdyejdWfdzej5fed}gd~ejdWfedxdejfgdejdWfed{dejfgd~ejdWfed|dejfgdejdWfed}dejfgdZ6dd Z7dS )r   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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[\'"\\]z%|(\{{1,2}))r   Interpol)ttype r(   ^/home/kop/projects/devel/pgwui/test_venv/lib/python3.7/site-packages/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\{zexpr-inside-fstringz[^\\\'"{}\n]+z[\'"\\])r   r&   )r'   r(   r(   r)   fstring_rulesW   s    
zPythonLexer.fstring_rulesz\nz&^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")z&^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')z\A#!.+$z#.*$z\\\nz\\keywordsz(def)((?:\s|\\\s)+)funcnamez(class)((?:\s|\\\s)+)	classnamez(from)((?:\s|\\\s)+)
fromimportz(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([uUbB]?)(""")stringescapez([uUbB]?)(''')z([uUbB]?)(")z([uUbB]?)(')z[^\S\n]+numbersz!=|==|<<|>>|:=|[-~+/*%=<>&^|.]z[]{}:(),;[]z(in|is|and|or|not)\bzexpr-keywordsbuiltins
magicfuncs	magicvarsnamez[{([]zexpr-inside-fstring-innerz(=\s*)?(\![sraf])?\}z#popz(=\s*)?(\![sraf])?:z\s+z[])}])z	async forawaitelseforiflambdayieldz
yield fromz\b)suffix)TrueFalseNone)assertasyncrB   breakcontinuedelelifrC   exceptfinallyrD   globalrE   rF   passraisenonlocalreturntrywhilerG   z
yield from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zipz(?<!\.))prefixrH   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)*@z(\s+)(as)(\s+)z\.z(\s*)(,)(\s*)z(\s+)(import)\bzNone\bz\{\{z\}\}zY\\([\\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})"z\\\\|\\"|\\\nzfstrings-double'z\\\\|\\'|\\\nzfstrings-singlezstrings-doublezstrings-singlez"""z''')rootr1   zexpr-inside-fstringzexpr-inside-fstring-innerzexpr-keywordsr,   r>   r?   r@   r=   rA   r-   r.   r0   r/   r2   r7   r<   zfstrings-singlezfstrings-doublezstrings-singlezstrings-doubler5   r6   r:   r;   r3   r4   r8   r9   c             C   s   t | dpd| d d kS )Nzpythonw?(3(\.\d)?)?zimport i  )r   )textr(   r(   r)   analyse_text|  s    
zPythonLexer.analyse_textN)8rN  rL  rP  rG  rA   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tokensrY  r(   r(   r(   r)   r      sl  	











	
















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 )NzG%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]z[^\\\'"%\n]+z[\'"\\]%)r   r&   )r'   r(   r(   r)   r*     s
    zPython2Lexer.innerstring_rulesz\nz&^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")z&^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')z[^\S\n]+z\A#!.+$z#.*$z[]{}:(),;[]z\\\nz\\z(in|is|and|or|not)\bz!=|==|<<|>>|[-~+/*%=<>&^|.]r,   z(def)((?:\s|\\\s)+)r-   z(class)((?:\s|\\\s)+)r.   z(from)((?:\s|\\\s)+)r/   z(import)((?:\s|\\\s)+)r0   r>   r?   r@   backtickz!([rR]|[uUbB][rR]|[rR][uUbB])(""")r8   z!([rR]|[uUbB][rR]|[rR][uUbB])(''')r9   z([rR]|[uUbB][rR]|[rR][uUbB])(")r:   z([rR]|[uUbB][rR]|[rR][uUbB])(')r;   z([uUbB]?)(""")r<   z([uUbB]?)(''')z([uUbB]?)(")z([uUbB]?)(')rA   r=   )rL   rN   rO   rP   rQ   rC   rR   execrS   rD   rT   rE   rF   rU   r   rV   rX   rY   rZ   rG   z
yield fromr[   r\   z\b)rH   )Nr]   r^   r_   r`   apply
basestringra   rb   bufferrc   rd   callablere   rf   cmpcoercerg   rh   ri   rj   rk   rl   rm   rn   execfileexitfilero   rp   rr   rs   rt   ru   rv   rw   rx   ry   rz   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   z(?<!\.))r   rH   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  r  r  r  Z__long__r  r  r  r  r  r  r  r   __nonzero__Z__oct__Z__op__r"  r#  r$  r&  r'  Z__rcmp__Z__rdiv__r(  r)  r*  r+  r,  r.  r/  Z__rop__r0  r2  r3  r4  r5  r6  r7  r8  r9  r:  Z__setslice__r;  r<  r=  r>  __unicode__r?  )rA  rB  rC  rD  rE  rF  rG  rH  rI  rJ  __metaclass__rL  rM  rN  rQ  rR  rS  z'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?z\d+[eE][+-]?[0-9]+j?z	0[0-7]+j?z
0[bB][01]+z0[xX][a-fA-F0-9]+z\d+Lz\d+j?z`.*?`z@[\w.]+z[a-zA-Z_]\w*z#popz(?:[ \t]|\\\n)+zas\b,z[a-zA-Z_][\w.]*zimport\bzNone\bz[a-zA-Z_.][\w.]*zY\\([\\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})rU  z\\\\|\\"|\\\nzstrings-doublerV  z\\\\|\\'|\\\nzstrings-singlez"""z''')rW  r,   r>   r?   r@   r=   rx  rA   r-   r.   r0   r/   r<   zstrings-singlezstrings-doubler:   r;   r8   r9   c             C   s
   t | dS )Nzpythonw?2(\.\d)?)r   )rX  r(   r(   r)   rY  ]  s    zPython2Lexer.analyse_textN)/rN  rL  rP  rG  rA   rZ  r[  r\  r*   r   r   r   rb  rc  r   rd  re  r   r   rh  r   r   rf  rg  r	   r   r   ri  rj  r   rk  rl  rm  r   rn  ro  rp  rq  rr  LongBacktickrs  r   rt  ru  rv  rY  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}xt|D ]v}	|	 }
|
	ds||
	drd}|
t|dtj|
d d fgf ||
dd  7 }qZ|
 dkr|s|
t|dtjdfgf ||
dd  7 }qZ|rt|||E d H  d}g }|
	ds2td	|
rDd
}|
}|	 }qZ|
dkrb|	 tj|
fV  qZ|r||
7 }|
	ds|
 dksd}x*||D ]\}}}|| ||fV  qW d}qZ|	 tj|
fV  qZW |rt|||E d H  |r$x*||D ]\}}}|| ||fV  qW 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   rt  stripZOutput)r  rX  ZpylexerZtblexerZcurcodeZ
insertionsZcurtbZtbindextbr  lineitvr(   r(   r)   r    s^    



z)PythonConsoleLexer.get_tokens_unprocessedN)	rN  rL  rP  rG  rA   rZ  r\  r
  r  r(   r(   r(   r)   r   a  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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-tracebackz\nz'^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\nz^(?=  File "[^"]+", line \d+)z^.*\nz0^(  File )("[^"]+")(, line )(\d+)(, in )(.+)(\n)z%^(  File )("[^"]+")(, line )(\d+)(\n)z^(    )(.+)(\n)z^([ \t]*)(\.\.\.)(\n)z^([^:]+)(: )(.+)(\n)z#popz^([a-zA-Z_][\w.]*)(:?\n))rW  r  N)rN  rL  rP  rG  rA   rZ  r[  r\  r   r   	Tracebackr   r   r   ri  r   r   r   r   r   rv  r(   r(   r(   r)   r     s2   	

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  z^(?=  File "[^"]+", line \d+)z^.*\nz0^(  File )("[^"]+")(, line )(\d+)(, in )(.+)(\n)z%^(  File )("[^"]+")(, line )(\d+)(\n)z^(    )(.+)(\n)z^([ \t]*)(\.\.\.)(\n)z^([^:]+)(: )(.+)(\n)z#popz^([a-zA-Z_]\w*)(:?\n))rW  r  N)rN  rL  rP  rG  rA   rZ  r[  r\  r   r   r   r  r   r   ri  r   r   r   r   r   rv  r(   r(   r(   r)   r     s*   	
c            !   @   sL  e 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d/e
ed.d(fd0e
ed.d*fd1e
ed.d,fed2ed3ged4d5d6efd7ejfged8d9d5d:ejfd;ejjfed<d9d5d:ejfg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dDej"dEfgdFej#fdGefdHe	ej"edEfdIe	ej"eefdJedEfdKefdLedEfdMedEfdDejfdNefg
dDej$dEfgdOe	eeefdPej%fdQe	eeefe&dEgdRe	eedEfdSej%fe&dEgdTe
j'fgdUe
j(fdVe
fdWe
fdXe
fgde
fgdYe
dEfdZe
j'fed[gd\e
dEfd]e
j'fed[gd^e
dEfed[ed_gd`e
dEfed[ed_gdaZ)dbS )cr   z]
    For Pyrex and `Cython <http://cython.org>`_ source code.

    .. versionadded:: 1.1
    ZCythonZcythonZpyxZpyrexz*.pyxz*.pxdz*.pxiztext/x-cythonzapplication/x-cythonz\nz^(\s*)("""(?:.|\n)*?""")z^(\s*)('''(?:.|\n)*?''')z[^\S\n]+z#.*$z[]{}:(),;[]z\\\nz\\z(in|is|and|or|not)\bz(<)([a-zA-Z0-9.?]+)(>)z!=|==|<<|>>|[-~+/*%=<>&^|.?]z(from)(\d+)(<=)(\s+)(<)(\d+)(:)r,   z(def|property)(\s+)r-   z(cp?def)(\s+)cdefz	(cdef)(:)z(class|struct)(\s+)r.   z(from)(\s+)r/   z(c?import)(\s+)r0   r>   rx  z(?:[rR]|[uU][rR]|[rR][uU])"""r8   z(?:[rR]|[uU][rR]|[rR][uU])'''r9   z(?:[rR]|[uU][rR]|[rR][uU])"r:   z(?:[rR]|[uU][rR]|[rR][uU])'r;   z[uU]?"""r<   z[uU]?'''z[uU]?"z[uU]?'rA   r=   )rL   rM   rB   rN   ZbyrO   ZctypedefrP   rQ   rC   rR   zexcept?ry  rS   rD   ZfusedZgilrT   rE   r   rF   ZnogilrU   r   rV   rX   rY   rZ   rG   r[   r\   z\b)rH   z(DEF|IF|ELIF|ELSE)\b)Qr]   r^   r_   r`   rz  r{  ra   Zbintrb   r|  rc   rd   r}  re   rf   r~  r  rg   rh   ri   rj   rk   rl   rm   rn   r  r  r  ro   rp   rr   rs   rt   ru   rv   rw   rx   ry   rz   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   z(?<!\.))r   rH   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+z0[xX][a-fA-F0-9]+z\d+Lz\d+z`.*?`z@\w+z[a-zA-Z_]\w*z#popz%(public|readonly|extern|api|inline)\bz(struct|enum|union|class)\bz([a-zA-Z_]\w*)(\s*)(?=[(:#=]|$)z([a-zA-Z_]\w*)(\s*)(,)zfrom\bzas\b:z	(?=["\']).z(\s+)(as)(\s+)z[a-zA-Z_][\w.]*z(\s*)(,)(\s*)z(\s+)(c?import)\bz[a-zA-Z_.][\w.]*zY\\([\\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})zP%(\([a-zA-Z0-9]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]z[^\\\'"%\n]+z[\'"\\]rw  rU  z\\\\|\\"|\\\nstringsrV  z\\\\|\\'|\\\nz"""nlz''')rW  r,   r>   r=   rx  rA   r-   r  r.   r0   r/   r<   r  r  r:   r;   r8   r9   N)*rN  rL  rP  rG  rA   rZ  r[  r\  r   r   r   rc  r   r   r   rh  r   Typer   rr  r   r   r	   r   ZPreprocri  rj  r   rn  ro  rq  r  r  rs  rk  Reservedrt  rf  r   ru  r&   rv  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 <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-dgz\s+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?)'''r<   r9   stringz(?i)(br|r?b?)"""r8   z(?i)(br|r?b?)'r;   z(?i)(br|r?b?)"r:   z`\w+'*`z\b(and|in|is|or|where)\bz[!$%&*+\-./:<-@\\^|~;,]+)rb   rc   rd   rf   rh   rj   zdict'rp   rr   rz   r   zlist'r   r   r   r   r   zset'r   r   r   r   r   ztuple'r   z(?<!\.)z
(?![\'\w]))r   rH   )=r]   r^   r_   r`   ra   bindre   r~  rg   rh   ri   rk   rl   Zdrop	dropwhilerm   rn   Zexhaustro   Zflipzfoldl1?rq   Zfstrs   rt   ru   rv   headrw   rx   initry   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  zY\\([\\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})zG%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]z[^\\\'"%\n]+z[\'"\\]rw  z\nrU  z#poprV  z"""z''')rW  r<   r  r:   r;   r8   r9   N)"rN  rL  rP  rG  rA   rZ  r[  r\  r   r   re  r   rp  ro  rq  rn  rr  r   r	   r   rh  r   r   ri  rj  r   r   r  r  r   r   ru  r&   rv  r(   r(   r(   r)   r     sj   


c              @   sR  e 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.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hZdd Z	dd Z
dS (  r    z[
    A Python lexer recognizing Numerical Python builtins.

    .. versionadded:: 0.10
    ZNumPy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_boundsrd   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   sN   xHt | |D ]8\}}}|tkr:|| jkr:|tj|fV  q|||fV  qW d S )N)r   r  r   EXTRA_KEYWORDSr   rj  )r  rX  indextokenvaluer(   r(   r)   r  z  s
    z!NumPyLexer.get_tokens_unprocessedc             C   s.   | d d }t | dsd|ko,d|kp,d|kS )Ni  zpythonw?(3(\.\d)?)?zimport zimport numpyzfrom numpy import)r   )rX  Zltextr(   r(   r)   rY    s    
zNumPyLexer.analyse_textN)rN  rL  rP  rG  rA   rZ  r\  r[  r'  r  rY  r(   r(   r(   r)   r    )  s   












 ")+rG  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   ra  __all__rg   r  r   ZPython3Lexerr   r   r   ZPython3TracebackLexerr   r   r   r    r(   r(   r(   r)   <module>	   s.   ,4

  h ^X,+ 4c