ó
    ùŠÂj  ã                   ó¦  • S SK JrJrJrJr  SSKJr  S\R                  S\R                  4S jrS\R                  \R                  -  S\\R                     SS	4S
 jrS\R                  \R                  -  S\R                  \R                  -  4S jrS\R                  \R                  -  S\\R                  \R                  -  \4   4S jrg	)é    )ÚAnyÚListÚTupleÚcasté   )Úc_astÚswitch_nodeÚreturnc                 ó¦  • [        U [        R                  5      (       d   e[        U R                  [        R                  5      (       d  U $ [        R                  " / U R                  R
                  5      nSnU R                  R                  =(       d    /  H®  n[        U[        R                  [        R                  45      (       aA  UR                  R                  U5        [        X1R                  5        UR                  S   nMs  Uc  UR                  R                  U5        M“  UR                  R                  U5        M°     Xl        U $ )a‡  The 'case' statements in a 'switch' come out of parsing with one
child node, so subsequent statements are just tucked to the parent
Compound. Additionally, consecutive (fall-through) case statements
come out messy. This is a peculiarity of the C grammar. The following:

    switch (myvar) {
        case 10:
            k = 10;
            p = k + 1;
            return 10;
        case 20:
        case 30:
            return 20;
        default:
            break;
    }

Creates this tree (pseudo-dump):

    Switch
        ID: myvar
        Compound:
            Case 10:
                k = 10
            p = k + 1
            return 10
            Case 20:
                Case 30:
                    return 20
            Default:
                break

The goal of this transform is to fix this mess, turning it into the
following:

    Switch
        ID: myvar
        Compound:
            Case 10:
                k = 10
                p = k + 1
                return 10
            Case 20:
            Case 30:
                return 20
            Default:
                break

A fixed AST node is returned. The argument may be modified.
Néÿÿÿÿ)Ú
isinstancer   ÚSwitchÚstmtÚCompoundÚcoordÚblock_itemsÚCaseÚDefaultÚappendÚ_extract_nested_caseÚstmts)r	   Únew_compoundÚ	last_caseÚchilds       ÚN/var/www/website/venv/lib/python3.13/site-packages/pycparser/ast_transforms.pyÚfix_switch_casesr      s  € ôf �k¤5§<¡<×0Ñ0Ð0Ð0Ü�k×&Ñ&¬¯©×7Ñ7ØÐô —>’> " k×&6Ñ&6×&<Ñ&<Ó=€Lð 48€Ið
 ×!Ñ!×-Ñ-×3°Ò3ˆÜ�eœeŸj™j¬%¯-©-Ð8×9Ñ9ð
 ×$Ñ$×+Ñ+¨EÔ2Ü  ×(@Ñ(@ÔAØ$×0Ñ0°Ñ4ŠIð Ñ Ø×(Ñ(×/Ñ/°Ö6à—‘×&Ñ& uÖ-ñ 4ð" $ÔØÐó    Ú	case_nodeÚ
stmts_listNc                 ó  • [        U R                  S   [        R                  [        R                  45      (       aF  U R                  R                  5       nUR                  U5        [        [        [        U5      U5        gg)zsRecursively extract consecutive Case statements that are made nested
by the parser and add them to the stmts_list.
r   N)
r   r   r   r   r   Úpopr   r   r   r   )r   r   Únesteds      r   r   r   e   s^   € ô �)—/‘/ !Ñ$¤u§z¡z´5·=±=Ð&A×BÑBØ—‘×$Ñ$Ó&ˆØ×Ñ˜&Ô!ÜœT¤# vÓ.°
Õ;ð Cr   Údeclc                 óª  •  [        U 5      u  pU(       d  OM  U n[        U[        R                  5      (       d.   UR                  n[        U[        R                  5      (       d  M.  SUR                  ;   a+  SU R                  ;  a  U R                  R                  S5        UR                  c  U R                  Ul        U $ ! [
         a    U s $ f = f)a&  Atomic specifiers like _Atomic(type) are unusually structured,
conferring a qualifier upon the contained type.

This function fixes a decl with atomic specifiers to have a sane AST
structure, by removing spurious Typename->TypeDecl pairs and attaching
the _Atomic qualifier in the right place.
Ú_Atomic)
Ú_fix_atomic_specifiers_oncer   r   ÚTypeDeclÚtypeÚAttributeErrorÚqualsr   ÚdeclnameÚname)r#   ÚfoundÚtyps      r   Úfix_atomic_specifiersr/   q   s²   € ð Ü1°$Ó7‰ˆÞØñ ð €CÜ˜œeŸn™n×-Ñ-ð	Ø—(‘(ˆCô ˜œeŸn™n×-Ó-ð
 �C—I‘IÓ )°4·:±:Ó"=Ø�
‰
×Ñ˜)Ô$Ø
‡|�|ÑØ—y‘yˆŒà€Køô ó 	ØŠKð	ús   »C ÃCÃCc                 óì  • U nSnU R                   nUbF  [        U[        R                  5      (       a  SUR                  ;   a  O UnUnUR                   nUb  MF  [        U[        R                  5      (       d   eUc   eUR                   [        [        U5      l         SUR                   R                  ;  a%  UR                   R                  R                  S5        U S4$ ! [
         a    U S4s $ f = f)zvPerforms one 'fix' round of atomic specifiers.
Returns (modified_decl, found) where found is True iff a fix was made.
Nr%   FT)
r(   r   r   ÚTypenamer*   r)   r'   r   r   r   )r#   ÚparentÚgrandparentÚnodes       r   r&   r&   “   sá   € ð €FØ€KØ—	‘	€DØ
Ñ
Ü�dœEŸN™N×+Ñ+°	¸T¿Z¹ZÓ0GØð	Ø ˆKØˆFØ—9‘9ˆDð Ó
ô �fœeŸn™n×-Ñ-Ð-Ð-ØÑ"Ð"Ð"Ø"&§)¡)„DŒˆkÓÔØ˜Ÿ	™	Ÿ™Ó'Ø�	‰	�‰×Ñ˜yÔ)Ø�ˆ:Ðøô ó 	ð ˜�;Òð		ús   ÁC" Ã"C3Ã2C3)Útypingr   r   r   r   Ú r   r   r   r   r   ÚNoder   ÚDeclÚTypedefr/   Úboolr&   © r   r   Ú<module>r<      sË   ð÷ *Ó )å ðS %§,¡,ð S°5·<±<ô Sðl	<Ø�z‰z˜EŸM™MÑ)ð	<Ø7;¸E¿J¹JÑ7Gð	<à	ô	<ðØ
�*‰*�u—}‘}Ñ
$ðà
‡Z�Z�%—-‘-ÑôðDØ
�*‰*�u—}‘}Ñ
$ðà
ˆ5�:‰:˜Ÿ™Ñ% tÐ+Ñ,õr   