o
    ԅZ                     @   s>   d dl Zd dlZdd Zdd Zdd Zedkre  dS dS )	    Nc                 C   sd   t | }d| }d| }|D ]\}}| |r nq|D ]\}}| |r+ nq|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   */usr/lib/python3/dist-packages/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_linesZincludeZ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 d    n1 s/w   Y  t	|d\}}t	|d\}}t	|d\}}||| }	t
|	d}
t
|
d}||||< |
|||< d	d
 |D }tt j| dd}|| W d    n1 sw   Y  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   	
