ó
    ‰*£h
K  ã                   óÀ   • S SK r \ R                  R                  S:”  a  S r\rS rS rO\rS rS r " S S	\	5      r
 " S
 S\	5      r " S S\
5      r " S S\5      rg)é    Né   c                 ó   • U $ ©N© )Úss    Ú]/home/mande/repo/quber/.venv/lib/python3.13/site-packages/pylatexenc/macrospec/_argparsers.pyÚunicoder	   %   s   € ˜1�Hó    c                 ó   • U $ r   r   ©Úxs    r   Ú<lambda>r   '   ó   € ¡!r
   c                 ó   • U $ r   r   r   s    r   r   r   (   r   r
   c                 ó6   • [        U 5      R                  S5      $ ©Nzutf-8)r	   Úencoder   s    r   r   r   ,   s   € ¤'¨!£*×"3Ñ"3°GÔ"<r
   c                 ó$   • U R                  S5      $ r   )Údecoder   s    r   r   r   -   s   €  !§(¡(¨7Ô"3r
   c                   óF   ^ • \ rS rSrSr/ S4U 4S jjrS rS rS rSr	U =r
$ )	ÚParsedMacroArgsé2   a  
Parsed representation of macro arguments.

The base class provides a simple way of storing the arguments as a list of
parsed nodes.

This base class can be subclassed to store additional information and
provide more advanced APIs to access macro arguments for certain categories
of macros.

Arguments:

  - `argnlist` is a list of latexwalker nodes that represent macro
    arguments.  If the macro arguments are too complicated to store in a
    list, leave this as `None`.  (But then code that uses the latexwalker
    must be aware of your own API to access the macro arguments.)

    The difference between `argnlist` and the legacy `nodeargs` is that all
    options, regardless of optional or mandatory, are stored in the list
    `argnlist` with possible `None`\ 's at places where optional arguments
    were not provided.  Previously, whether a first optional argument was
    included in `nodeoptarg` or `nodeargs` depended on how the macro
    specification was given.

  - `argspec` is a string or a list that describes how each corresponding
    argument in `argnlist` represents.  If the macro arguments are too
    complicated to store in a list, leave this as `None`.  For standard
    macros and parsed arguments this is a string with characters '*', '[',
    '{' describing an optional star argument, an optional
    square-bracket-delimited argument, and a mandatory argument.

Attributes:

.. py:attribute:: argnlist

   The list of latexwalker nodes that was provided to the constructor

.. py:attribute:: argspec

   Argument type specification provided to the constructor

.. py:attribute:: legacy_nodeoptarg_nodeargs

   A tuple `(nodeoptarg, nodeargs)` that should be exposed as properties in
   :py:class:`~pylatexenc.latexwalker.LatexMacroNode` to provide (as best as
   possible) compatibility with pylatexenc < 2.

   This is either `(<1st optional arg node>, <list of remaining args>)` if
   the first argument is optional and all remaining args are mandatory; or
   it is `(None, <list of args>)` for any other argument structure.
Ú c                 óœ   >• [         [        U ]
  " S0 UD6  Xl        X l        U R                  U R                  U R                  5      U l        g )Nr   )Úsuperr   Ú__init__ÚargnlistÚargspecÚ_get_legacy_attribsÚlegacy_nodeoptarg_nodeargs)Úselfr   r   ÚkwargsÚ	__class__s       €r   r   ÚParsedMacroArgs.__init__f   sA   ø€ ÜŒo˜tÒ-Ñ7°Ò7à ŒØŒð ×$Ñ$ T§\¡\°4·=±=ÓAð 	Õ'r
   c                 óÚ   • SnUR                  S5      (       a"  USS  nUS-  nUR                  S5      (       a  M"  USS S:X  a%  [        S USS   5       5      (       a  X#   X#S-   S  4$ S U4$ )Nr   Ú*é   Ú[c              3   ó*   #   • U  H	  oS :H  v •  M     g7f)Ú{Nr   ©Ú.0r   s     r   Ú	<genexpr>Ú6ParsedMacroArgs._get_legacy_attribs.<locals>.<genexpr>u   s   é € Ð&Eº°A¨C¦xºùó   ‚)Ú
startswithÚall)r!   r   r   Únskips       r   r   Ú#ParsedMacroArgs._get_legacy_attribsp   s†   € ØˆØ× Ñ  ×%Ñ%Ø˜a˜b�kˆGØ�Q‰JˆEð × Ñ  ×%Ó%ð �1�Qˆ<˜3Ó¤3Ñ&E¸ÀÀ¹Ó&E×#EÑ#EØ‘_ h°Q©w¨xÐ&8Ð:Ð:à˜(Ð#Ð#r
   c                 ó>   • [        U R                  U R                  S9$ )au  
Called when we export the node structure to JSON when running latexwalker in
command-line.

Return a representation of the current parsed arguments in an object,
typically a dictionary, that can easily be exported to JSON.  The object
may contain latex nodes and other parsed-argument objects, as we use a
custom JSON encoder that understands these types.

Subclasses may
©r   r   )Údictr   r   ©r!   s    r   Úto_json_objectÚParsedMacroArgs.to_json_object{   s   € ô Ø—L‘LØ—]‘]ñ
ð 	
r
   c                 óx   • SR                  U R                  R                  U R                  U R                  5      $ )Nz{}(argspec={!r}, argnlist={!r}))Úformatr#   Ú__name__r   r   r7   s    r   Ú__repr__ÚParsedMacroArgs.__repr__�   s.   € Ø0×7Ñ7Ø�N‰N×#Ñ# T§\¡\°4·=±=ó
