U e5d9ã@sRddlZe d¡jZe d¡jZe d¡Ze d¡Ze d¡Z[Gdd„dƒZdS) éNz[a-zA-Z][-_.a-zA-Z0-9]*\s*z(\'[^\']*\'|"[^"]*")\s*z--\s*>z ]\s*]\s*>z]\s*>c@sŒeZdZdd„Zdd„Zdd„Zdd„Zd d „Zd Zd d „Z d"dd„Z d#dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd „Zd!S)$Ú ParserBasecCs|jtkrtdƒ‚dS)Nz)_markupbase.ParserBase must be subclassed)Ú __class__rÚ RuntimeError©Úself©rú#/usr/lib64/python3.8/_markupbase.pyÚ__init__s ÿzParserBase.__init__cCs tdƒ‚dS)Nz.subclasses of ParserBase must override error())ÚNotImplementedError)rÚmessagerrrÚerror sÿzParserBase.errorcCsd|_d|_dS)Nér©ÚlinenoÚoffsetrrrrÚreset$szParserBase.resetcCs |j|jfS©NrrrrrÚgetpos(szParserBase.getposcCsb||kr |S|j}| d||¡}|rN|j||_| d||¡}||d|_n|j|||_|S)NÚ r )ÚrawdataÚcountrÚrindexr)rÚiÚjrZnlinesÚposrrrÚ updatepos0s zParserBase.updateposÚc CsÂ|j}|d}|||d…dkr*|dS|||d…dkrBdSt|ƒ}|||d…dkrh| |¡S||dkr~| |¡S| ||¡\}}|dkrš|S|d kr¨d |_||kr¾||}|dkrø||d|…}|d kræ| |¡n | |¡|dS|d kr t||ƒ}|sdS|  ¡}n|d kr<| ||¡\} }nt||jkrR|d}n^|dkrž|d krx|  |d|¡}n$|d kr’|  d|¡n |  d¡n|  d||¡|dkr¨|Sq¨dS)Nér ú>)ú-réÿÿÿÿz--ú[rZdoctyperz"'Z4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ>ÚlinktypeÚattlistÚelementÚlinkz&unsupported '[' char in %s declarationz"unexpected '[' char in declarationz!unexpected %r char in declaration) rÚlenÚ parse_commentÚparse_marked_sectionÚ _scan_nameÚ_decl_othercharsZ handle_declÚ unknown_declÚ_declstringlit_matchÚendÚ_parse_doctype_subsetr ) rrrrÚnZdecltypeÚcÚdataÚmÚnamerrrÚparse_declaration@sZ                  ÿzParserBase.parse_declarationr cCsª|j}| |d|¡\}}|dkr&|S|dkr@t ||d¡}n4|dkrZt ||d¡}n| d||d|…¡|s|dS|r | d¡}| ||d|…¡| d¡S)Nér>ÚrcdataÚtempÚignoreÚcdataÚinclude>ÚendifÚelseÚifz+unknown status keyword %r in marked sectionr ) rr)Ú_markedsectioncloseÚsearchÚ_msmarkedsectioncloser Ústartr+r-)rrÚreportrZsectNamerÚmatchrrrr(’s zParserBase.parse_marked_sectioncCsj|j}|||d…dkr$| d¡t ||d¡}|sr$r#ÚnotationÚentityz)unknown declaration %r in internal subsetZ_parse_doctype_ú%ú;ú]rz%unexpected char after internal subsetz%unexpected char %r in internal subset)rr&rr r'r)ÚgetattrÚisspace) rrÚ declstartposrr/rr0Úsr3Zmethrrrr.¶sp     ÿ             z ParserBase._parse_doctype_subsetcCsF| ||¡\}}|dkrdS|j}d||d…krB| d|¡dSdS)Nr rr )r)rÚfind)rrrOr3rrrrrÚ_parse_doctype_elementùsz!ParserBase._parse_doctype_elementcCs¶|j}| ||¡\}}|||d…}|dkr2dS|dkrB|dS| ||¡\}}|dkr^|S|||d…}|dkrzdS|dkrØd||d…kr¤| d|¡d}ndS|||d… ¡rÆ|d}q¨||d…sèdSn| ||¡\}}|||d…}|sdS|dkrDt||ƒ}|r&| ¡}ndS|||d…}|sDdS|d kr ||d…d krddS| |d|¡\}}|dkr†|S|||d…}|s dS|dkrB|dSqBdS) Nr rr rrú(ú)ú'"ú#)rr)rQrNr,r-)rrrOrr3rr0r2rrrÚ_parse_doctype_attlistsX       z!ParserBase._parse_doctype_attlistcCs| ||¡\}}|dkr|S|j}|||d…}|s:dS|dkrJ|dS|dkrnt||ƒ}|sddS| ¡}q"| ||¡\}}|dkr"|Sq"dS)Nrr r rrU)r)rr,r-)rrrOr3rrr0r2rrrÚ_parse_doctype_notation=s"  z"ParserBase._parse_doctype_notationcCsä|j}|||d…dkrR|d}|||d…}|s:dS| ¡rP|d}q"qVq"n|}| ||¡\}}|dkrr|S|j||d…}|sŒdS|dkr²t||ƒ}|r¬| ¡}qÞdSqr|dkrÂ|dS| ||¡\}}|dkrr|SqrdS)Nr rJr rrUr)rrNr)r,r-)rrrOrrr0r3r2rrrÚ_parse_doctype_entityTs4   z ParserBase._parse_doctype_entitycCs†|j}t|ƒ}||krdSt||ƒ}|r\| ¡}| ¡}|t|ƒ|krLdS| ¡| ¡fS| ||¡| d|||d…¡dS)N)Nr zexpected name token at %ré) rr&Ú_declname_matchÚgroupÚstripÚlowerr-rr )rrrOrr/r2rPr3rrrr)xs  ÿzParserBase._scan_namecCsdSrr)rr1rrrr+ŠszParserBase.unknown_declN)r )r )Ú__name__Ú __module__Ú __qualname__r r rrrr*r4r(r'r.rRrWrXrYr)r+rrrrrs  R  C 9$r) ÚreÚcompilerCr[r,rFr>r@rrrrrÚs