
    x
h13                        d dl mZ d dlZ G d de      Z G d de      Z G d de      Z G d	 d
e      Z G d de      Z G d de      Z	 G d de      Z
 G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d d e      Z G d! d"e      Z G d# d$e      Z G d% d&e      Z G d' d(e      Z G d) d*e      Z G d+ d,e      Z G d- d.e      Zy)/    )OrderedDictNc                       e Zd Zd Zy)ASTNodec                 .    || _         || _        || _        y)z
        Args:
            lineno (int): The line number where the start of this element
                occurs.
            lexpos (int): The character offset into the file where this element
                occurs.
        N)pathlinenolexpos)selfr   r   r	   s       W/var/www/html/lionshead-backend/venv/lib/python3.12/site-packages/stone/frontend/ast.py__init__zASTNode.__init__   s     	    N)__name__
__module____qualname__r    r   r   r   r      s    
r   r   c                   *     e Zd Z fdZd Zd Z xZS )AstNamespacec                 L    t         t        |   |||       || _        || _        y)z
        Args:
            name (str): The namespace of the spec.
            doc (Optional[str]): The docstring for this namespace.
        N)superr   r   namedoc)r
   r   r   r	   r   r   	__class__s         r   r   zAstNamespace.__init__   s&     	lD*4@	r   c                 "    | j                         S N__repr__r
   s    r   __str__zAstNamespace.__str__        }}r   c                 8    dj                  | j                        S )NzAstNamespace({!r}))formatr   r   s    r   r   zAstNamespace.__repr__#   s    #**49955r   r   r   r   r   r   r   __classcell__r   s   @r   r   r      s    6r   r   c                   *     e Zd Z fdZd Zd Z xZS )	AstImportc                 >    t         t        |   |||       || _        y)zV
        Args:
            target (str): The name of the namespace to import.
        N)r   r&   r   target)r
   r   r   r	   r(   r   s        r   r   zAstImport.__init__)   s    
 	i'ff=r   c                 "    | j                         S r   r   r   s    r   r   zAstImport.__str__1   r   r   c                 8    dj                  | j                        S )NzAstImport({!r}))r!   r(   r   s    r   r   zAstImport.__repr__4   s     ''44r   r"   r$   s   @r   r&   r&   '   s    5r   r&   c                   *     e Zd Z fdZd Zd Z xZS )AstAliasc                 h    t         t        |   |||       || _        || _        || _        g | _        y)z
        Args:
            name (str): The name of the alias.
            type_ref (AstTypeRef): The data type of the field.
            doc (Optional[str]): Documentation string for the alias.
        N)r   r,   r   r   type_refr   annotations)r
   r   r   r	   r   r.   r   r   s          r   r   zAstAlias.__init__9   s5     	h&tVV<	 r   c                     || _         y r   r/   r
   r/   s     r   set_annotationszAstAlias.set_annotationsF   
    &r   c                 N    dj                  | j                  | j                        S )NzAstAlias({!r}, {!r})r!   r   r.   r   s    r   r   zAstAlias.__repr__I   s    %,,TYYFFr   )r   r   r   r   r3   r   r#   r$   s   @r   r,   r,   7   s    'Gr   r,   c                   *     e Zd Z fdZd Zd Z xZS )
AstTypeDefc	                    t         t        |   |||       || _        t	        |t
        t        d      f      sJ t        |             || _        t	        |t        j                  t        d      f      sJ || _
        t	        |t              sJ || _        t	        |t        t        d      f      sJ t        |             || _        y)a  
        Args:
            name (str): Name assigned to the type.
            extends (Optional[str]); Name of the type this inherits from.
            doc (Optional[str]): Docstring for the type.
            fields (List[AstField]): Fields of a type, not including
                inherited ones.
            examples (Optional[OrderedDict[str, AstExample]]): Map from label
                to example.
        N)r   r8   r   r   
