3
(hA\                 @   s  d dl Z G dd deZG dd deZG dd deZG dd	 d	eZG d
d deZG dd deZG dd deZG dd deZ	G dd deZ
G dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG d d! d!eZG d"d# d#eZG d$d% d%eZG d&d' d'eZG d(d) d)eZG d*d+ d+eZG d,d- d-eZG d.d/ d/eZG d0d1 d1eZG d2d3 d3eZG d4d5 d5eZG d6d7 d7eZG d8d9 d9eZG d:d; d;eZG d<d= d=eZG d>d? d?eZ G d@dA dAeZ!G dBdC dCeZ"G dDdE dEeZ#G dFdG dGeZ$G dHdI dIeZ%G dJdK dKeZ&G dLdM dMeZ'G dNdO dOeZ(G dPdQ dQeZ)G dRdS dSeZ*G dTdU dUeZ+G dVdW dWeZ,G dXdY dYeZ-G dZd[ d[eZ.G d\d] d]eZ/G d^d_ d_eZ0G d`da daeZ1G dbdc dceZ2dS )d    Nc               @   s0   e Zd Zf Zdd ZejdddddfddZdS )Nodec             C   s   dS )z3 A sequence of all children that are Nodes
        N )selfr   r   ../pycparser/c_ast.pychildren   s    zNode.childrenr   FNc          	      s  d| }|r4|dk	r4|j | jj d | d  n|j | jj d   jr|r~ fdd jD }djd	d
 |D }	n( fdd jD }
djdd
 |
D }	|j |	 |r|j d j  |j d x. j D ]"\}}|j||d ||||d qW dS )a   Pretty print the Node and all its attributes and
            children (recursively) to a buffer.

            buf:
                Open IO buffer into which the Node is printed.

            offset:
                Initial offset (amount of leading spaces)

            attrnames:
                True if you want to see the attribute names in
                name=value pairs. False to only see the values.

            nodenames:
                True if you want to see the actual node names
                within their parents.

            showcoord:
                Do you want the coordinates of each Node to be
                displayed.
         Nz <z>: z: c                s   g | ]}|t  |fqS r   )getattr).0n)r   r   r   
<listcomp>=   s    zNode.show.<locals>.<listcomp>z, c             s   s   | ]}d | V  qdS )z%s=%sNr   )r	   Znvr   r   r   	<genexpr>>   s    zNode.show.<locals>.<genexpr>c                s   g | ]}t  |qS r   )r   )r	   r
   )r   r   r   r   @   s    c             s   s   | ]}d | V  qdS )z%sNr   )r	   vr   r   r   r   A   s    z (at %s)
   )offset	attrnames	nodenames	showcoord_my_node_name)write	__class____name__
attr_namesjoincoordr   show)r   Zbufr   r   r   r   r   ZleadZnvlistZattrstrZvlistZ
child_namechildr   )r   r   r      s,     

z	Node.show)r   
__module____qualname__	__slots__r   sysstdoutr   r   r   r   r   r      s   r   c               @   s    e Zd ZdZdd Zdd ZdS )NodeVisitora-   A base NodeVisitor class for visiting c_ast nodes.
        Subclass it and define your own visit_XXX methods, where
        XXX is the class name you want to visit with these
        methods.

        For example:

        class ConstantVisitor(NodeVisitor):
            def __init__(self):
                self.values = []

            def visit_Constant(self, node):
                self.values.append(node.value)

        Creates a list of values of all the constant nodes
        encountered below the given node. To use it:

        cv = ConstantVisitor()
        cv.visit(node)

        Notes:

        *   generic_visit() will be called for AST nodes for which
            no visit_XXX method was defined.
        *   The children of nodes for which a visit_XXX was
            defined will not be visited - if you need this, call
            generic_visit() on the node.
            You can use:
                NodeVisitor.generic_visit(self, node)
        *   Modeled after Python's own AST visiting facilities
            (the ast module of Python 3.0)
    c             C   s"   d|j j }t| || j}||S )z Visit a node.
        visit_)r   r   r   generic_visit)r   nodemethodvisitorr   r   r   visits   s    zNodeVisitor.visitc             C   s$   x|j  D ]\}}| j| q
