+
    UBi#                        R t ^ RIHt ^ RIt^ RIt^RIHt ]P                  '       d   ^ RI	t	]P                   ! R R4      4       tR# )zProvides helpers for building AST

This is meant to make building Meson AST from foreign (largely declarative)
build descriptions easier.
)annotationsN)mparserc                  >   ] tR t^t$ R]R&   R R ltR R ltR R ltR	 R
 ltR R lt	R R lt
R R ltR R ltR R ltR3R R lltR3R R lltR R ltR R ltR R ltR  R! ltR" R# ltR$ R% ltR& R' ltR( R) ltR* R+ ltR, R- ltR. R/ ltR0 R1 ltR2tR# )4Builderstrfilenamec               $    V ^8  d   QhRRRRRR/# )   tidr   valuezmparser.TV_TokenTypesreturnz$mparser.Token[mparser.TV_TokenTypes] )formats   "=/usr/lib/python3.14/site-packages/mesonbuild/cargo/builder.py__annotate__Builder.__annotate__   s(     N N# N&; N@d N    c           	     L    \         P                  ! WP                  RRRRV4      # )zCreate a Token object, but with the line numbers stubbed out.

:param tid: the token id (such as string, number, etc)
:param filename: the filename that the token was generated from
:param value: the value of the token
:return: A Token object
)r   r   )r   Tokenr   )selfr
   r   s   &&&r   _tokenBuilder._token   s!     }}S--RXuMMr   c                    V ^8  d   QhRRRR/# )r	   valr   r   zmparser.SymbolNoder   )r   s   "r   r   r   #   s     8 83 8#5 8r   c                	N    \         P                  ! V P                  R V4      4      # ) )r   
SymbolNoder   )r   r   s   &&r   _symbolBuilder._symbol#   s    !!$++b#"677r   c               $    V ^8  d   QhRRRRRR/# )r	   r   mparser.BaseNodevarnamer   r   zmparser.AssignmentNoder   )r   s   "r   r   r   &   s(     Z Z, Zs Z?U Zr   c                	n    \         P                  ! V P                  V4      V P                  R 4      V4      # )=)r   AssignmentNode
identifierr   r   r   r"   s   &&&r   assignBuilder.assign&   s*    %%doog&>S@QSXYYr   c                    V ^8  d   QhRRRR/# )r	   r   r   r   zmparser.StringNoder   )r   s   "r   r   r   )   s     N NC N$6 Nr   c                R    \         P                  ! V P                  RV4      RR7      # )zPBuild A StringNode

:param value: the value of the string
:return: A StringNode
stringF)escape)r   
StringNoder   r   r   s   &&r   r,   Builder.string)   s"     !!$++h">uMMr   c                    V ^8  d   QhRRRR/# )r	   r   intr   zmparser.NumberNoder   )r   s   "r   r   r   1   s     E EC E$6 Er   c                `    \         P                  ! V P                  R\        V4      4      4      # )zPBuild A NumberNode

:param value: the value of the number
:return: A NumberNode
number)r   
NumberNoder   r   r/   s   &&r   r4   Builder.number1   s$     !!$++hE
"CDDr   c                    V ^8  d   QhRRRR/# )r	   r   zbuiltins.boolr   zmparser.BooleanNoder   )r   s   "r   r   r   9   s     ? ?- ?,? ?r   c                N    \         P                  ! V P                  RV4      4      # )zSBuild A BooleanNode

:param value: the value of the boolean
:return: A BooleanNode
bool)r   BooleanNoder   r/   s   &&r   r9   Builder.bool9   s      ""4;;vu#=>>r   c                    V ^8  d   QhRRRR/# )r	   r   T.List[mparser.BaseNode]r   zmparser.ArrayNoder   )r   s   "r   r   r   A   s      M M3 M8I Mr   c                    \         P                  ! V P                  RR4      4      pWn        \         P                  ! V P                  R4      W P                  R4      4      # )z{Build an Array Node

:param value: A list of nodes to insert into the array
:return: An ArrayNode built from the arguments
arrayunused[])r   ArgumentNoder   	arguments	ArrayNoder   )r   r   argss   && r   r?   Builder.arrayA   sI     ##DKK$BC  c!2D,,s:KLLr   c                    V ^8  d   QhRRRR/# )r	   r   z*T.Dict[mparser.BaseNode, mparser.BaseNode]r   zmparser.DictNoder   )r   s   "r   r   r   K   s      	L 	LD 	LIY 	Lr   c                   \         P                  ! V P                  RR4      4      pVP                  4        F  w  r4VP	                  W44       K  	  \         P
                  ! V P                  R4      W P                  R4      4      # )zBuild an Dictionary Node