isinstance
AstTypeReftypeextendssix	text_typer   listfieldsr   examples)
r
   r   r   r	   r   r=   r   rA   rB   r   s
            r   r   zAstTypeDef.__init__N   s     	j$(vv>	'JT
#;<Kd7mK<#tDz:;;;&$'''([$t*$=>NXN> r   c                 "    | j                         S r   r   r   s    r   r   zAstTypeDef.__str__f   r   r   c                 d    dj                  | j                  | j                  | j                        S )NzAstTypeDef({!r}, {!r}, {!r})r!   r   r=   rA   r   s    r   r   zAstTypeDef.__repr__i   s*    -44IILLKK
 	
r   r"   r$   s   @r   r8   r8   L   s    !0
r   r8   c                   (     e Zd Z	 d fd	Zd Z xZS )AstStructDefc
           
          t         t        |   ||||||||       t        |	t        t        d      f      sJ t        |	             |	| _        y)z
        Args:
            subtypes (Tuple[List[AstSubtypeField], bool]): Inner list
                enumerates subtypes. The bool indicates whether this struct
                is a catch-all.

        See AstTypeDef for other constructor args.
        N)r   rG   r   r:   tupler<   subtypes)r
   r   r   r	   r   r=   r   rA   rB   rJ   r   s             r   r   zAstStructDef.__init__r   sO     	lD*&&$fh	H(UDJ$78H$x.H8 r   c                 d    dj                  | j                  | j                  | j                        S )NzAstStructDef({!r}, {!r}, {!r})rE   r   s    r   r   zAstStructDef.__repr__   s*    /66IILLKK
 	
r   r   r   r   r   r   r   r#   r$   s   @r   rG   rG   p   s     %)! 
r   rG   c                   $     e Zd Z fdZd Z xZS )AstStructPatchc                     t         t        |   |||       || _        t	        |t
              sJ || _        t	        |t        t        d       f      sJ t        |             || _	        y r   )
r   rN   r   r   r:   r@   rA   r   r<   rB   )r
   r   r   r	   r   rA   rB   r   s          r   r   zAstStructPatch.__init__   s]    nd,T66B	&$'''([$t*$=>NXN> r   c                 N    dj                  | j                  | j                        S )NzAstStructPatch({!r}, {!r}))r!   r   rA   r   s    r   r   zAstStructPatch.__repr__   s#    +22IIKK
 	
r   rL   r$   s   @r   rN   rN      s    !
r   rN   c                   (     e Zd Z	 d fd	Zd Z xZS )AstUnionDefc
           
      H    t         t        |   ||||||||       |	| _        y)z
        Args:
            closed (bool): Set if this is a closed union.

        See AstTypeDef for other constructor args.
        N)r   rR   r   closed)r
   r   r   r	   r   r=   r   rA   rB   rT   r   s             r   r   zAstUnionDef.__init__   s-     	k4)&&$fh	Hr   c                 z    dj                  | j                  | j                  | j                  | j                        S )Nz#AstUnionDef({!r}, {!r}, {!r}, {!r}))r!   r   r=   rA   rT   r   s    r   r   zAstUnionDef.__repr__   s1    4;;IILLKKKK	
 	
r   )FrL   r$   s   @r   rR   rR      s     #(

r   rR   c                   $     e Zd Z fdZd Z xZS )AstUnionPatchc                     t         t        |   |||       || _        t	        |t
              sJ || _        t	        |t        t        d       f      sJ t        |             || _	        || _
        y r   )r   rW   r   r   r:   r@   rA   r   r<   rB   rT   )	r
   r   r   r	   r   rA   rB   rT   r   s	           r   r   zAstUnionPatch.__init__   sd    mT+D&&A	&$'''([$t*$=>NXN> r   c                 d    dj                  | j                  | j                  | j                        S )NzAstUnionPatch({!r}, {!r}, {!r}))r!   r   rA   rT   r   s    r   r   zAstUnionPatch.__repr__   s*    077IIKKKK
 	
r   rL   r$   s   @r   rW   rW      s    
r   rW   c                   $     e Zd Z fdZd Z xZS )r;   c                 h    t         t        |   |||       || _        || _        || _        || _        y)aY  
        Args:
            name (str): Name of the referenced type.
            args (tuple[list, dict]): Arguments to type.
            nullable (bool): Whether the type is nullable (can be null)
            ns (Optional[str]): Namespace that referred type is a member of.
                If none, then refers to the current namespace.
        N)r   r;   r   r   argsnullablens)	r
   r   r   r	   r   r\   r]   r^   r   s	           r   r   zAstTypeRef.__init__   s4     	j$(vv>		 r   c                 z    dj                  | j                  | j                  | j                  | j                        S )Nz"AstTypeRef({!r}, {!r}, {!r}, {!r}))r!   r   r\   r]   r^   r   s    r   r   zAstTypeRef.__repr__   s1    3::IIIIMMGG	
 	
