Edit File: sgmllib.pyc
� ��7ec�����������@���s]��d��Z��d�d�l�m�Z�e�d�d�d��[�d�d�l�Z�d�d�l�Z�d�d�g�Z�e�j�d ���Z�e�j�d ���Z�e�j�d���Z �e�j�d���Z �e�j�d ���Z�e�j�d���Z�e�j�d���Z �e�j�d���Z�e�j�d���Z�e�j�d���Z�e�j�d���Z�d�e�f�d�������YZ�d�e�j�f�d�������YZ�d�e�f�d�������YZ�e�d���Z�e�d�k�rYe����n��d�S(���s;���A parser for SGML, using the derived class as a static DTD.i����(���t���warnpy3ks1���the sgmllib module has been removed in Python 3.0t ���stackleveli���Nt ���SGMLParsert���SGMLParseErrors���[&<]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./,:;+*%?!&$\(\)_#=~\'"@]*))?c�����������B���s���e��Z�d��Z�RS(���s&���Exception raised for all parse errors.(���t���__name__t ���__module__t���__doc__(����(����(����s���/usr/lib64/python2.7/sgmllib.pyR���,���s���c�����������B���si��e��Z�e�j�d����Z�d�d���Z�d����Z�d����Z�d����Z�d����Z �d����Z �d����Z�d ����Z�d �Z �d����Z�d����Z�d ����Z�d����Z�d����Z�d����Z�d����Z�d����Z�d����Z�d����Z�d����Z�d����Z�d����Z�d����Z�i�d�d�6d�d�6d�d�6d�d �6d!�d"�6Z�d#����Z�d$����Z�d%����Z�d&����Z �d'����Z!�d(����Z"�d)����Z#�d*����Z$�d+����Z%�d,����Z&�RS(-���s+���&(?:([a-zA-Z][-.a-zA-Z0-9]*)|#([0-9]+))(;?)i����c���������C���s���|�|��_��|��j����d�S(���s#���Initialize and reset this instance.N(���t���verboset���reset(���t���selfR���(����(����s���/usr/lib64/python2.7/sgmllib.pyt���__init__B���s���� c���������C���sJ���d�|��_�d�|��_�g��|��_�d�|��_�d�|��_�d�|��_�t�j�j �|����d�S(���s0���Reset this instance. Loses all unprocessed data.t����s���???i����N( ���t���Nonet���_SGMLParser__starttag_textt���rawdatat���stackt���lasttagt ���nomoretagst���literalt ���markupbaset ���ParserBaseR ���(���R ���(����(����s���/usr/lib64/python2.7/sgmllib.pyR ���G���s���� c���������C���s���d�|��_��|��_�d�S(���sY���Enter literal mode (CDATA) till EOF. Intended for derived classes only. i���N(���R���R���(���R ���(����(����s���/usr/lib64/python2.7/sgmllib.pyt ���setnomoretagsQ���s����c���������G���s ���d�|��_��d�S(���sP���Enter literal mode (CDATA). Intended for derived classes only. i���N(���R���(���R ���t���args(����(����s���/usr/lib64/python2.7/sgmllib.pyt ���setliteralX���s����c���������C���s!���|��j��|�|��_��|��j�d���d�S(���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().) i����N(���R���t���goahead(���R ���t���data(����(����s���/usr/lib64/python2.7/sgmllib.pyt���feed_���s����c���������C���s���|��j��d���d�S(���s���Handle the remaining data.i���N(���R���(���R ���(����(����s���/usr/lib64/python2.7/sgmllib.pyt���closej���s����c���������C���s���t��|�����d��S(���N(���R���(���R ���t���message(����(����s���/usr/lib64/python2.7/sgmllib.pyt���errorn���s����c��� ������C���s@��|��j��}�d�}�t�|���}�x�|�|�k��r�|��j�rQ�|��j�|�|�|�!��|�}�Pn��t�j�|�|���}�|�rx�|�j����}�n�|�}�|�|�k��r��|��j�|�|�|�!��n��|�}�|�|�k�r��Pn��|�|�d�k�rlt�j�|�|���r.|��j �r|��j�|�|���|�d�}�q�n��|��j �|���}�|�d�k��r"Pn��|�}�q�n��|�j�d�|���rt|��j�|���}�|�d�k��r_Pn��|�}�d�|��_ �q�n��|��j �r�|�|�d�k�r�|��j�d���|�d�}�q�Pq�n��|�j�d�|���r�|��j �|���}�|�d�k��r�Pn��|�}�q�n��|�j�d�|���r,|��j�|���}�|�d�k��rPn��|�|�}�q�n��|�j�d�|���r�|��j�|���}�|�d�k��r]Pn��|�}�q�q�n|�|�d�k�r}|��j �r�|��j�|�|���|�d�}�q�n��t�j�|�|���}�|�r|�j�d���}�|��j�|���|�j�d���}�|�|�d�d �k�r�|�d�}�q�q�n��t�j�|�|���}�|�r�|�j�d���}�|��j�|���|�j�d���}�|�|�d�d �k�r�|�d�}�q�q�q�n �|��j�d ���t�j�|�|���}�|�s�|��j�|�|���|�d�}�q�n��|�j�d���}�|�|�k�r�Pn��|��j�|�|�|�!��|�}�q�W|�r/|�|�k��r/|��j�|�|�|�!��|�}�n��|�|�|��_��d��S(���Ni����t���<i���s���</s���<!--s���<?s���<!t���&t���;s���neither < nor & ??(���R���t���lenR���t���handle_datat���interestingt���searcht���startt���starttagopent���matchR���t���parse_starttagt ���startswitht���parse_endtagt ���parse_commentt���parse_pit���parse_declarationt���charreft���groupt���handle_charreft���endt ���entityreft���handle_entityrefR���t ���incomplete( ���R ���R2���R���t���it���nR(���t���jt���kt���name(����(����s���/usr/lib64/python2.7/sgmllib.pyR���t���s����� �� �� �� � � � t���=c���������C���s����|��j��}�|�|�|�d�!d�k�r0�|��j�d���n��t�j�|�|�d���}�|�sP�d�S|�j�d���}�|��j�|�|�d�|�!��|�j�d���}�|�|�S(���Ni���s���<?s���unexpected call to parse_pi()i����i����(���R���R���t���picloseR%���R&���t ���handle_piR2���(���R ���R6���R���R(���R8���(����(����s���/usr/lib64/python2.7/sgmllib.pyR-�������s���� c���������C���s���|��j��S(���N(���R���(���R ���(����(����s���/usr/lib64/python2.7/sgmllib.pyt���get_starttag_text����s����c��� ������C���s���d��|��_�|�}�|��j�}�t�j�|�|���r��t�j�|�|���}�|�sF�d�S|�j�d�d���\�}�}�d�|�|��_�|�j����}�|�j�d���}�|��j �|�|���|�|�|�j�d���d�!|��_�|�St �j�|�|�d���}�|�s��d�S|�j�d���}�g��} �|�|�|�d�!d�k�r|�}�|��j �}�n[�t�j�|�|�d���}�|�sA|��j�d���n��|�j�d���}�|�|�d�|�!j����}�|�|��_ �x��|�|�k��rct�j�|�|���}�|�s�Pn��|�j�d�d�d���\�} �}�}�|�s�| �}�np�|�d� d �k�o�|�d�k�n�s|�d� d �k�o|�d�k�n�r |�d�d�!}�n��|��j�j�|��j�|���}�| �j�| �j����|�f���|�j�d���}�qsW|�|�d�k�r�|�d�}�n��|�|�|�!|��_�|��j�|�| ���|�S(���Ni����i���i���s���<%s/i����s���<>s!���unexpected call to parse_starttagi���t���'t���"R���(���R ���R���R���t���shorttagopenR(���t���shorttagR0���t���lowerR2���t���finish_shorttagt ���endbracketR%���R&���R���t���tagfindR���t���attrfindt���entity_or_charreft���subt���_convert_reft���appendt���finish_starttag( ���R ���R6���t ���start_posR���R(���t���tagR���R9���R8���t���attrst���attrnamet���restt ���attrvalue(����(����s���/usr/lib64/python2.7/sgmllib.pyR)�������s^���� � $$ c���������C���s����|�j��d���r9�|��j�|�j��d�����p8�d�|�j����d�S|�j��d���rq�|��j�|�j��d�����pp�d�|�j��d���Sd�|�j��d���Sd��S(���Ni���s���&#%s%si���i���s���&%s;s���&%s(���R0���t���convert_charreft���groupst���convert_entityref(���R ���R(���(����(����s���/usr/lib64/python2.7/sgmllib.pyRJ���,��s����c���������C���s����|��j��}�t�j�|�|�d���}�|�s)�d�S|�j�d���}�|�|�d�|�!j����j����}�|�|�d�k�rr�|�d�}�n��|��j�|���|�S(���Ni���i����i����i���R���(���R���RE���R%���R&���t���stripRC���t ���finish_endtag(���R ���R6���R���R(���R8���RN���(����(����s���/usr/lib64/python2.7/sgmllib.pyR+���7��s���� c���������C���s.���|��j��|�g����|��j�|���|��j�|���d��S(���N(���RL���R#���RW���(���R ���RN���R���(����(����s���/usr/lib64/python2.7/sgmllib.pyRD���D��s���� c���������C���s����y�t��|��d�|���}�Wnd�t�k �r}�y�t��|��d�|���}�Wn"�t�k �rb�|��j�|�|���d�SX|��j�|�|�|���d�Sn(�X|��j�j�|���|��j�|�|�|���d�Sd��S(���Nt���start_t���do_i����i����i���(���t���getattrt���AttributeErrort���unknown_starttagt���handle_starttagR���RK���(���R ���RN���RO���t���method(����(����s���/usr/lib64/python2.7/sgmllib.pyRL���K��s���� c���������C���sa��|�s9�t��|��j���d�}�|�d�k��r��|��j�|���d��Sn��|�|��j�k�r��y�t�|��d�|���}�Wn�t�k �r�|��j�|���n�X|��j�|���d��St��|��j���}�x0�t�|���D]"�}�|��j�|�|�k�r��|�}�q��q��Wx��t��|��j���|�k�r\|��j�d�}�y�t�|��d�|���}�Wn�t�k �r(d��}�n�X|�rB|��j�|�|���n �|��j�|���|��j�d�=q��Wd��S(���Ni���i����t���end_i����( ���R"���R���t���unknown_endtagRZ���R[���t���report_unbalancedt���rangeR ���t ���handle_endtag(���R ���RN���t���foundR^���R6���(����(����s���/usr/lib64/python2.7/sgmllib.pyRW���]��s4���� � c���������C���s���|�|���d��S(���N(����(���R ���RN���R^���RO���(����(����s���/usr/lib64/python2.7/sgmllib.pyR]���|��s����c���������C���s���|����d��S(���N(����(���R ���RN���R^���(����(����s���/usr/lib64/python2.7/sgmllib.pyRc������s����c���������C���s)���|��j��r%�d�|�d�GHd�G|��j�GHn��d��S(���Ns���*** Unbalanced </R���s ���*** Stack:(���R���R���(���R ���RN���(����(����s���/usr/lib64/python2.7/sgmllib.pyRa������s���� c���������C���sR���y�t��|���}�Wn�t�k �r$�d�SXd�|�k�o<�d�k�n�sE�d�S|��j�|���S(���s/���Convert character reference, may be overridden.Ni����i���(���t���intt ���ValueErrort���convert_codepoint(���R ���R:���R7���(����(����s���/usr/lib64/python2.7/sgmllib.pyRS������s���� c���������C���s ���t��|���S(���N(���t���chr(���R ���t ���codepoint(����(����s���/usr/lib64/python2.7/sgmllib.pyRg������s����c���������C���s<���|��j��|���}�|�d�k�r+�|��j�|���n �|��j�|���d�S(���s0���Handle character reference, no need to override.N(���RS���R ���t���unknown_charrefR#���(���R ���R:���t���replacement(����(����s���/usr/lib64/python2.7/sgmllib.pyR1������s����R���t���ltR���t���gtR ���t���ampR@���t���quots���'t���aposc���������C���s%���|��j��}�|�|�k�r�|�|�Sd�Sd�S(���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:���t���table(����(����s���/usr/lib64/python2.7/sgmllib.pyRU������s���� c���������C���s<���|��j��|���}�|�d�k�r+�|��j�|���n �|��j�|���d�S(���s.���Handle entity references, no need to override.N(���RU���R ���t���unknown_entityrefR#���(���R ���R:���Rk���(����(����s���/usr/lib64/python2.7/sgmllib.pyR4������s����c���������C���s���d��S(���N(����(���R ���R���(����(����s���/usr/lib64/python2.7/sgmllib.pyR#������s����c���������C���s���d��S(���N(����(���R ���R���(����(����s���/usr/lib64/python2.7/sgmllib.pyt���handle_comment���s����c���������C���s���d��S(���N(����(���R ���t���decl(����(����s���/usr/lib64/python2.7/sgmllib.pyt���handle_decl���s����c���������C���s���d��S(���N(����(���R ���R���(����(����s���/usr/lib64/python2.7/sgmllib.pyR=������s����c���������C���s���d��S(���N(����(���R ���RN���RO���(����(����s���/usr/lib64/python2.7/sgmllib.pyR\������R���c���������C���s���d��S(���N(����(���R ���RN���(����(����s���/usr/lib64/python2.7/sgmllib.pyR`������R���c���������C���s���d��S(���N(����(���R ���t���ref(����(����s���/usr/lib64/python2.7/sgmllib.pyRj������R���c���������C���s���d��S(���N(����(���R ���Rw���(����(����s���/usr/lib64/python2.7/sgmllib.pyRs������R���('���R���R���t���ret���compileRH���R���R ���R���R���R���R���R���R���t���_decl_othercharsR-���R>���R)���RJ���R+���RD���RL���RW���R]���Rc���Ra���RS���Rg���R1���Rq���RU���R4���R#���Rt���Rv���R=���R\���R`���Rj���Rs���(����(����(����s���/usr/lib64/python2.7/sgmllib.pyR���<���sF��� g > ) t���TestSGMLParserc�����������B���se���e��Z�d��d���Z�d����Z�d����Z�d����Z�d����Z�d����Z�d����Z�d����Z �d ����Z �d ����Z�RS(���i����c���������C���s���d�|��_��t�j�|��|���d��S(���NR���(���t���testdataR���R���(���R ���R���(����(����s���/usr/lib64/python2.7/sgmllib.pyR������s���� c���������C���s<���|��j��|�|��_��t�t�|��j������d�k�r8�|��j����n��d��S(���NiF���(���R|���R"���t���reprt���flush(���R ���R���(����(����s���/usr/lib64/python2.7/sgmllib.pyR#������s����c���������C���s.���|��j��}�|�r*�d�|��_��d�Gt�|���GHn��d��S(���NR���s���data:(���R|���R}���(���R ���R���(����(����s���/usr/lib64/python2.7/sgmllib.pyR~������s���� c���������C���sN���|��j�����t�|���}�t�|���d�k�rA�|�d� d�|�d�}�n��d�G|�GHd��S(���NiD���i ���s���...i��s���comment:(���R~���R}���R"���(���R ���R���t���r(����(����s���/usr/lib64/python2.7/sgmllib.pyRt������s ���� c���������C���s\���|��j�����|�s �d�|�d�GHn8�d�|�Gx(�|�D] �\�}�}�|�d�d�|�d�Gq/�Wd�GHd��S(���Ns���start tag: <R���R;���R@���(���R~���(���R ���RN���RO���R:���t���value(����(����s���/usr/lib64/python2.7/sgmllib.pyR\������s���� c���������C���s���|��j�����d�|�d�GHd��S(���Ns���end tag: </R���(���R~���(���R ���RN���(����(����s���/usr/lib64/python2.7/sgmllib.pyR`������s���� c���������C���s���|��j�����d�|�d�GHd��S(���Ns���*** unknown entity ref: &R!���(���R~���(���R ���Rw���(����(����s���/usr/lib64/python2.7/sgmllib.pyRs������s���� c���������C���s���|��j�����d�|�d�GHd��S(���Ns���*** unknown char ref: &#R!���(���R~���(���R ���Rw���(����(����s���/usr/lib64/python2.7/sgmllib.pyRj������s���� c���������C���s���|��j�����d�|�d�GHd��S(���Ns���*** unknown decl: [t���](���R~���(���R ���R���(����(����s���/usr/lib64/python2.7/sgmllib.pyt���unknown_decl���s���� c���������C���s���t��j�|����|��j����d��S(���N(���R���R���R~���(���R ���(����(����s���/usr/lib64/python2.7/sgmllib.pyR������s���� (���R���R���R���R#���R~���Rt���R\���R`���Rs���Rj���R����R���(����(����(����s���/usr/lib64/python2.7/sgmllib.pyR{������s��� c��� ������C���s(��d�d��l��}�|��d��k�r(�|�j�d�}��n��|��rQ�|��d�d�k�rQ�|��d�}��t�}�n�t�}�|��rj�|��d�}�n�d�}�|�d�k�r��|�j�}�nC�y�t�|�d���}�Wn-�t�k �r��}�|�Gd�G|�GH|�j�d���n�X|�j ����}�|�|�j�k �r��|�j ����n��|����}�x�|�D]�}�|�j�|���qW|�j ����d��S( ���Ni����i���i����s���-ss ���test.htmlt���-R���t���:(���t���sysR ���t���argvR���R{���t���stdint���opent���IOErrort���exitt���readR���R���( ���R���R����t���klasst���filet���ft���msgR���t���xt���c(����(����s���/usr/lib64/python2.7/sgmllib.pyt���test��s0���� t���__main__(���R���t���warningsR����R���Rx���t���__all__Ry���R$���R5���R3���R/���R'���RA���RB���R<���RE���RF���RG���t���RuntimeErrorR���R���R���R{���R ���R����R���(����(����(����s���/usr/lib64/python2.7/sgmllib.pyt���<module>���s4��� ���7$