Ë
    7^(hN  ã                   óŠ   — d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ  ed«      Z	 G d„ d«      Z
e	� e
«       Zdefd	„Zdd
„Zy)é    N)ÚPath)Úimport_module)ÚTransformToSymPyExprÚlarkc                   ó$   — e Zd ZdZdd„Zdefd„Zy)ÚLarkLaTeXParseraF  Class for converting input `\mathrm{\LaTeX}` strings into SymPy Expressions.
    It holds all the necessary internal data for doing so, and exposes hooks for
    customizing its behavior.

    Parameters
    ==========

    print_debug_output : bool, optional

        If set to ``True``, prints debug output to the logger. Defaults to ``False``.

    transform : bool, optional

        If set to ``True``, the class runs the Transformer class on the parse tree
        generated by running ``Lark.parse`` on the input string. Defaults to ``True``.

        Setting it to ``False`` can help with debugging the `\mathrm{\LaTeX}` grammar.

    grammar_file : str, optional

        The path to the grammar file that the parser should use. If set to ``None``,
        it uses the default grammar, which is in ``grammar/latex.lark``, relative to
        the ``sympy/parsing/latex/lark/`` directory.

    transformer : str, optional

        The name of the Transformer class to use. If set to ``None``, it uses the
        default transformer class, which is :py:func:`TransformToSymPyExpr`.

    Nc                 óÒ  — t         j                  j                  t         j                  j                  t        «      d«      }|€:t        t         j                  j                  |d«      «      j                  d¬«      }nt        |«      j                  d¬«      }t        j                  ||ddddd	d	d
¬«	      | _	        || _
        || _        |€t        «       | _        y  |«       | _        y )Nzgrammar/z
latex.larkzutf-8)ÚencodingÚearleyÚlatex_stringÚautoÚexplicitFT)Úsource_pathÚparserÚstartÚlexerÚ	ambiguityÚpropagate_positionsÚmaybe_placeholdersÚkeep_all_tokens)ÚosÚpathÚjoinÚdirnameÚ__file__r   Ú	read_textÚ_larkÚLarkr   Úprint_debug_outputÚtransform_exprr   Útransformer)Úselfr   Ú	transformÚgrammar_filer!   Úgrammar_dir_pathÚlatex_grammars          úc/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/sympy/parsing/latex/lark/latex_parser.pyÚ__init__zLarkLaTeXParser.__init__+   sÈ   € ÜŸ7™7Ÿ<™<¬¯©¯©¼Ó(AÀ:ÓNÐàÐÜ ¤§¡§¡Ð.>ÀÓ!MÓN×XÑXÐbiÐXÓj‰Mä  Ó.×8Ñ8À'Ð8ÓJˆMä—j‘jØØ(ØØ ØØ Ø %Ø$Ø ð !ó 	"ˆŒð #5ˆÔØ'ˆÔàÐÜ3Ó5ˆDÕá*›}ˆDÕó    Úsc                 óâ  — | j                   r-t        j                  j                  t        j
                  «       | j                  j                  |«      }| j                  snt        j                  j                  d|«       t        j                  j                  |«       t        j                  j                  |j                  «       «       |S | j                   rMt        j                  j                  d|«       t        j                  j                  |j                  «       «       | j                  j                  |«      }| j                   r t        j                  j                  d|«       |S )Nzexpression = %szSymPy expression = %s)r   r   ÚloggerÚsetLevelÚloggingÚDEBUGr   Úparser    ÚdebugÚprettyr!   r#   )r"   r*   Ú
parse_treeÚsympy_expressions       r'   ÚdoparsezLarkLaTeXParser.doparseF   sû   € Ø×"Ò"Ü�L‰L×!Ñ!¤'§-¡-Ô0à—[‘[×&Ñ& qÓ)ˆ
à×"Ò"ä�L‰L×ÑÐ0°!Ô4Ü�L‰L×Ñ˜zÔ*Ü�L‰L×Ñ˜z×0Ñ0Ó2Ô3ØÐà×"Ò"ä�L‰L×ÑÐ0°!Ô4ä�L‰L×Ñ˜z×0Ñ0Ó2Ô3à×+Ñ+×5Ñ5°jÓAÐà×"Ò"Ü�L‰L×ÑÐ6Ð8HÔIàÐr)   )FTNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r(   Ústrr5   © r)   r'   r   r      s   „ ñó<-ð6 ˜ô  r)   r   r*   c                 óN   — t         €t        d«      ‚t        j                  | «      S )z™
    Experimental LaTeX parser using Lark.

    This function is still under development and its API may change with the
    next releases of SymPy.
    zLark is probably not installed)r   ÚImportErrorÚ_lark_latex_parserr5   )r*   s    r'   Úparse_latex_larkr?   e   s&   € ô €}ÜÐ:Ó;Ð;Ü×%Ñ% aÓ(Ð(r)   c                 ó<  — t        | t        j                  «      r| j                  S t	        | j
                  «      }|j                  d«      }|rt        j                  dd|«      }|dk(  }|r|dz   }n|}d}| xs |}|r|t	        |«      dz   z  }|rA|ddj                  | j                  D �	cg c]  }	d	|z  t        |	||«      z   ‘Œ c}	«      z   z  }n7|d
j                  | j                  D �	cg c]  }	t        |	||«      ‘Œ c}	«      z  }|r|dz  }|S c c}	w c c}	w )NÚ
expressionz^expressionÚEÚ_ambigé   Ú ú(ú
ú ú,ú))Ú
isinstancer   ÚTokenÚvaluer:   ÚdataÚ
startswithÚreÚsubr   ÚchildrenÚ_pretty_print_lark_trees)
ÚtreeÚindentÚ	show_exprrN   Úis_exprÚis_ambigÚ
new_indentÚoutputÚ	show_nodeÚis
             r'   rS   rS   q   s1  € Ü�$œŸ™Ô$Ø�z‰zÐäˆt�y‰y‹>€Dà�o‰o˜lÓ+€GáÜ�v‰v�n c¨4Ó0ˆà˜Ñ €HáØ˜a‘Z‰
àˆ
à€FØ�Ò(˜y€IáØ”#�d“)˜c‘/Ñ!ˆáØ�$˜Ÿ™Ðsw÷  tAñ  tAö  $BÐno C¨*Ñ$4Ô7OÐPQÐS]Ð_hÓ7iÓ$iò  $Bó  Cñ  Cñ  	C‰à�#—(‘(ÐX\×XeÑXeÖfÐSTÔ4°Q¸
ÀIÕNÒfÓgÑgˆáØ�#‰ˆà€Mùò $Bùâfs   Â.DÃ.D
)r   T)r   r.   rP   Úpathlibr   Úsympy.externalr   Ú$sympy.parsing.latex.lark.transformerr   r   r   r>   r:   r?   rS   r;   r)   r'   ú<module>r`      sP   ðÛ 	Û Û 	Ý å (Ý Eá�fÓ€÷R ñ R ðj 	ÐÙ(Ó*Ðð	)˜ó 	)ô r)   