ok

Mini Shell

Direktori : /lib64/python2.7/
Upload File :
Current File : //lib64/python2.7/sgmllib.pyc

�
zfc@s]dZddlmZeddd�[ddlZddlZddgZejd	�Zejd
�Zejd�Z	ejd�Z
ejd
�Zejd�Zejd�Z
ejd�Zejd�Zejd�Zejd�Zdefd��YZdejfd��YZdefd��YZed�ZedkrYe�ndS(s;A parser for SGML, using the derived class as a static DTD.i����(twarnpy3ks1the sgmllib module has been removed in Python 3.0t
stackleveliNt
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./,:;+*%?!&$\(\)_#=~\'"@]*))?cBseZdZRS(s&Exception raised for all parse errors.(t__name__t
__module__t__doc__(((s/usr/lib64/python2.7/sgmllib.pyR,scBsieZejd�Zdd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zidd6dd6dd6dd 6d!d"6Zd#�Zd$�Zd%�Zd&�Z d'�Z!d(�Z"d)�Z#d*�Z$d+�Z%d,�Z&RS(-s+&(?:([a-zA-Z][-.a-zA-Z0-9]*)|#([0-9]+))(;?)icCs||_|j�dS(s#Initialize and reset this instance.N(tverbosetreset(tselfR((s/usr/lib64/python2.7/sgmllib.pyt__init__Bs	cCsJd|_d|_g|_d|_d|_d|_tjj	|�dS(s0Reset this instance. Loses all unprocessed data.ts???iN(
tNonet_SGMLParser__starttag_texttrawdatatstacktlasttagt
nomoretagstliteralt
markupbaset
ParserBaseR	(R
((s/usr/lib64/python2.7/sgmllib.pyR	Gs						cCsd|_|_dS(sYEnter literal mode (CDATA) till EOF.

        Intended for derived classes only.
        iN(RR(R
((s/usr/lib64/python2.7/sgmllib.pyt
setnomoretagsQscGs
d|_dS(sPEnter literal mode (CDATA).

        Intended for derived classes only.
        iN(R(R
targs((s/usr/lib64/python2.7/sgmllib.pyt
setliteralXscCs!|j||_|jd�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(Rtgoahead(R
tdata((s/usr/lib64/python2.7/sgmllib.pytfeed_scCs|jd�dS(sHandle the remaining data.iN(R(R
((s/usr/lib64/python2.7/sgmllib.pytclosejscCst|��dS(N(R(R
tmessage((s/usr/lib64/python2.7/sgmllib.pyterrornsc	Cs@|j}d}t|�}x�||kr�|jrQ|j|||!�|}Pntj||�}|rx|j�}n|}||kr�|j|||!�n|}||kr�Pn||dkrltj||�r.|j	r|j||�|d}qn|j
|�}|dkr"Pn|}qn|jd|�rt|j|�}|dkr_Pn|}d|_	qn|j	r�||dkr�|jd�|d}qPqn|jd|�r�|j
|�}|dkr�Pn|}qn|jd|�r,|j|�}|dkrPn||}qn|jd|�r�|j|�}|dkr]Pn|}qq�n||dkr}|j	r�|j||�|d}qntj||�}|r|jd�}|j|�|jd�}||dd	kr|d}qqntj||�}|r�|jd�}|j|�|jd�}||dd	kr|d}qqq�n
|jd
�tj||�}|s�|j||�|d}qn|jd�}||kr�Pn|j|||!�|}qW|r/||kr/|j|||!�|}n|||_dS(Nit<is</s<!--s<?s<!t&t;sneither < nor & ??(RtlenRthandle_datatinterestingtsearchtstarttstarttagopentmatchRtparse_starttagt
startswithtparse_endtagt
parse_commenttparse_pitparse_declarationtcharreftgroupthandle_charreftendt	entityrefthandle_entityrefRt
incomplete(	R
R2RtitnR(tjtktname((s/usr/lib64/python2.7/sgmllib.pyRts�			
		


		




	


	t=cCs�|j}|||d!dkr0|jd�ntj||d�}|sPdS|jd�}|j||d|!�|jd�}||S(Nis<?sunexpected call to parse_pi()i����i(RRtpicloseR%R&t	handle_piR2(R
R6RR(R8((s/usr/lib64/python2.7/sgmllib.pyR-�s	cCs|jS(N(R(R
((s/usr/lib64/python2.7/sgmllib.pytget_starttag_text�sc
Cs�d|_|}|j}tj||�r�tj||�}|sFdS|jdd�\}}d||_|j�}|jd�}|j	||�|||jd�d!|_|St
j||d�}|s�dS|jd�}g}	|||d!dkr|}|j
}n[tj||d�}|sA|jd�n|jd�}||d|!j�}||_
x�||krctj||�}|s�Pn|jddd�\}
}}|s�|
}np|d d	ko�|dkns|d d
ko|dknr |dd!}n|jj|j|�}|	j|
j�|f�|jd�}qsW||dkr�|d}n|||!|_|j||	�|S(Ni����iis<%s/is<>s!unexpected call to parse_starttagit't"R(R
RRtshorttagopenR(tshorttagR0tlowerR2tfinish_shorttagt
endbracketR%R&RttagfindRtattrfindtentity_or_charreftsubt_convert_reftappendtfinish_starttag(
R
R6t	start_posRR(ttagRR9R8tattrstattrnametrestt	attrvalue((s/usr/lib64/python2.7/sgmllib.pyR)�s^		
		$$	
cCs�|jd�r9|j|jd��p8d|j�dS|jd�rq|j|jd��ppd|jd�Sd|jd�SdS(Nis&#%s%siis&%s;s&%s(R0tconvert_charreftgroupstconvert_entityref(R
R(((s/usr/lib64/python2.7/sgmllib.pyRJ,scCs�|j}tj||d�}|s)dS|jd�}||d|!j�j�}||dkrr|d}n|j|�|S(Nii����iiR(RRER%R&tstripRCt
finish_endtag(R
R6RR(R8RN((s/usr/lib64/python2.7/sgmllib.pyR+7s	

cCs.|j|g�|j|�|j|�dS(N(RLR#RW(R
RNR((s/usr/lib64/python2.7/sgmllib.pyRDDs
cCs�yt|d|�}Wndtk
r}yt|d|�}Wn"tk
rb|j||�dSX|j|||�dSn(X|jj|�|j|||�dSdS(Ntstart_tdo_i����ii(tgetattrtAttributeErrortunknown_starttagthandle_starttagRRK(R
RNROtmethod((s/usr/lib64/python2.7/sgmllib.pyRLKs

cCsa|s9t|j�d}|dkr�|j|�dSn�||jkr�yt|d|�}Wntk
r|j|�nX|j|�dSt|j�}x0t|�D]"}|j||kr�|}q�q�Wx�t|j�|kr\|jd}yt|d|�}Wntk
r(d}nX|rB|j||�n
|j|�|jd=q�WdS(Niitend_i����(	R"Rtunknown_endtagRZR[treport_unbalancedtrangeR
t
handle_endtag(R
RNtfoundR^R6((s/usr/lib64/python2.7/sgmllib.pyRW]s4







cCs||�dS(N((R
RNR^RO((s/usr/lib64/python2.7/sgmllib.pyR]|scCs|�dS(N((R
RNR^((s/usr/lib64/python2.7/sgmllib.pyRc�scCs)|jr%d|dGHdG|jGHndS(Ns*** Unbalanced </Rs
*** Stack:(RR(R
RN((s/usr/lib64/python2.7/sgmllib.pyRa�s	
cCsRyt|�}Wntk
r$dSXd|ko<dknsEdS|j|�S(s/Convert character reference, may be overridden.Nii(tintt
ValueErrortconvert_codepoint(R
R:R7((s/usr/lib64/python2.7/sgmllib.pyRS�s
cCs
t|�S(N(tchr(R
t	codepoint((s/usr/lib64/python2.7/sgmllib.pyRg�scCs<|j|�}|dkr+|j|�n
|j|�dS(s0Handle character reference, no need to override.N(RSR
tunknown_charrefR#(R
R:treplacement((s/usr/lib64/python2.7/sgmllib.pyR1�sRtltRtgtR tampR@tquots'taposcCs%|j}||kr||SdSdS(s�Convert entity references.

        As an alternative to overriding this method; one can tailor the
        results by setting up the self.entitydefs mapping appropriately.
        N(t
entitydefs(R
R:ttable((s/usr/lib64/python2.7/sgmllib.pyRU�s	cCs<|j|�}|dkr+|j|�n
|j|�dS(s.Handle entity references, no need to override.N(RUR
tunknown_entityrefR#(R
R:Rk((s/usr/lib64/python2.7/sgmllib.pyR4�scCsdS(N((R
R((s/usr/lib64/python2.7/sgmllib.pyR#�scCsdS(N((R
R((s/usr/lib64/python2.7/sgmllib.pythandle_comment�scCsdS(N((R
tdecl((s/usr/lib64/python2.7/sgmllib.pythandle_decl�scCsdS(N((R
R((s/usr/lib64/python2.7/sgmllib.pyR=�scCsdS(N((R
RNRO((s/usr/lib64/python2.7/sgmllib.pyR\�RcCsdS(N((R
RN((s/usr/lib64/python2.7/sgmllib.pyR`�RcCsdS(N((R
tref((s/usr/lib64/python2.7/sgmllib.pyRj�RcCsdS(N((R
Rw((s/usr/lib64/python2.7/sgmllib.pyRs�R('RRtretcompileRHRR	RRRRRRt_decl_othercharsR-R>R)RJR+RDRLRWR]RcRaRSRgR1RqRUR4R#RtRvR=R\R`RjRs(((s/usr/lib64/python2.7/sgmllib.pyR<sF	
						g			>		
							
		
)										tTestSGMLParsercBseeZdd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�ZRS(icCsd|_tj||�dS(NR(ttestdataRR(R
R((s/usr/lib64/python2.7/sgmllib.pyR�s	cCs<|j||_tt|j��dkr8|j�ndS(NiF(R|R"treprtflush(R
R((s/usr/lib64/python2.7/sgmllib.pyR#�scCs.|j}|r*d|_dGt|�GHndS(NRsdata:(R|R}(R
R((s/usr/lib64/python2.7/sgmllib.pyR~�s		cCsN|j�t|�}t|�dkrA|d d|d}ndG|GHdS(NiDi s...i��scomment:(R~R}R"(R
Rtr((s/usr/lib64/python2.7/sgmllib.pyRt�s

cCs\|j�|s d|dGHn8d|Gx(|D] \}}|dd|dGq/WdGHdS(Nsstart tag: <RR;R@(R~(R
RNROR:tvalue((s/usr/lib64/python2.7/sgmllib.pyR\�s
cCs|j�d|dGHdS(Nsend tag: </R(R~(R
RN((s/usr/lib64/python2.7/sgmllib.pyR`�s
cCs|j�d|dGHdS(Ns*** unknown entity ref: &R!(R~(R
Rw((s/usr/lib64/python2.7/sgmllib.pyRs�s
cCs|j�d|dGHdS(Ns*** unknown char ref: &#R!(R~(R
Rw((s/usr/lib64/python2.7/sgmllib.pyRj�s
cCs|j�d|dGHdS(Ns*** unknown decl: [t](R~(R
R((s/usr/lib64/python2.7/sgmllib.pytunknown_decl�s
cCstj|�|j�dS(N(RRR~(R
((s/usr/lib64/python2.7/sgmllib.pyR�s
(RRRR#R~RtR\R`RsRjR�R(((s/usr/lib64/python2.7/sgmllib.pyR{�s				
				c	Cs(ddl}|dkr(|jd}n|rQ|ddkrQ|d}t}nt}|rj|d}nd}|dkr�|j}nCyt|d�}Wn-tk
r�}|GdG|GH|jd�nX|j	�}||jk	r�|j
�n|�}x|D]}|j|�qW|j
�dS(	Ni����iis-ss	test.htmlt-Rt:(tsysR
targvRR{tstdintopentIOErrortexittreadRR(	RR�tklasstfiletftmsgRtxtc((s/usr/lib64/python2.7/sgmllib.pyttests0
	


	
t__main__(RtwarningsRRRxt__all__RyR$R5R3R/R'RARBR<RERFRGtRuntimeErrorRRRR{R
R�R(((s/usr/lib64/python2.7/sgmllib.pyt<module>s4		��7$

Zerion Mini Shell 1.0