B
    ë¹`S>  ã               @   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 ddlmZmZmZmZmZmZmZmZ ddgZG dd	„ d	eƒZG d
d„ deƒZG dd„ deƒZdS )zÊ
    pygments.lexers.c_cpp
    ~~~~~~~~~~~~~~~~~~~~~

    Lexers for C/C++ languages.

    :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
é    N)Ú
RegexLexerÚincludeÚbygroupsÚusingÚthisÚinheritÚdefaultÚwords)Úget_bool_opt)ÚTextÚCommentÚOperatorÚKeywordÚNameÚStringÚNumberÚPunctuationÚCLexerÚCppLexerc            %   @   sÞ  e Zd ZdZdZdZdZdZdZdZ	dZ
d	ejd
fdejdfde d eeeƒejƒd
fde d eeeƒ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g
edƒedƒdeejeƒdfdeejejejejƒfde d e d e d e d e d  ejfd!e d e d e d e d" e d# ejfd$e d% e d& e d' e d( ejfd)e e ejfd*e ejfd+e ejfd,e e ejfd-efd.efd/ej fd0e	 d1 eej!eeƒfe	efge"d2d3d4d5e#j$fe"d6d4d7e#j%fgd8ee#eƒd9fe"d:d4d7e#fe"d;d4d7e#j$fd<e#j$fe"d=d3d4d5e#j$fged>ƒedƒd0e
 d? e
 d@ eeeƒej&eeƒeeƒeƒdAfd0e
 d? e
 dB eeeƒej&eeƒeeƒeƒfe'dCƒged>ƒedDƒdEefdFedGfged>ƒedDƒdHefdIedJfdEedGfgdKedGfdLej(fdMefdefdNefgd0e dO e dP eeeƒejeeƒej)ejƒfd0e dO e dQ eeeƒejeeƒej)ejƒfdRejfdSejfdTejdGfdUejfdVejfdejdGfgdWejdJfdXejdGfdYejdGfdZefge	ej*dGfd[edGfe'dGƒgd\œZ+d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndohZ,dpdqdrdsdtdudvdwdxdydzd{d|d}d~dd€dd‚dƒd„d…d†d‡dˆd‰dŠd‹hZ-dŒddŽddd‘d’d“d”d•d–d—d˜d™dšd›dœddždŸh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Äh%Z/dÅdÆ„ Z0dÇdÈ„ Z1dÉS )ÊÚCFamilyLexerzg
    For C family source code.  This is used as a base class to avoid repetitious
    definitions.
    z(?:\s|//.*?\n|/[*].*?[*]/)+z\s*(?:/[*].*?[*]/\s*)?z[0-9a-fA-F](\'?[0-9a-fA-F])*z
\d(\'?\d)*z!(([uU][lL]{0,2})|[lL]{1,2}[uU]?)?z`(?:[a-zA-Z_$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8})(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8})*zc(?:[a-zA-Z_$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8})(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|::)*z^#if\s+0Úif0z^#Úmacroz^(z
)(#if\s+0)z)(#)z\nz\s+z\\\nz//(\n|[\w\W]*?[^\\]\n)z/(\\\n)?[*][\w\W]*?[*](\\\n)?/z/(\\\n)?[*][\w\W]*ÚkeywordsÚtypesz([LuU]|u8)?(")ÚstringzA([LuU]|u8)?(')(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])(')z0[xX](z\.z|\.ú|z
)[pP][+-]?z[lL]?z(-)?(z
)[eE][+-]?z[fFlL]?z(-)?((z\.(z)?|\.z)[fFlL]?)|(z[fFlL])z	(-)?0[xX]z(-)?0[bB][01](\'?[01])*z(-)?0(\'?[0-7])+z(-)?z[~!%^&*+=|?:<>/-]z
[()\[\],.]z(true|false|NULL)\bú(z)(\s*)(:)(?!:))Zint8Úint16Úint32Úint64Úwchar_tÚ__z\b)ÚprefixÚsuffix)
ÚboolÚintÚlongÚfloatÚshortÚdoubleÚcharZunsignedÚsignedÚvoid)r#   z(struct|union)(\s+)Ú	classname)ÚasmÚautoÚbreakZcaseÚconstÚcontinuer   ÚdoÚelseÚenumZexternÚforÚgotoÚifÚregisterZ
restrictedÚreturnÚsizeofÚstructZstaticÚswitchZtypedefZvolatileÚwhileÚunionZthread_localZalignasZalignofZstatic_assertZ_Pragma)ÚinlineZ_inlineZ__inlineZnakedÚrestrictÚthreadz(__m(128i|128d|128|64))\b)r.   ZbasedÚexceptZstdcallZcdeclZfastcallZdeclspecÚfinallyÚtryZleaveZw64Z	unalignedÚraiseZnoopÚ
identifierZforceinlineZassumeÚ
whitespacez(?:[&*\s])+)(z)(\s*\([^;]*?\))([^;{]*)(\{)Úfunctionz)(\s*\([^;]*?\))([^;]*)(;)Ú	statementÚ
statementsz\}z[{;]z#popú;z\{z#pushú"zO\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})z	[^\\"\n]+z\\z)(include)(z)("[^"]+")([^\n]*)z)(<[^>]+>)([^\n]*)z[^/\n]+z/[*](.|\n)*?[*]/z//.*?\nú/z	(?<=\\)\nz^\s*#if.*?(?<!\\)\nz^\s*#el(?:se|if).*\nz^\s*#endif.*?(?<!\\)\nz.*?\nz\s*(?=>))rH   rK   r   r   ÚrootrJ   rI   r   r   r   r-   Zsize_tZssize_tZoff_tr    Z	ptrdiff_tZsig_atomic_tZfpos_tZclock_tZtime_tZva_listZjmp_bufÚFILEZDIRZdiv_tZldiv_tZ	mbstate_tZ	wctrans_tZwint_tZwctype_tZint8_tZint16_tZint32_tZint64_tZuint8_tZuint16_tZuint32_tZuint64_tZint_least8_tZint_least16_tZint_least32_tZint_least64_tZuint_least8_tZuint_least16_tZuint_least32_tZuint_least64_tZint_fast8_tZint_fast16_tZint_fast32_tZint_fast64_tZuint_fast8_tZuint_fast16_tZuint_fast32_tZuint_fast64_tZintptr_tZ	uintptr_tZintmax_tZ	uintmax_tZ	clockid_tZ	cpu_set_tZ	cpumask_tZdev_tZgid_tZid_tZino_tZkey_tZmode_tZnfds_tZpid_tZrlim_tZsig_tZsighandler_tZ	siginfo_tZsigset_tZsigval_tZ	socklen_tZtimer_tZuid_tZatomic_boolZatomic_charZatomic_scharZatomic_ucharZatomic_shortZatomic_ushortZ
atomic_intZatomic_uintZatomic_longZatomic_ulongZatomic_llongZatomic_ullongZatomic_char16_tZatomic_char32_tZatomic_wchar_tZatomic_int_least8_tZatomic_uint_least8_tZatomic_int_least16_tZatomic_uint_least16_tZatomic_int_least32_tZatomic_uint_least32_tZatomic_int_least64_tZatomic_uint_least64_tZatomic_int_fast8_tZatomic_uint_fast8_tZatomic_int_fast16_tZatomic_uint_fast16_tZatomic_int_fast32_tZatomic_uint_fast32_tZatomic_int_fast64_tZatomic_uint_fast64_tZatomic_intptr_tZatomic_uintptr_tZatomic_size_tZatomic_ptrdiff_tZatomic_intmax_tZatomic_uintmax_tc             K   sJ   t |ddƒ| _t |ddƒ| _t |ddƒ| _t |ddƒ| _tj| f|Ž d S )NÚstdlibhighlightingTÚc99highlightingÚc11highlightingÚplatformhighlighting)r
   rQ   rR   rS   rT   r   Ú__init__)ÚselfÚoptions© rX   ú]/home/kop/projects/devel/pgwui/test_venv/lib/python3.7/site-packages/pygments/lexers/c_cpp.pyrU   Ð   s
    zCFamilyLexer.__init__c             c   s’   xŒt  | |¡D ]|\}}}|tkr~| jr8|| jkr8tj}nF| jrP|| jkrPtj}n.| j	rh|| j