W dS )zy Called if no explicit visitor function exists for a
            node. Implements preorder visiting of the node.
        N)r   r(   )r   r%   Zc_namecr   r   r   r$   z   s    zNodeVisitor.generic_visitN)r   r   r   __doc__r(   r$   r   r   r   r   r"   R   s    r"   c               @   s&   e Zd ZdZdddZd	d
 ZdZdS )	ArrayDecltypedim	dim_qualsr   __weakref__Nc             C   s   || _ || _|| _|| _d S )N)r,   r-   r.   r   )r   r,   r-   r.   r   r   r   r   __init__   s    zArrayDecl.__init__c             C   s@   g }| j d k	r|jd| j f | jd k	r8|jd| jf t|S )Nr,   r-   )r,   appendr-   tuple)r   nodelistr   r   r   r      s    
 
 zArrayDecl.children)r,   r-   r.   r   r/   )N)r.   )r   r   r   r   r0   r   r   r   r   r   r   r+      s   
r+   c               @   s&   e Zd Zd
ZdddZdd	 Zf ZdS )ArrayRefname	subscriptr   r/   Nc             C   s   || _ || _|| _d S )N)r5   r6   r   )r   r5   r6   r   r   r   r   r0      s    zArrayRef.__init__c             C   s@   g }| j d k	r|jd| j f | jd k	r8|jd| jf t|S )Nr5   r6   )r5   r1   r6   r2   )r   r3   r   r   r   r      s    
 
 zArrayRef.children)r5   r6   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   r4      s   
r4   c               @   s&   e Zd ZdZdddZd	d
 ZdZdS )
Assignmentoplvaluervaluer   r/   Nc             C   s   || _ || _|| _|| _d S )N)r8   r9   r:   r   )r   r8   r9   r:   r   r   r   r   r0      s    zAssignment.__init__c             C   s@   g }| j d k	r|jd| j f | jd k	r8|jd| jf t|S )Nr9   r:   )r9   r1   r:   r2   )r   r3   r   r   r   r      s    
 
 zAssignment.children)r8   r9   r:   r   r/   )N)r8   )r   r   r   r   r0   r   r   r   r   r   r   r7      s   
r7   c               @   s&   e Zd ZdZdddZd	d
 ZdZdS )BinaryOpr8   leftrightr   r/   Nc             C   s   || _ || _|| _|| _d S )N)r8   r<   r=   r   )r   r8   r<   r=   r   r   r   r   r0      s    zBinaryOp.__init__c             C   s@   g }| j d k	r|jd| j f | jd k	r8|jd| jf t|S )Nr<   r=   )r<   r1   r=   r2   )r   r3   r   r   r   r      s    
 
 zBinaryOp.children)r8   r<   r=   r   r/   )N)r8   )r   r   r   r   r0   r   r   r   r   r   r   r;      s   
r;   c               @   s&   e Zd ZdZd	ddZdd Zf ZdS )
Breakr   r/   Nc             C   s
   || _ d S )N)r   )r   r   r   r   r   r0      s    zBreak.__init__c             C   s   f S )Nr   )r   r   r   r   r      s    zBreak.children)r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   r>      s   
r>   c               @   s&   e Zd Zd
ZdddZdd	 Zf ZdS )Caseexprstmtsr   r/   Nc             C   s   || _ || _|| _d S )N)r@   rA   r   )r   r@   rA   r   r   r   r   r0      s    zCase.__init__c             C   sT   g }| j d k	r|jd| j f x,t| jp*g D ]\}}|jd| |f q.W t|S )Nr@   z	stmts[%d])r@   r1   	enumeraterA   r2   )r   r3   ir   r   r   r   r      s    
 zCase.children)r@   rA   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   r?      s   
r?   c               @   s&   e Zd Zd
ZdddZdd	 Zf ZdS )Castto_typer@   r   r/   Nc             C   s   || _ || _|| _d S )N)rE   r@   r   )r   rE   r@   r   r   r   r   r0      s    zCast.__init__c             C   s@   g }| j d k	r|jd| j f | jd k	r8|jd| jf t|S )NrE   r@   )rE   r1   r@   r2   )r   r3   r   r   r   r      s    
 
 zCast.children)rE   r@   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   rD      s   
