Ñò
#8Zc           @   sÓ   d  Z  d d k l Z l Z d „  Z d d d „  ƒ  YZ d d d „  ƒ  YZ d „  Z e d	 j on d d
 k	 Z	 d d k l
 Z
 l Z xI e	 i d D]6 Z e GHe
 e ƒ Z e ƒ  Z e e e ƒ e i GHHq‘ Wn d
 S(   s   Parser for future statements

iÿÿÿÿ(   t   astt   walkc         C   s5   t  |  t i ƒ p d S|  i d j o d Sd Sd S(   s:   Return true if statement is a well-formed future statementi    t
   __future__i   N(   t
   isinstanceR    t   Fromt   modname(   t   stmt(    (    s%   /usr/lib/python2.6/compiler/future.pyt	   is_future   s
    t   FutureParserc           B   s2   e  Z d Z d „  Z d „  Z d	 „  Z d
 „  Z RS(   t   nested_scopest
   generatorst   divisiont   absolute_importt   with_statementt   print_functiont   unicode_literalsc         C   s   h  |  _  d  S(   N(   t   found(   t   self(    (    s%   /usr/lib/python2.6/compiler/future.pyt   __init__   s    c         C   s6   | i  } x& | i D] } |  i | ƒ p Pq q Wd  S(   N(   t   nodet   nodest
   check_stmt(   R   R   R   t   s(    (    s%   /usr/lib/python2.6/compiler/future.pyt   visitModule   s
    	
 c         C   sg   t  | ƒ oV xE | i D]: \ } } | |  i j o d |  i | <q t d | ‚ q Wd | _ d Sd S(   Ni   s    future feature %s is not definedi    (   R   t   namest   featuresR   t   SyntaxErrort   valid_future(   R   R   t   namet   asname(    (    s%   /usr/lib/python2.6/compiler/future.pyR      s    
 	c         C   s   |  i  i ƒ  S(   s4   Return list of features enabled by future statements(   R   t   keys(   R   (    (    s%   /usr/lib/python2.6/compiler/future.pyt   get_features+   s    (   R	   R
   R   R   R   R   R   (   t   __name__t
   __module__R   R   R   R   R   (    (    (    s%   /usr/lib/python2.6/compiler/future.pyR      s     			t   BadFutureParserc           B   s   e  Z d  Z d „  Z RS(   s#   Check for invalid future statementsc         C   sA   t  | d ƒ o d  S| i d j o d  St d t | ƒ ‚ d  S(   NR   R   s   invalid future statement (   t   hasattrR   R   t   repr(   R   R   (    (    s%   /usr/lib/python2.6/compiler/future.pyt	   visitFrom2   s
    (   R    R!   t   __doc__R%   (    (    (    s%   /usr/lib/python2.6/compiler/future.pyR"   /   s   c         C   s6   t  ƒ  } t ƒ  } t |  | ƒ t |  | ƒ | i ƒ  S(   N(   R   R"   R   R   (   R   t   p1t   p2(    (    s%   /usr/lib/python2.6/compiler/future.pyt   find_futures9   s
    		t   __main__N(   t	   parseFileR   i   (    (    (   R&   t   compilerR    R   R   R   R"   R)   R    t   sysR+   t   argvt   filet   treet   vR   (    (    (    s%   /usr/lib/python2.6/compiler/future.pyt   <module>   s    		
	 	