U if @shddlmZddlmZddlmZddlmZddlmZmZm Z m Z e dZ Gdddej Zd S) )patcomp)pytree)token) fixer_base)NameCallCommaStringz"atom< '(' [atom|STRING|NAME] ')' >c@s$eZdZdZdZddZddZdS)FixPrintTzP simple_stmt< any* bare='print' any* > | print_stmt c Cs`|d}|r,|ttdg|jddS|jdd}t|dkrXt|drXdSd}}}|r|dt kr|dd}d}|r|dt t j dkr|d}|d d}d d |D}|rd |d_|dk s|dk s|dk rF|dk r||d tt||dk r.||dtt||dk rF||d|ttd|} |j| _| S)NZbareprint)prefix z>>cSsg|] }|qS)clone).0argrr?sz&FixPrint.transform..sependfile)getreplacerrr Zchildrenlen parend_exprmatchrrLeafr RIGHTSHIFTr add_kwargr repr) selfZnodeZresultsZ bare_printargsrrrZl_argsZn_stmtrrr transform%s:         zFixPrint.transformcCsNd|_t|jjt|ttjd|f}|r@| t d|_| |dS)Nr=r) r rZNodeZsymsZargumentrr!rEQUALappendr)r%Zl_nodesZs_kwdZn_exprZ n_argumentrrrr#Ms   zFixPrint.add_kwargN)__name__ __module__ __qualname__Z BM_compatibleZPATTERNr'r#rrrrr s(r N)rrrZpgen2rrZ fixer_utilrrrr Zcompile_patternrZBaseFixr rrrrs