rD   c               @   s&   e Zd Zd	Zd
ddZdd Zf ZdS )Compoundblock_itemsr   r/   Nc             C   s   || _ || _d S )N)rG   r   )r   rG   r   r   r   r   r0      s    zCompound.__init__c             C   s:   g }x,t | jpg D ]\}}|jd| |f qW t|S )Nzblock_items[%d])rB   rG   r1   r2   )r   r3   rC   r   r   r   r   r      s    zCompound.children)rG   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   rF      s   
rF   c               @   s&   e Zd Zd
ZdddZdd	 Zf ZdS )CompoundLiteralr,   initr   r/   Nc             C   s   || _ || _|| _d S )N)r,   rI   r   )r   r,   rI   r   r   r   r   r0      s    zCompoundLiteral.__init__c             C   s@   g }| j d k	r|jd| j f | jd k	r8|jd| jf t|S )Nr,   rI   )r,   r1   rI   r2   )r   r3   r   r   r   r      s    
 
 zCompoundLiteral.children)r,   rI   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   rH      s   
rH   c               @   s&   e Zd Zd
ZdddZdd	 ZdZdS )Constantr,   valuer   r/   Nc             C   s   || _ || _|| _d S )N)r,   rK   r   )r   r,   rK   r   r   r   r   r0   	  s    zConstant.__init__c             C   s   g }t |S )N)r2   )r   r3   r   r   r   r     s    zConstant.children)r,   rK   r   r/   )N)r,   rK   )r   r   r   r   r0   r   r   r   r   r   r   rJ     s   
rJ   c               @   s&   e Zd ZdZd	ddZdd Zf ZdS )
Continuer   r/   Nc             C   s
   || _ d S )N)r   )r   r   r   r   r   r0     s    zContinue.__init__c             C   s   f S )Nr   )r   r   r   r   r     s    zContinue.children)r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   rL     s   
rL   c            	   @   s&   e Zd ZdZdddZdd ZdZd
S )Declr5   qualsstoragefuncspecr,   rI   bitsizer   r/   Nc	       	      C   s4   || _ || _|| _|| _|| _|| _|| _|| _d S )N)r5   rN   rO   rP   r,   rI   rQ   r   )	r   r5   rN   rO   rP   r,   rI   rQ   r   r   r   r   r0      s    zDecl.__init__c             C   sZ   g }| j d k	r|jd| j f | jd k	r8|jd| jf | jd k	rR|jd| jf t|S )Nr,   rI   rQ   )r,   r1   rI   rQ   r2   )r   r3   r   r   r   r   *  s    
 
 
 zDecl.children)	r5   rN   rO   rP   r,   rI   rQ   r   r/   )N)r5   rN   rO   rP   )r   r   r   r   r0   r   r   r   r   r   r   rM     s   

rM   c               @   s&   e Zd Zd	Zd
ddZdd Zf ZdS )DeclListdeclsr   r/   Nc             C   s   || _ || _d S )N)rS   r   )r   rS   r   r   r   r   r0   5  s    zDeclList.__init__c             C   s:   g }x,t | jpg D ]\}}|jd| |f qW t|S )Nz	decls[%d])rB   rS   r1   r2   )r   r3   rC   r   r   r   r   r   9  s    zDeclList.children)rS   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   rR   3  s   
rR   c               @   s&   e Zd Zd	Zd
ddZdd Zf ZdS )DefaultrA   r   r/   Nc             C   s   || _ || _d S )N)rA   r   )r   rA   r   r   r   r   r0   C  s    zDefault.__init__c             C   s:   g }x,t | jpg D ]\}}|jd| |f qW t|S )Nz	stmts[%d])rB   rA   r1   r2   )r   r3   rC   r   r   r   r   r   G  s    zDefault.children)rA   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   rT   A  s   
rT   c               @   s&   e Zd Zd
ZdddZdd	 Zf ZdS )DoWhilecondstmtr   r/   Nc             C   s   || _ || _|| _d S )N)rV   rW   r   )r   rV   rW   r   r   r   r   r0   Q  s    zDoWhile.__init__c             C   s@   g }| j d k	r|jd| j f | jd k	r8|jd| jf t|S )NrV   rW   )rV   r1   rW   r2   )r   r3   r   r   r   r   V  s    
 
 zDoWhile.children)rV   rW   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   rU   O  s   
