mò %U²Ic@s6dZdkZdkZddgZeidƒZeidƒZeidƒZeidƒZeidƒZ eid ƒZ eid ƒZ eid ƒZ eid ƒZ eid ƒZeidƒZdefd„ƒYZdeifd„ƒYZdefd„ƒYZed„Zedjo eƒndS(s;A parser for SGML, using the derived class as a static DTD.Nt SGMLParsertSGMLParseErrors[&<]sN&([a-zA-Z][a-zA-Z0-9]*|#[0-9]*)?|<([a-zA-Z][^<>]*|/([a-zA-Z][^<>]*)?|![^<>]*)?s%&([a-zA-Z][-.a-zA-Z0-9]*)[^a-zA-Z0-9]s&#([0-9]+)[^0-9]s <[>a-zA-Z]s<[a-zA-Z][-.a-zA-Z0-9]*/s"<([a-zA-Z][-.a-zA-Z0-9]*)/([^/]*)/t>s[<>]s[a-zA-Z][-_.a-zA-Z0-9]*se\s*([a-zA-Z_][-:.a-zA-Z_0-9]*)(\s*=\s*(\'[^\']*\'|"[^"]*"|[][\-a-zA-Z0-9./,:;+*%?!&$\(\)_#=~\'"@]*))?cBstZdZRS(s&Exception raised for all parse errors.(t__name__t __module__t__doc__(((t$/data/zmath/lib/python2.4/sgmllib.pyR's cBs@tZdd„Zd„Zd„Zd„Zd„Zd„Zd„Zd „Z d Z d „Z d „Z d „Z d„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zhdd<dd<dd<dd<dds      cCsd|_|_dS(sYEnter literal mode (CDATA) till EOF. Intended for derived classes only. iN(RRR(R((Rt setnomoretagsHscGs d|_dS(sPEnter literal mode (CDATA). Intended for derived classes only. iN(RR(Rtargs((Rt setliteralOscCs!|i||_|idƒdS(sãFeed some data to the parser. Call this as often as you want, with as little or as much text as you want (may include ' '). (This just saves the text, all the processing is done by goahead().) iN(RRtdatatgoahead(RR((RtfeedVscCs|idƒdS(sHandle the remaining data.iN(RR(R((RtcloseascCst|ƒ‚dS(N(Rtmessage(RR((Rterroresc Csy|i}d}t|ƒ}x||jo |io|i|||!ƒ|}Pnti||ƒ}|o|i ƒ}n|}||jo|i|||!ƒn|}||joPn||djoÀt i ||ƒoZ|i o"|i||ƒ|d}qn|i|ƒ}|djoPn|}qn|id|ƒo7|i|ƒ}|djoPn|}d|_ qn|i o4||djo|idƒ|d}qPqn|id|ƒo.|i|ƒ}|djoPn|}qn|id|ƒo2|i|ƒ}|djoPn||}qn|id|ƒo.|i|ƒ}|djoPn|}qq»n+||djo |i o"|i||ƒ|d}qnti ||ƒ}|oU|idƒ}|i|ƒ|idƒ}||dd jo|d}qqnti ||ƒ}|oU|idƒ}|i|ƒ|idƒ}||dd jo|d}qqq»n|id ƒti ||ƒ}|p"|i||ƒ|d}qn|idƒ}||joPn|i|||!ƒ|}qW|o+||jo|i|||!ƒ|}n|||_dS( Nits!unexpected call to parse_starttagis't"R(R RR R!t start_posRt shorttagopenR'tshorttagR3ttagRtlowerR6R,tfinish_shorttagt endbracketR&R(R)tattrsRttagfindRtattrfindtattrnametrestt attrvaluetappendtfinish_starttag( RR!RJRKR)RIRBRR?RR,R'RF((RR+åsZ        LcCsŠ|i}ti||dƒ}|pdSn|idƒ}||d|!iƒi ƒ}||djo|d}n|i |ƒ|S(NiiÿÿÿÿiiR( RRRER&R!R'R(R)tstripRCRBt finish_endtag(RR!R)RBRR'((RR.s  cCs.|i|gƒ|i|ƒ|i|ƒdS(N(RRMRBR$RRO(RRBR((RRD,s cCs°yt|d|ƒ}Wnktj o_yt|d|ƒ}Wn'tj o|i||ƒdSq¬X|i|||ƒdSn)X|ii |ƒ|i|||ƒdSdS(Ntstart_tdo_iÿÿÿÿii( tgetattrRRBtmethodtAttributeErrortunknown_starttagRFthandle_starttagRRL(RRBRFRS((RRM3s  cCsw|p9t|iƒd}|djo|i|ƒdSqãn¤||ijoOyt|d|ƒ}Wn tj o|i|ƒnX|i |ƒdSnt|iƒ}x2t |ƒD]$}|i||jo |}q»q»Wxt|iƒ|jov|id}yt|d|ƒ}Wntj o d}nX|o|i ||ƒn|i|ƒ|id=qæWdS(Niitend_iÿÿÿÿ(RBR"RRtfoundtunknown_endtagRRRSRTtreport_unbalancedtrangeR!R t handle_endtag(RRBR!RXRS((RROEs8        cCs||ƒdS(N(RSRF(RRBRSRF((RRVdscCs |ƒdS(N(RS(RRBRS((RR\hscCs+|iod|dGHdG|iGHndS(Ns*** Unbalanced taposs'cCs@|i}||jo|i||ƒn|i|ƒdSdS(s°Handle entity references. There should be no need to override this method; it can be tailored by setting up the self.entitydefs mapping appropriately. N(Rt entitydefsttableR4R$tunknown_entityref(RR4Rg((RR8s    cCsdS(N((RR((RR$scCsdS(N((RR((Rthandle_comment“scCsdS(N((Rtdecl((Rt handle_decl—scCsdS(N((RR((RR<›scCsdS(N((RRBRF((RRUŸscCsdS(N((RRB((RRY scCsdS(N((Rtref((RR_¡scCsdS(N((RRl((RRh¢s( RRR R RRRRRRt_decl_othercharsR0R=R+R.RDRMRORVR\RZR5RfR8R$RiRkR<RURYR_Rh(((RR7s<      g  :       3        tTestSGMLParsercBsetZdd„Zd„Zd„Zd„Zd„Zd„Zd„Zd „Z d „Z d „Z RS( NicCsd|_ti||ƒdS(NR (RttestdataRR R(RR((RR §s cCs>|i||_tt|iƒƒdjo|iƒndS(NiF(RRoRR"treprtflush(RR((RR$«scCs0|i}|od|_dGt|ƒGHndS(NR sdata:(RRoRRp(RR((RRq°s  cCsP|iƒt|ƒ}t|ƒdjo|d d|d}ndG|GHdS(NiDi s...iàÿÿÿscomment:(RRqRpRtrR"(RRRr((RRi¶s   cCs^|iƒ|pd|dGHn9d|Gx(|D] \}}|dd|dGq1WdGHdS(Ns start tag: (RRqRFRBR4tvalue(RRBRFRsR4((RRU½s  cCs|iƒd|dGHdS(Ns end tag: