U AT^0c @sddlZddlmZzddlmZWnek r<dZYnXddgZejej Bej BZ e dZ e dZe dZGd ddeZeee d Zed e Zd d dddddddZddZdeejfddZepeZede ZdZdejefddZejefddZGd ddeZdS)!N)scanner) scanstring JSONDecoderJSONDecodeErrorZnanZinfz-infc@seZdZddZddZdS)rcCsb|dd|d}||dd|}d||||f}t||||_||_||_||_||_dS)N rz%s: line %d column %d (char %d)) ZcountZrfind ValueError__init__msgdocposlinenocolno)selfr r r r r Zerrmsgr$/usr/lib64/python3.8/json/decoder.pyrs zJSONDecodeError.__init__cCs|j|j|j|jffSN)Z __class__r r r )rrrr __reduce__*szJSONDecodeError.__reduce__N)__name__ __module__ __qualname__rrrrrrrs  )z -InfinityZInfinityNaNz(.*?)(["\\\x00-\x1f])"\/zz rz z )rrrZbZfZnZrZtcCsb||d|d}t|dkrN|ddkrNz t|dWStk rLYnXd}t|||dS)NriZxXizInvalid \uXXXX escape)lenintrr)sr escr rrr _decode_uXXXX;s rTcCsg}|j}|d}|||}|dkr0td|||}|\} } | rP|| | dkr^qn.| dkr|rd| } t| ||n || qz ||} Wn"tk rtd||dYnX| dkrz || } Wn*tk rd| } t| ||YnX|d7}nt||}|d7}d |kr2d krnn`|||d d krt||d}d |krrdkrnn d|d d>|d B}|d7}t|} || qd ||fS)NrzUnterminated string starting atrrz"Invalid control character {0!r} atZuzInvalid \escape: {0!r}riiiz\uiiii i) appendrendZgroupsZformat IndexErrorZKeyErrorrZchrZjoin)rr"strictZ_bZ_mZchunks_appendZbeginZchunkZcontentZ terminatorr rZcharZuniZuni2rrr py_scanstringEsX           2 r&z [ \t\n\r]*z c Cs|\}} g} | j} |dkri}|j} || | d} | dkr| |krb||| } || | d} | dkr|dk r|| }|| dfSi} |dk r|| } | | dfS| dkrtd|| | d7} t|| |\}} | ||}|| | ddkr"||| } || | ddkr"td|| | d7} z:|| |krb| d7} || |krb||| d} Wntk rzYnXz||| \}} Wn4tk r}ztd||jdW5d}~XYnX| ||fz0|| } | |kr||| d} || } Wntk rd} YnX| d7} | dkr4qn| d krNtd || d||| } || | d} | d7} | dkrtd|| dq|dk r|| }|| fSt| } |dk r|| } | | fS) NrrZ}z1Expecting property name enclosed in double quotesz:zExpecting ':' delimiterExpecting valuer ,Expecting ',' delimiter) r!Z setdefaultr"rrr# StopIterationvalueZdict) s_and_endr$ scan_once object_hookobject_pairs_hookmemo_w_wsrr"ZpairsZ pairs_appendZmemo_getnextcharZresultZkeyr+errrrr JSONObjects    "        r5c Cst|\}}g}|||d}||krF|||d}|||d}|dkrZ||dfS|j}z|||\} }Wn2tk r} ztd|| jdW5d} ~ XYnX|| |||d}||kr|||d}|||d}|d7}|dkrqln|dkrtd||dz:|||krP|d7}|||krP|||d}Wq`tk rhYq`Xq`||fS)Nrz]r'r(r))r"r!r*rr+r#) r,r-r1r2rr"Zvaluesr3r%r+r4rrr JSONArrays> " r6c@s<eZdZdddddddddZejfddZd d d ZdS) rNT)r. parse_float parse_intparse_constantr$r/cCsZ||_|p t|_|pt|_|p"tj|_||_||_ t |_ t |_ t|_i|_t||_dSr)r.floatr7rr8 _CONSTANTSZ __getitem__r9r$r/r5Z parse_objectr6Z parse_arrayrZ parse_stringr0rZ make_scannerr-)rr.r7r8r9r$r/rrrrs#   zJSONDecoder.__init__cCsF|j|||dd\}}|||}|t|krBtd|||S)Nr)idxz Extra data) raw_decoder"rr)rrr1objr"rrrdecodeLs   zJSONDecoder.decoderc CsPz|||\}}Wn2tk rF}ztd||jdW5d}~XYnX||fS)Nr')r-r*rr+)rrr<r>r"r4rrrr=Ws "zJSONDecoder.raw_decode)r)rrrr WHITESPACEmatchr?r=rrrrrs 0 )ZreZjsonrZ_jsonrZ c_scanstringZ ImportErrorZ__all__ZVERBOSEZ MULTILINEZDOTALLZFLAGSr:rZPosInfZNegInfrrr;ZcompileZ STRINGCHUNKZ BACKSLASHrrAr&r@ZWHITESPACE_STRr5r6ZobjectrrrrrZsN     =  Q%