ó
    …~i”  ã                  ó¨   • S SK Jr  S SKrS SKrS SKrS SKJr  S SKJrJ	r	J
r
JrJrJr  S SKJrJr  \(       a  S SKJr  S SKJr  SS jr " S	 S
5      rg)é    )ÚannotationsN)Úcontextmanager)ÚTYPE_CHECKINGÚ	GeneratorÚMatchÚPatternÚcastÚoverload)ÚBlockElementÚDocument)ÚLiteral)ÚParserc                ó&   • U R                  SS5      $ )Nz
Ú
)Úreplace)Útexts    ÚI/home/mande/repo/quber/.venv/lib/python3.13/site-packages/marko/source.pyÚ_preprocess_textr      s   € Ø�<‰<˜ Ó%Ð%ó    c                  óR  • \ rS rSr% SrS\S'   SS jr\SS j5       r\SS j5       r	SS jr
SS	 jr\SS
 j5       r\SS j5       r\SS j5       rS S jr\\R&                  S!S j5       5       rS"S jr\S#S$S jj5       r\S#S%S jj5       rS&S'S jjrS(S jrS(S jrS(S jrS(S jrSrg))ÚSourceé   z%Wrapper class on content to be parsedr   Úparserc                ó�   • [        U5      U l        SU l        SU l        / U l        S U l        [        R                  " 5       U l        g )Nr   )	r   Ú_bufferÚposÚ_anchorÚ_statesÚmatchÚtypesÚSimpleNamespaceÚcontext)Úselfr   s     r   Ú__init__ÚSource.__init__   s:   € Ü'¨Ó-ˆŒØˆŒØˆŒØ+-ˆŒØ(,ˆŒ
ä×,Ò,Ó.ˆ�r   c                óX   • U R                   (       d  [        S5      eU R                   S   $ )z"Returns the current element state.úNeed to push a state first.éÿÿÿÿ)r   ÚRuntimeError©r#   s    r   ÚstateÚSource.state#   s&   € ð �|�|ÜÐ<Ó=Ð=Ø�|‰|˜BÑÐr   c                ót   • U R                   (       d  [        S5      e[        [        U R                   S   5      $ )zAReturns the root element, which is at the bottom of self._states.r'   r   )r   r)   r	   r   r*   s    r   ÚrootÚSource.root*   s,   € ð �|�|ÜÐ<Ó=Ð=Ü”H˜dŸl™l¨1™oÓ.Ð.r   c                ó:   • U R                   R                  U5        g)z$Push a new state to the state stack.N)r   Úappend©r#   Úelements     r   Ú
push_stateÚSource.push_state1   s   € à�‰×Ñ˜GÕ$r   c                ó6   • U R                   R                  5       $ )zPop the top most state.)r   Úpopr*   s    r   Ú	pop_stateÚSource.pop_state5   s   € à�|‰|×ÑÓ!Ð!r   c              #  óV   #   • U R                  U5        U v •  U R                  5         g7f)z4A context manager to enable a new state temporarily.N)r4   r8   r2   s     r   Úunder_stateÚSource.under_state9   s"   é € ð 	�‰˜Ô ØŠ
Ø�‰Õùs   ‚')c                óF   • U R                   [        U R                  5      :¬  $ )z-Indicates whether the source reaches the end.)r   Úlenr   r*   s    r   Ú	exhaustedÚSource.exhausted@   s   € ð �x‰xœ3˜tŸ|™|Ó,Ñ,Ð,r   c                óF   • SR                  S U R                   5       5      $ )z%The prefix of each line when parsing.Ú c              3  ó8   #   • U  H  oR                   v •  M     g 7f©N)Ú_prefix)Ú.0Úss     r   Ú	<genexpr>Ú Source.prefix.<locals>.<genexpr>H   s   é € Ð7ª, Q—y–yª,ùs   ‚)Újoinr   r*   s    r   ÚprefixÚSource.prefixE   s   € ð �w‰wÑ7¨$¯,ª,Ó7Ó7Ð7r   c                ó�   • [        U[        5      (       a  [        R                  " U5      nUR	                  U R
                  U5      $ rD   )Ú
