+
    ¿Ìjû  ã                   ó2  € R t ^ RIHtHtHtHtHtHt ^ RIH	t	H
t
 ^ RIHt ]]	],          ]3,          t]]	],          ]3,          t]]]	3,          tRt ! R R4      t ! R R]
]]	],          3,          4      t ! R	 R
4      tR R lt ! R R4      tR R ltR# )z™This module defines utilities for matching and translation tree templates.

A tree templates is a tree that contains nodes that are template variables.

)ÚUnionÚOptionalÚMappingÚDictÚTupleÚIterator)ÚTreeÚTransformer)ÚMissingVariableErrorÚ$c                   óv   a € ] tR t^t o RtRR ltV 3R lR ltV 3R lR ltV 3R lR	 ltV 3R
 lR lt	Rt
V tR# )ÚTemplateConfzrTemplate Configuration

Allows customization for different uses of Template

parse() must return a Tree instance.
Nc                ó   € Wn         R # ©N©Ú_parse)ÚselfÚparses   &&Úm/home/l0st/web/w4ttz.lol/public_html/toolz/MsgDoxxer/venv/lib/python3.14/site-packages/lark/tree_templates.pyÚ__init__ÚTemplateConf.__init__   s   € ØŽó    c                ó\   <€ V ^8„  d   QhRS[ S[S[,          S[3,          RS[S[,          /# )é   ÚvarÚreturn)r   r   Ústrr   )ÚformatÚ__classdict__s   "€r   Ú__annotate__ÚTemplateConf.__annotate__   s,   ø€ ÷ ñ ™E¡$¡s¥)©S .Õ1ð ±h¹sµmñ r   c                óP  € \        V\        4      '       d   \        V4      # \        V\        4      '       do   VP                  R8X  d^   \        VP                  4      ^ 8”  dD   \        VP                  ^ ,          \        4      '       d   \        VP                  ^ ,          4      # R# )zÄGiven a tree node, if it is a template variable return its name. Otherwise, return None.

This method may be overridden for customization

Parameters:
    var: Tree | str - The tree node to test