ð 	
r
   )r   r   r    )r<   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r8   r=   Ú__static_attributes__Ú__classcell__©r#   s   @r   r   r   2   s*   ø† ñ2ðf !#¨B÷ Bò$ò
÷$
ð 
r
   r   c                   óD   ^ • \ rS rSrSr  SU 4S jjrSS jrS rSrU =r	$ )	ÚMacroStandardArgsParseré”   a¨	  
Parses the arguments to a LaTeX macro.

This class parses a simple macro argument specification with a specified
arrangement of optional and mandatory arguments.

This class also serves as base class for more advanced argument parsers
(e.g. for a ``\verb+...+`` macro argument parser).  In such cases,
subclasses should attempt to provide the most suitable `argspec` (and
`argnlist` for the corresponding :py:class:`ParsedMacroArgs`) for their use,
if appropriate, or set them to `None`.

Arguments:

  - `argspec`: must be a string in which each character corresponds to an
    argument.  The character '{' represents a mandatory argument (single
    token or LaTeX group) and the character '[' denotes an optional argument
    delimited by braces.  The character '\*' denotes a possible star char at
    that position in the argument list, a corresponding
    ``latexwalker.LatexCharsNode('*')`` (or `None` if no star) will be
    inserted in the argument node list.  For instance, the string '\*{[[{'
    would be suitable to specify the signature of the '\\newcommand' macro.

    Currently, the argspec string may only contain the characters '\*', '{'
    and '['.

    The `argspec` may also be `None`, which is the same as specifying an
    empty string.

  - `optional_arg_no_space`: If set to `True`, then an optional argument
    cannot have any whitespace between the preceeding tokens and the '['
    character.  Set this to `True` in cases such as for ``\\`` in AMS-math
    environments, where AMS apparently introduced a patch to prevent a
    bracket on a new line after ``\\`` from being interpreted as the
    optional argument to ``\\``.

  - `args_math_mode`: Either `None`, or a list of the same length as
    `argspec`.  If a list is given, then each item must be `True`, `False`,
    or `None`.  The corresponding argument (cf. `argspec`) is then
    respectively parsed in math mode (`True`), in text mode (`False`), or
    with the mode unchanged (`None`).  If `args_math_mode` is `None`, then
    all arguments are parsed in the same mode as the current mode.

  - additional unrecognized keyword arguments are passed on to superclasses
    in case of multiple inheritance

Attributes:

.. py:attribute:: argspec

   Argument type specification provided to the constructor.

.. py:attribute:: optional_arg_no_space

   See the corresponding constructor argument.

.. py:attribute:: args_math_mode

   See the corresponding constructor argument.
