a
    T_:                     @   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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-2020 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ErrorCLexerCppLexerc                   @   s  e 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
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fd-eeed.fed/d0d1efd2ej fed3d0d1ej!fd4ej!fed5d6d0d7ej!fd8e"j#fd9e	 d: ee"j$eefe	e"fge%d;d<e	 d= e	 d> eeee"j&eeeeed?fd<e	 d= e	 d@ eeee"j&eeeeefe'dAge%d;e%dBdCefdDedEfge%d;e%dBdFefdGedHfdCedEfgdIedEfdJej(fdKefdefdLefgdMe dN ee
jeee
j)e
jfdMe dO ee
jeee
j)e
jfdPe
jfdQe
jfdRe
jdEfdSe
jfdTe
jfde
jdEfgdUe
jdHfdVe
jdEfdWe
jdEfdXe
fge	e"j*dEfdYedEfe'dEgdZ	Z+h d[Z,h d\Z-h d]Z.h d^Z/d_d` Z0dadb Z1dcS )d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})*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]*z([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
[()\[\],.]z(struct|union)(\s+)	classname)asmautobreakZcaseZconstcontinuer   ZdoelseenumZexternforZgotoifregisterZ
restrictedreturnZsizeofstructZstaticZswitchZtypedefZvolatilewhileunionZthread_localZalignasZalignofZstatic_assertZ_Pragma\bsuffixz>(bool|int|long|float|short|double|char|unsigned|signed|void)\b)ZinlineZ_inlineZ__inlineZnakedrestrictthreadz(__m(128i|128d|128|64))\b)r   Zint8ZbasedexceptZint16ZstdcallZcdeclZfastcallZint32ZdeclspecfinallyZint64tryZleavewchar_tZw64Z	unalignedraiseZnoopZ
identifierZforceinlineZassume__prefixr+   z(true|false|NULL)\b(z)(\s*)(:)(?!:)
whitespacez((?:z(?:[&*\s])+))(z)(\s*\([^;]*?\))([^;{]*)(\{)functionz)(\s*\([^;]*?\))([^;]*)(;)	statement
statementsz\}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.*?\n\s*(?=>))	r7   r:   rootr9   r8   r   r   r   r   >   Zwctype_tZldiv_tZsig_atomic_tZsize_tZjmp_bufZfpos_tZdiv_tZoff_tZclock_tZ	mbstate_tZ	ptrdiff_tZtime_tZva_listr1   ZDIRZwint_tZ	wctrans_tZssize_tZFILE>   Zuint_fast32_tZintmax_tZ	uintmax_tZuint_least64_tZint64_tZuint_least16_tZuint_fast8_tZint32_tZint_least8_tZintptr_tZint_fast64_tZint_least16_tZuint_fast64_tZint_least64_tZuint8_tZuint32_tZint_fast8_tZint_fast32_tZint_least32_tZuint_fast16_tZint_fast16_tZint8_tZuint16_tZint16_tZuint_least32_tZuint_least8_tZ	uintptr_tZuint64_t>   Zkey_tZ	cpu_set_tZsigset_tZnfds_tZ	siginfo_tZdev_tZgid_tZ	socklen_tZ	cpumask_tZsigval_tZuid_tZtimer_tZrlim_tZid_tZsighandler_tZpid_tZino_tZmode_tZsig_tZ	clockid_t>%   Zatomic_longZatomic_uint_fast8_tZatomic_uintmax_tZatomic_charZatomic_uint_least16_tZatomic_intmax_tZatomic_uintptr_tZatomic_ulongZatomic_int_least16_tZatomic_llongZatomic_int_least64_tZatomic_uint_least32_tZatomic_ullongZatomic_int_fast64_tZatomic_int_least32_tZatomic_size_tZatomic_int_least8_tZatomic_char16_tZatomic_int_fast32_tZatomic_scharZatomic_int_fast16_tZatomic_wchar_tZ
atomic_intZatomic_intptr_tZatomic_int_fast8_tZatomic_uintZatomic_ushortZatomic_boolZatomic_shortZatomic_char32_tZatomic_uint_least8_tZatomic_uint_fast16_tZatomic_uint_fast32_tZatomic_ptrdiff_tZatomic_ucharZatomic_uint_least64_tZatomic_uint_fast64_tc                 K   sN   t |dd| _t |dd| _t |dd| _t |dd| _tj| fi | d S )NstdlibhighlightingTc99highlightingc11highlightingplatformhighlighting)r
   rA   rB   rC   rD   r   __init__)selfZoptions rG   7/usr/lib/python3/dist-packages/pygments/lexers/c_cpp.pyrE      s
    zCFamilyLexer.__init__c                 c   s   t | |D ]|\}}}|tu r|| jr6|| jv r6tj}nF| jrN|| jv rNtj}n.| j	rf|| j