krhtj}n| jr~|| jkr~tj}|||fV  qW d S )N)r   Úget_tokens_unprocessedr   rQ   Ústdlib_typesr   ÚTyperR   Ú	c99_typesrS   Úc11_atomic_typesrT   Úlinux_types)rV   ÚtextÚindexÚtokenÚvaluerX   rX   rY   rZ   ×   s    z#CFamilyLexer.get_tokens_unprocessedN)2Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú_wsZ_ws1Z_hexpartZ_decpartZ
_intsuffixÚ_identZ_namespaced_identr   ZPreprocr   r   r   r   ÚSingleZ	Multiliner   r   ÚAffixÚCharr   ZFloatZHexZBinÚOctZIntegerr   r   r   ZBuiltinZLabelr	   r   ÚReservedr\   ZFunctionr   ZEscapeZPreprocFileÚClassÚtokensr[   r]   r_   r^   rU   rZ   rX   rX   rX   rY   r      sè   




00(















r   c               @   sd   e Zd ZdZdZdgZdddgZddgZd	Ze	d
dde
fege	ddde
jfegdœZdd„ ZdS )r   aÍ  
    For C source code with preprocessor directives.

    Additional options accepted:

    `stdlibhighlighting`
        Highlight common types found in the C/C++ standard library (e.g. `size_t`).
        (default: ``True``).

    `c99highlighting`
        Highlight common types found in the C99 standard library (e.g. `int8_t`).
        Actually, this includes all fixed-width integer types.
        (default: ``True``).

    `c11highlighting`
        Highlight atomic types found in the C11 standard library (e.g. `atomic_bool`).
        (default: ``True``).

    `platformhighlighting`
        Highlight common types found in the platform SDK headers (e.g. `clockid_t` on Linux).
        (default: ``True``).
    ÚCÚcz*.cz*.hz*.idcztext/x-chdrztext/x-csrcgš™™™™™¹?)