rU   c               @   s&   e Zd ZdZd	ddZdd Zf ZdS )
EllipsisParamr   r/   Nc             C   s
   || _ d S )N)r   )r   r   r   r   r   r0   `  s    zEllipsisParam.__init__c             C   s   f S )Nr   )r   r   r   r   r   c  s    zEllipsisParam.children)r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   rX   ^  s   
rX   c               @   s&   e Zd ZdZd	ddZdd Zf ZdS )
EmptyStatementr   r/   Nc             C   s
   || _ d S )N)r   )r   r   r   r   r   r0   j  s    zEmptyStatement.__init__c             C   s   f S )Nr   )r   r   r   r   r   m  s    zEmptyStatement.children)r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   rY   h  s   
rY   c               @   s&   e Zd Zd
ZdddZdd	 ZdZdS )Enumr5   valuesr   r/   Nc             C   s   || _ || _|| _d S )N)r5   r[   r   )r   r5   r[   r   r   r   r   r0   t  s    zEnum.__init__c             C   s&   g }| j d k	r|jd| j f t|S )Nr[   )r[   r1   r2   )r   r3   r   r   r   r   y  s    
 zEnum.children)r5   r[   r   r/   )N)r5   )r   r   r   r   r0   r   r   r   r   r   r   rZ   r  s   
rZ   c               @   s&   e Zd Zd
ZdddZdd	 ZdZdS )
Enumeratorr5   rK   r   r/   Nc             C   s   || _ || _|| _d S )N)r5   rK   r   )r   r5   rK   r   r   r   r   r0     s    zEnumerator.__init__c             C   s&   g }| j d k	r|jd| j f t|S )NrK   )rK   r1   r2   )r   r3   r   r   r   r     s    
 zEnumerator.children)r5   rK   r   r/   )N)r5   )r   r   r   r   r0   r   r   r   r   r   r   r\     s   
r\   c               @   s&   e Zd Zd	Zd
ddZdd Zf ZdS )EnumeratorListenumeratorsr   r/   Nc             C   s   || _ || _d S )N)r^   r   )r   r^   r   r   r   r   r0     s    zEnumeratorList.__init__c             C   s:   g }x,t | jpg D ]\}}|jd| |f qW t|S )Nzenumerators[%d])rB   r^   r1   r2   )r   r3   rC   r   r   r   r   r     s    zEnumeratorList.children)r^   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   r]     s   
r]   c               @   s&   e Zd Zd	Zd
ddZdd Zf ZdS )ExprListexprsr   r/   Nc             C   s   || _ || _d S )N)r`   r   )r   r`   r   r   r   r   r0     s    zExprList.__init__c             C   s:   g }x,t | jpg D ]\}}|jd| |f qW t|S )Nz	exprs[%d])rB   r`   r1   r2   )r   r3   rC   r   r   r   r   r     s    zExprList.children)r`   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   r_     s   
r_   c               @   s&   e Zd Zd	Zd
ddZdd Zf ZdS )FileASTextr   r/   Nc             C   s   || _ || _d S )N)rb   r   )r   rb   r   r   r   r   r0     s    zFileAST.__init__c             C   s:   g }x,t | jpg D ]\}}|jd| |f qW t|S )Nzext[%d])rB   rb   r1   r2   )r   r3   rC   r   r   r   r   r     s    zFileAST.children)rb   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   ra     s   
ra   c               @   s&   e Zd ZdZddd	Zd
d Zf ZdS )ForrI   rV   nextrW   r   r/   Nc             C   s"   || _ || _|| _|| _|| _d S )N)rI   rV   rd   rW   r   )r   rI   rV   rd   rW   r   r   r   r   r0     s
    zFor.__init__c             C   st   g }| j d k	r|jd| j f | jd k	r8|jd| jf | jd k	rR|jd| jf | jd k	rl|jd| jf t|S )NrI   rV   rd   rW   )rI   r1   rV   rd   rW   r2   )r   r3   r   r   r   r     s    
 
 
 
 zFor.children)rI   rV   rd   rW   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   rc     s   
rc   c               @   s&   e Zd Zd
ZdddZdd	 Zf ZdS )FuncCallr5   argsr   r/   Nc             C   s   || _ || _|| _d S )N)r5   rf   r   )r   r5   rf   r   r   r   r   r0     s    zFuncCall.__init__c             C   s@   g }| j d k	r|jd| j f | jd k	r8|jd| jf t|S )Nr5   rf   )r5   r1   rf   r2   )r   r3   r   r   r   r     s    
 
 zFuncCall.children)r5   rf   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   re     s   
re   c               @   s&   e Zd Zd
ZdddZdd	 Zf ZdS )FuncDeclrf   r,   r   r/   Nc             C   s   || _ || _|| _d S )N)rf   r,   r   )r   rf   r,   r   r   r   r   r0     s    zFuncDecl.__init__c             C   s@   g }| j d k	r|jd| j f | jd k	r8|jd| jf t|S )Nrf   r,   )rf   r1   r,   r2   )r   r3   r   r   r   r     s    
 
 zFuncDecl.children)rf   r,   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   rg     s   
rg   c               @   s&   e Zd ZdZdddZd	d
 Zf ZdS )FuncDefdeclparam_declsbodyr   r/   Nc             C   s   || _ || _|| _|| _d S )N)ri   rj   rk   r   )r   ri   rj   rk   r   r   r   r   r0     s    zFuncDef.__init__c             C   sn   g }| j d k	r|jd| j f | jd k	r8|jd| jf x,t| jpDg D ]\}}|jd| |f qHW t|S )Nri   rk   zparam_decls[%d])ri   r1   rk   rB   rj   r2   )r   r3   rC   r   r   r   r   r     s    
 
 zFuncDef.children)ri   rj   rk   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   rh     s   
rh   c               @   s&   e Zd Zd	Zd
ddZdd ZdZdS )Gotor5   r   r/   Nc             C   s   || _ || _d S )N)r5   r   )r   r5   r   r   r   r   r0     s    zGoto.__init__c             C   s   g }t |S )N)r2   )r   r3   r   r   r   r     s    zGoto.children)r5   r   r/   )N)r5   )r   r   r   r   r0   r   r   r   r   r   r   rl     s   
rl   c               @   s&   e Zd Zd	Zd
ddZdd ZdZdS )IDr5   r   r/   Nc             C   s   || _ || _d S )N)r5   r   )r   r5   r   r   r   r   r0   	  s    zID.__init__c             C   s   g }t |S )N)r2   )r   r3   r   r   r   r     s    zID.children)r5   r   r/   )N)r5   )r   r   r   r   r0   r   r   r   r   r   r   rm     s   
rm   c               @   s&   e Zd Zd	Zd
ddZdd ZdZdS )IdentifierTypenamesr   r/   Nc             C   s   || _ || _d S )N)ro   r   )r   ro   r   r   r   r   r0     s    zIdentifierType.__init__c             C   s   g }t |S )N)r2   )r   r3   r   r   r   r     s    zIdentifierType.children)ro   r   r/   )N)ro   )r   r   r   r   r0   r   r   r   r   r   r   rn     s   
rn   c               @   s&   e Zd ZdZdddZd	d
 Zf ZdS )IfrV   iftrueiffalser   r/   Nc             C   s   || _ || _|| _|| _d S )N)rV   rq   rr   r   )r   rV   rq   rr   r   r   r   r   r0   !  s    zIf.__init__c             C   sZ   g }| j d k	r|jd| j f | jd k	r8|jd| jf | jd k	rR|jd| jf t|S )NrV   rq   rr   )rV   r1   rq   rr   r2   )r   r3   r   r   r   r   '  s    
 
 
 zIf.children)rV   rq   rr   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   rp     s   
rp   c               @   s&   e Zd Zd	Zd
ddZdd Zf ZdS )InitListr`   r   r/   Nc             C   s   || _ || _d S )N)r`   r   )r   r`   r   r   r   r   r0   2  s    zInitList.__init__c             C   s:   g }x,t | jpg D ]\}}|jd| |f qW t|S )Nz	exprs[%d])rB   r`   r1   r2   )r   r3   rC   r   r   r   r   r   6  s    zInitList.children)r`   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   rs   0  s   
rs   c               @   s&   e Zd Zd
ZdddZdd	 ZdZdS )Labelr5   rW   r   r/   Nc             C   s   || _ || _|| _d S )N)r5   rW   r   )r   r5   rW   r   r   r   r   r0   @  s    zLabel.__init__c             C   s&   g }| j d k	r|jd| j f t|S )NrW   )rW   r1   r2   )r   r3   r   r   r   r   E  s    
 zLabel.children)r5   rW   r   r/   )N)r5   )r   r   r   r   r0   r   r   r   r   r   r   rt   >  s   