r   rL   r$   s   @r   r;   r;      s    
r   r;   c                   $     e Zd Z fdZd Z xZS )	AstTagRefc                 >    t         t        |   |||       || _        y)zK
        Args:
            tag (str): Name of the referenced type.
        N)r   ra   r   tag)r
   r   r   r	   rc   r   s        r   r   zAstTagRef.__init__   s    
 	i'ff=r   c                 8    dj                  | j                        S )NzAstTagRef({!r}))r!   rc   r   s    r   r   zAstTagRef.__repr__   s     ''HH
 	
r   rL   r$   s   @r   ra   ra      s    
r   ra   c                   $     e Zd Z fdZd Z xZS )AstAnnotationRefc                 L    t         t        |   |||       || _        || _        y)zX
        Args:
            annotation (str): Name of the referenced annotation.
        N)r   rf   r   
annotationr^   )r
   r   r   r	   rh   r^   r   s         r   r   zAstAnnotationRef.__init__   s'    
 	.tVVD$r   c                 N    dj                  | j                  | j                        S )NzAstAnnotationRef({!r}, {!r}))r!   rh   r^   r   s    r   r   zAstAnnotationRef.__repr__   s"    -44OOTWW
 	
r   rL   r$   s   @r   rf   rf      s    
r   rf   c                   $     e Zd Z fdZd Z xZS )AstAnnotationDefc	                 v    t         t        |   |||       || _        || _        || _        || _        || _        y)a  
        Args:
            name (str): Name of the defined annotation.
            annotation_type (str): Type of annotation to define.
            annotation_type_ns (Optional[str]): Namespace where the annotation
              type was defined. If None, current namespace or builtin.
            args (str): Arguments to define annotation.
            kwargs (str): Keyword Arguments to define annotation.
        N)r   rk   r   r   annotation_typeannotation_type_nsr\   kwargs)
r
   r   r   r	   r   rm   rn   r\   ro   r   s
            r   r   zAstAnnotationDef.__init__   s>     	.tVVD	."4	r   c                     dj                  | j                  | j                  | j                  | j                  | j
                        S )Nz.AstAnnotationDef({!r}, {!r}, {!r}, {!r}, {!r}))r!   r   rm   rn   r\   ro   r   s    r   r   zAstAnnotationDef.__repr__  s<    ?FFII  ##IIKK
 	
r   rL   r$   s   @r   rk   rk      s    $
r   rk   c                   $     e Zd Z fdZd Z xZS )AstAnnotationTypeDefc                 Z    t         t        |   |||       || _        || _        || _        y)a  
        Args:
            name (str): Name of the defined annotation type.
            doc (str): Docstring for the defined annotation type.
            params (List[AstField]): Parameters that can be passed to the
                annotation type.
        N)r   rr   r   r   r   params)r
   r   r   r	   r   r   rt   r   s          r   r   zAstAnnotationTypeDef.__init__  s.     	"D24H	r   c                 d    dj                  | j                  | j                  | j                        S )Nz&AstAnnotationTypeDef({!r}, {!r}, {!r}))r!   r   r   rt   r   s    r   r   zAstAnnotationTypeDef.__repr__'  s*    7>>IIHHKK
 	
r   rL   r$   s   @r   rr   rr     s    
r   rr   c                   :     e Zd ZdZ fdZd Zd Zd Zd Z xZ	S )AstFieldz
    Represents both a field of a struct and a field of a union.
    TODO(kelkabany): Split this into two different classes.
    c                     t         t        |   |||       || _        || _        d| _        d| _        d| _        g | _        y)z
        Args:
            name (str): The name of the field.
            type_ref (AstTypeRef): The data type of the field.
        NF)	r   rw   r   r   r.   r   has_defaultdefaultr/   r
   r   r   r	   r   r.   r   s         r   r   zAstField.__init__4  sD     	h&tVV<	  r   c                     || _         y r   r   r
   	docstrings     r   set_doczAstField.set_docB  	    r   c                      d| _         || _        y )NT)ry   rz   )r
   rz   s     r   set_defaultzAstField.set_defaultE  s    r   c                     || _         y r   r1   r2   s     r   r3   zAstField.set_annotationsI  r4   r   c                 d    dj                  | j                  | j                  | j                        S )NzAstField({!r}, {!r}, {!r}))r!   r   r.   r/   r   s    r   r   zAstField.__repr__L  s,    +22IIMM
 	