isinstanceÚstrÚreÚcompiler   r   )r#   Úregexpr   s      r   Ú
_expect_reÚSource._expect_reJ   s2   € Ü�fœc×"Ñ"Ü—Z’Z Ó'ˆFØ�|‰|˜DŸL™L¨#Ó.Ð.r   c                ó¤  • [         R                  " XR                  S5      5      nU(       dI  [         R                  " XR                  S5      R                  SS5      5      (       a  [	        U5      S-
  $ gUR                  5       nUS:X  a  g[        S[	        U5      S-   5       H(  n[	        USU R                  S5      5      U:¼  d  M&  Us  $    g)z‚Check if the line starts with given prefix and
return the position of the end of prefix.
If the prefix is not matched, return -1.
é   r   zd                                                                                                   
é   r(   r   N)rP   r   Ú
expandtabsr   r>   ÚendÚrange)rK   ÚlineÚmr   Úis        r   Úmatch_prefixÚSource.match_prefixO   sª   € ô �HŠH�VŸ_™_¨QÓ/Ó0ˆÞÜ�xŠx˜§¡°Ó 2× :Ñ :¸4ÀÓ Q×RÑRÜ˜4“y 1‘}Ð$ØØ�e‰e‹gˆØ�!‹8ØÜ�qœ#˜d›) a™-Ö(ˆAÜ�4˜˜�8×&Ñ& qÓ)Ó*¨cÕ1Ø’ñ )ð r   c                ó®   • U R                  U R                  U R                  SS95      nUS:¼  a&  U R                  XR                  U-   5      nX0l        U$ g)z�Test against the given regular expression and returns the match object.
:param regexp: the expression to be tested.
:returns: the match object.
F)Úrequire_prefixr   N)r^   rK   Ú	next_linerS   r   r   )r#   rR   Ú
prefix_lenr   s       r   Ú	expect_reÚSource.expect_rec   sU   € ð
 ×&Ñ&Ø�K‰K˜Ÿ™°u˜Ð=ó
ˆ
ð ˜‹?Ø—O‘O F¯H©H°zÑ,AÓBˆEØŒJØˆLàr   c                ó   • g rD   © ©r#   ra   s     r   rb   ÚSource.next_liner   s   € ØFIr   c                ó   • g rD   rg   rh   s     r   rb   ri   u   s   € ØLOr   c                ó¨   • U(       a  U R                  S5      nOU R                  SU R                  5      nX l        U(       a  UR	                  5       $ g)zÆReturn the next line in the source.

:param require_prefix:  if False, the whole line will be returned.
    otherwise, return the line with prefix stripped or None if the prefix
    is not matched.
z(?m)[^\n]*?$\n?z(?m)[^\n]*$\n?N)rd   rS   r   r   Úgroup)r#   ra   r\   s      r   rb   ri   x   sB   € ö Ø—‘Ð1Ó2‰Aà—‘Ð 1°4·8±8Ó<ˆAØŒ
ÞØ—7‘7“9ÐØr   c                óÖ   • U R                   (       aX  U R                   R                  5       U l        U R                   R                  5       SS S:X  a  U R	                  5         SU l         gg)z6Consume the body of source. ``pos`` will move forward.r(   Nr   )r   rY   r   rl   Ú_update_prefixr*   s    r   ÚconsumeÚSource.consumeˆ   sO   € à�:�:Ø—z‘z—~‘~Ó'ˆDŒHØ�z‰z×ÑÓ! " #Ð&¨$Ó.Ø×#Ñ#Ô%ØˆD�Jð	 r   c                ó&   • U R                   U l        g)z!Pin the current parsing position.N)r   r   r*   s    r   ÚanchorÚSource.anchor�   s   € à—x‘xˆ�r   c                ó&   • U R                   U l        g)z&Reset the position to the last anchor.N)r   r   r*   s    r   ÚresetÚSource.reset”   s   € à—<‘<ˆ�r   c                ór   • U R                    H'  n[        US5      (       d  M  UR                  Ul        M)     g )NÚ_second_prefix)r   Úhasattrrx   rE   )r#   rG   s     r   rn   ÚSource._update_prefix˜   s+   € Ø—”ˆAÜ�qÐ*×+Ó+Ø×,Ñ,�–	ò r   )r   r   r   r"   r   r   N)r   rO   ÚreturnÚNone)r{   r   )r{   r   )r3   r   r{   r|   )r3   r   r{   zGenerator[Source, None, None])r{   Úbool)r{   rO   )rR   úPattern[str] | strr   Úintr{   úMatch[str] | None)rK   rO   r[   rO   r{   r   )rR   r~   r{   r€   ).)ra   zLiteral[False]r{   rO   )ra   zLiteral[True]r{   ú
str | None)T)ra   r}   r{   r�   )r{   r|   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotations__r$   Úpropertyr+   r.   r4   r8   r   r;   r?   rK   rS   ÚstaticmethodÚ	functoolsÚ	lru_cacher^   rd   r
   rb   ro   rr   ru   rn   Ú__static_attributes__rg   r   r   r   r      sà   ‡ Ù/àƒNô/ð ó ó ð ð ó/ó ð/ô%ô"ð óó ðð ó-ó ð-ð ó8ó ð8ô/ð
 Ø×Ñóó ó ðô$ð ÝIó ØIàÝOó ØOöô ô ô ÷-r   r   )r   rO   r{   rO   )Ú
__future__r   rŠ   rP   r    Ú
contextlibr   Útypingr   r   r   r   r	   r
   Úmarko.blockr   r   r   Úmarko.parserr   r   r   rg   r   r   Ú<module>r’      s7   ðÝ "ã Û 	Û Ý %ß K× Kç .æÝå#ô&÷F-ò F-r   