o
    ‡ÎÖa±>  ã                   @   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-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Ú
WhitespaceÚ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 d eeeeƒejeeƒ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d0ej!feefge"d1d2d3d4�e#j$fe"d5d3d6�e#j%fgd7ee#eƒd8fe"d9d3d6�e#fe"d:d3d6�e#j$fd;e#j$fe"d<d2d3d4�e#j$fged=ƒedƒd>e	 d? e	 d@ eeeƒej&eeƒeeƒeƒdAfd>e	 d? e	 dB eeeƒej&eeƒeeƒeƒfedƒ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d>e dO e dP eeeƒe
jeeƒe
j)e
jƒfd>e 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+h d]£Z,h d^£Z-h d_£Z.h d`£Z/dadb„ Z0dcdd„ Z1deS )fÚCFamilyLexerzg
    For C family source code.  This is used as a base class to avoid repetitious
    definitions.
    z\s*(?:/[*].*?[*]/\s*)?z[0-9a-fA-F](\'?[0-9a-fA-F])*z
\d(\'?\d)*z!(([uU][lL]{0,2})|[lL]{1,2}[uU]?)?z4(?!\d)(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8})+z7(?!\d)(?:[\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@(^[ \t]*)(?!(?:public|private|protected|default)\b)(case\b\s+)?(z)(\s*)(:)(?!:)z\nz[^\S\n]+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)Úint8Úint16Úint32Úint64Úwchar_tÚ__ú\b©ÚprefixÚsuffix)
ÚboolÚintÚlongÚfloatÚshortÚdoubleÚcharÚunsignedÚsignedÚvoid©r&   z(struct|union)(\s+)Ú	classname)ÚasmÚautoÚbreakÚcaseÚconstÚcontinuer   ÚdoÚelseÚenumÚexternÚforÚgotoÚifÚregisterÚ
restrictedÚreturnÚsizeofÚstructÚstaticÚswitchÚtypedefÚvolatileÚwhileÚunionÚthread_localÚalignasÚalignofÚstatic_assertÚ_Pragma)ÚinlineÚ_inlineÚ__inlineÚnakedÚrestrictÚthreadz(__m(128i|128d|128|64))\b)r3   ÚbasedÚexceptÚstdcallÚcdeclÚfastcallÚdeclspecÚfinallyÚtryÚleaveÚw64Ú	unalignedÚraiseÚnoopÚ
identifierÚforceinlineÚassumeÚ
whitespaceú(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*(?=>))rf   rj   r   r   Úrootri   rh   r   r   r   r2   >   ÚDIRÚFILEÚdiv_tÚoff_tÚfpos_tÚldiv_tÚsize_tÚtime_tÚwint_tÚclock_tÚjmp_bufÚssize_tÚva_listr!   Úwctype_tÚ	mbstate_tÚ	ptrdiff_tÚ	wctrans_tÚsig_atomic_t>   Úint8_tÚint16_tÚint32_tÚint64_tÚuint8_tÚintmax_tÚintptr_tÚuint16_tÚuint32_tÚuint64_tÚ	uintmax_tÚ	uintptr_tÚint_fast8_tÚint_fast16_tÚint_fast32_tÚint_fast64_tÚint_least8_tÚuint_fast8_tÚint_least16_tÚint_least32_tÚint_least64_tÚuint_fast16_tÚuint_fast32_tÚuint_fast64_tÚuint_least8_tÚuint_least16_tÚuint_least32_tÚuint_least64_t>   Úid_tÚdev_tÚgid_tÚino_tÚkey_tÚpid_tÚsig_tÚuid_tÚmode_tÚnfds_tÚrlim_tÚtimer_tÚsigset_tÚsigval_tÚ	clockid_tÚ	cpu_set_tÚ	cpumask_tÚ	siginfo_tÚ	socklen_tÚsighandler_t>%   Ú
atomic_intÚatomic_boolÚatomic_charÚatomic_longÚatomic_uintÚatomic_llongÚatomic_scharÚatomic_shortÚatomic_ucharÚatomic_ulongÚatomic_size_tÚatomic_ullongÚatomic_ushortÚatomic_wchar_tÚatomic_char16_tÚatomic_char32_tÚatomic_intmax_tÚatomic_intptr_tÚatomic_ptrdiff_tÚatomic_uintmax_tÚatomic_uintptr_tÚatomic_int_fast8_tÚatomic_int_fast16_tÚatomic_int_fast32_tÚatomic_int_fast64_tÚatomic_int_least8_tÚatomic_uint_fast8_tÚatomic_int_least16_tÚatomic_int_least32_tÚatomic_int_least64_tÚatomic_uint_fast16_tÚatomic_uint_fast32_tÚatomic_uint_fast64_tÚatomic_uint_least8_tÚatomic_uint_least16_tÚatomic_uint_least32_tÚatomic_uint_least64_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
   rØ   rÙ   rÚ   rÛ   r   Ú__init__)ÚselfÚoptions© rß   ú7/usr/lib/python3/dist-packages/pygments/lexers/c_cpp.pyrÜ   Ï   s
   zCFamilyLexer.__init__c                 c   s�   � t  | |¡D ]>\}}}|tu r?| jr|| jv rtj}n#| jr(|| jv r(tj}n| j	r4|| j
v r4tj}n| jr?|| jv r?tj}|||fV  qd S )N)r   Úget_tokens_unprocessedr   rØ   Ústdlib_typesr   ÚTyperÙ   Ú	c99_typesrÚ   Úc11_atomic_typesrÛ   Úlinux_types)rÝ   ÚtextÚindexÚtokenÚvaluerß   rß   rà   rá   Ö   s   €
ÿõz#CFamilyLexer.get_tokens_unprocessedN)2Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú_ws1Ú_hexpartÚ_decpartÚ
_intsuffixÚ_identÚ_namespaced_identr   ÚPreprocr   r   r   r   r   ÚLabelr   r   ÚSingleÚ	Multiliner   r   ÚAffixÚCharr   ÚFloatÚHexÚBinÚOctÚIntegerr   ÚBuiltinr	   r   ÚReservedrã   ÚFunctionr   ÚEscapeÚPreprocFileÚClassÚtokensrâ   rä   ræ   rå   rÜ   rá   rß   rß   rß   rà   r      s$   


ÿ
ÿ
ÿïÿ00(íÿÿÿÿýûûÿÿûûó
ÿÿÿú
ÿÿÿüíüûÿú	ÿÿ

ö


ü
ü� r   c                   @   sb   e Zd ZdZdZdgZg d¢Zg d¢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Úc)z*.cz*.hz*.idcz*.x[bp]m)ztext/x-chdrztext/x-csrczimage/x-xbitmapzimage/x-xpixmapçš™™™™™¹?)
Ú_AlignasÚ_AlignofÚ	_NoreturnÚ_GenericÚ_Thread_localÚ_Static_assertÚ
_ImaginaryÚnoreturnÚ	imaginaryÚcomplexr#   r1   )Ú_BoolÚ_ComplexÚ_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 [<"]r	  z^\s*#ifn?def )ÚreÚsearchÚ	MULTILINE©rç   rß   rß   rà   Úanalyse_text  s
   ÿzCLexer.analyse_textN)rë   rì   rí   rî   ÚnameÚaliasesÚ	filenamesÚ	mimetypesÚpriorityr	   r   r   rã   r  r  rß   rß   rß   rà   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
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++srcr	  z<((?:[LuU]|u8)?R)(")([^\\()\s]{,16})(\()((?:.|\n)*?)(\)\3)("))Úvirtual_inheritanceÚuuidofÚsuperÚsingle_inheritanceÚmultiple_inheritanceÚ	interfaceÚeventr"   r#   r$   z#__(offload|blockingoffload|outer)\brf   )ÚclassrD   r1   rk   ro   z(class|concept|typename)(\s+)r2   ))ÚcatchÚ
const_castÚdeleteÚdynamic_castÚexplicitÚexportÚfriendÚmutableÚnewÚoperatorÚprivateÚ	protectedÚpublicÚreinterpret_castr)  rT   Ústatic_castÚtemplater   ÚthrowÚthrowsr]   Útypeidr   ÚvirtualÚ	constexprÚnullptrÚconceptÚdecltypeÚnoexceptÚoverrideÚfinalÚ	constinitÚ	constevalÚco_awaitÚ	co_returnÚco_yieldÚrequiresÚimportÚmoduleÚtypenameznamespace\bÚ	namespacez(enum)(\s+)Úenumnamezchar(16_t|32_t|8_t)\bz[;{])rk   rp   zinline\bri   )rj   rp   rO  r   r   rN  c                 C   s$   t  d| ¡rdS t  d| ¡rdS d S )Nz#include <[a-z_]+>gš™™™™™É?zusing namespace gš™™™™™Ù?)r  r  r  rß   rß   rà   r  l  s
   ÿzCppLexer.analyse_textN)rë   rì   rí   rî   r  r  r  r  r   r   r   rù   Ú	Delimiterr   r	   r   r  ÚPseudor   r   ró   r   r  r   r   r   rã   r   Ú	Namespacer  r  rß   rß   rß   rà   r     s`    ÿÿûþþù
ù
	÷	÷
òþ
üÒ6)rî   r  Úpygments.lexerr   r   r   r   r   r   r   r	   Úpygments.utilr
   Úpygments.tokenr   r   r   r   r   r   r   r   r   Ú__all__r   r   r   rß   rß   rß   rà   Ú<module>   s    
(, P2