ó m”þfc@s}dZddlZejdƒjZejdƒjZejdƒZejdƒZejdƒZ[dd d „ƒYZ dS( süShared support for scanning document type declarations in HTML and XHTML. This module is used as a foundation for the HTMLParser and sgmllib modules (indirectly, for htmllib as well). It has no documented public API and should not be used directly. iÿÿÿÿNs[a-zA-Z][-_.a-zA-Z0-9]*\s*s(\'[^\']*\'|"[^"]*")\s*s--\s*>s ]\s*]\s*>s]\s*>t ParserBasecBs¡eZdZd„Zd„Zd„Zd„Zd„ZdZd„Z dd „Z dd „Z d „Z d „Z d „Zd„Zd„Zd„Zd„ZRS(siParser base class which provides some common support methods used by the SGML/HTML and XHTML parsers.cCs"|jtkrtdƒ‚ndS(Ns(markupbase.ParserBase must be subclassed(t __class__Rt RuntimeError(tself((s"/usr/lib64/python2.7/markupbase.pyt__init__scCstdƒ‚dS(Ns.subclasses of ParserBase must override error()(tNotImplementedError(Rtmessage((s"/usr/lib64/python2.7/markupbase.pyterror!scCsd|_d|_dS(Nii(tlinenotoffset(R((s"/usr/lib64/python2.7/markupbase.pytreset%s cCs|j|jfS(s&Return current line number and offset.(RR (R((s"/usr/lib64/python2.7/markupbase.pytgetpos)scCs…||kr|S|j}|jd||ƒ}|rm|j||_|jd||ƒ}||d|_n|j|||_|S(Ns i(trawdatatcountRtrindexR (RtitjR tnlinestpos((s"/usr/lib64/python2.7/markupbase.pyt updatepos1s  tc Cse|j}|d}|||!dks2tdƒ‚|||d!dkrQ|dS|||d!dkrldSt|ƒ}|||d!d krœ|j|ƒS||d kr¹|j|ƒS|j||ƒ\}}|d krá|S|d krùd|_nxe||kr`||}|dkr`||d|!}|d krK|j|ƒn |j|ƒ|dS|d kr”t ||ƒ}|s…dS|j ƒ}n¹|dkr»|j||ƒ\} }n’||jkr×|d}nv|d kr8|d kr|j |d|ƒ}qM|dkr(|j d|ƒqM|j dƒn|j d||ƒ|d krü|SqüWdS(Nist-Riÿÿÿÿs--t[itdoctypes"'t4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZtattlisttlinktypetlinktelements&unsupported '[' char in %s declarations"unexpected '[' char in declarations!unexpected %r char in declaration(RR(RRslinkselement( R tAssertionErrortlent parse_commenttparse_marked_sectiont _scan_namet_decl_othercharst handle_declt unknown_declt_declstringlit_matchtendt_parse_doctype_subsetR( RRR Rtntdecltypetctdatatmtname((s"/usr/lib64/python2.7/markupbase.pytparse_declarationAsZ                   icCs|j}|||d!dks,tdƒ‚|j|d|ƒ\}}|dkrX|S|dkr}tj||dƒ}nA|dkr¢tj||dƒ}n|jd ||d|!ƒ|sÈdS|rø|jdƒ}|j||d|!ƒn|j dƒS(NisR((s"/usr/lib64/python2.7/markupbase.pyR ©s c CsÌ|j}t|ƒ}|}xª||krÇ||}|dkr”|||d!}|dkradS|dkr•|j||dƒ|jd|ƒn|d|kr©dS|d|kr½dS|||d!dkrÿ|j|d d ƒ}|d kr|Sqn|j|d|ƒ\}}|dkr+dS|dkr_|j||dƒ|jd|ƒnt|d|ƒ} | ||ƒ}|d krÄ|Sq|dkr|d|kr´dS|j|d|ƒ\}}|d krà|S||dkrÄ|d}qÄq|dkrŠ|d}x*||krB||jƒrB|d}qW||krƒ||dkrc|S|j||ƒ|jdƒqÄdSq|jƒr£|d}q|j||ƒ|jd|ƒqWdS(Nts$     cCs1|j}|||d!dkrh|d}xA|||d!}|sHdS|jƒra|d}q-Pq-n|}|j||ƒ\}}|dkr–|Sx”|j||d!}|s·dS|dkrît||ƒ}|rç|jƒ}q*dSq™|dkr|dS|j||ƒ\}}|dkr™|Sq™dS(NiREiÿÿÿÿis'"R(R RIR"R&R'(RRRJR RR+R.R-((s"/usr/lib64/python2.7/markupbase.pyt_parse_doctype_entityUs8        cCs²|j}t|ƒ}||kr%dSt||ƒ}|r‚|jƒ}|jƒ}|t|ƒ|krldS|jƒ|jƒfS|j||ƒ|j d|||d!ƒdS(Niÿÿÿÿsexpected name token at %ri(Niÿÿÿÿ(Niÿÿÿÿ( R RtNonet_declname_matchtgrouptstriptlowerR'RR(RRRJR R)R-RKR.((s"/usr/lib64/python2.7/markupbase.pyR"ys      cCsdS(N((RR,((s"/usr/lib64/python2.7/markupbase.pyR%‹s(t__name__t __module__t__doc__RRR R RR#R/R!R R(RNRRRSRTR"R%(((s"/usr/lib64/python2.7/markupbase.pyRs"      R   C 9  $ (( R\tretcompileR>RVR&R?R8R:R(((s"/usr/lib64/python2.7/markupbase.pyts