ó
â™xTc           @   sX   d  Z  d d l m Z d d l Z d d l Z d d l m Z d e f d „  ƒ  YZ d S(   s>    Tools to statically analyse source code in various languages iÿÿÿÿ(   t   divisionN(   t   globt   commentsc           B   sM   e  Z d  Z e d „ Z e j d e j ƒ Z e j d e j ƒ Z	 d „  Z
 RS(   s!    Information about comment lines c         C   s¥   | |  _  d |  _ d |  _ xƒ | D]{ } xr t | ƒ D]d } t j j | ƒ } t j j | ƒ \ } } | j ƒ  } | d k r� |  j	 | ƒ q5 t
 | ƒ ‚ q5 Wq" Wd S(	   s/    Construct the information for the given files i    s   .fs   .fpps   .incs   .f77s   .f90N(   s   .fs   .fpps   .incs   .f77s   .f90(   t   debugt   commented_linest   linesR   t   ost   patht
   expandusert   splitextt   lowert   process_fortrant   NotImplemented(   t   selft   filesR   t   ft   pt   roott   ext(    (    sB   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/code_analysis.pyt   __init__   s    			s   ^ (?: C | \* | !) \W* \ws   ! \W* \wc         C   sh  d } xLt  | ƒ D]>} |  j d 7_ |  j j | ƒ rb | d 7} |  j r |  j G| GHq q n  | j d ƒ } | d k  rƒ q n  | j d ƒ | j d ƒ } } | d k sº | d k r| d k rä | d k rä t | | ƒ } n | d k rù | } n | } | | k  rq qn  |  j j | d | ƒr | d 7} |  j rQ|  j G| GHqQq q W|  j | 7_ d  S(   Ni    i   t   !t   't   "t   pos(	   t   openR   t   fortran_start_of_linet   searchR   t   rfindt   maxt   fortran_bang_anywhereR   (   R   t	   file_patht   nt   linet   bangt   single_quotet   double_quotet   quote(    (    sB   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/code_analysis.pyR      s2    
	  	 	
	 (   t   __name__t
   __module__t   __doc__t   FalseR   t   ret   compilet   XR   R   R   (    (    (    sB   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/code_analysis.pyR   	   s
   (   R'   t
   __future__R    R   R)   R   t   objectR   (    (    (    sB   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/code_analysis.pyt   <module>   s
   