ó
_ûäSc           @   sg   d  Z  d Z d d l Z d Z e j e d ƒ Z e j e d ƒ Z d e f d „  ƒ  YZ d	 „  Z	 d S(
   s‡   Scans a source JS file for its provided and required namespaces.

Simple class to scan a JavaScript file and express its dependencies.
s   nnaze@google.comiÿÿÿÿNs"   ^\s*goog\.%s\(\s*['"](.+)['"]\s*\)t   providet   requiret   Sourcec           B   sj   e  Z d  Z e j d e j e j Be j Bƒ Z d „  Z	 d „  Z
 e d „  ƒ Z e d „  ƒ Z d „  Z RS(   sC   Scans a JavaScript source for its provided and required namespaces.s°   
      ^\s*   # Start of a new line and whitespace
      /\*    # Opening "/*"
      .*?    # Non greedy match of any characters (including newlines)
      \*/    # Closing "*/c         C   s/   t  ƒ  |  _ t  ƒ  |  _ | |  _ |  j ƒ  d S(   sN   Initialize a source.

    Args:
      source: str, The JavaScript source.
    N(   t   sett   providest   requirest   _sourcet   _ScanSource(   t   selft   source(    (    s³   /home/elemoine/src/openlayers.github.io/.grunt/openlayers-website/repo/node_modules/closure-util/.deps/library/8ef01183c539886a0c0458d8cc6d968170ae8d76/closure/bin/build/source.pyt   __init__.   s    	c         C   s   |  j  S(   s   Get the source as a string.(   R   (   R   (    (    s³   /home/elemoine/src/openlayers.github.io/.grunt/openlayers-website/repo/node_modules/closure-util/.deps/library/8ef01183c539886a0c0458d8cc6d968170ae8d76/closure/bin/build/source.pyt	   GetSource;   s    c         C   s   |  j  j d | ƒ S(   Nt    (   t   _COMMENT_REGEXt   sub(   t   clsR	   (    (    s³   /home/elemoine/src/openlayers.github.io/.grunt/openlayers-website/repo/node_modules/closure-util/.deps/library/8ef01183c539886a0c0458d8cc6d968170ae8d76/closure/bin/build/source.pyt   _StripComments?   s    c         C   s1   x* |  j  j | ƒ D] } d | k r t Sq Wt S(   s9   Determines whether the @provideGoog flag is in a comment.s   @provideGoog(   R   t   findallt   Truet   False(   R   R	   t   comment_content(    (    s³   /home/elemoine/src/openlayers.github.io/.grunt/openlayers-website/repo/node_modules/closure-util/.deps/library/8ef01183c539886a0c0458d8cc6d968170ae8d76/closure/bin/build/source.pyt   _HasProvideGoogFlagC   s    c         C   sí   |  j  |  j ƒ  ƒ } | j ƒ  } xp | D]h } t j | ƒ } | r_ |  j j | j d ƒ ƒ n  t j | ƒ } | r( |  j	 j | j d ƒ ƒ q( q( W|  j
 |  j ƒ  ƒ ré t |  j ƒ sÇ t |  j	 ƒ rÖ t d ƒ ‚ n  |  j j d ƒ n  d S(   s5   Fill in provides and requires by scanning the source.i   s3   Base file should not provide or require namespaces.t   googN(   R   R   t
   splitlinest   _PROVIDE_REGEXt   matchR   t   addt   groupt   _REQUIRES_REGEXR   R   t   lent	   Exception(   R   t   stripped_sourcet   source_linest   lineR   (    (    s³   /home/elemoine/src/openlayers.github.io/.grunt/openlayers-website/repo/node_modules/closure-util/.deps/library/8ef01183c539886a0c0458d8cc6d968170ae8d76/closure/bin/build/source.pyR   L   s     (   t   __name__t
   __module__t   __doc__t   ret   compilet	   MULTILINEt   DOTALLt   VERBOSER   R
   R   t   classmethodR   R   R   (    (    (    s³   /home/elemoine/src/openlayers.github.io/.grunt/openlayers-website/repo/node_modules/closure-util/.deps/library/8ef01183c539886a0c0458d8cc6d968170ae8d76/closure/bin/build/source.pyR      s   			c         C   s,   t  |  ƒ } z | j ƒ  SWd | j ƒ  Xd S(   sº   Get a file's contents as a string.

  Args:
    path: str, Path to file.

  Returns:
    str, Contents of file.

  Raises:
    IOError: An error occurred opening or reading the file.

  N(   t   opent   readt   close(   t   patht   fileobj(    (    s³   /home/elemoine/src/openlayers.github.io/.grunt/openlayers-website/repo/node_modules/closure-util/.deps/library/8ef01183c539886a0c0458d8cc6d968170ae8d76/closure/bin/build/source.pyt   GetFileContentse   s    (
   R$   t
   __author__R%   t   _BASE_REGEX_STRINGR&   R   R   t   objectR   R0   (    (    (    s³   /home/elemoine/src/openlayers.github.io/.grunt/openlayers-website/repo/node_modules/closure-util/.deps/library/8ef01183c539886a0c0458d8cc6d968170ae8d76/closure/bin/build/source.pyt   <module>   s   F