:param value: A dict of nodes to insert into the dictionary
:return: An DictNode built from the arguments
dictr@   {})r   rC   r   itemsset_kwarg_no_checkDictNoder   )r   r   rF   keyr   s   &&   r   rJ   Builder.dictK   sd     ##DKK$ABHC##C- &S 14c9JKKr   c                    V ^8  d   QhRRRR/# )r	   r   r   r   zmparser.IdNoder   )r   s   "r   r   r   V   s     8 8 8 8r   c                N    \         P                  ! V P                  RV4      4      # )zNBuild A IdNode

:param value: the value of the boolean
:return: A BooleanNode
id)r   IdNoder   r/   s   &&r   r&   Builder.identifierV   s     ~~dkk$677r   Nc          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r	   namer   id_r!   pos$T.Optional[T.List[mparser.BaseNode]]kw,T.Optional[T.Mapping[str, mparser.BaseNode]]r   zmparser.MethodNoder   )r   s   "r   r   r   ^   s<     } }3 }%5 }8}?} '}r   c           
        \         P                  ! V P                  RR4      4      pVe   W5n        Ve:   VP	                  4        UUu/ uF  w  rgV P                  V4      VbK  	  uppVn        \         P                  ! W P                  R4      V P                  V4      V P                  R4      WPP                  R4      4      # u uppi )a  Create a method call.

:param name: the name of the method
:param id_: the object to call the method of
:param pos: a list of positional arguments, defaults to None
:param kw: a dictionary of keyword arguments, defaults to None
:return: a method call object
r?   r@   .())	r   rC   r   rD   rM   r&   kwargs
MethodNoder   )r   rX   rY   rZ   r\   rF   kvs   &&&&&   r   methodBuilder.method^   s     ##DKK$BC? N>=?XXZHZTQ4??1-q0ZHDK!!#||C'8$//$:OQUQ]Q]^aQbdhjvjvwzj{|| Is   Cc               (    V ^8  d   QhRRRRRRRR/# )	r	   rX   r   rZ   r[   r\   r]   r   zmparser.FunctionNoder   )r   s   "r   r   r   q   s3     g gS g:gAg +gr   c                r   \         P                  ! V P                  RR4      4      pVe   W$n        Ve:   VP	                  4        UUu/ uF  w  rVV P                  V4      VbK  	  uppVn        \         P                  ! V P                  V4      V P                  R4      W@P                  R4      4      # u uppi )zCreate a function call.