c                 ó<  >• [         [        U ]
  " S0 UD6  U(       a  UOSU l        X l        X0l        [        U R                  [        5      (       a!  [        S U R                   5       5      (       d$  [        SR                  U R                  5      5      eSU l        g )Nr   c              3   ó*   #   • U  H	  oS ;   v •  M     g7f)z*[{Nr   r+   s     r   r-   Ú3MacroStandardArgsParser.__init__.<locals>.<genexpr>Ù   s   é € Ð4¢| !˜–:¢|ùr/   zCargspec must be a string containing chars '*', '[', '{{' only: {!r}Fr   )r   rG   r   r   Úoptional_arg_no_spaceÚargs_math_modeÚ
isinstanceÚ_basestringr1   Ú	TypeErrorr;   Ú&_like_pylatexenc1x_ignore_leading_star)r!   r   rL   rM   r"   r#   s        €r   r   Ú MacroStandardArgsParser.__init__Ñ   s{   ø€ äÔ% tÒ5Ñ?¸Ò?Þ")‘w¨rˆŒØ%:Ô"Ø,Ôä˜$Ÿ,™,¬×4Ñ4ÜÑ4 t§|¢|Ó4×4Ñ4ÜØUß‘˜Ÿ™Ó%óð ð 7<ˆÕ3r
   c                 ó�  ^ ^• SSK Jn  Tc  UR                  5       m/ nT R                  b[  [	        T R                  5      [	        T R
                  5      :w  a/  [        SR                  T R                  T R
                  5      5      eUU 4S jnUnT R                  (       aJ  UR                  U5      nUR                  S:X  a)  UR                  S:X  a  UR                  UR                  -   n[        T R
                  5       GHª  u  pšU
S:X  a1  UR                  US	U" U	5      S
9u  p¼nXÍ-   nUR                  U5        M=  U
S:X  a§  T R                   (       aN  U[	        UR"                  5      :  a5  UR"                  U   R%                  5       (       a  UR                  S5        M¢  UR'                  UU" U	5      S9nUc  UR                  S5        MÎ  Uu  p¼nXÍ-   nUR                  U5        Mê  U
S:X  a£  UR                  U5      nUR                  S:X  an  UR                  R)                  S5      (       aN  UR                  UR+                  UR,                  U" U	5      SUR                  SS95        UR                  S-   nGM  UR                  S5        GM“  [/        SR                  U
5      5      e   [1        T R
                  US9nXòXr-
  4$ )a�  
Parse the arguments encountered at position `pos` in the
:py:class:`~pylatexenc.latexwalker.LatexWalker` instance `w`.

You may override this function to provide custom parsing of complicated
macro arguments (say, ``\verb+...+``).  The method will be called by
keyword arguments, so the argument names should not be altered.

The argument `w` is the :py:class:`pylatexenc.latexwalker.LatexWalker`
object that is currently parsing LaTeX code.  You can call methods like
`w.get_goken()`, `w.get_latex_expression()` etc., to parse and read
arguments.

The argument `parsing_state` is the current parsing state in the
:py:class:`~pylatexenc.latexwalker.LatexWalker` (e.g., are we currently
in math mode?).  See doc for
:py:class:`~pylatexenc.latexwalker.ParsingState`.

This function should return a tuple `(argd, pos, len)` where:

- `argd` is a :py:class:`ParsedMacroArgs` instance, or an instance of a
  subclass of :py:class:`ParsedMacroArgs`.  The base `parse_args()`
  provided here returns a :py:class:`ParsedMacroArgs` instance.

- `pos` is the position of the first parsed content.  It should be the
  same as the `pos` argument, except if there is whitespace at that
  position in which case the returned `pos` would have to be the
  position where the argument contents start.

- `len` is the length of the parsed expression.  You will probably want
  to continue parsing stuff at the index `pos+len` in the string.
r   ©ÚlatexwalkerNz-Invalid args_math_mode={!r} for argspec={!r}!c                 ó²   >• TR                   c  T$ TR                   U    nUb  UTR                  :X  a  T$ US:X  a  TR                  SS9$ TR                  SS9$ )NT)Úin_math_modeF)rM   rW   Úsub_context)ÚjÚammÚparsing_stater!   s     €€r   Úget_inner_parsing_stateÚCMacroStandardArgsParser.parse_args.<locals>.get_inner_parsing_state  sl   ø€ Ø×"Ñ"Ñ*Ø$Ð$Ø×%Ñ% aÑ(ˆCØ‰{˜c ]×%?Ñ%?Ó?Ø$Ð$Ø�d‹{Ø$×0Ñ0¸dÐ0ÐCÐCØ ×,Ñ,¸%Ð,Ð@Ð@r
   Úcharr&   r*   F)Ústrict_bracesr[   r(   )r[   r'   ©r[   ÚcharsÚposÚlenz+Unknown macro argument kind for macro: {!r}r5   )r   rU   Úmake_parsing_staterM   rc   r   Ú
ValueErrorr;   rQ   Ú	get_tokenÚtokÚargrb   Ú	enumerateÚget_latex_expressionÚappendrL   r   ÚisspaceÚget_latex_maybe_optional_argr0   Ú	make_nodeÚLatexCharsNodeÚLatexWalkerErrorr   )r!   Úwrb   r[   rU   r   r\   Úprg   rY   ÚargtÚnodeÚnpÚnlÚoptarginfotupleÚparseds   `  `            r   Ú
parse_argsÚ"MacroStandardArgsParser.parse_argsã   sv  ù€ õD 	#àÑ Ø×0Ñ0Ó2ˆMàˆà×ÑÑ*Üˆt×"Ñ"Ó#¤s¨4¯<©<Ó'8Ó8ÜÐLß$™f T×%8Ñ%8¸$¿,¹,ÓGóIð Iö	Að ˆà×6×6à—+‘+˜a“.ˆCØ�w‰w˜&Ó  S§W¡W°£^Ø—G‘G˜cŸg™gÑ%�ä  §¡×.‰GˆAØ�s‹{Ø!"×!7Ñ!7ØØ"'Ù"9¸!Ó"<ð "8ð "‘�˜2ð
 ‘G�Ø—‘ Ö%à˜“à×-×-°!´c¸!¿#¹#³h³,À1Ç3Á3ÀqÁ6Ç>Á>×CSÑCSà—O‘O DÔ)Ùà"#×"@Ñ"@ØÙ"9¸!Ó"<ð #Að #�ð #Ñ*Ø—O‘O DÔ)ÙØ!0‘�˜2Ø‘G�Ø—‘ Ö%à˜“à—k‘k !“n�Ø—7‘7˜fÓ$¨¯©×);Ñ);¸C×)@Ñ)@à—O‘OØŸ™ K×$>Ñ$>Ù2IÈ!Ó2LØ*-°3·7±7Àð $ð Côð
 Ÿ™ !™“Aà—O‘O D×)ô 'ØA×HÑHÈÓNóð ñW /ô^ !Ø—L‘LØñ
ˆð
 ˜Q™UÐ#Ð#r
   c                 óŽ   • SR                  U R                  R                  U R                  U R                  U R
                  5      $ )NzA{}(argspec={!r}, optional_arg_no_space={!r}, args_math_mode={!r}))r;   r#   r<   r   rL   rM   r7   s    r   r=   Ú MacroStandardArgsParser.__repr__Z  s9   € ØR×YÑYØ�N‰N×#Ñ# T§\¡\°4×3MÑ3MØ×Ñó
ð 	
r
   )rQ   rM   r   rL   )NFNr   ©
r<   r?   r@   rA   rB   r   ry   r=   rC   rD   rE   s   @r   rG   rG   ”   s(   ø† ñ;ðx <AØ $÷<ô$t$÷n
ð 
r
   rG   c                   ó6   ^ • \ rS rSrSrSU 4S jjrS rSrU =r$ )ÚParsedVerbatimArgsic  a8  
Parsed representation of arguments to LaTeX verbatim constructs, such as
``\begin{verbatim}...\end{verbatim}`` or ``\verb|...|``.

Instances of `ParsedVerbatimArgs` are returned by the args parser
:py:class:`VerbatimArgsParser`.

Arguments:

  - `verbatim_chars_node` --- a properly initialized
    :py:class:`pylatexenc.latexwalker.LatexCharsNode` that stores the
    verbatim text provided.  It is used to initialize the base class
    :py:class:`ParsedMacroArgs` to expose a single mandatory argument with
    the given verbatim text.  The `verbatim_text` attribute is initialized
    from this node, too.

  - `verbatim_delimiters` --- a 2-item tuple of characters used to delimit
    the verbatim arguemnt (in case of a ``\verb+...+`` macro) or `None`.

Attributes:

.. py:attribute:: verbatim_text

   The verbatim text that was provided

.. py:attribute:: verbatim_delimiters

   If the verbatim text was specified as an argument to ``\verb$...$``, then
   this is set to a 2-item tuple that specifies the begin and end
   delimiters.  Otherwise, the attribute is `None`.
c                 ód   >• [         [        U ]
  " SSU/S.UD6  UR                  U l        X l        g )Nr*   r5   r   )r   r   r   ra   Úverbatim_textÚverbatim_delimiters)r!   Úverbatim_chars_noder‚   r"   r#   s       €r   r   ÚParsedVerbatimArgs.__init__ƒ  sC   ø€ ô 	Ô  $Ò0ð 	
ØØ)Ð*ñ	
ð ò	
ð 1×6Ñ6ˆÔØ#6Õ r
   c                 óx   • SR                  U R                  R                  U R                  U R                  5      $ )Nz0{}(verbatim_text={!r}, verbatim_delimiters={!r}))r;   r#   r<   r�   r‚   r7   s    r   r=   ÚParsedVerbatimArgs.__repr__’  s2   € ØA×HÑHØ�N‰N×#Ñ# T×%7Ñ%7¸×9QÑ9Qó