rt   c               @   s&   e Zd Zd
ZdddZdd	 Zf ZdS )NamedInitializerr5   r@   r   r/   Nc             C   s   || _ || _|| _d S )N)r5   r@   r   )r   r5   r@   r   r   r   r   r0   N  s    zNamedInitializer.__init__c             C   sT   g }| j d k	r|jd| j f x,t| jp*g D ]\}}|jd| |f q.W t|S )Nr@   zname[%d])r@   r1   rB   r5   r2   )r   r3   rC   r   r   r   r   r   S  s    
 zNamedInitializer.children)r5   r@   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   ru   L  s   
ru   c               @   s&   e Zd Zd	Zd
ddZdd Zf ZdS )	ParamListparamsr   r/   Nc             C   s   || _ || _d S )N)rw   r   )r   rw   r   r   r   r   r0   ^  s    zParamList.__init__c             C   s:   g }x,t | jpg D ]\}}|jd| |f qW t|S )Nz
params[%d])rB   rw   r1   r2   )r   r3   rC   r   r   r   r   r   b  s    zParamList.children)rw   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   rv   \  s   
rv   c               @   s&   e Zd Zd
ZdddZdd	 ZdZdS )PtrDeclrN   r,   r   r/   Nc             C   s   || _ || _|| _d S )N)rN   r,   r   )r   rN   r,   r   r   r   r   r0   l  s    zPtrDecl.__init__c             C   s&   g }| j d k	r|jd| j f t|S )Nr,   )r,   r1   r2   )r   r3   r   r   r   r   q  s    
 zPtrDecl.children)rN   r,   r   r/   )N)rN   )r   r   r   r   r0   r   r   r   r   r   r   rx   j  s   