r   N)Ú
isinstancer   Ú_get_template_namer   ÚdataÚlenÚchildren)r   r   s   &&r   Útest_varÚTemplateConf.test_var   ss   € ô �cœ3×ÒÜ% cÓ*Ð*ô �sœD×!Ò!Ø—‘˜EÔ!Ü�C—L‘LÓ! AÔ%Ü˜3Ÿ<™<¨�?¬C×0Ò0ä% c§l¡l°1¥oÓ6Ð6ár   c                ó6   <€ V ^8„  d   QhRS[ RS[S[,          /# )r   Útemplater   )Ú
TreeOrCoder   r   )r   r   s   "€r   r   r    3   s   ø€ ÷ ñ ¡*ð ±±cµñ r   c                ó¾   € \        V\        4      '       d&   V P                  '       g   Q hV P                  V4      p\        V\        4      '       g   \	        R 4      hV# )z+template parser must return a Tree instance)r"   r   r   r   Ú	TypeError©r   r*   s   &&r   Ú	_get_treeÚTemplateConf._get_tree3   sI   € Ü�h¤×$Ò$Ø—;—;�;Ð�;Ø—{‘{ 8Ó,ˆHä˜(¤D×)Ò)ÜÐIÓJÐJàˆr   c                ó4   <€ V ^8„  d   QhRS[ S[,          RR/# )r   r*   r   ÚTemplate©r   r   )r   r   s   "€r   r   r    =   s   ø€ ÷ -ñ -¡¡c¥ð -¨zñ -r   c                ó   € \        WR 7      # ))Úconf)r2   r.   s   &&r   Ú__call__ÚTemplateConf.__call__=   s   € Ü˜Ô,Ð,r   c                ó<   <€ V ^8„  d   QhRS[ RS[RS[S[,          /# )r   r*   Útreer   )r+   ÚBranchr   ÚMatchResult)r   r   s   "€r   r   r    @   s(   ø€ ÷ ñ ©Zð ¹vð É(ÑS^ÕJ_ñ r   c                óv  € V P                  V4      pV'       d)   \        V\        4      '       g   \        RV: 24      hW2/# \        V\        4      '       d   W8X  d   / # R# \        V\        4      '       d   \        V\        4      '       g   Q RV RV 24       hVP
                  VP
                  8X  d„   \        VP                  4      \        VP                  4      8X  dW   / p\        VP                  VP                  4       F.  w  rVV P                  WV4      pVf    R# VP                  V4       K0  	  V# R# )zAReturns dict of {var: match} if found a match, else None
        z6Template variables can only match Tree instances. Not Nz	template=z tree=)r'   r"   r   r-   r   r$   r%   r&   ÚzipÚ_match_tree_templateÚupdate)r   r*   r9   Útemplate_varÚresÚt1Út2Úmatchess   &&&     r   r>   Ú!TemplateConf._match_tree_template@   s  € ð —}‘} XÓ.ˆßÜ˜d¤D×)Ò)ÜÐ"XÐY]ÑX`Ð aÓbÐbØ Ð'Ð'ä�h¤×$Ò$ØÔØ�	Ùä˜(¤D×)Ò)¬j¸¼t×.DÒ.DÐhÈ	ÐRZÐQ[Ð[aÐbfÐagÐFhÓhÐDà�=‰=˜DŸI™IÔ%¬#¨h×.?Ñ.?Ó*@ÄCÈÏÉÓDVÔ*VØˆCÜ˜h×/Ñ/°·±Ö?‘�Ø×3Ñ3°BÓ;�Ø’?Úà—
‘
˜7Ö#ñ @ð ˆJár   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r'   r/   r6   r>   Ú__static_attributes__Ú__classdictcell__©r   s   @r   r   r      s7   ø‡ € ñô÷ð ÷,ð ÷-ð -÷ö r   r   c                   óV   a a€ ] tR t^^t oV3R lV 3R lltV3R lV 3R lltRtVtV ;t# )Ú_ReplaceVarsc                óP   <€ V ^8„  d   QhRS[ RS[S[S[S[,          3,          RR/# )r   r5   Úvarsr   N)r   r   r   r   )r   r   s   "€r   r   Ú_ReplaceVars.__annotate___   s/   ø€ ÷ ñ ™\ð ±¹¹dÁ3½i¸Õ1Hð ÈTñ r   c                ó<   <€ \         SV `  4        Wn        W n        R # r   )Úsuperr   Ú_confÚ_vars)r   r5   rQ   Ú	__class__s   &&&€r   r   Ú_ReplaceVars.__init___   s   ø€ Ü‰ÑÔØŒ
ØŽ
r   c                ó0   <€ V ^8„  d   QhRS[ S[,          /# )r   r   r3   )r   r   s   "€r   r   rR   d   s   ø€ ÷ 	ñ 	±4¹µ9ñ 	r   c                óÒ   <€ \         SV `  WV4      pV P                  P                  V4      pV'       d    V P                  V,          # V#   \
         d    \        R T R24      hi ; i)z"No mapping for template variable (Ú))rT   Ú__default__rU   r'   rV   ÚKeyErrorr
   )r   r$   r&   Úmetar9   r   rW   s   &&&&  €r   r\   Ú_ReplaceVars.__default__d   sp   ø€ Ü‰wÑ" 4°4Ó8ˆà�j‰j×!Ñ! $Ó'ˆßðXØ—z‘z #•Ð&ð ˆøô ô XÜ*Ð-OÐPSÈuÐTUÐ+VÓWÐWðXús   ¶A ÁA&)rU   rV   )	rF   rG   rH   rI   r   r\   rK   rL   Ú__classcell__)rW   r   s   @@r   rO   rO   ^   s   ù‡ € ÷ó ÷
	÷ 	ó 	r   rO   c                   ó|   a € ] tR t^pt o Rt]! 4       3V 3R lR lltV 3R lR ltV 3R lR ltV 3R lR	 lt	R
t
V tR# )r2   a
  Represents a tree template, tied to a specific configuration

A tree template is a tree that contains nodes that are template variables.
Those variables will match any tree.
(future versions may support annotations on the variables, to allow more complex templates)
c                ó6   <€ V ^8„  d   QhRS[ S[,          RS[/# )r   r9   r5   )r   r   r   )r   r   s   "€r   r   ÚTemplate.__annotate__x   s   ø€ ÷ )ñ )™T¡#�Yð )©lñ )r   c                ó>   € W n         VP                  V4      V n        R # r   )r5   r/   r9   )r   r9   r5   s   &&&r   r   ÚTemplate.__init__x   s   € ØŒ	Ø—N‘N 4Ó(ˆŽ	r   c                ó6   <€ V ^8„  d   QhRS[ RS[S[,          /# ©r   r9   r   )r+   r   r;   )r   r   s   "€r   r   rc   |   s    ø€ ÷ ?ñ ?™*ð ?©±+Õ)>ñ ?r   c                ó„   € V P                   P                  V4      pV P                   P                  V P                  V4      # )a�  Match a tree template to a tree.

A tree template without variables will only match ``tree`` if it is equal to the template.

Parameters:
    tree (Tree): The tree to match to the template

Returns:
    Optional[Dict[str, Tree]]: If match is found, returns a dictionary mapping
        template variable names to their matching tree nodes.
        If no match was found, returns None.
)r5   r/   r>   r9   )r   r9   s   &&r   ÚmatchÚTemplate.match|   s3   € ð �y‰y×"Ñ" 4Ó(ˆØ�y‰y×-Ñ-¨d¯i©i¸Ó>Ð>r   c                ó\   <€ V ^8„  d   QhRS[ RS[S[S[S[,          S[3,          ,          /# rg   )r+   r   r   r   r   r;   )r   r   s   "€r   r   rc   Œ   s.   ø€ ÷ #ñ #™:ð #©(±5¹¹c½ÁKÐ9OÕ3PÕ*Qñ #r   c              #  ó²   "  € V P                   P                  V4      pVP                  4        F#  pV P                  V4      pV'       g   K  W#3x € K%  	  R# 5i)zISearch for all occurrences of the tree template inside ``tree``.
        N)r5   r/   Úiter_subtreesri   )r   r9   ÚsubtreerA   s   &&  r   ÚsearchÚTemplate.searchŒ   sI   é € ð �y‰y×"Ñ" 4Ó(ˆØ×)Ñ)Ö+ˆGØ—*‘*˜WÓ%ˆCß‰sØ�lÔ"ó ,ùs   ‚AAÁAc                ó\   <€ V ^8„  d   QhRS[ S[S[S[,          3,          RS[S[,          /# )r   rQ   r   )r   r   r   )r   r   s   "€r   r   rc   •   s0   ø€ ÷ Bñ B™w¡s©D±­I ~Õ6ð B¹4Á½9ñ Br   c                ó`   € \        V P                  V4      P                  V P                  4      # )z(Apply vars to the template tree
        )rO   r5   Ú	transformr9   )r   rQ   s   &&r   Ú
apply_varsÚTemplate.apply_vars•   s$   € ô ˜DŸI™I tÓ,×6Ñ6°t·y±yÓAÐAr   )r5   r9   N)rF   rG   rH   rI   rJ   r   r   ri   ro   rt   rK   rL   rM   s   @r   r2   r2   p   s<   ø‡ € ññ >J»^÷ )ò )÷?ð ?÷ #ð #÷Bö Br   r2   c                ó<   € V ^8„  d   QhR\         R\         R\        /# )r   rB   rC   r9   )r2   r+   )r   s   "r   r   r   ›   s!   € ÷ ñ ”(ð ¤ð ´
ñ r   c                óÞ   € V P                   P                  V4      pV P                  V4       F<  w  r4VP                  V4      pVP	                  VP
                  VP                  4       K>  	  V# )z=Search tree and translate each occurrence of t1 into t2.
    )r5   r/   ro   rt   Úsetr$   r&   )rB   rC   r9   rn   rQ   rA   s   &&&   r   Ú	translatery   ›   sW   € ð �7‰7×Ñ˜TÓ"€DØŸ™ 4ž‰ˆØ�m‰m˜DÓ!ˆØ�‰�C—H‘H˜cŸl™lÖ+ñ )ð €Kr   c                   óH   a € ] tR t^¥t o RtV 3R lR ltV 3R lR ltRtV tR# )ÚTemplateTranslatorz;Utility class for translating a collection of patterns
    c                ó6   <€ V ^8„  d   QhRS[ S[S[3,          /# )r   Útranslations)r   r2   )r   r   s   "€r   r   ÚTemplateTranslator.__annotate__©   s   ø€ ÷ )ñ )¡W©X±xÐ-?Õ%@ñ )r   c                óÂ   € \         ;QJ d*    R  VP                  4        4       F  '       d   K   RM	  RM! R  VP                  4        4       4      '       g   Q hWn        R# )c              3   óv   "  € T F/  w  r\        V\        4      ;'       d    \        V\        4      x € K1  	  R # 5ir   )r"   r2   )Ú.0ÚkÚvs   &  r   Ú	<genexpr>Ú.TemplateTranslator.__init__.<locals>.<genexpr>ª   s-   é € ÐhÑSgÉ4È1”:˜a¤Ó*×FÐF¬z¸!¼XÓ/FÔFÓSgùs   ‚9 9FTN)ÚallÚitemsr}   )r   r}   s   &&r   r   ÚTemplateTranslator.__init__©   sC   € ß‹sÑhÐS_×SeÑSeÔSgÓh�s�sŠsÑhÐS_×SeÑSeÔSgÓh×hÒhÐhÐhØ(Ör   c                ó0   <€ V ^8„  d   QhRS[ S[,          /# )r   r9   r3   )r   r   s   "€r   r   r~   ­   s   ø€ ÷ ñ ™d¡3�iñ r   c                ód   € V P                   P                  4        F  w  r#\        W#V4      pK  	  V# r   )r}   r‡   ry   )r   r9   r‚   rƒ   s   &&  r   ry   ÚTemplateTranslator.translate­   s.   € Ø×%Ñ%×+Ñ+Ö-‰DˆAÜ˜Q 4Ó(ŠDñ .àˆr   )r}   N)	rF   rG   rH   rI   rJ   r   ry   rK   rL   rM   s   @r   r{   r{   ¥   s   ø‡ € ñ÷)ð )÷ö r   r{   c                óF   € V ^8„  d   QhR\         R\        \         ,          /# )r   Úvaluer   )r   r   )r   s   "r   r   r   ³   s"   € ÷ Zñ Zœcð Z¤h¬s¥mñ Zr   c                 óf   € V P                  \        4      '       d   V P                  \        4      # R # r   )Ú
startswithÚ_TEMPLATE_MARKERÚlstrip)r�   s   &r   r#   r#   ³   s)   € Ø-2×-=Ñ-=Ô>N×-OÒ-Oˆ5�<‰<Ô(Ó)ÐYÐUYÐYr   N)rJ   Útypingr   r   r   r   r   r   Úlarkr   r	   Úlark.exceptionsr
   r   r:   r+   r;   r�   r   rO   r2   ry   r{   r#   © r   r   Ú<module>r–      s˜   ðñ÷ C× Bç "Ý 0à	ˆt�C�y˜#ˆ~Õ	€Ø�4˜•9˜c�>Õ"€
Ø�3˜�9�o€ØÐ ÷Iñ IôX�;˜s D¨¥I˜~Õ.ô ÷$(Bñ (BõV÷ñ ÷Zr   