
^Yc           @   s  d  Z  d  Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z y e j e j	 f Z
 Wn e k
 r e e f Z
 n Xe j d  Z d e f d     YZ d e f d     YZ d e f d	     YZ d
 e f d     YZ d f  d     YZ d   Z d   Z d   Z d   Z d   Z d   Z d e f d     YZ e e e e d e  e j!  e e e e d 
 Z" e e d  Z# d   Z$ e$ Z% d S(   s   3.10iNs   ^[a-zA-Z0-9_]+$t   LexErrorc           B   s   e  Z d    Z RS(   c         C   s   | f |  _  | |  _ d  S(   N(   t   argst   text(   t   selft   messaget   s(    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   __init__:   s    (   t   __name__t
   __module__R   (    (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyR    9   s   t   LexTokenc           B   s   e  Z d    Z d   Z RS(   c         C   s    d |  j  |  j |  j |  j f S(   Ns   LexToken(%s,%r,%d,%d)(   t   typet   valuet   linenot   lexpos(   R   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   __str__A   s    c         C   s
   t  |   S(   N(   t   str(   R   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   __repr__D   s    (   R   R   R   R   (    (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyR	   @   s   	t	   PlyLoggerc           B   s8   e  Z d    Z d   Z d   Z d   Z e Z e Z RS(   c         C   s   | |  _  d  S(   N(   t   f(   R   R   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyR   L   s    c         O   s   |  j  j | | d  d  S(   Ns   
(   R   t   write(   R   t   msgR   t   kwargs(    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   criticalO   s    c         O   s    |  j  j d | | d  d  S(   Ns	   WARNING: s   
(   R   R   (   R   R   R   R   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   warningR   s    c         O   s    |  j  j d | | d  d  S(   Ns   ERROR: s   
(   R   R   (   R   R   R   R   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   errorU   s    (   R   R   R   R   R   R   t   infot   debug(    (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyR   K   s   				t
   NullLoggerc           B   s   e  Z d    Z d   Z RS(   c         C   s   |  S(   N(    (   R   t   name(    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   __getattribute__^   s    c         O   s   |  S(   N(    (   R   R   R   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   __call__a   s    (   R   R   R   R   (    (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyR   ]   s   	t   Lexerc           B   s   e  Z d    Z d d  Z d d  Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z e Z RS(   c         C   s   d  |  _ d  |  _ i  |  _ i  |  _ i  |  _ d |  _ g  |  _ d  |  _ i  |  _	 i  |  _
 i  |  _ d |  _ d  |  _ d |  _ d |  _ d  |  _ d  |  _ d  |  _ d |  _ d |  _ d  |  _ d |  _ t |  _ d  S(   Nt   INITIALi    t    i   (   t   Nonet   lexret	   lexretextt
   lexstateret   lexstateretextt   lexstaterenamest   lexstatet   lexstatestackt   lexstateinfot   lexstateignoret   lexstateerrorft   lexstateeofft
   lexreflagst   lexdataR   t   lexlent	   lexerrorft   lexeofft	   lextokenst	   lexignoret   lexliteralst	   lexmoduleR   t   Falset   lexoptimize(   R   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyR   t   s.    																						c         C   s3  t  j  |   } | r/i  } x |  j j   D] \ } } g  } xw | D]o \ } } g  }	 xZ | D]R }
 |
 su |
 d r |	 j |
  q] n  |	 j t | |
 d j  |
 d f  q] WqD W| j | |	 f  | | | <q+ W| | _ i  | _ x6 |  j j   D]% \ } } t | | j  | j | <q W| | _ n  | S(   Ni    i   (   t   copyR%   t   itemst   appendt   getattrR   R,   R6   (   R   t   objectt   ct   newtabt   keyt   ritemt   newret   cret   findext	   newfindexR   t   ef(    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   clone   s(    /		R!   c         C   sn  t  | t j  r! t d   n  | j d  d } t j j | |  d } t | d  } | j	 d | t
 f  | j	 d t t   | j	 d t t |  j    | j	 d	 t |  j   | j	 d
 t |  j   | j	 d t |  j   i  } x |  j j   D]r \ } } g  }	 xS t | |  j | |  j |  D]1 \ \ }
 } } } |	 j | t | |  f  qDW|	 | | <qW| j	 d t |   | j	 d t |  j   i  } x6 |  j j   D]% \ } } | r| j n d  | | <qW| j	 d t |   i  } x6 |  j j   D]% \ } } | r?| j n d  | | <q$W| j	 d t |   Wd  QXd  S(   Ns&   Won't overwrite existing lextab modulet   .is   .pyt   wsJ   # %s.py. This file automatically created by PLY (version %s). Don't edit!
s   _tabversion   = %s
s   _lextokens    = set(%s)
s   _lexreflags   = %s
s   _lexliterals  = %s
s   _lexstateinfo = %s
s   _lexstatere   = %s
s   _lexstateignore = %s
s   _lexstateerrorf = %s
s   _lexstateeoff = %s
(   t
   isinstancet   typest
   ModuleTypet   IOErrort   splitt   ost   patht   joint   openR   t   __version__t   reprt   __tabversion__t   tupleR3   R.   R5   R*   R%   R:   t   zipR&   R'   R;   t   _funcs_to_namesR+   R,   R   R"   R-   (   R   t   lextabt	   outputdirt   basetabmodulet   filenamet   tft   tabret	   statenamet   lret   titemt   patt   funct   retextt   renamest   taberrRF   t   tabeof(    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   writetab   s6     6 c         B   s  e  | e j  r | } n d | d  Ue j | } e | d d  e k r[ e d   n  | j |  _	 | j
 |  _ | j |  _ |  j	 e |  j  B|  _ | j |  _ | j |  _ i  |  _ i  |  _ x | j j   D]t \ } } g  } g  } x? | D]7 \ } }	 | j e j | | j
  e |	 |  f  q W| |  j | <| |  j | <q Wi  |  _ x. | j j   D] \ } }
 | |
 |  j | <qcWi  |  _ x. | j j   D] \ } }
 | |
 |  j | <qW|  j  d  d  S(   Ns	   import %st   _tabversions   0.0s   Inconsistent PLY versionR    (!   RJ   RK   RL   t   syst   modulesR<   RU   t   ImportErrort
   _lextokensR3   t   _lexreflagsR.   t   _lexliteralsR5   t   sett   lextokens_allt   _lexstateinfoR*   t   _lexstateignoreR+   R%   R&   t   _lexstatereR:   R;   t   ret   compilet   _names_to_funcsR,   t   _lexstateerrorfR-   t   _lexstateeofft   begin(   R   t   tabfilet   fdictRY   R_   R`   Ra   t   txtitemRb   t	   func_nameRF   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   readtab   s8    			/		c         C   sM   | d  } t  | t  s( t d   n  | |  _ d |  _ t |  |  _ d  S(   Ni   s   Expected a stringi    (   RJ   t   StringTypest
   ValueErrorR/   R   t   lenR0   (   R   R   R>   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   input   s    
		c         C   s   | |  j  k r t d   n  |  j  | |  _ |  j | |  _ |  j j | d  |  _ |  j j | d   |  _
 |  j j | d   |  _ | |  _ d  S(   Ns   Undefined stateR!   (   R%   R   R#   R&   R$   R+   t   getR4   R,   R"   R1   R-   R2   R(   (   R   t   state(    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyRz     s    c         C   s$   |  j  j |  j  |  j |  d  S(   N(   R)   R;   R(   Rz   (   R   R   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt
   push_state  s    c         C   s   |  j  |  j j    d  S(   N(   Rz   R)   t   pop(   R   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt	   pop_state  s    c         C   s   |  j  S(   N(   R(   (   R   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   current_state!  s    c         C   s   |  j  | 7_  d  S(   N(   R   (   R   t   n(    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   skip'  s    c         C   si  |  j  } |  j } |  j } |  j } x| | k  r| | | k rS | d 7} q' n  x|  j D]K\ } } | j | |  } | s q] n  t   } | j   | _ |  j	 | _	 | | _  | j
 }	 | |	 \ }
 | _ |
 s| j r | j   |  _  | S| j   } Pn  | j   } |  | _ | |  _ | |  _  |
 |  } | sQ|  j  } |  j } Pn  |  j s| j |  j k rt d |
 j j |
 j j |
 j | j f | |   qn  | SW| | |  j k rt   } | | | _ |  j	 | _	 | j | _ | | _  | d |  _  | S|  j rt   } |  j | | _ |  j	 | _	 d | _ |  | _ | | _  | |  _  |  j |  } | |  j  k rt d | | | |   n  |  j  } | sq' n  | S| |  _  t d | | | f | |   q' W|  j r:t   } d | _ d | _ |  j	 | _	 | | _  |  | _ | |  _  |  j |  } | S| d |  _  |  j d  k ret d   n  d  S(	   Ni   s4   %s:%d: Rule '%s' returned an unknown token type '%s'R   s&   Scanning error. Illegal character '%s's"   Illegal character '%s' at index %dt   eofR!   s"   No input string given with input()(   R   R0   R4   R/   R#   t   matchR	   t   groupR   R   t	   lastindexR
   t   endt   lexert   lexmatchR8   Rq   R    t   __code__t   co_filenamet   co_firstlinenoR   R5   R1   R2   R"   t   RuntimeError(   R   R   R0   R4   R/   R#   t   lexindexfunct   mt   tokt   iRc   t   newtok(    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   token1  s    				
										#										%							c         C   s   |  S(   N(    (   R   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   __iter__  s    c         C   s%   |  j    } | d  k r! t  n  | S(   N(   R   R"   t   StopIteration(   R   t   t(    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   next  s    	N(   R   R   R   R"   RG   Rh   R   R   Rz   R   R   R   R   R   R   R   t   __next__(    (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyR   s   s   	%	(						
	n		c         C   s   t  |  d |  j  S(   Nt   regex(   R<   t   __doc__(   Rc   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt
   _get_regex  s    c         C   sG   t  j |   } | j j   } | j | j k rC | j | j  n  | S(   N(   Rj   t	   _getframet	   f_globalsR9   t   f_localst   update(   t   levelsR   t   ldict(    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   get_caller_module_dict  s
    c         C   sa   g  } xT t  |  |  D]C \ } } | rL | d rL | j | | d f  q | j |  q W| S(   Ni    i   (   RW   R;   (   t   funclistt   namelistt   resultR   R   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyRX     s    c         C   sZ   g  } xM |  D]E } | rE | d rE | j  | | d | d f  q | j  |  q W| S(   Ni    i   (   R;   (   R   R|   R   R   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyRw     s    "c         C   s  |  s
 g  Sd j  |   } yt j | |  } d  g t | j j    d } | } x | j j   D] \ } }	 | j | d   }
 t	 |
  t
 j t
 j f k r |
 | | f | |	 <| | |	 <qe |
 d  k	 re | | |	 <| j d  d k r d | |	 <qd  | | f | |	 <qe qe W| | f g | g | g f SWn t k
 rt t |   d  } | d k rmd } n  t |  |  | | |  \ } } } t |  | | | |  \ } } } | | | | | | f SXd  S(   Nt   |i   t   ignore_i    i   (   NN(   RQ   Ru   Rv   R"   t   maxt
   groupindext   valuesR:   R   R
   RK   t   FunctionTypet
   MethodTypet   findt	   Exceptiont   intR   t   _form_master_re(   t   relistt   reflagsR   t   toknamesR   R#   R   t   lexindexnamesR   R   t   handleR   t   llistR`   t   lnamest   rlistt   rret   rnames(    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyR     s2     
 	""c         C   s   d } |  j  d  } x= t | d d  D]( \ } } | | k r) | d k r) Pq) q) W| d k rw t | d | ! } n d } d | k r t |  } n  d j | |  } | | f S(   Ni   t   _t   ANYR    (   s   INITIAL(   RN   t	   enumerateRV   RQ   (   R   t   namest   nonstatet   partsR   t   partt   statest	   tokenname(    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   _statetoken  s     t   LexerReflectc           B   sq   e  Z d d  d  Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z RS(   i    c         C   sq   | |  _  d  |  _ g  |  _ | |  _ i d d 6|  _ t   |  _ t |  _	 | d  k rd t
 t j  n | |  _ d  S(   Nt	   inclusiveR    (   R   R"   t
   error_funct   tokensR   t	   stateinfoRp   Rk   R7   R   R   Rj   t   stderrt   log(   R   R   R   R   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyR   /  s    					c         C   s,   |  j    |  j   |  j   |  j   d  S(   N(   t
   get_tokenst   get_literalst
   get_statest	   get_rules(   R   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   get_all:  s    


c         C   s%   |  j    |  j   |  j   |  j S(   N(   t   validate_tokenst   validate_literalst   validate_rulesR   (   R   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   validate_allA  s    


c         C   s   |  j  j d d   } | s8 |  j j d  t |  _ d  St | t t f  sj |  j j d  t |  _ d  S| s |  j j d  t |  _ d  S| |  _	 d  S(   NR   s   No token list is defineds   tokens must be a list or tuples   tokens is empty(
   R   R   R"   R   R   t   TrueRJ   t   listRV   R   (   R   R   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyR   H  s    			c         C   sx   i  } xk |  j  D]` } t j |  sD |  j j d |  t |  _ n  | | k rf |  j j d |  n  d | | <q Wd  S(   Ns   Bad token name '%s's   Token '%s' multiply definedi   (   R   t   _is_identifierR   R   R   R   R   (   R   t	   terminalsR   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyR   \  s    c         C   s1   |  j  j d d  |  _ |  j s- d |  _ n  d  S(   Nt   literalsR!   (   R   R   R   (   R   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyR   g  s    	c         C   s   y_ xX |  j  D]M } t | t  s5 t |  d k r |  j j d t |   t |  _ q q WWn* t k
 r |  j j d  t |  _ n Xd  S(   Ni   s.   Invalid literal %s. Must be a single charactersI   Invalid literals specification. literals must be a sequence of characters(	   R   RJ   R   R   R   R   RT   R   t	   TypeError(   R   R>   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyR   m  s    "c         C   su  |  j  j d d   |  _ |  j rqt |  j t t f  sU |  j j d  t	 |  _ qqx|  j D]} t | t  s t
 |  d k r |  j j d t |   t	 |  _ q_ n  | \ } } t | t  s |  j j d t |   t	 |  _ q_ n  | d k p| d k s,|  j j d |  t	 |  _ q_ n  | |  j k r]|  j j d	 |  t	 |  _ q_ n  | |  j | <q_ Wn  d  S(
   NR   s)   states must be defined as a tuple or listi   sM   Invalid state specifier %s. Must be a tuple (statename,'exclusive|inclusive')s   State name %s must be a stringR   t	   exclusives:   State type for state %s must be 'inclusive' or 'exclusive's   State '%s' already defined(   R   R   R"   R   RJ   RV   R   R   R   R   R   RT   R   R   (   R   R   R   t	   statetype(    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyR   x  s0    	"				c   	      C   s  g  |  j  D] } | d  d k r
 | ^ q
 } i  |  _ i  |  _ i  |  _ i  |  _ i  |  _ i  |  _ x+ |  j D]  } g  |  j | <g  |  j | <ql Wt |  d k r |  j	 j
 d  t |  _
 d  Sx| D]} |  j  | } t | |  j  \ } } | |  j | <t | d  r| d k r:x | D] } | |  j | <q Wq| d k rgx | D] } | |  j | <qMWq| d k r| j j } | j j } |  j	 j
 d	 | | | j  t |  _
 qx | D]  } |  j | j | | f  qWq t | t  r| d k r?x | D] } | |  j | <qWd
 | k r|  j	 j d |  qq| d k rj|  j	 j
 d |  t |  _
 qxG | D]  } |  j | j | | f  qqWq |  j	 j
 d |  t |  _
 q Wx* |  j j   D] } | j d d    qWx0 |  j j   D] } | j d d   d t  qWd  S(   Ni   t   t_i    s+   No rules of the form t_rulename are definedR   R   R   t   ignores,   %s:%d: Rule '%s' must be defined as a strings   \s#   %s contains a literal backslash '\'s'   Rule '%s' must be defined as a functions&   %s not defined as a function or stringR@   c         S   s   |  d j  j S(   Ni   (   R   R   (   t   x(    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   <lambda>  s    c         S   s   t  |  d  S(   Ni   (   R   (   R   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyR     s    t   reverse(   R   R   t   funcsymt   strsymR   t   errorft   eoffR   R   R   R   R   R   t   hasattrR   R   R   R   R;   RJ   R   R   R   t   sort(	   R   R   t   tsymbolsR   R   R   t   toknamet   linet   file(    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyR     sb    ,							!!c         C   s  x|  j  D]} x|  j | D]\ } } | j j } | j j } t j |  } |  j j |  |  j	 | } t
 | t j  r d } n d } | j j }	 |	 | k r |  j j d | | | j  t |  _ q n  |	 | k  r	|  j j d | | | j  t |  _ q n  t |  s@|  j j d | | | j  t |  _ q n  y` t j d | t |  f |  j  }
 |
 j d  r|  j j d | | | j  t |  _ n  Wq t j k
 r} |  j j d	 | | | j |  d
 t |  k r|  j j d | | | j  n  t |  _ q Xq WxJ|  j | D];\ } } |  j	 | } | d k rk|  j j d |  t |  _ q$n  | |  j k r| j d  d k  r|  j j d | |  t |  _ q$n  yQ t j d | | f |  j  }
 |
 j d  r|  j j d |  t |  _ n  Wq$t j k
 r^} |  j j d | |  d
 | k rR|  j j d |  n  t |  _ q$Xq$W|  j | r|  j | r|  j j d |  t |  _ n  |  j j | d   } | r
 | } | j j } | j j } t j |  } |  j j |  t
 | t j  rd } n d } | j j }	 |	 | k rW|  j j d | | | j  t |  _ n  |	 | k  r|  j j d | | | j  t |  _ qq
 q
 Wx |  j D] } |  j |  qWd  S(   Ni   i   s'   %s:%d: Rule '%s' has too many argumentss%   %s:%d: Rule '%s' requires an arguments2   %s:%d: No regular expression defined for rule '%s's
   (?P<%s>%s)R!   s<   %s:%d: Regular expression for rule '%s' matches empty strings3   %s:%d: Invalid regular expression for rule '%s'. %st   #s6   %s:%d. Make sure '#' in rule '%s' is escaped with '\#'R   s'   Rule '%s' must be defined as a functionR   i    s-   Rule '%s' defined for an unspecified token %ss5   Regular expression for rule '%s' matches empty strings,   Invalid regular expression for rule '%s'. %ss/   Make sure '#' in rule '%s' is escaped with '\#'s   No rules defined for state '%s'(   R   R   R   R   R   t   inspectt	   getmoduleRk   t   addR   RJ   RK   R   t   co_argcountR   R   R   R   R   Ru   Rv   R   R   R   R   R   R   R   R"   t   validate_module(   R   R   t   fnameR   R   R   t   moduleR   t   reqargst   nargsR>   t   eR   t   rt   efunc(    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyR     s    				%	$		c         C   s  y t  j |  \ } } Wn t k
 r- d  SXt j d  } t j d  } i  } | d 7} x | D] } | j |  } | s | j |  } n  | r | j d  }	 | j |	  }
 |
 s | | |	 <q t  j |  } |  j	 j
 d | | |	 |
  t |  _
 n  | d 7} qc Wd  S(   Ns   \s*def\s+(t_[a-zA-Z_0-9]*)\(s   \s*(t_[a-zA-Z_0-9]*)\s*=i   s7   %s:%d: Rule %s redefined. Previously defined on line %d(   R   t   getsourcelinesRM   Ru   Rv   R   R   R   t   getsourcefileR   R   R   (   R   R   t   linest   linent   fret   sret	   counthashR   R   R   t   prevR\   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyR   @  s*    
N(   R   R   R"   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyR   .  s   								B	gRY   c
   &      B   s  | d  k r d } n  d  }
 i d d 6} e   } | | _ |	 d  k rX e e j  }	 n  | r | d  k r e e j  } q n  | r | }  n  |  r g  e |   D] } | e |  |  f ^ q } e |  }
 d |
 k re j	 |
 d j
 |
 d <qn e d  }
 |
 j d  } | rHe | e  rHd | k rH| d | } qHn  e |
 d	 |	 d
 | } | j   | s| j   re d   qn  | r| ry0 | j | |
  | j a | j a | a | SWqe k
 rqXn  | r#| j d | j  | j d | j  | j d | j  n  e   | _ x! | j D] } | j j |  q9We | j e e  f  re! | j d    j" | j  | _# n | j | _# | j e | j#  B| _$ | j } i  } x | D] } g  } xu | j% | D]f \ } } | j& j' } | j& j( } | j) d | e* |  f  | r| j d | e* |  |  qqWxQ | j+ | D]B \ } } | j) d | | f  | r`| j d | | |  q`q`W| | | <qW| r| j d  n  x | D] } e, | | | |
 | j-  \ } } } | | j. | <| | j/ | <| | j0 | <| rx3 e1 |  D]" \ } } | j d | | |  q6WqqWx | j2   D]x \ } }  | d k rp|  d k rp| j. | j3 | j. d  | j/ | j3 | j/ d  | j0 | j3 | j0 d  qpqpW| | _4 | j. d | _5 | j/ d | _6 | | _7 | j8 | _9 | j9 j d d  | _: | j; | _< | j; j d d   | _= | j= s|	 j> d  n  | j? | _@ | j? j d d   | _A x | j2   D] \ }! }  |  d k r|! | j; k r|	 j> d |!  n  |! | j8 k r| j: r|	 j> d |!  qq|  d k r|! | j; k rR| j; j d d   | j; |! <n  |! | j8 k r| j8 j d d  | j8 |! <qqqW| j a | j a | a | r| r| d  k rJe | eB jC  r| j
 }" n` d | k r|
 d }" nG | jD d  }# d j" |# d   }$ d |$ d  Ue e j	 |$ d d  }" eE jF jG |"  } n  y | jH | |  WqeI k
 r}% |	 j> d | |% f  qXn  | S(   NRY   R   R    t   __file__R   i   t   __package__RH   R   R   s   Can't build lexers   lex: tokens   = %rs   lex: literals = %rs   lex: states   = %ri    s
   (?P<%s>%s)s(   lex: Adding rule %s -> '%s' (state '%s')s#   lex: ==== MASTER REGEXS FOLLOW ====s"   lex: state '%s' : regex[%d] = '%s'R!   s   No t_error rule is definedR   s1   No error rule is defined for exclusive state '%s's2   No ignore rule is defined for exclusive state '%s'is	   import %ss#   Couldn't write lextab module %r. %s(J   R"   R   R8   R   Rj   R   t   dirR<   t   dictRk   R
  R   R   RJ   R   R   R   R   t   SyntaxErrorR   R   R   R   Rl   R   R   R   R   Rp   R3   R   R   RV   R
   RQ   R5   Rq   R   R   R   R   R;   R   R   R   R   R%   R&   R'   R   R:   t   extendR*   R#   R$   R.   R   R+   R4   R   R,   R1   R   R   R-   R2   RK   RL   RN   RO   RP   t   dirnameRh   RM   (&   R   R=   R   t   optimizeRY   R   t   nowarnRZ   t   debuglogt   errorlogR   R   t   lexobjt   kt   _itemst   pkgt   linfoR   t   regexsR   t
   regex_listR   R   R   R   R   R   R#   t   re_textt   re_namesR   R   t   stypeR   t   srcfileR   t   pkgnameR   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   lex_  s    				.
		(	#%!"			&		c         C   s   | so y3 t  j d } t |  } | j   } | j   Wqo t k
 rk t  j j d  t  j j   } qo Xn  |  r |  j	 } n t	 } | |  |  r |  j
 } n t
 } xI t r |   } | s Pn  t  j j d | j | j | j | j f  q Wd  S(   Ni   s/   Reading from standard input (type EOF to end):
s   (%s,%r,%d,%d)
(   Rj   t   argvRR   t   readt   closet
   IndexErrort   stdoutR   t   stdinR   R   R   R
   R   R   R   (   R   t   dataR\   R   t   _inputt   _tokenR   (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   runmain  s*    
		c            s     f d   } | S(   Nc            s.   t    d  r! t    |  _ n	   |  _ |  S(   NR   (   R   R   R   (   R   (   R   (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt	   set_regexB  s    	(    (   R   R,  (    (   R   s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   TOKENA  s    (&   RS   RU   Ru   Rj   RK   R9   RO   R   t
   StringTypet   UnicodeTypeR   t   AttributeErrorR   t   bytesRv   R   R   R    R=   R	   R   R   R   R   R   RX   Rw   R   R   R   R"   R7   R   t   VERBOSER!  R+  R-  t   Token(    (    (    s$   /tmp/pip-build-kpPAdC/ply/ply/lex.pyt   <module>"   s>    E	
				(	 2!"	