ð 	
r
   )r‚   r�   r   )	r<   r?   r@   rA   rB   r   r=   rC   rD   rE   s   @r   r   r   c  s   ø† ñ÷>7÷
ð 
r
   r   c                   ó<   ^ • \ rS rSrSrU 4S jrSS jrS rSrU =r	$ )ÚVerbatimArgsParseri™  a  
Parses the arguments to various LaTeX "verbatim" constructs such as
``\begin{verbatim}...\end{verbatim}`` environment or ``\verb+...+``.

This class also serves to illustrate how to write custom parsers for
complicated macro arguments.  See also :py:class:`MacroStandardArgsParser`.

Arguments:

.. py:attribute:: verbatim_arg_type

  One of 'verbatim-environment' or 'verb-macro'.
c                 ó>   >• [         [        U ]
  " SSS0UD6  Xl        g )Nr   r*   r   )r   rˆ   r   Úverbatim_arg_type)r!   rŠ   r"   r#   s      €r   r   ÚVerbatimArgsParser.__init__§  s!   ø€ ÜÔ  $Ò0ÑG¸ÐGÀÒGØ!2Õr
   c           
      ó`  • SSK Jn  U R                  S:X  ax  UR                  R	                  SU5      nUS:X  a  UR                  UR                  USS9eXR-
  n[        UR                  UR                  UUR                  X"U-    UUS9S	9nXrU4$ U R                  S
:X  Ga  UR                  U   R                  5       (       a]  US-  nU[        UR                  5      :¼  a  UR                  UR                  USS9eUR                  U   R                  5       (       a  M]  UR                  U   nUS-   n	UR                  R	                  X‰5      n
U
S:X  a  UR                  UR                  USS9eUR                  Xš n[        UR                  UR                  UUU	X©-
  S9Xˆ4S9nXrU
S-   U-
  4$ g )Nr   rT   zverbatim-environmentz\end{verbatim}éÿÿÿÿz#Cannot find matching \end{verbatim})r   rb   Úmsgr`   )rƒ   z
