zfc@s}dZddlZejdjZejdjZejdZejdZejdZ[dd d YZ dS( sShared 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. iNs[a-zA-Z][-_.a-zA-Z0-9]*\s*s(\'[^\']*\'|"[^"]*")\s*s--\s*>s ]\s*]\s*>s]\s*>t ParserBasecBseZdZdZdZdZdZdZdZdZ dd Z dd Z d Z d Z d ZdZdZdZdZRS(siParser base class which provides some common support methods used by the SGML/HTML and XHTML parsers.cCs"|jtkrtdndS(Ns(markupbase.ParserBase must be subclassed(t __class__Rt RuntimeError(tself((s"/usr/lib64/python2.7/markupbase.pyt__init__scCstddS(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 CsF|j}|d}|||d!dkr2|dS|||d!dkrMdSt|}|||d!dkr}|j|S||dkr|j|S|j||\}}|d kr|S|d krd|_nxe||krA||}|dkrA||d|!}|d kr,|j|n |j||dS|d krut||}|sfdS|j }n|d kr|j||\} }n||jkr|d}nv|dkr|d kr|j |d|}q.|dkr |j d|q.|j dn|j d|||d kr|SqWdS(Niit>t-Ris--t[itdoctypes"'t4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZtattlisttlinktypetlinktelements&unsupported '[' char in %s declarations"unexpected '[' char in declarations!unexpected %r char in declaration(RR(RRRR( R tlent 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_declarationAsX                   icCs|j}|j|d|\}}|dkr5|S|d krZtj||d}nA|dkrtj||d}n|jd ||d|!|sd S|r|jd}|j||d|!n|jdS(Niittemptcdatatignoretincludetrcdatatiftelsetendifs+unknown status keyword %r in marked sectioni(R/R0R1R2R3(R4R5R6( R R!t_markedsectionclosetsearcht_msmarkedsectioncloseRtstartR$R&(RRtreportR tsectNameRtmatch((s"/usr/lib64/python2.7/markupbase.pyR s    cCs|j}|||d!dkr0|jdntj||d}|sPdS|r|jd}|j||d|!n|jdS(Nis