ó
µ”ù\c        ,   @   s»  d  Z  d d l m Z d d l Z d d l m Z e d d d d d	 d
 d d d d d d d d d d d d d d d d d d d d d d  d! d" d# d$ d% d& d' d( d) d* d+ d, d- d. d/ g+ d0 e d1 e ƒZ	 i d2 d3 6d4 d5 6d6 d7 6d8 d9 6d: d; 6Z
 e j d< e j ƒ Z e j d= e j ƒ Z e j d> ƒ Z e j d? e j ƒ Z e j d@ ƒ Z e j dA e j ƒ Z e j dB ƒ Z e dC dD ƒ Z d e j dE e j ƒ f d e j dF ƒ f dG e j dH ƒ f dI e j dJ e j e j Bƒ f dK e f dL e f dM e j dN e j ƒ f dO e j dP e j ƒ f dQ e j dR d j e e j e	 ƒ ƒ ƒ f dS e j dT e j ƒ f dU e j dV e j e j Bƒ f g Z dW „  Z dX „  Z dY „  Z  e e e dZ „ Z! d S([   sí   
    babel.messages.jslexer
    ~~~~~~~~~~~~~~~~~~~~~~

    A simple JavaScript 1.5 lexer which is used for the JavaScript
    extractor.

    :copyright: (c) 2013-2019 by the Babel Team.
    :license: BSD, see LICENSE for more details.
iÿÿÿÿ(   t
   namedtupleN(   t   unichrt   +t   -t   *t   %s   !=s   ==t   <t   >s   <=s   >=t   =s   +=s   -=s   *=s   %=s   <<s   >>s   >>>s   <<=s   >>=s   >>>=t   &s   &=t   |s   |=s   &&s   ||t   ^s   ^=t   (t   )t   [t   ]t   {t   }t   !s   --s   ++t   ~t   ,t   ;t   .t   :t   keyt   reverses   t   bs   t   fs   
t   ns   t   rs   	t   ts   [\w$_][\w\d$_]*s   [\w$_][\w\d$_.]*[\w\d$_.]s   /=?s%   /(?:[^/\\]*(?:\\.[^/\\]*)*)/[a-zA-Z]*s   (\r\n|\n|\r)s   \\s   [a-fA-F0-9]{1,4}t   Tokens   type value linenos   \s+s   <!--.*t   linecomments   //.*t   multilinecomments	   /\*.*?\*/t   dotted_namet   namet   numbersb   (
        (?:0|[1-9]\d*)
        (\.\d+)?
        ([eE][-+]?\d+)? |
        (0x[a-fA-F0-9]+)
    )t   jsx_tags   (?:</?[^>\s]+|/>)t   operators   (%s)t   template_strings   `(?:[^`\\]*(?:\\.[^`\\]*)*)`t   stringsT   (
        '(?:[^'\\]*(?:\\.[^'\\]*)*)'  |
        "(?:[^"\\]*(?:\\.[^"\\]*)*)"
    )c         C   s   g  } x€ t  D]x \ } } |  r8 | r8 d | k r8 q n  | rQ | d k rQ q n  | d k rr | si q n  d } n  | j | | f ƒ q W| S(   se   
    Get a tokenization rule list given the passed syntax options.

    Internal to this module.
    t   jsxR'   R"   R#   (   t   _rulest   append(   R)   t   dottedR'   t   rulest
   token_typet   rule(    (    s5   lib/python2.7/site-packages/babel/messages/jslexer.pyt	   get_rules:   s    	c         C   s)   |  j  d k r |  j d k S|  j  d k S(   sz   A helper function that helps the tokenizer to decide if the current
    token may be followed by a division operator.
    R&   R   R   R   s   ++s   --R#   R$   R(   t   regexp(   R   R   R   s   ++s   --(   R#   R$   R(   R1   (   t   typet   value(   t   token(    (    s5   lib/python2.7/site-packages/babel/messages/jslexer.pyt   indicates_divisionN   s    c         C   sÇ  |  r* |  d |  d k r* |  d d k s6 t  d ƒ ‚ t j d |  d d !ƒ }  g  } | j } d } x0|  j d | ƒ } | d k  r‰ Pn  | |  | | !ƒ |  | d } | t k rÅ | t | ƒ nÄ | d k rt j |  | d	 ƒ } | d k	 rr| j	 ƒ  } t
 | ƒ d
 k rRy | t t | d ƒ ƒ ƒ Wn t k
 rAqRX| d } qg n  | | | ƒ | j ƒ  } qg q‰| | ƒ n
 | | ƒ | d	 } qg W| t
 |  ƒ k  rº| |  | ƒ n  d j | ƒ S(   s¥   Unquote a string with JavaScript rules.  The string has to start with
    string delimiters (``'``, ``"`` or the back-tick/grave accent (for template strings).)
    i    iÿÿÿÿs   "'`s)   string provided is not properly delimiteds   \1i   s   \t   uUi   i   i   i   u    N(   t   AssertionErrort   line_join_ret   subR+   t   findt   escapest   uni_escape_ret   matcht   Nonet   groupt   lenR   t   intt
   ValueErrort   endt   join(   R(   t   resultt   addt   post
   escape_post	   next_chart   escapedt   escaped_value(    (    s5   lib/python2.7/site-packages/babel/messages/jslexer.pyt   unquote_stringW   sD    -		

c         c   sA  t  } d } d } t |  ƒ } t d | d | d | ƒ } x| | k  r<x‹ | D]. \ }	 }
 |
 j |  | ƒ } | d k	 rO PqO qO W| r¢ t j |  | ƒ } d }	 n t j |  | ƒ } d }	 | d k rÖ | d 7} q< n  | j ƒ  } |	 d k	 rt |	 | | ƒ } t	 | ƒ } | Vn  | t t
 j | ƒ ƒ 7} | j ƒ  } q< Wd S(	   sì   
    Tokenize JavaScript/JSX source.  Returns a generator of tokens.

    :param jsx: Enable (limited) JSX parsing.
    :param dotted: Read dotted names as single name token.
    :param template_string: Support ES6 template strings
    i    i   R)   R,   R'   R&   R1   N(   t   FalseR@   R0   R=   R>   t   division_ret   regex_reR?   R   R5   t   line_ret   findallRC   (   t   sourceR)   R,   R'   t
   may_divideRG   t   linenoRC   R-   R.   R/   R=   t   token_valueR4   (    (    s5   lib/python2.7/site-packages/babel/messages/jslexer.pyt   tokenize   s2    	
("   t   __doc__t   collectionsR    t   ret   babel._compatR   t   sortedR@   t   Truet	   operatorsR;   t   compilet   UNICODEt   name_ret   dotted_name_reRN   t   DOTALLRO   RP   t   patternR8   R<   R   R>   t   VERBOSEt   IRD   t   mapt   escapeR*   R0   R5   RL   RV   (    (    (    s5   lib/python2.7/site-packages/babel/messages/jslexer.pyt   <module>   sF   !!*)			+					8