3 rW@s:ddlZddlZddZddZddZedkr6edS) NcCsht|}d|}d|}x |D]\}}|jj|rPqWx |D]\}}|jj|r@Pq@W|d|fS)Nz #--! %s-startz #--! %s-end) enumeratestrip startswithendswith)linestagZsrclinesZ start_tagZend_tagZ start_indexlineZ end_indexr /usr/lib/python3.6/ygen.pyget_source_range sr cCsFg}d}d|}x0|D](}|jj|r0| }q|r|j|qW|S)NTz#--! %s)rrappend)rrZfiltered_linesincludeZtag_textr r r r filter_sections rc Cstjjt}tjtjj|dtjj|dttjj|dd}|j}WdQRXt |d\}}t |d\}}t |d\}}|||} t | d} t | d} | |||<| |||<d d |D}ttjj|dd }|j |WdQRXt d dS) Nzyacc.pyz yacc.py.bakrZ parsedebugZparseoptzparseopt-notrackDEBUGZTRACKINGcSsg|]}|jdqS) )rstrip).0r r r r >szmain..wzUpdated yacc.py) ospathdirname__file__shutilZcopy2joinopen readlinesr r writelinesprint) rfrZ parse_startZ parse_endZparseopt_startZ parseopt_endZparseopt_notrack_startZparseopt_notrack_endZ orig_linesZparseopt_linesZparseopt_notrack_linesr r r main's        r"__main__)Zos.pathrrr rr"__name__r r r r  s