rx   c               @   s&   e Zd Zd	Zd
ddZdd Zf ZdS )Returnr@   r   r/   Nc             C   s   || _ || _d S )N)r@   r   )r   r@   r   r   r   r   r0   z  s    zReturn.__init__c             C   s&   g }| j d k	r|jd| j f t|S )Nr@   )r@   r1   r2   )r   r3   r   r   r   r   ~  s    
 zReturn.children)r@   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   ry   x  s   
ry   c               @   s&   e Zd Zd
ZdddZdd	 ZdZdS )Structr5   rS   r   r/   Nc             C   s   || _ || _|| _d S )N)r5   rS   r   )r   r5   rS   r   r   r   r   r0     s    zStruct.__init__c             C   s:   g }x,t | jpg D ]\}}|jd| |f qW t|S )Nz	decls[%d])rB   rS   r1   r2   )r   r3   rC   r   r   r   r   r     s    zStruct.children)r5   rS   r   r/   )N)r5   )r   r   r   r   r0   r   r   r   r   r   r   rz     s   
rz   c               @   s&   e Zd ZdZdddZd	d
 ZdZdS )	StructRefr5   r,   fieldr   r/   Nc             C   s   || _ || _|| _|| _d S )N)r5   r,   r|   r   )r   r5   r,   r|   r   r   r   r   r0     s    zStructRef.__init__c             C   s@   g }| j d k	r|jd| j f | jd k	r8|jd| jf t|S )Nr5   r|   )r5   r1   r|   r2   )r   r3   r   r   r   r     s    
 
 zStructRef.children)r5   r,   r|   r   r/   )N)r,   )r   r   r   r   r0   r   r   r   r   r   r   r{     s   
r{   c               @   s&   e Zd Zd
ZdddZdd	 Zf ZdS )SwitchrV   rW   r   r/   Nc             C   s   || _ || _|| _d S )N)rV   rW   r   )r   rV   rW   r   r   r   r   r0     s    zSwitch.__init__c             C   s@   g }| j d k	r|jd| j f | jd k	r8|jd| jf t|S )NrV   rW   )rV   r1   rW   r2   )r   r3   r   r   r   r     s    
 
 zSwitch.children)rV   rW   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   r}     s   
r}   c               @   s&   e Zd ZdZdddZd	d
 Zf ZdS )	TernaryOprV   rq   rr   r   r/   Nc             C   s   || _ || _|| _|| _d S )N)rV   rq   rr   r   )r   rV   rq   rr   r   r   r   r   r0     s    zTernaryOp.__init__c             C   sZ   g }| j d k	r|jd| j f | jd k	r8|jd| jf | jd k	rR|jd| jf t|S )NrV   rq   rr   )rV   r1   rq   rr   r2   )r   r3   r   r   r   r     s    
 
 
 zTernaryOp.children)rV   rq   rr   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   r~     s   