:param name: the name of the function
:param pos: a list of positional arguments, defaults to None
:param kw: a dictionary of keyword arguments, defaults to None
:return: a method call object
r?   r@   r`   ra   )	r   rC   r   rD   rM   r&   rb   FunctionNoder   )r   rX   rZ   r\   rF   rd   re   s   &&&&   r   functionBuilder.functionq   s     ##DKK$BC? N>=?XXZHZTQ4??1-q0ZHDK##DOOD$94<<;LdT`T`adTeff Is   B3c               $    V ^8  d   QhRRRRRR/# r	   lhsr!   rhsr   zmparser.ComparisonNoder   )r   s   "r   r   r      s)     J J) J0@ JE[ Jr   c                P    \         P                  ! RWP                  R4      V4      # )zCreate an equality operation

:param lhs: The left hand side of the equal
:param rhs: the right hand side of the equal
:return: A comparison node
z==r   ComparisonNoder   r   ro   rp   s   &&&r   equalBuilder.equal   "     %%dCd1CSIIr   c               $    V ^8  d   QhRRRRRR/# rn   r   )r   s   "r   r   r      s)     J J- J4D JI_ Jr   c                P    \         P                  ! RWP                  R4      V4      # )zCreate an inequality operation

:param lhs: The left hand side of the "!="
:param rhs: the right hand side of the "!="
:return: A comparison node
z!=rr   rt   s   &&&r   	not_equalBuilder.not_equal   rw   r   c               $    V ^8  d   QhRRRRRR/# rn   r   )r   s   "r   r   r      s)     J J' J.> JCY Jr   c                P    \         P                  ! RWP                  R4      V4      # )zCreate an "in" operation

:param lhs: The left hand side of the "in"
:param rhs: the right hand side of the "in"
:return: A comparison node
inrr   rt   s   &&&r   in_Builder.in_   rw   r   c               $    V ^8  d   QhRRRRRR/# rn   r   )r   s   "r   r   r      s)     Q Q* Q1A QF\ Qr   c                P    \         P                  ! RWP                  R4      V4      # )zCreate an "not in" operation

:param lhs: The left hand side of the "not in"
:param rhs: the right hand side of the "not in"
:return: A comparison node
notinznot inrr   rt   s   &&&r   not_inBuilder.not_in   s"     %%gsLL4JCPPr   c               $    V ^8  d   QhRRRRRR/# )r	   ro   r!   rp   r   zmparser.OrNoder   )r   s   "r   r   r      s#     < <' <.> <> <r   c                N    \         P                  ! WP                  R4      V4      # )zjCreate and OrNode

:param lhs: The Left of the Node
:param rhs: The Right of the Node
:return: The OrNode
or)r   OrNoder   rt   s   &&&r   or_Builder.or_   s     ~~c<<#5s;;r   c               $    V ^8  d   QhRRRRRR/# )r	   ro   r!   rp   r   zmparser.AndNoder   )r   s   "r   r   r      s#     > >( >/? >O >r   c                N    \         P                  ! WP                  R4      V4      # )ziCreate an AndNode

:param lhs: The left of the And
:param rhs: The right of the And
:return: The AndNode
and)r   AndNoder   rt   s   &&&r   and_Builder.and_   s     sLL$7==r   c                    V ^8  d   QhRRRR/# )r	   r   r!   r   zmparser.NotNoder   )r   s   "r   r   r      s     S S* S Sr   c                p    \         P                  ! V P                  RR4      V P                  R4      V4      # )zJCreate a not node

:param value: The value to negate
:return: The NotNode
notr   )r   NotNoder   r   r/   s   &&r   not_Builder.not_   s+     t{{5"5t||E7JERRr   c                    V ^8  d   QhRRRR/# )r	   linesr=   r   mparser.CodeBlockNoder   )r   s   "r   r   r      s      3 8M r   c                	^    \         P                  ! V P                  R R4      4      pWn        V# )noder   )r   CodeBlockNoder   r   )r   r   blocks   && r   r   Builder.block   s'    %%dkk&"&=>r   c               $    V ^8  d   QhRRRRRR/# )r	   ro   r!   rp   r   zmparser.ArithmeticNoder   )r   s   "r   r   r      s)     J J( J/? JDZ Jr   c                P    \         P                  ! RWP                  R4      V4      # )zCreate an addition node

:param lhs: The left of the addition
:param rhs: The right of the addition
:return: The ArithmeticNode
add+)r   ArithmeticNoder   rt   s   &&&r   plusBuilder.plus   s"     %%eS,,s2CSIIr   c               $    V ^8  d   QhRRRRRR/# )r	   r   r!   r"   r   r   zmparser.PlusAssignmentNoder   )r   s   "r   r   r      s(     _ _ 0 _3 _C] _r   c                n    \         P                  ! V P                  V4      V P                  R4      V4      # )zzCreate a "+=" node

:param value: The value to add
:param varname: The variable to assign
:return: The PlusAssignmentNode
z+=)r   PlusAssignmentNoder&   r   r'   s   &&&r   
plusassignBuilder.plusassign   s-     ))$//'*BDLLQUDVX]^^r   c               $    V ^8  d   QhRRRRRR/# )r	   	conditionr!   r   r   r   zmparser.IfClauseNoder   )r   s   "r   r   r      s$     
 
- 
6K 
Pd 
r   c                    \         P                  ! V4      pVP                  P                  \         P                  ! W0P                  R4      W4      4       \         P                  ! RRV P                  4      Vn        V# )zxCreate a "if" block

:param condition: The condition
:param block: Lines inside the condition
:return: The IfClauseNode
ifr   )	r   IfClauseNodeifsappendIfNoder   	EmptyNoder   	elseblock)r   r   r   clauses   &&& r   if_Builder.if_   sZ     %%i0

'..d1CYVW",,RT]]Cr   c               (    V ^8  d   QhRRRRRRRR/# )	r	   varnameszT.List[str]rM   r!   r   r   r   zmparser.ForeachClauseNoder   )r   s   "r   r   r      s5     
O 
O 
O4D 
OMb 
O  hA 
Or   c                R   V Uu. uF  q@P                  V4      NK  	  pp\        \        V4      ^,
          4       Uu. uF  q@P                  R4      NK  	  pp\        P
                  ! V P                  R4      WVV P                  R4      W#V P                  R4      4      # u upi u upi )zCreate a "foreach" loop

:param varnames: Iterator variable names (one for list, two for dict).
:param items: The list of dict to iterate
:param block: Lines inside the loop
:return: The ForeachClauseNode
,foreach:
endforeach)r&   rangelenr   r   ForeachClauseNode)r   r   rM   r   ivaridscommass   &&&&   r   r   Builder.foreach   s     /77h//!$h7-23x=13D-EF-E,,s#-EF((i)@&RVR^R^_bRcejswss  AM  tN  O  	O 8Fs
   BB$r   )NN)__name__
__module____qualname____firstlineno____annotations__r   r   r(   r,   r4   r9   r?   rJ   r&   rf   rk   ru   rz   r   r   r   r   r   r   r   r   r   r   __static_attributes__r   r   r   r   r      s     MN8ZNE?M	L8}&g$JJJQ<>S
J_

O 
Or   r   )__doc__
__future__r   dataclassestypingTr   r   TYPE_CHECKINGbuiltins	dataclassr   r   r   r   <module>r      sI    #   ??? YO YO YOr   