U
    9%e                     @   s:   d dl Zd dlZdd Zdd Zdd Zedkr6e  dS )	    Nc                 C   sd   t | }d| }d| }|D ]\}}| |r q8q|D ]\}}| |r< qXq<|d |fS )Nz#--! %s-startz#--! %s-end   )	enumeratestrip
startswithendswith)linestagZsrclinesZ	start_tagZend_tagstart_indexlineZ	end_index r   Q/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/pycparser/ply/ygen.pyget_source_range   s    r   c                 C   sB   g }d}d| }| D ](}|  |r.| }q|r|| q|S )NTz#--! %s)r   r   append)r   r   Zfiltered_linesincludetag_textr
   r   r   r   filter_section   s    r   c               	   C   s   t jt} tt j| dt j| d tt j| dd}| }W 5 Q R X t	|d\}}t	|d\}}t	|d\}}||| }	t
|	d}
t
|
d}||||< |
|||< d	d
 |D }tt j| dd}|| W 5 Q R X td d S )Nzyacc.pyzyacc.py.bakrZ
parsedebugZparseoptzparseopt-notrackDEBUGZTRACKINGc                 S   s   g | ]}|  d  qS )
)rstrip).0r
   r   r   r   
<listcomp>>   s     zmain.<locals>.<listcomp>wzUpdated yacc.py)ospathdirname__file__shutilcopy2joinopen	readlinesr   r   
writelinesprint)r   fr   Zparse_startZ	parse_endZparseopt_startZparseopt_endZparseopt_notrack_startZparseopt_notrack_endZ
orig_linesZparseopt_linesZparseopt_notrack_linesr   r   r   main'   s      

r%   __main__)os.pathr   r   r   r   r%   __name__r   r   r   r   <module>
   s   