r~   c               @   s&   e Zd ZdZdddZd	d
 ZdZdS )TypeDecldeclnamerN   r,   r   r/   Nc             C   s   || _ || _|| _|| _d S )N)r   rN   r,   r   )r   r   rN   r,   r   r   r   r   r0     s    zTypeDecl.__init__c             C   s&   g }| j d k	r|jd| j f t|S )Nr,   )r,   r1   r2   )r   r3   r   r   r   r     s    
 zTypeDecl.children)r   rN   r,   r   r/   )N)r   rN   )r   r   r   r   r0   r   r   r   r   r   r   r     s   
r   c               @   s&   e Zd ZdZddd	Zd
d ZdZdS )Typedefr5   rN   rO   r,   r   r/   Nc             C   s"   || _ || _|| _|| _|| _d S )N)r5   rN   rO   r,   r   )r   r5   rN   rO   r,   r   r   r   r   r0     s
    zTypedef.__init__c             C   s&   g }| j d k	r|jd| j f t|S )Nr,   )r,   r1   r2   )r   r3   r   r   r   r     s    
 zTypedef.children)r5   rN   rO   r,   r   r/   )N)r5   rN   rO   )r   r   r   r   r0   r   r   r   r   r   r   r     s   
r   c               @   s&   e Zd ZdZdddZd	d
 ZdZdS )Typenamer5   rN   r,   r   r/   Nc             C   s   || _ || _|| _|| _d S )N)r5   rN   r,   r   )r   r5   rN   r,   r   r   r   r   r0     s    zTypename.__init__c             C   s&   g }| j d k	r|jd| j f t|S )Nr,   )r,   r1   r2   )r   r3   r   r   r   r     s    
 zTypename.children)r5   rN   r,   r   r/   )N)r5   rN   )r   r   r   r   r0   r   r   r   r   r   r   r     s   
r   c               @   s&   e Zd Zd
ZdddZdd	 ZdZdS )UnaryOpr8   r@   r   r/   Nc             C   s   || _ || _|| _d S )N)r8   r@   r   )r   r8   r@   r   r   r   r   r0     s    zUnaryOp.__init__c             C   s&   g }| j d k	r|jd| j f t|S )Nr@   )r@   r1   r2   )r   r3   r   r   r   r     s    
 zUnaryOp.children)r8   r@   r   r/   )N)r8   )r   r   r   r   r0   r   r   r   r   r   r   r     s   
r   c               @   s&   e Zd Zd
ZdddZdd	 ZdZdS )Unionr5   rS   r   r/   Nc             C   s   || _ || _|| _d S )N)r5   rS   r   )r   r5   rS   r   r   r   r   r0     s    zUnion.__init__c             C   s:   g }x,t | jpg D ]\}}|jd| |f qW t|S )Nz	decls[%d])rB   rS   r1   r2   )r   r3   rC   r   r   r   r   r     s    zUnion.children)r5   rS   r   r/   )N)r5   )r   r   r   r   r0   r   r   r   r   r   r   r      s   
r   c               @   s&   e Zd Zd
ZdddZdd	 Zf ZdS )WhilerV   rW   r   r/   Nc             C   s   || _ || _|| _d S )N)rV   rW   r   )r   rV   rW   r   r   r   r   r0     s    zWhile.__init__c             C   s@   g }| j d k	r|jd| j f | jd k	r8|jd| jf t|S )NrV   rW   )rV   r1   rW   r2   )r   r3   r   r   r   r     s    
 
 zWhile.children)rV   rW   r   r/   )N)r   r   r   r   r0   r   r   r   r   r   r   r     s   
r   c               @   s&   e Zd Zd	Zd
ddZdd ZdZdS )Pragmastringr   r/   Nc             C   s   || _ || _d S )N)r   r   )r   r   r   r   r   r   r0      s    zPragma.__init__c             C   s   g }t |S )N)r2   )r   r3   r   r   r   r   $  s    zPragma.children)r   r   r/   )N)r   )r   r   r   r   r0   r   r   r   r   r   r   r     s   
r   )3r    objectr   r"   r+   r4   r7   r;   r>   r?   rD   rF   rH   rJ   rL   rM   rR   rT   rU   rX   rY   rZ   r\   r]   r_   ra   rc   re   rg   rh   rl   rm   rn   rp   rs   rt   ru   rv   rx   ry   rz   r{   r}   r~   r   r   r   r   r   r   r   r   r   r   r   <module>   sb   <0



