3

T'ícã@sòdZddlZddlmZmZmZmZmZmZej	dƒZ
ej	dƒZej	dƒZej	dƒZ
ej	dƒZd	d
ddd
dddœZej	dƒZeedœdd„Zeedœdd„ZedjƒƒZd%eeedœdd„Zeeddœdd„Zeedœd d!„Zeed"œd#d$„ZdS)&z}This module implements a simple JavaScript serializer.

Uses the basestring encode function from simplejson by Bob Ippolito.
éN)ÚIOÚAnyÚDictÚListÚMatchÚUnionz"(\\\\|\\"|[^"])*"z\d+z[a-zA-Z_]\w*z[a-zA-Z_][a-zA-Z0-9_]*$z([\\"]|[^\ -~])z\\z\"z\bz\fz\nz\rz\t)ú\ú"úúÚ
ú
ú	z\\u.{4}|\\.)ÚsÚreturncCs(ttdœdd„}dttj||ƒƒdS)N)ÚmatchrcSsv|jdƒ}yt|Stk
rpt|ƒ}|dkr<d|fS|d8}d|d?d@B}d|d@B}d||fSYnXdS)	Nriz\u%04xiØé
iÿiÜz\u%04x\u%04x)ÚgroupÚESCAPE_DICTÚKeyErrorÚord)rrÚnÚs1Ús2©rú4/tmp/pip-build-gk9425m9/sphinx/sphinx/util/jsdump.pyÚreplaces

zencode_string.<locals>.replacer	)rÚstrÚESCAPE_ASCIIÚsub)rrrrrÚ
encode_stringsr cCstjdd„|ƒS)NcSstd|jƒdƒS)Nr	)Úevalr)ÚmrrrÚ<lambda>0szdecode_string.<locals>.<lambda>)ÚESCAPEDr)rrrrÚ
decode_string/sr%aÝabstract   else   instanceof   switch
boolean   enum   int   synchronized
break   export   interface   this
byte   extends   long   throw
case   false   native   throws
catch   final   new   transient
char   finally   null   true
class   float   package   try
const   for   private   typeof
continue   function   protected   var
debugger   goto   public   void
default   if   return   volatile
delete   implements   short   while
do   import   static   with
double   in   superF)ÚobjÚkeyrcCs|r4t|tƒst|ƒ}tj|ƒr,|tkr,|St|ƒS|dkr@dS|dksP|dkr\|rXdSdSt|ttfƒrrt|ƒSt|tƒrœddj	t
dd	„|jƒDƒƒƒSt|tƒrÂd
dj	t
dd	„|DƒƒƒSt|t
tfƒrèd
dj	dd	„|DƒƒSt|tƒrüt|ƒStt|ƒƒ‚dS)
NÚnullTFÚtrueÚfalsez{%s}ú,css(|] \}}dt|dƒt|ƒfVqdS)z%s:%sTN)Údumps)Ú.0r'Úvaluerrrú	<genexpr>Tszdumps.<locals>.<genexpr>z[%s]css|]}t|ƒVqdS)N)r,)r-Úxrrrr/Yscss|]}t|ƒVqdS)N)r,)r-r0rrrr/[s)Ú
isinstancerÚ_nameonly_rerÚreswordsr ÚintÚfloatÚdictÚjoinÚsortedÚitemsÚsetÚtupleÚlistÚ	TypeErrorÚtype)r&r'rrrr,Es,


r,)r&ÚfrcCs|jt|ƒƒdS)N)Úwriter,)r&r?rrrÚdumpasrA)r0rcCsštƒ}d}t|ƒ}g}|}d}g}x^||kr‚||}|dkrfi}|j|ƒd}|j|ƒ|d7}q&|dkr”g}|j|ƒd}|j|ƒ|d7}q&|dkr"|rº|d|k	r¶tdƒ‚d}|jƒ}	|jƒ|r|d}t|tƒr
|d|krütd	|	ƒ‚|	||d<n
|j|	ƒnP|d7}q&|d
krT|r:tdƒ‚t|tƒrJd}|d7}q&|dkrŽt|tƒsrtd
ƒ‚|d7}|sˆtdƒ‚d}q&d}
tj||ƒ}|rºt	|j
ƒdd…ƒ}
n†tj||ƒ}|rÚt|j
ƒƒ}
nft
j||ƒ}|r4|j
ƒ}
|
dkrd}
n.|
dkrd}
n|
dkr$d}
n|s@tdƒ‚ntd|ƒ‚|jƒ}t|tƒrv|rd|
|d<n|
||d<d}q&|j|
ƒq&W||kr–tdƒ‚|S)z8Loader that can read the JS subset the indexer produces.rFÚ{Téú[z}]zunfinished dictzinvalid key objectr+z
multiple keysú:z
colon in listzmultiple valuesNr)r*r(zbareword as valuezread error at pos %dznothing loaded from stringéÿÿÿÿrFrFrFrFrFrF)ÚobjectÚlenÚappendÚ
ValueErrorÚpopr1r6Ú_str_rerr%rÚ_int_rer4Ú_name_reÚend)r0ZnothingÚirÚstackr&r'ÚkeysÚcZoldobjÚyr"rrrÚloadsesž

















rU)r?rcCst|jƒƒS)N)rUÚread)r?rrrÚloadÁsrW)F)Ú__doc__ÚreÚtypingrrrrrrÚcompilerLrMrNr2rrr$rr r%r:Úsplitr3Úboolr,rArUrWrrrrÚ<module>s. 






\