;
?c           @   sz   d  Z  d k Z e i d  i Z e i d  i Z e i d  Z e i d  Z e i d  Z [ d f  d     YZ	 d S(	   sI   Shared support for scanning document type declarations in HTML and XHTML.Ns   [a-zA-Z][-_.a-zA-Z0-9]*\s*s   (\'[^\']*\'|"[^"]*")\s*s   --\s*>s	   ]\s*]\s*>s   ]\s*>s
   ParserBasec           B   s   t  Z d  Z d   Z d   Z d   Z d   Z d   Z d Z d   Z	 d d	  Z
 d d
  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   si   Parser base class which provides some common support methods used
    by the SGML/HTML and XHTML parsers.c         C   s$   |  i t j o t d   n d  S(   Ns(   markupbase.ParserBase must be subclassed(   s   selfs	   __class__s
   ParserBases   RuntimeError(   s   self(    (    s'   /mit/python/lib/python2.3/markupbase.pys   __init__   s    c         C   s   t  d   d  S(   Ns.   subclasses of ParserBase must override error()(   s   NotImplementedError(   s   selfs   message(    (    s'   /mit/python/lib/python2.3/markupbase.pys   error   s    c         C   s   d |  _ d |  _ d  S(   Ni   i    (   s   selfs   linenos   offset(   s   self(    (    s'   /mit/python/lib/python2.3/markupbase.pys   reset   s    	c         C   s   |  i |  i f Sd S(   s&   Return current line number and offset.N(   s   selfs   linenos   offset(   s   self(    (    s'   /mit/python/lib/python2.3/markupbase.pys   getpos#   s     c         C   s   | | j o | Sn |  i } | i d | |  } | o: |  i | |  _ | i d | |  } | | d |  _	 n |  i	 | | |  _	 | Sd  S(   Ns   
i   (
   s   is   js   selfs   rawdatas   counts   nliness   linenos   rindexs   poss   offset(   s   selfs   is   js   poss   rawdatas   nlines(    (    s'   /mit/python/lib/python2.3/markupbase.pys	   updatepos+   s    	s    c   
      C   st  |  i } | d } | | | d !d d f j o d Sn t |  } | | | d !d j o |  i |  Sn; | | d j o |  i |  Sn |  i | |  \ } } | d j  o | Sn | d	 j o d |  _
 n x| | j  o| | } | d
 j oH | | d | !}	 | d	 j o |  i |	  n |  i |	  | d Sn | d j o/ t | |  } | o d Sn | i   } n | d j o |  i | |  \ } } n | |  i
 j o | d } n | d j of | d	 j o |  i | d |  } qR| d d d d f j o |  i d |  qR|  i d  n |  i d | |  | d j  o | Sq q Wd Sd  S(   Ni   i   s   -s    is   --s   [i    s   doctypes   >s   "'s4   abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZs   attlists   linktypes   links   elements&   unsupported '[' char in %s declarations"   unexpected '[' char in declarations!   unexpected %s char in declaration(   s   selfs   rawdatas   is   js   lens   ns   parse_comments   parse_marked_sections
   _scan_names   decltypes   _decl_othercharss   cs   datas   handle_decls   unknown_decls   _declstringlit_matchs   ms   ends   names   _parse_doctype_subsets   error(
   s   selfs   is   cs   decltypes   names   js   ms   ns   rawdatas   data(    (    s'   /mit/python/lib/python2.3/markupbase.pys   parse_declaration;   sV    	
  
i   c         C   s  |  i } |  i | d |  \ } } | d j  o | Sn | d d d d d f j o t i | | d  } nN | d d	 d
 f j o t	 i | | d  } n |  i
 d | | d | ! | o d Sn | o+ | i d  } |  i | | d | ! n | i d  Sd  S(   Ni   i    s   temps   cdatas   ignores   includes   rcdatas   ifs   elses   endifs+   unknown status keyword %s in marked sectioni(   s   selfs   rawdatas
   _scan_names   is   sectNames   js   _markedsectioncloses   searchs   matchs   _msmarkedsectioncloses   errors   reports   starts   unknown_decls   end(   s   selfs   is   reports   sectNames   js   rawdatas   match(    (    s'   /mit/python/lib/python2.3/markupbase.pys   parse_marked_section   s     	 c         C   s   |  i } | | | d !d j o |  i d  n t i | | d  } | o d Sn | o+ | i d  } |  i
 | | d | ! n | i d  Sd  S(   Ni   s   <!--s"   unexpected call to parse_comment()ii    (   s   selfs   rawdatas   is   errors   _commentcloses   searchs   matchs   reports   starts   js   handle_comments   end(   s   selfs   is   reports   js   rawdatas   match(    (    s'   /mit/python/lib/python2.3/markupbase.pys   parse_comment   s    	c   
      C   s#  |  i } t |  } | } x| | j  o| | } | d j o| | | d !} | d j o d Sn | d j o* |  i | | d  |  i
 d |  n | d | j o d Sn | d | j o d Sn | | | d !d j o1 |  i | d	 d
 } | d
 j  o | Sq q n |  i | d |  \ } } | d j o d Sn | d d d d f j o* |  i | | d  |  i
 d |  n t |  d |  }	 |	 | |  } | d
 j  o | Sqq | d j om | d | j o d Sn |  i | d |  \ } } | d
 j  o | Sn | | d j o | d } qq | d j o | d } x- | | j  o | | i   o | d } q]W| | j  o: | | d j o | Sn |  i | |  |  i
 d  qd Sq | i   o | d } q |  i | |  |  i
 d |  q Wd Sd  S(   Ns   <i   is   <!i   s*   unexpected char in internal subset (in %s)i   s   <!--s   reporti    s   attlists   elements   entitys   notations)   unknown declaration %s in internal subsets   _parse_doctype_s   %s   ;s   ]s   >s%   unexpected char after internal subsets%   unexpected char %s in internal subset(   s   selfs   rawdatas   lens   ns   is   js   cs   ss	   updateposs   declstartposs   errors   parse_comments
   _scan_names   names   getattrs   meths   isspace(
   s   selfs   is   declstartposs   names   js   cs   ns   ss   rawdatas   meth(    (    s'   /mit/python/lib/python2.3/markupbase.pys   _parse_doctype_subset   sp    	 

 c         C   sg   |  i | |  \ } } | d j o d Sn |  i } d | | j o | i d |  d Sn d Sd  S(   Nis   >i   (   s   selfs
   _scan_names   is   declstartposs   names   js   rawdatas   find(   s   selfs   is   declstartposs   names   js   rawdata(    (    s'   /mit/python/lib/python2.3/markupbase.pys   _parse_doctype_element   s    	c         C   sn  |  i } |  i | |  \ } } | | | d !} | d j o d Sn | d j o | d Sn xn o|  i | |  \ } } | d j  o | Sn | | | d !} | d j o d Sn | d j oq d | | j o | i d |  d } n d Sx' | | | d !i	   o | d } q W| | o d SqSn |  i | |  \ } } | | | d !} | o d Sn | d j oO t
 | |  } | o | i   } n d S| | | d !} | o d Sqn | d	 j oo | | d	 j o d Sn |  i | d |  \ } } | d j  o | Sn | | | d !} | o d SqLn | d j o | d Sqc qj Wd  S(
   Ni   s    is   >i    s   (s   )s   '"s   #(   s   selfs   rawdatas
   _scan_names   is   declstartposs   names   js   cs   finds   isspaces   _declstringlit_matchs   ms   end(   s   selfs   is   declstartposs   names   js   ms   cs   rawdata(    (    s'   /mit/python/lib/python2.3/markupbase.pys   _parse_doctype_attlist   s^    	  c         C   s   |  i | |  \ } } | d j  o | Sn |  i } x n o | | | d !} | o d Sn | d j o | d Sn | d j o/ t | |  } | o d Sn | i
   } q9 |  i | |  \ } } | d j  o | Sq9 q@ Wd  S(   Ni    i   is   >s   '"(   s   selfs
   _scan_names   is   declstartposs   names   js   rawdatas   cs   _declstringlit_matchs   ms   end(   s   selfs   is   declstartposs   names   js   ms   cs   rawdata(    (    s'   /mit/python/lib/python2.3/markupbase.pys   _parse_doctype_notation2  s&    	 c         C   sf  |  i } | | | d !d j oZ | d } xS n oA | | | d !} | o d Sn | i   o | d } q. Pq5 Wn | } |  i | |  \ } } | d j  o | Sn x n o |  i | | d !} | o d Sn | d j o. t	 | |  } | o | i   } q]d Sq | d j o | d Sq |  i | |  \ } } | d j  o | Sq q Wd  S(   Ni   s   %ii    s   '"s   >(   s   selfs   rawdatas   is   js   cs   isspaces
   _scan_names   declstartposs   names   _declstringlit_matchs   ms   end(   s   selfs   is   declstartposs   cs   names   js   ms   rawdata(    (    s'   /mit/python/lib/python2.3/markupbase.pys   _parse_doctype_entityI  s<    	
 
 c         C   s   |  i } t |  } | | j o t d f Sn t | |  } | oW | i   } | i
   } | t |  | j o t d f Sn | i   | i   f Sn |  i | |  |  i d  d  S(   Nis   expected name token(   s   selfs   rawdatas   lens   ns   is   Nones   _declname_matchs   ms   groups   ss   strips   names   lowers   ends	   updateposs   declstartposs   error(   s   selfs   is   declstartposs   names   ms   ns   ss   rawdata(    (    s'   /mit/python/lib/python2.3/markupbase.pys
   _scan_namem  s    	c         C   s   d  S(   N(    (   s   selfs   data(    (    s'   /mit/python/lib/python2.3/markupbase.pys   unknown_decl~  s    (   s   __name__s
   __module__s   __doc__s   __init__s   errors   resets   getposs	   updateposs   _decl_othercharss   parse_declarations   parse_marked_sections   parse_comments   _parse_doctype_subsets   _parse_doctype_elements   _parse_doctype_attlists   _parse_doctype_notations   _parse_doctype_entitys
   _scan_names   unknown_decl(    (    (    s'   /mit/python/lib/python2.3/markupbase.pys
   ParserBase   s"    						K	D		9		$	(
   s   __doc__s   res   compiles   matchs   _declname_matchs   _declstringlit_matchs   _commentcloses   _markedsectioncloses   _msmarkedsectioncloses
   ParserBase(   s   _commentcloses
   ParserBases   _markedsectioncloses   _declname_matchs   _declstringlit_matchs   res   _msmarkedsectionclose(    (    s'   /mit/python/lib/python2.3/markupbase.pys   ?   s   	