verb-macror'   z!Missing argument to \verb commandz=End of stream reached while reading argument to \verb command)rƒ   r‚   )r   rU   rŠ   r   ÚfindÚLatexWalkerParseErrorr   rn   ro   rl   rc   )r!   rq   rb   r[   rU   Ú
endverbposÚlen_ÚargdÚverbdelimcharÚbeginposÚendposÚverbargs               r   ry   ÚVerbatimArgsParser.parse_args«  sâ  € å"à×!Ñ!Ð%;Ó;ð Ÿ™Ÿ™Ð"3°SÓ9ˆJØ˜RÓØ!×7Ñ7Ø—c‘cØØ>ð 8ð ð ð ‘>ˆDä%Ø$%§K¡K°×0JÑ0JØ>KØ67·c±c¸#À$¹hÐ6GØ47Ø48ð	 %0ð %:ñˆDð ˜tÐ$Ð$à×!Ñ! \Ô1ð —#‘#�c‘(×"Ñ"×$Ñ$Ø�q‘�Øœ#˜aŸc™c›(“?Ø%×;Ñ;ØŸ#™#ØØ@ð <ð ð ð —#‘#�c‘(×"Ñ"×$Ó$ð ŸC™C ™HˆMØ˜1‘uˆHØ—S‘S—X‘X˜mÓ6ˆFØ˜‹|Ø!×7Ñ7Ø—c‘cØØXð 8ð ð ð —c‘c˜(Ð*ˆGä%Ø$%§K¡K°×0JÑ0JØ>KØ6=Ø4<Ø4:±Oð	 %0ð %Eð
 &3Ð$BñˆDð ˜v a™x¨™|Ð,Ð,ðA 2r
   c                 ób   • SR                  U R                  R                  U R                  5      $ )Nz{}(verbatim_arg_type={!r}))r;   r#   r<   rŠ   r7   s    r   r=   ÚVerbatimArgsParser.__repr__é  s*   € Ø+×2Ñ2Ø�N‰N×#Ñ# T×%;Ñ%;ó
ð 	
r
   )rŠ   r   r}   rE   s   @r   rˆ   rˆ   ™  s   ø† ñõ3ô;-÷|
ð 
r
   rˆ   )ÚsysÚversion_infoÚmajorr	   ÚstrrO   Ú_str_from_unicodeÚ_unicode_from_strÚ
basestringÚobjectr   rG   r   rˆ   r   r
   r   Ú<module>r£      s‚   ðó@ ð ×Ñ×Ñ˜AÓâØ€KÙ#ÐÙ#Ñð €KÙ<ÐÙ3Ðô
^
�fô ^
ôDJ
˜fô J
ô^2
˜ô 2
ôlS
Ð0õ S
r
   