ó
Nä²Wc           @@  sl   d  Z  d d l m Z d d l Td d l Td d l m Z d e f d „  ƒ  YZ e ƒ  Z	 d	 d
 d „ Z d	 S(   s±   
This module deals with interpreting the parse tree as Python
would have done, in the compiler.

For now this only covers parse tree to value conversion of
compile-time values.
i    (   t   absolute_importi   (   t   *(   t   CompileErrort
   EmptyScopec           B@  s   e  Z d  „  Z RS(   c         C@  s   d  S(   N(   t   None(   t   selft   name(    (    s>   /bar/jli/Chip-seq/script/cython/Cython/Compiler/Interpreter.pyt   lookup   s    (   t   __name__t
   __module__R   (    (    (    s>   /bar/jli/Chip-seq/script/cython/Cython/Compiler/Interpreter.pyR      s   c         @  sÅ   ‡  ‡ f d †  } |  rI g  t  |  ƒ D] \ } } | | | ƒ ^ q% }  n  | r» t | t ƒ sd t ‚ i  } xE | j D]: } | | j d ƒ \ }	 }
 | | j | j j ƒ | |	 <qt W| } n  |  | f S(   s,  
    Tries to interpret a list of compile time option nodes.
    The result will be a tuple (optlist, optdict) but where
    all expression nodes have been interpreted. The result is
    in the form of tuples (value, pos).

    optlist is a list of nodes, while optdict is a DictNode (the
    result optdict is a dict)

    If type_env is set, all type nodes will be analysed and the resulting
    type set. Otherwise only interpretateable ExprNodes
    are allowed, other nodes raises errors.

    A CompileError will be raised if there are problems.
    c         @  s¹   | ˆ  k r^ ˆ rI |  j  ˆ ƒ } | s< t |  j d ƒ ‚ n  | |  j f St |  j d ƒ ‚ nW t j d d k rŸ t |  t ƒ rŸ |  j d  k	 rŸ |  j |  j f S|  j	 t
 ƒ |  j f Sd  S(   Ns   Invalid type.s   Type not allowed here.i    i   (   t   analyse_as_typeR   t   post   syst   version_infot
   isinstancet
   StringNodet   unicode_valueR   t   compile_time_valuet   empty_scope(   t   nodet   ixt   type(   t	   type_argst   type_env(    s>   /bar/jli/Chip-seq/script/cython/Cython/Compiler/Interpreter.pyt	   interpret'   s    N(   t	   enumerateR   t   DictNodet   AssertionErrort   key_value_pairst   keyR   t   value(   t   optlistt   optdictR   R   R   R   t   xt   new_optdictt   itemt   new_keyt   dummy(    (   R   R   s>   /bar/jli/Chip-seq/script/cython/Cython/Compiler/Interpreter.pyt   interpret_compiletime_options   s    1 	N(    (   t   __doc__t
   __future__R    t   Nodest	   ExprNodest   ErrorsR   t   objectR   R   R   R&   (    (    (    s>   /bar/jli/Chip-seq/script/cython/Cython/Compiler/Interpreter.pyt   <module>   s   

	