;ò
ñŒü?c           @   s3  d  Z  d k Z d k Z d g Z e i d ƒ Z e i d ƒ Z e i d ƒ Z e i d ƒ Z e i d ƒ Z	 e i d ƒ Z
 e i d	 ƒ Z e i d
 ƒ Z e i d ƒ Z e i d ƒ Z e i d ƒ Z d e f d „  ƒ  YZ d e i f d „  ƒ  YZ d e f d „  ƒ  YZ e d „ Z e d j o e ƒ  n d S(   s;   A parser for SGML, using the derived class as a static DTD.Ns
   SGMLParsers   [&<]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]*)/([^/]*)/s   >s   [<>]s   [a-zA-Z][-_.a-zA-Z0-9]*sb   \s*([a-zA-Z_][-:.a-zA-Z_0-9]*)(\s*=\s*(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./,:;+*%?!&$\(\)_#=~\'"@]*))?s   SGMLParseErrorc           B   s   t  Z d  Z RS(   s&   Exception raised for all parse errors.(   s   __name__s
   __module__s   __doc__(    (    (    s$   /mit/python/lib/python2.3/sgmllib.pys   SGMLParseError'   s    c           B   s@  t  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 h  d d <d d <d d <d d <d d <Z d  „  Z d! „  Z d" „  Z d# „  Z d$ „  Z d% „  Z d& „  Z d' „  Z d( „  Z RS()   Ni    c         C   s   | |  _  |  i ƒ  d S(   s#   Initialize and reset this instance.N(   s   verboses   selfs   reset(   s   selfs   verbose(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   __init__9   s     	c         C   sJ   t  |  _ d |  _ g  |  _ d |  _ d |  _ d |  _ t i	 i
 |  ƒ d S(   s0   Reset this instance. Loses all unprocessed data.s    s   ???i    N(   s   Nones   selfs   _SGMLParser__starttag_texts   rawdatas   stacks   lasttags
   nomoretagss   literals
   markupbases
   ParserBases   reset(   s   self(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   reset>   s     						c         C   s   d |  _ |  _ d S(   sY   Enter literal mode (CDATA) till EOF.

        Intended for derived classes only.
        i   N(   s   selfs
   nomoretagss   literal(   s   self(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   setnomoretagsH   s     c         G   s   d |  _ d S(   sP   Enter literal mode (CDATA).

        Intended for derived classes only.
        i   N(   s   selfs   literal(   s   selfs   args(    (    s$   /mit/python/lib/python2.3/sgmllib.pys
   setliteralO   s     c         C   s!   |  i | |  _ |  i 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(   s   selfs   rawdatas   datas   goahead(   s   selfs   data(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   feedV   s     c         C   s   |  i d ƒ d S(   s   Handle the remaining data.i   N(   s   selfs   goahead(   s   self(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   closea   s     c         C   s   t  | ƒ ‚ d  S(   N(   s   SGMLParseErrors   message(   s   selfs   message(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   errore   s    c   	      C   sz  |  i } d } t | ƒ } x| | j  o|  i o |  i | | | !ƒ | } Pn t i | | ƒ } | o | i
 ƒ  } n | } | | j  o |  i | | | !ƒ n | } | | j o Pn | | d j oÀt i	 | | ƒ oZ |  i o" |  i | | ƒ | d } q n |  i | ƒ } | d j  o Pn | } q n | i d | ƒ o7 |  i | ƒ } | d j  o Pn | } d |  _ q n |  i o4 | | d j o |  i d ƒ | d } q Pq n | i d | ƒ o. |  i | ƒ } | d j  o Pn | } q n | i d | ƒ o2 |  i | ƒ } | d j  o Pn | | } q n | i d | ƒ o. |  i | ƒ } | d j  o Pn | } q q»n+| | d j o|  i o" |  i | | ƒ | d } q n t i	 | | ƒ } | oU | i d ƒ } |  i | ƒ | i d ƒ } | | d d	 j o | d } q q n t i	 | | ƒ } | oU | i d ƒ } |  i | ƒ | i d ƒ } | | d d	 j o | d } q q q»n |  i d
 ƒ t i	 | | ƒ } | o" |  i | | ƒ | d } q n | i d ƒ } | | j o Pn |  i | | | !ƒ | } q W| o
 | | j  o |  i | | | !ƒ | } n | | |  _ d  S(   Ni    s   <i   s   </s   <!--s   <?s   <!s   &s   ;s   neither < nor & ??(   s   selfs   rawdatas   is   lens   ns
   nomoretagss   handle_datas   interestings   searchs   matchs   starts   js   starttagopens   literals   parse_starttags   ks
   startswiths   parse_endtags   parse_comments   parse_pis   parse_declarations   charrefs   groups   names   handle_charrefs   ends	   entityrefs   handle_entityrefs   errors
   incomplete(	   s   selfs   ends   names   is   js   ns   rawdatas   ks   match(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   goaheadk   sÀ    	 
  

  	
  
 

  

s   =c         C   sš   |  i } | | | d !d j o |  i d ƒ n t i | | d ƒ } | o d Sn | i d ƒ } |  i	 | | d | !ƒ | i
 d ƒ } | | Sd  S(   Ni   s   <?s   unexpected call to parse_pi()iÿÿÿÿi    (   s   selfs   rawdatas   is   errors   picloses   searchs   matchs   starts   js	   handle_pis   end(   s   selfs   is   js   rawdatas   match(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   parse_piÕ   s    	c         C   s   |  i Sd  S(   N(   s   selfs   _SGMLParser__starttag_text(   s   self(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   get_starttag_textá   s    c         C   s¶  t  |  _ | } |  i } t i | | ƒ o— t i | | ƒ } | o d Sn | i	 d d ƒ \ } }	 d | |  _ | i ƒ  } | i d ƒ }
 |  i | |	 ƒ | | | i d ƒ d !|  _ |
 Sn t i | | d ƒ } | o d Sn | i d ƒ } g  } | | | d !d j o | }
 |  i } n_ t i | | d ƒ } | o |  i d ƒ n | i d ƒ }
 | | d |
 !i ƒ  } | |  _ xæ |
 | j  oØ t i | |
 ƒ } | o Pn | i	 d d d ƒ \ } } } | o
 | } n^ | d  d	 j o | d j n p# | d  d
 j o | d j n o | d d !} n | i | i ƒ  | f ƒ | i d ƒ }
 q‰W| | d j o | d } n | | | !|  _ |  i | | ƒ | Sd  S(   Niÿÿÿÿi   i   s   <%s/i    s   <>s!   unexpected call to parse_starttagi   s   's   "s   >(   s   Nones   selfs   _SGMLParser__starttag_texts   is	   start_poss   rawdatas   shorttagopens   matchs   shorttags   groups   tags   datas   lowers   ends   ks   finish_shorttags
   endbrackets   searchs   starts   js   attrss   lasttags   tagfinds   errors   attrfinds   attrnames   rests	   attrvalues   appends   finish_starttag(   s   selfs   is   rests	   attrvalues   js   attrnames   tags   rawdatas	   start_poss   datas   ks   matchs   attrs(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   parse_starttagå   sZ    			  
Lc         C   s�   |  i } t i | | d ƒ } | o d Sn | i d ƒ } | | d | !i ƒ  i	 ƒ  } | | d j o | d } n |  i | ƒ | Sd  S(   Ni   iÿÿÿÿi    i   s   >(   s   selfs   rawdatas
   endbrackets   searchs   is   matchs   starts   js   strips   lowers   tags   finish_endtag(   s   selfs   is   js   tags   rawdatas   match(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   parse_endtag  s    	c         C   s.   |  i | g  ƒ |  i | ƒ |  i | ƒ d  S(   N(   s   selfs   finish_starttags   tags   handle_datas   datas   finish_endtag(   s   selfs   tags   data(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   finish_shorttag)  s    c         C   s°   y t  |  d | ƒ } Wnk t j
 o_ y t  |  d | ƒ } Wn' t j
 o |  i | | ƒ d Sq¬ X|  i | | | ƒ d Sn) X|  i i	 | ƒ |  i | | | ƒ d Sd  S(   Ns   start_s   do_iÿÿÿÿi    i   (
   s   getattrs   selfs   tags   methods   AttributeErrors   unknown_starttags   attrss   handle_starttags   stacks   append(   s   selfs   tags   attrss   method(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   finish_starttag0  s    		c         C   sx  | o9 t |  i ƒ d } | d j  o |  i | ƒ d  Sqä n¤ | |  i j oO y t |  d | ƒ } Wn  t j
 o |  i | ƒ n X|  i	 | ƒ d  Sn t |  i ƒ } x2 t
 | ƒ D]$ } |  i | | j o
 | } q¼ q¼ Wx� t |  i ƒ | j ov |  i d } y t |  d | ƒ } Wn t j
 o t } n X| o |  i | | ƒ n |  i | ƒ |  i d =qç Wd  S(   Ni   i    s   end_iÿÿÿÿ(   s   tags   lens   selfs   stacks   founds   unknown_endtags   getattrs   methods   AttributeErrors   report_unbalanceds   ranges   is   Nones   handle_endtag(   s   selfs   tags   is   founds   method(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   finish_endtagB  s8       c         C   s   | | ƒ d  S(   N(   s   methods   attrs(   s   selfs   tags   methods   attrs(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   handle_starttaga  s    c         C   s   | ƒ  d  S(   N(   s   method(   s   selfs   tags   method(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   handle_endtage  s    c         C   s+   |  i o d | d GHd G|  i GHn d  S(   Ns   *** Unbalanced </s   >s
   *** Stack:(   s   selfs   verboses   tags   stack(   s   selfs   tag(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   report_unbalancedi  s    
c         C   s‚   y t  | ƒ } Wn$ t j
 o |  i | ƒ d Sn Xd | j o
 d j n o |  i | ƒ d Sn |  i t | ƒ ƒ d S(   s0   Handle character reference, no need to override.Ni    iÿ   (   s   ints   names   ns
   ValueErrors   selfs   unknown_charrefs   handle_datas   chr(   s   selfs   names   n(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   handle_charrefn  s     	s   lts   <s   gts   >s   amps   &s   quots   "s   aposs   'c         C   s@   |  i } | | j o |  i | | ƒ n |  i | ƒ d Sd S(   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(   s   selfs
   entitydefss   tables   names   handle_datas   unknown_entityref(   s   selfs   names   table(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   handle_entityref~  s     	c         C   s   d  S(   N(    (   s   selfs   data(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   handle_dataŒ  s    c         C   s   d  S(   N(    (   s   selfs   data(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   handle_comment�  s    c         C   s   d  S(   N(    (   s   selfs   decl(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   handle_decl”  s    c         C   s   d  S(   N(    (   s   selfs   data(    (    s$   /mit/python/lib/python2.3/sgmllib.pys	   handle_pi˜  s    c         C   s   d  S(   N(    (   s   selfs   tags   attrs(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   unknown_starttagœ  s    c         C   s   d  S(   N(    (   s   selfs   tag(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   unknown_endtag�  s    c         C   s   d  S(   N(    (   s   selfs   ref(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   unknown_charrefž  s    c         C   s   d  S(   N(    (   s   selfs   ref(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   unknown_entityrefŸ  s    (    s   __name__s
   __module__s   __init__s   resets   setnomoretagss
   setliterals   feeds   closes   errors   goaheads   _decl_othercharss   parse_pis   get_starttag_texts   parse_starttags   parse_endtags   finish_shorttags   finish_starttags   finish_endtags   handle_starttags   handle_endtags   report_unbalanceds   handle_charrefs
   entitydefss   handle_entityrefs   handle_datas   handle_comments   handle_decls	   handle_pis   unknown_starttags   unknown_endtags   unknown_charrefs   unknown_entityref(    (    (    s$   /mit/python/lib/python2.3/sgmllib.pys
   SGMLParser7   s<   	
						g			7								3								s   TestSGMLParserc           B   se   t  Z d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d	 „  Z	 d
 „  Z
 d „  Z RS(   Ni    c         C   s   d |  _ t i |  | ƒ d  S(   Ns    (   s   selfs   testdatas
   SGMLParsers   __init__s   verbose(   s   selfs   verbose(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   __init__¤  s    	c         C   s9   |  i | |  _ t |  i ƒ d j o |  i ƒ  n d  S(   NiF   (   s   selfs   testdatas   datas   lens   flush(   s   selfs   data(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   handle_data¨  s    c         C   s+   |  i } | o d |  _ d G| GHn d  S(   Ns    s   data:(   s   selfs   testdatas   data(   s   selfs   data(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   flush­  s    		c         C   sK   |  i ƒ  | } t | ƒ d j o | d  d | d } n d G| GHd  S(   NiD   i    s   ...iàÿÿÿs   comment:(   s   selfs   flushs   datas   rs   len(   s   selfs   datas   r(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   handle_comment³  s
    
c         C   s_   |  i ƒ  | o d | d GHn9 d | Gx( | D]  \ } } | d d | d Gq2 Wd GHd  S(   Ns   start tag: <s   >s   =s   "(   s   selfs   flushs   attrss   tags   names   value(   s   selfs   tags   attrss   values   name(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   unknown_starttagº  s    
 c         C   s   |  i ƒ  d | d GHd  S(   Ns   end tag: </s   >(   s   selfs   flushs   tag(   s   selfs   tag(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   unknown_endtagÄ  s    
c         C   s   |  i ƒ  d | d GHd  S(   Ns   *** unknown entity ref: &s   ;(   s   selfs   flushs   ref(   s   selfs   ref(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   unknown_entityrefÈ  s    
c         C   s   |  i ƒ  d | d GHd  S(   Ns   *** unknown char ref: &#s   ;(   s   selfs   flushs   ref(   s   selfs   ref(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   unknown_charrefÌ  s    
c         C   s   |  i ƒ  d | d GHd  S(   Ns   *** unknown decl: [s   ](   s   selfs   flushs   data(   s   selfs   data(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   unknown_declÐ  s    
c         C   s   t  i |  ƒ |  i ƒ  d  S(   N(   s
   SGMLParsers   closes   selfs   flush(   s   self(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   closeÔ  s    (   s   __name__s
   __module__s   __init__s   handle_datas   flushs   handle_comments   unknown_starttags   unknown_endtags   unknown_entityrefs   unknown_charrefs   unknown_decls   close(    (    (    s$   /mit/python/lib/python2.3/sgmllib.pys   TestSGMLParser¢  s   				
				c   	      C   s2  d  k  } |  t j o | i d }  n |  o |  d d j o |  d }  t } n t } |  o |  d } n d } | d j o | i } nF y t
 | d ƒ } Wn/ t j
 o# } | Gd G| GH| i d ƒ n X| i ƒ  } | | i j	 o | i ƒ  n | ƒ  } x | D] } | i | ƒ qW| i ƒ  d  S(   Ni   i    s   -ss	   test.htmls   -s   rs   :(   s   syss   argss   Nones   argvs
   SGMLParsers   klasss   TestSGMLParsers   files   stdins   fs   opens   IOErrors   msgs   exits   reads   datas   closes   xs   cs   feed(	   s   argss   files   fs   datas   cs   syss   klasss   xs   msg(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   testÙ  s2    	

	 s   __main__(   s   __doc__s
   markupbases   res   __all__s   compiles   interestings
   incompletes	   entityrefs   charrefs   starttagopens   shorttagopens   shorttags   picloses
   endbrackets   tagfinds   attrfinds   RuntimeErrors   SGMLParseErrors
   ParserBases
   SGMLParsers   TestSGMLParsers   Nones   tests   __name__(   s   starttagopens
   SGMLParsers   TestSGMLParsers   SGMLParseErrors   __all__s   res   interestings   charrefs   tagfinds
   markupbases   tests	   entityrefs   shorttags   attrfinds   shorttagopens
   endbrackets   picloses
   incomplete(    (    s$   /mit/python/lib/python2.3/sgmllib.pys   ?   s*   			ÿ l7$