HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/sphinx/util/__pycache__/cfamily.cpython-310.pyc
o

�$�a�7�@s�dZddlZddlmZddlmZmZmZmZm	Z	m
Z
mZmZddl
mZddlmZddlmZddlmZe�e�ZeegefZe�d	�Ze�d
�Ze�d�Ze�d�Ze�d
�Ze�d�Z e�d�Z!e�d�Z"e�d�Z#e�d�Z$e�d�Z%deddfdd�Z&Gdd�de'�Z(Gdd�d�Z)Gdd�de)�Z*Gdd�de*�Z+Gd d!�d!e)�Z,Gd"d#�d#e*�Z-Gd$d%�d%e*�Z.Gd&d'�d'e*�Z/Gd(d)�d)e)�Z0Gd*d+�d+e'�Z1Gd,d-�d-e'�Z2Gd.d/�d/�Z3dS)0z�
    sphinx.util.cfamily
    ~~~~~~~~~~~~~~~~~~~

    Utility functions common to the C and C++ domains.

    :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N��deepcopy)�Any�Callable�List�Match�Optional�Pattern�Tuple�Union)�nodes)�TextElement)�Config)�loggingz(?u)\s+z(@[a-zA-Z0-9_])[a-zA-Z0-9_]*\ba
(?x)
    (   # This 'extends' _anon_identifier_re with the ordinary identifiers,
        # make sure they are in sync.
        (~?\b[a-zA-Z_])  # ordinary identifiers
    |   (@[a-zA-Z0-9_])  # our extension for names of anonymous entities
    )
    [a-zA-Z0-9_]*\b
z[1-9][0-9]*(\'[0-9]+)*z0[0-7]*(\'[0-7]+)*z"0[xX][0-9a-fA-F]+(\'[0-9a-fA-F]+)*z0[bB][01]+(\'[01]+)*a%(?x)
    # unsigned and/or (long) long, in any order, but at least one of them
    (
        ([uU]    ([lL]  |  (ll)  |  (LL))?)
        |
        (([lL]  |  (ll)  |  (LL))    [uU]?)
    )\b
    # the ending word boundary is important for distinguishing
    # between suffixes and UDLs in C++
a(?x)
    [+-]?(
    # decimal
      ([0-9]+(\'[0-9]+)*[eE][+-]?[0-9]+(\'[0-9]+)*)
    | (([0-9]+(\'[0-9]+)*)?\.[0-9]+(\'[0-9]+)*([eE][+-]?[0-9]+(\'[0-9]+)*)?)
    | ([0-9]+(\'[0-9]+)*\.([eE][+-]?[0-9]+(\'[0-9]+)*)?)
    # hex
    | (0[xX][0-9a-fA-F]+(\'[0-9a-fA-F]+)*[pP][+-]?[0-9a-fA-F]+(\'[0-9a-fA-F]+)*)
    | (0[xX]([0-9a-fA-F]+(\'[0-9a-fA-F]+)*)?\.
        [0-9a-fA-F]+(\'[0-9a-fA-F]+)*([pP][+-]?[0-9a-fA-F]+(\'[0-9a-fA-F]+)*)?)
    | (0[xX][0-9a-fA-F]+(\'[0-9a-fA-F]+)*\.([pP][+-]?[0-9a-fA-F]+(\'[0-9a-fA-F]+)*)?)
    )
z[fFlL]\bz�(?x)
    ((?:u8)|u|U|L)?
    '(
      (?:[^\\'])
    | (\\(
        (?:['"?\\abfnrtv])
      | (?:[0-7]{1,3})
      | (?:x[0-9a-fA-F]{2})
      | (?:u[0-9a-fA-F]{4})
      | (?:U[0-9a-fA-F]{8})
      ))
    )'
�mode�returncCs|dvr
td|��dS)N)�
lastIsName�
noneIsName�markType�markName�param�udlz!Description mode '%s' is invalid.)�	Exception)r�r�5/usr/lib/python3/dist-packages/sphinx/util/cfamily.py�verify_description_modePs�rc@�eZdZdS)�NoOldIdErrorN��__name__�
__module__�__qualname__rrrrrUsrc@s~eZdZUdedefdd�ZdZegefe	d<defdd�Z
d	edefd
d�Z
defdd
�Zdefdd�Zdefdd�ZdS)�ASTBaseBase�otherrcCsZt|�t|�ur
dSz|j��D]\}}|t||�krWdSqWdSty,YdSw)NFT)�type�__dict__�items�getattr�AttributeError)�selfr#�key�valuerrr�__eq__[s����zASTBaseBase.__eq__N�__hash__cC�t|�S�Nr�r)rrr�clonehszASTBaseBase.clone�	transformcC�tt|���r/��NotImplementedError�repr�r)r2rrr�
_stringifyk�zASTBaseBase._stringifycC�|�dd��S)NcSr.r/)�str��astrrr�<lambda>o�z%ASTBaseBase.__str__.<locals>.<lambda>�r8r0rrr�__str__n�zASTBaseBase.__str__cCr:)NcSs|��Sr/)�get_display_stringr<rrrr>rr?z0ASTBaseBase.get_display_string.<locals>.<lambda>r@r0rrrrCqrBzASTBaseBase.get_display_stringcCsd|jjS)Nz<%s>)�	__class__rr0rrr�__repr__tr9zASTBaseBase.__repr__)rr r!r�boolr,r-r�int�__annotations__r1�StringifyTransformr;r8rArCrErrrrr"Zs
r"c@seZdZdeddfdd�ZdS)�ASTAttribute�signoderNcCr3r/r4�r)rKrrr�describe_signature}r9zASTAttribute.describe_signature)rr r!r
rMrrrrrJ|srJc@sBeZdZdeddfdd�Zdedefdd�Zd	eddfd
d�ZdS)�ASTCPPAttribute�argrNcC�
||_dSr/�rO)r)rOrrr�__init__��
zASTCPPAttribute.__init__r2cCsd|jdS)Nz[[z]]rQr7rrrr8�rBzASTCPPAttribute._stringifyrKcC�t|�}|�t�||��dSr/�r;�appendr�Text�r)rK�txtrrrrM��z"ASTCPPAttribute.describe_signature)	rr r!r;rRrIr8r
rMrrrrrN�srNc@s8eZdZdededddfdd�Zdedefd	d
�ZdS)�ASTGnuAttribute�name�args�ASTBaseParenExprListrNcC�||_||_dSr/)r\r])r)r\r]rrrrR��
zASTGnuAttribute.__init__r2cCs(|jg}|jr|�||j��d�|�S)N�)r\r]rV�join)r)r2�resrrrr8�s
zASTGnuAttribute._stringify)rr r!r;rrRrIr8rrrrr[�sr[c@sFeZdZdeeddfdd�Zdedefdd�Zd	e	ddfd
d�Z
dS)�ASTGnuAttributeList�attrsrNcCrPr/)re)r)rerrrrR�rSzASTGnuAttributeList.__init__r2cCsJdg}d}|jD]}|s|�d�d}|�||��q|�d�d�|�S)Nz__attribute__((Tz, Fz))ra)rerVrb)r)r2rc�first�attrrrrr8�s



