+
    i                     Z    ^ RI HtHtHtHt ^RIHt R R ltR R ltR R lt	R	 R
 lt
R# )    )AnyListTuplecast)c_astc                X    V ^8  d   QhR\         P                  R\         P                  /# )   switch_nodereturn)r   Switch)formats   "_/home/wkmabra/.openclaw/workspace/venv/lib/python3.14/site-packages/pycparser/ast_transforms.py__annotate__r      s&     S S%,, S5<< S    c                   \        V \        P                  4      '       g   Q h\        V P                  \        P                  4      '       g   V # \        P                  ! . V P                  P
                  4      pRpV P                  P                  ;'       g    .  F  p\        V\        P                  \        P                  34      '       dF   VP                  P                  V4       \        W1P                  4       VP                  R,          pKx  Vf   VP                  P                  V4       K  VP                  P                  V4       K  	  Wn        V # )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   r   stmtCompoundcoordblock_itemsCaseDefaultappend_extract_nested_casestmts)r
   new_compound	last_casechilds   &   r   fix_switch_casesr       s   f k5<<0000k&&77 >>"k&6&6&<&<=L 48I
 !!--333eejj%--899
 $$++E2 (@(@A$004I  ((//6&&u- 4" $r   c                    V ^8  d   QhR\         P                  \         P                  ,          R\        \         P                  ,          RR/# )r	   	case_node
stmts_listr   N)r   r   r   r   Node)r   s   "r   r   r   e   s:     	< 	<zzEMM)	<7;EJJ7G	<		<r   c                   \        V P                  ^ ,          \        P                  \        P                  34      '       dH   V P                  P                  4       pVP                  V4       \        \        \        V4      V4       R# R# )zsRecursively extract consecutive Case statements that are made nested
by the parser and add them to the stmts_list.
N)
r   r   r   r   r   popr   r   r   r   )r"   r#   nesteds   && r   r   r   e   s^     )//!$uzz5==&ABB$$&&!T#v.
; Cr   c                    V ^8  d   QhR\         P                  \         P                  ,          R\         P                  \         P                  ,          /# r	   declr   )r   DeclTypedef)r   s   "r   r   r   q   s6      
**u}}
$
ZZ%--r   c                x    \        V 4      w  rV'       d   K   T p\        T\        P                  4      '       g    TP                  pK/  RTP                  9   d-   RT P                  9  d   T P                  P                  R4       TP                  f   T P                  Tn        T #   \
         d    T u # i ; i)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_specifiersr8   q   s     1$7u
 Cenn--	((C CII)4::"=

)$
||yyK  	K	s   B) )B98B9c                    V ^8  d   QhR\         P                  \         P                  ,          R\        \         P                  \         P                  ,          \        3,          /# r)   )r   r+   r,   r   bool)r   s   "r   r   r      s@      
**u}}
$
5::%t+,r   c                   T pRpV P                   pVeF   \        V\        P                  4      '       d   RVP                  9   d   M TpTpVP                   pKI  \        V\        P                  4      '       g   Q hVf   Q hVP                   \        \        V4      n         RVP                   P                  9  d&   VP                   P                  P                  R4       V R3#   \
         d    T R3u # i ; i)zvPerforms one 'fix' round of atomic specifiers.
Returns (modified_decl, found) where found is True iff a fix was made.
Nr.   FT)
r1   r   r   Typenamer3   r2   r0   r   r   r   )r*   parentgrandparentnodes   &   r   r/   r/      s     FK		D

dENN++	TZZ0G	 KF99D fenn----""""&))Dk		'		y):  	 ;		s   C% %C76C7N)typingr   r   r   r    r   r    r   r8   r/    r   r   <module>rC      s'    * ) Sl	<Dr   