Z_AlignasZ_AlignofZ	_NoreturnZ_GenericZ_Thread_localZ_Static_assertZ
_ImaginaryZnoreturnZ	imaginaryÚcomplexz\b)r#   )Z_BoolZ_ComplexZ_Atomic)r   r   c             C   s,   t  d| t j¡rdS t  d| t j¡r(dS d S )Nz^\s*#include [<"]gš™™™™™¹?z^\s*#ifn?def )ÚreÚsearchÚ	MULTILINE)r`   rX   rX   rY   Úanalyse_text  s    zCLexer.analyse_textN)rd   re   rf   rg   ÚnameÚaliasesÚ	filenamesÚ	mimetypesÚpriorityr	   r   r   r\   rp   rw   rX   rX   rX   rY   r   æ   s   


c               @   s&  e Zd ZdZdZddgZddddd	d
ddddddgZddgZdZde	e
je
e
je
je
e
je
ƒfegeeddddejfdejfgedƒedddefejejdfdedfedƒgde	eeƒd fed!ddefd"ed#fd$e	eeƒd%fegd&ejfegd'ed(fd)ejfejejfed*ƒgd+œZd,d-„ Zd.S )/r   aÏ  
    For C++ source code with preprocessor directives.

    Additional options accepted:

    `stdlibhighlighting`
        Highlight common types found in the C/C++ standard library (e.g. `size_t`).
        (default: ``True``).

    `c99highlighting`
        Highlight common types found in the C99 standard library (e.g. `int8_t`).
        Actually, this includes all fixed-width integer types.
        (default: ``True``).

    `c11highlighting`
        Highlight atomic types found in the C11 standard library (e.g. `atomic_bool`).
        (default: ``True``).

    `platformhighlighting`
        Highlight common types found in the platform SDK headers (e.g. `clockid_t` on Linux).
        (default: ``True``).
    zC++Úcppzc++z*.cppz*.hppz*.c++z*.h++z*.ccz*.hhz*.cxxz*.hxxz*.Cz*.Hz*.cpz*.CPPztext/x-c++hdrztext/x-c++srcgš™™™™™¹?z<((?:[LuU]|u8)?R)(")([^\\()\s]{,16})(\()((?:.|\n)*?)(\)\3)("))Zvirtual_inheritanceZuuidofÚsuperZsingle_inheritanceZmultiple_inheritanceZ	interfaceÚeventr!   z\b)r"   r#   z#__(offload|blockingoffload|outer)\brH   )Úclassr<   )r#   z#popz\s*(?=>)z(class|concept|typename)(\s+)r-   ))ZcatchZ
const_castÚdeleteZdynamic_castÚexplicitZexportZfriendZmutableÚnewÚoperatorÚprivateZ	protectedÚpublicZreinterpret_castr€   rA   Zstatic_castÚtemplater   ÚthrowZthrowsrE   Ztypeidr   ZvirtualZ	constexprZnullptrZconceptÚdecltypeZnoexceptÚoverrideÚfinalZ	constinitZ	constevalZco_awaitZ	co_returnZco_yieldÚrequiresÚimportÚmoduleÚtypenameznamespace\bÚ	namespacez(enum)(\s+)Úenumnamezchar(16_t|32_t|8_t)\bz[;{])z#poprO   zinline\brJ   )rK   rO   r‘   r   r   r   c             C   s$   t  d| ¡rdS t  d| ¡r dS d S )Nz#include <[a-z_]+>gš™™™™™É?zusing namespace gš™™™™™Ù?)rt   ru   )r`   rX   rX   rY   rw   m  s    zCppLexer.analyse_textN)rd   re   rf   rg   rx   ry   rz   r{   r|   r   r   rk   Z	Delimiterr   r	   r   rn   ZPseudor   r   ri   r   ro   r   r   r\   r   Ú	Namespacerp   rw   rX   rX   rX   rY   r     sF   


)rg   rt   Zpygments.lexerr   r   r   r   r   r   r   r	   Zpygments.utilr
   Zpygments.tokenr   r   r   r   r   r   r   r   Ú__all__r   r   r   rX   rX   rX   rY   Ú<module>	   s   (( Q2