r   )
r   r   r   __doc__r   r   r   r3   r   r#   r$   s   @r   rw   rw   .  s!    
'
r   rw   c                   6     e Zd Z fdZd Zd Zd Zd Z xZS )AstVoidFieldc                 Z    t         t        |   |||       || _        d | _        g | _        y r   )r   r   r   r   r   r/   )r
   r   r   r	   r   r   s        r   r   zAstVoidField.__init__U  s,    lD*4@	r   c                     || _         y r   r}   r~   s     r   r   zAstVoidField.set_doc[  r   r   c                     || _         y r   r1   r2   s     r   r3   zAstVoidField.set_annotations^  r4   r   c                 "    | j                         S r   r   r   s    r   r   zAstVoidField.__str__a  r   r   c                 N    dj                  | j                  | j                        S )NzAstVoidField({!r}, {!r}))r!   r   r/   r   s    r   r   zAstVoidField.__repr__d  s%    )00II
 	
r   )	r   r   r   r   r   r3   r   r   r#   r$   s   @r   r   r   S  s    '
r   r   c                   $     e Zd Z fdZd Z xZS )AstSubtypeFieldc                 L    t         t        |   |||       || _        || _        y r   )r   r   r   r   r.   r{   s         r   r   zAstSubtypeField.__init__l  s$    ot-dFFC	 r   c                 N    dj                  | j                  | j                        S )NzAstSubtypeField({!r}, {!r})r6   r   s    r   r   zAstSubtypeField.__repr__q  s#    ,33IIMM
 	
r   rL   r$   s   @r   r   r   j  s    !

r   r   c                   .     e Zd Z	 d fd	Zd Zd Z xZS )AstRouteDefc
                     t         t        |   |||       || _        || _        || _        || _        || _        |	| _        d | _	        i | _
        y r   )r   r   r   r   version
deprecatedarg_type_refresult_type_referror_type_refr   attrs)r
   r   r   r	   r   r   r   r   r   r   r   s             r   r   zAstRouteDef.__init__y  sQ    k4)$?	$(.,
r   c                     || _         y r   r}   r~   s     r   r   zAstRouteDef.set_doc  r   r   c                     || _         y r   )r   )r
   r   s     r   	set_attrszAstRouteDef.set_attrs  s	    
r   r   )r   r   r   r   r   r   r#   r$   s   @r   r   r   w  s     @D
r   r   c                   $     e Zd Z fdZd Z xZS )AstAttrFieldc                 L    t         t        |   |||       || _        || _        y r   )r   r   r   r   valuer
   r   r   r	   r   r   r   s         r   r   zAstAttrField.__init__  s$    lD*4@	
r   c                 N    dj                  | j                  | j                        S )NzAstAttrField({!r}, {!r})r!   r   r   r   s    r   r   zAstAttrField.__repr__  s#    )00IIJJ
 	
r   rL   r$   s   @r   r   r         

r   r   c                   $     e Zd Z fdZd Z xZS )
AstExamplec                 Z    t         t        |   |||       || _        || _        || _        y r   )r   r   r   labeltextrA   )r
   r   r   r	   r   r   rA   r   s          r   r   zAstExample.__init__  s+    j$(vv>
	r   c                 d    dj                  | j                  | j                  | j                        S )NzAstExample({!r}, {!r}, {!r}))r!   r   r   rA   r   s    r   r   zAstExample.__repr__  s*    -44JJIIKK
 	
r   rL   r$   s   @r   r   r     s    
r   r   c                   $     e Zd Z fdZd Z xZS )AstExampleFieldc                 L    t         t        |   |||       || _        || _        y r   )r   r   r   r   r   r   s         r   r   zAstExampleField.__init__  s$    ot-dFFC	
r   c                 N    dj                  | j                  | j                        S )NzAstExampleField({!r}, {!r})r   r   s    r   r   zAstExampleField.__repr__  s#    ,33IIJJ
 	
r   rL   r$   s   @r   r   r     r   r   r   c                   $     e Zd Z fdZd Z xZS )AstExampleRefc                 >    t         t        |   |||       || _        y r   )r   r   r   r   )r
   r   r   r	   r   r   s        r   r   zAstExampleRef.__init__  s    mT+D&&A
r   c                 8    dj                  | j                        S )NzAstExampleRef({!r}))r!   r   r   s    r   r   zAstExampleRef.__repr__  s    $++DJJ77r   rL   r$   s   @r   r   r     s    8r   r   )collectionsr   r>   objectr   r   r&   r,   r8   rG   rN   rR   rW   r;   ra   rf   rk   rr   rw   r   r   r   r   r   r   r   r   r   r   <module>r      s   # 
f 67 6&5 5 Gw G*"
 "
H
: 
2
W 
"
* 
,
G 
&
 
2
 

w 
 
w 
:
7 
,#
w #
J
7 
.
g 
' (
7 

 

g 
8G 8r   