zASTGnuAttributeList._stringifyrKcCrTr/rUrXrrrrM�rZz&ASTGnuAttributeList.describe_signature)rr r!rr[rRrIr;r8r
rMrrrrrd�srdc@sFeZdZdZdeddfdd�Zdedefdd	�Zd
eddfdd�Z	dS)
�ASTIdAttributez*For simple attributes defined by the user.�idrNcCrPr/�ri)r)rirrrrR�rSzASTIdAttribute.__init__r2cCs|jSr/rjr7rrrr8�szASTIdAttribute._stringifyrKcCs|�t�|j|j��dSr/)rVrrWrirLrrrrM��z!ASTIdAttribute.describe_signature�
rr r!�__doc__r;rRrIr8r
rMrrrrrh�s
rhc@sJeZdZdZdededdfdd�Zdedefd	d
�Zdeddfdd
�Z	dS)�ASTParenAttributez)For paren attributes defined by the user.rirOrNcCr_r/�rirO)r)rirOrrrrR�r`zASTParenAttribute.__init__r2cCs|jd|jdS)N�(�)ror7rrrr8��zASTParenAttribute._stringifyrKcCrTr/rUrXrrrrM�rZz$ASTParenAttribute.describe_signaturerlrrrrrn�s
rnc@r)r^Nrrrrrr^��r^c@r)�$UnsupportedMultiCharacterCharLiteralNrrrrrrt�rsrtc@r)�DefinitionErrorNrrrrrru�rsruc@s�eZdZdedeejeeefefddddfdd�Z	d	e
ed
edefdd�Z
edefd
d��Zdeddfdd�Zdeddfdd�Zdeddfdd�Zdedefdd�Zdedefdd�Zdedefdd�Zdefdd �Zdedefd!d"�Zdedefd#d$�Zedefd%d&��Zedefd'd(��Zedefd)d*��Zdefd+d,�Zd-d.�d/eddfd0d1�Zed2d3��Z ed4d5��Z!d6e
edefd7d8�Z"de#e$fd9d:�Z%de&fd;d<�Z'dS)=�
BaseParser�
definition�location�configrrNcCsD|��|_||_||_d|_t|j�|_d|_d|_g|_	d|_
dS)Nr)rNT)�striprwrxry�pos�len�end�
last_match�_previous_state�otherErrors�allowFallbackExpressionParsing)r)rwrxryrrrrR�s

zBaseParser.__init__�errors�headercCs�t|�dkr$t|�dkrt|dt|dd��Stt|dd��S|dg}|D]D}t|d�dkred}|�|d�|�d�t|d��d�D]}t|�dkrTqK|�|�|�|�|�d�qKq*|�t|d��q*td�|��S)N�r�
z  z:
ra)r|rur;rV�splitrb)r)r�r��result�e�indent�linerrr�_make_multi_error�s&


�zBaseParser._make_multi_errorcC�t�r/�r5r0rrr�language�zBaseParser.language�msgcCs&d|jd}td||j|f�dS)N�-�^z%s
%s
%s)r{�printrw)r)r��	indicatorrrr�statusszBaseParser.statuscCshg}d|jd}td|j||j|j|f�}|�|df�|jD]	}|�|df�q!g|_|�|d��)Nr�r�z2Invalid %s declaration: %s [error at %d]
  %s
  %sz
Main errorzPotential other errorra)r{rur�rwrVr�r�)r)r�r�r��exMain�errrrr�fail	s��
zBaseParser.failcCstj||jd�dS)N)rx)�logger�warningrx)r)r�rrr�warnrrzBaseParser.warn�regexcCs>|�|j|j�}|dur|j|jf|_|��|_||_dSdS�NTF)�matchrwr{r~rr})r)r�r�rrrr�s
zBaseParser.match�stringcCs8t|�}|j|j|j|�|kr|j|7_dSdSr�)r|rwr{)r)r��strlenrrr�skip_string!s
zBaseParser.skip_string�wordcCs|�t�dt�|���S)Nz\b%s\b)r��re�compile�escape�r)r�rrr�	skip_word(rkzBaseParser.skip_wordcCs
|�t�Sr/)r��_whitespace_rer0rrr�skip_ws+rSzBaseParser.skip_wscC�|�|�r|��dSdSr�)r�r�r�rrr�skip_word_and_ws.�
zBaseParser.skip_word_and_wscCr�r�)r�r�)r)r�rrr�skip_string_and_ws4r�zBaseParser.skip_string_and_wscCs|j|jkSr/)r{r}r0rrr�eof:szBaseParser.eofcCs$z|j|jWStyYdSw)N�EOF)rwr{�
IndexErrorr0rrr�current_char>s
�zBaseParser.current_charcCs|jdur
|j��SdSr/)r~�groupr0rrr�matched_textEs

zBaseParser.matched_textcCs|j|jd�}|j|_|Sr/)rwr{r})r)�rvrrr�	read_restLszBaseParser.read_restF)�allowSemicolonr�cCsT|��|r|js|j|jd�dkr|�d�dSdSdS|js(|�d�dSdS)N�;z Expected end of definition or ;.zExpected end of definition.)r�r�rwr{r�)r)r�rrr�
assert_endQs��zBaseParser.assert_endcCr�r/r�r0rrr�
id_attributes\r�zBaseParser.id_attributescCr�r/r�r0rrr�paren_attributes`r�zBaseParser.paren_attributesr}cCs�dddd�}|j}g}|jsSt|�dkr|j|vrn9|j|��vr*|�||j�nt|�dkr<|j|dkr<|��n
|jdvrI|�d|j�|jd	7_|jr|jr]|�d
|�|j||j�S)Nrq�]�})rp�[�{r���z)]}z&Unexpected '%s' in balanced-token-seq.r�z8Could not find end of balanced-token-seq starting at %d.)	r{r�r|r��keysrV�popr�rw)r)r}�brackets�startPos�symbolsrrr�_parse_balanced_token_seqds&

