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
Autolev.g4Z_antlrzË# *** GENERATED BY `setup.py antlr`, DO NOT EDIT BY HAND ***
#
# 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   úY/var/www/auris/lib/python3.10/site-packages/sympy/parsing/autolev/_build_autolev_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g}td d |¡¡ƒ tj|| d	 td
ƒ t tj | d¡¡pct tj | d¡¡D ]y}| d¡sqt |¡ qdt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 |¡ƒ qddS )Nz#Updating ANTLR-generated code in {}z__init__.pyzw+r   z-oz-no-visitorz Running code generation...
	$ {}ú )Úcwdz<Applying headers, removing unnecessary files and renaming...z
Autolev*.*z
autolev*.*z.pyÚrc                 S   s    g | ]}|  ¡  d d¡d ‘qS )zAutolevParser importzautolevparser importr   )ÚrstripÚreplace)Ú.0Úliner   r   r   Ú
<listcomp>D   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"   sL   
ÿüÿ

ÿÿ
ÿ
ûr2   Ú__main__)r   r   r#   Zsympy.utilities.miscr   r   ÚdirnameÚ__file__ÚhereÚabspathr   r"   Zdir_autolev_antlrr!   r   r2   Ú__name__r   r   r   r   Ú<module>   s    	3
ÿ