o
    GZŽhÍ
  ã                   @   s‚   d dl Z d dlZd dlZd dlmZ e j e¡Ze j 	e j 
ed¡¡Ze j 
ed¡ZdZdd„ Zefdd	„Zed
kr?eƒ  dS dS )é    N)ÚdebugzLaTeX.g4Z_antlra€  # *** GENERATED BY `setup.py antlr`, DO NOT EDIT BY HAND ***
#
# Generated from ../LaTeX.g4, derived from latex2sympy
#     latex2sympy is licensed under the MIT license
#     https://github.com/augustt198/latex2sympy/blob/master/LICENSE.txt
#
# Generated with antlr4
#    antlr4 is licensed under the BSD-3-Clause License
#    https://github.com/antlr/antlr4/blob/master/LICENSE.txt
c                	   C   sR   t dƒ zt t dg¡ d¡ d¡d ƒ W dS  tjtfy(   t dƒ Y dS w )	NzChecking antlr4 version...Úantlr4zutf-8Ú
r   Tz€The 'antlr4' command line tool is not installed, or not on your PATH.
> Please refer to the README.md file for more information.F)r   Ú
subprocessÚcheck_outputÚdecodeÚsplitÚCalledProcessErrorÚFileNotFoundError© r   r   úU/var/www/auris/lib/python3.10/site-packages/sympy/parsing/latex/_build_latex_antlr.pyÚcheck_antlr_version   s   ÿür   c           	   	   C   sÂ  t ƒ  td | ¡ƒ tj | ¡st | ¡ ttj | d¡dƒ}| 	t
¡ W d   ƒ n1 s/w   Y  dtd| ddg}td d	 |¡¡ƒ tj|| d
 tdƒ t tj | d¡¡pdt tj | d¡¡D ]y}| d¡srt |¡ qetj | tj |¡ ¡ ¡}t|dƒ}dd„ |D ƒ}W d   ƒ n1 s–w   Y  t |¡ t|dƒ*}d}||  d¡rº|d7 }||  d¡s¯| 	t
¡ | ||d … ¡ W d   ƒ n1 sÒw   Y  td |¡ƒ qedS )Nz#Updating ANTLR-generated code in {}z__init__.pyzw+r   z-oz-no-visitorz-no-listenerz Running code generation...
	$ {}ú )Úcwdz<Applying headers, removing unnecessary files and renaming...zLaTeX*.*zlatex*.*z.pyÚrc                 S   s   g | ]}|  ¡ d  ‘qS )r   )Úrstrip)Ú.0Úliner   r   r   Ú
<listcomp>J   s    z build_parser.<locals>.<listcomp>Úwr   ú#é   z	{}T)r   r   ÚformatÚosÚpathÚexistsÚmakedirsÚopenÚjoinÚwriteÚheaderÚgrammar_filer   r   ÚglobÚendswithÚunlinkÚbasenameÚlowerÚ
startswithÚ
writelines)	Ú
output_dirÚfpÚargsr   Únew_pathÚfÚlinesÚout_fileÚoffsetr   r   r   Úbuild_parser&   sJ   
ÿú	ÿ

ÿ
ÿ
ûr1   Ú__main__)r   r   r"   Zsympy.utilities.miscr   r   ÚdirnameÚ__file__ÚhereÚabspathr   r!   Zdir_latex_antlrr    r   r1   Ú__name__r   r   r   r   Ú<module>   s    4
ÿ