�
�z$BaseParser._parse_balanced_token_seqcCs�|��|j}|�d�r4|�d�s||_n|jdgd�}|�d�s&|�d�|�d�s0|�d�t|�S|�d�r�|�d�sC|�d�|�d�sM|�d	�g}	|�t	�rd|j
}|��}|�t
||��|�d�rjqO|�d�rpn|�d
�qP|�d�s�|�d�t|�S|jD]
}|�|�r�t|�Sq�|jD])}|�|�s�q�|�d�s�|�d�|jdgd�}|�d�s�|�d�t||�SdS)Nr�r�)r}z!Expected ']' in end of attribute.z-Expected ']' in end of attribute after [[...]�
__attribute__rpz#Expected '(' after '__attribute__'.z$Expected '(' after '__attribute__('.r��,rqz2Expected identifier, ')', or ',' in __attribute__.z(Expected ')' after '__attribute__((...)'z0Expected '(' after user-defined paren-attribute.z1Expected ')' to end user-defined paren-attribute.)r�r{r�r�r�r�rNr�r��
identifier_rer��_parse_paren_expression_listrVr[rdr�rhr�rn)r)r�rOrer\�exprsrirrr�_parse_attributexsZ














�



�





zBaseParser._parse_attributecCr�r/r�r0rrrr��sz'BaseParser._parse_paren_expression_list)(rr r!r;rr�Noder
rGrRrrrur��propertyr�r�r�r�r	rFr�r�r�r�r�r�r�r�r�r�r�r�r�r�rrJr�r^r�rrrrrv�sF��
�	

8rv)4rmr��copyr�typingrrrrrr	r
r�docutilsr�docutils.nodesr
�
sphinx.configr�sphinx.utilr�	getLoggerrr�r;rIr�r��anon_identifier_rer��integer_literal_re�octal_literal_re�hex_literal_re�binary_literal_re�integers_literal_suffix_re�float_literal_re�float_literal_suffix_re�char_literal_rerrrr"rJrNr[rdrhrnr^rtrurvrrrr�<module>sD
(












"