v rftj}n| jr||| jv r|tj}|||fV  qd S )N)r   get_tokens_unprocessedr   rA   stdlib_typesr   TyperB   	c99_typesrC   c11_atomic_typesrD   linux_types)rF   textindextokenvaluerG   rG   rH   rI      s    
z#CFamilyLexer.get_tokens_unprocessedN)2__name__
__module____qualname____doc__Z_wsZ_ws1Z_hexpartZ_decpartZ
_intsuffix_identr   ZPreprocr   r   r   r   SingleZ	Multiliner   AffixZCharr   ZFloatZHexZBinZOctZIntegerr   r   r   r   r	   rK   Reservedr   ZBuiltinZLabelr   ZFunctionr   ZEscapeZPreprocFileClasstokensrJ   rL   rN   rM   rE   rI   rG   rG   rG   rH   r      s   



00(*

	""





{r   c                   @   s^   e Zd ZdZdZdgZg dZddgZdZde	d	d
de
fe	dd
de
jfegi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c)z*.cz*.hz*.idcztext/x-chdrztext/x-csrc皙?r:   )
Z_AlignasZ_AlignofZ	_NoreturnZ_GenericZ_Thread_localZ_Static_assertZ
_ImaginaryZnoreturnZ	imaginarycomplexr)   r*   )Z_BoolZ_ComplexZ_Atomicc                 C   s,   t d| t jrdS t d| t jr(dS d S )Nz^\s*#include [<"]r_   z^\s*#ifn?def )research	MULTILINErO   rG   rG   rH   analyse_text  s    zCLexer.analyse_textN)rS   rT   rU   rV   namealiases	filenames	mimetypespriorityr	   r   rK   r   r\   re   rG   rG   rG   rH   r      s"   c                   @   s   e Zd ZdZdZddgZg dZddgZdZd	e	e
ed
feddde
fde
jfde	e
edf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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++Zcppzc++)z*.cppz*.hppz*.c++z*.h++z*.ccz*.hhz*.cxxz*.hxxz*.Cz*.Hz*.cpz*.CPPztext/x-c++hdrztext/x-c++srcr_   z(class|concept|typename)(\s+)r   )*ZcatchZ
const_castdeleteZdynamic_castZexplicitZexportZfriendZmutable	namespacenewoperatorZprivateZ	protectedZpublicZreinterpret_castclassr,   Zstatic_casttemplater   throwZthrowsr0   Ztypeidr   ZvirtualZ	constexprZnullptrZconceptZdecltypeZnoexceptoverridefinalZ	constinitZ	constevalZco_awaitZ	co_returnZco_yieldZrequiresimportmoduletypenamer)   r*   zchar(16_t|32_t|8_t)\bz(enum)(\s+)enumnamez<((?:[LuU]|u8)?R)(")([^\\()\s]{,16})(\()((?:.|\n)*?)(\)\3)("))Zvirtual_inheritanceZuuidofsuperZsingle_inheritanceZmultiple_inheritanceZ	interfaceZeventr3   r4   z#__(offload|blockingoffload|outer)\br7   )ro   r&   r;   r?   )r:   r@   rw   c                 C   s$   t d| rdS t d| r dS d S )Nz#include <[a-z_]+>g?zusing namespace g?)ra   rb   rd   rG   rG   rH   re   T  s    zCppLexer.analyse_textN)rS   rT   rU   rV   rf   rg   rh   ri   rj   r   r   r   r	   rK   r   rY   Z	Delimiterr   rZ   ZPseudor   r   rW   r   r[   r   r\   re   rG   rG   rG   rH   r     sJ   		

*)rV   ra   Zpygments.lexerr   r   r   r   r   r   r   r	   Zpygments.utilr
   Zpygments.tokenr   r   r   r   r   r   r   r   r   __all__r   r   r   rG   rG   rG   rH   <module>   s   
(, F/