Hacked By AnonymousFox
���]� � @ s� d Z d d l Z d d l Z d d l m Z d d l m Z d d l m Z Gd d � d e � Z
Gd d
� d
e � Z i a d d � Z
d S)
z+George Boutsioukis <gboutsioukis@gmail.com>� N)�defaultdict� )�pytree)�reduce_treec @ s( e Z d Z e j � Z d d � Z d S)�BMNodec C s1 i | _ g | _ t t j � | _ d | _ d S)N� )�transition_table�fixers�nextr �count�id�content)�self� r �0/opt/alt/python35/lib64/python3.5/btm_matcher.py�__init__ s zBMNode.__init__N)�__name__�
__module__�__qualname__� itertoolsr r r r r r r s r c @ sL e Z d Z d d � Z d d � Z d d � Z d d � Z d d
� Z d S)�
BottomMatcherc C sF t � | _ t � | _ | j g | _ g | _ t j d � | _ d S)NZRefactoringTool) �set�matchr �rootZnodesr �logging� getLogger�logger)r r r r r s
zBottomMatcher.__init__c C sh | j j | � t | j � } | j � } | j | d | j �} x | D] } | j j | � qJ Wd S)N�start)r �appendr Zpattern_treeZget_linear_subpattern�addr )r �fixerZtreeZlinear�match_nodesZ
match_noder r r � add_fixer% s
zBottomMatcher.add_fixerc C s | s
| g St | d t � r� g } x[ | d D]O } | j | d | �} x1 | D]) } | j | j | d d � | � � qS Wq1 W| S| d | j k r� t � } | | j | d <n | j | d } | d d � r� | j | d d � d | �} n | g } | Sd S)Nr r r )�
isinstance�tupler �extendr r )r �patternr r! ZalternativeZ end_nodes�endZ next_noder r r r 1 s"