-
<c       sn     d  Z    d k Z  d k Z  e i d  i Z  e i d  i 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
   ParserBasec      s    t  Z d  Z   d   Z  d   Z  d   Z  d   Z % d   Z 2 d Z 5 d   Z	 h 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    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    /usr/lib/python2.2/markupbase.pys   __init__ s   c    s     t  d   d  S(   Ns.   subclasses of ParserBase must override error()(   s   NotImplementedError(   s   selfs   message(    (    s    /usr/lib/python2.2/markupbase.pys   error s   c    s     d |  _  d |  _ d  S(   Ni   i    (   s   selfs   linenos   offset(   s   self(    (    s    /usr/lib/python2.2/markupbase.pys   reset s   c    s      |  i |  i f Sd S(   s&   Return current line number and offset.N(   s   selfs   linenos   offset(   s   self(    (    s    /usr/lib/python2.2/markupbase.pys   getpos s   c    s   % & | | j o ' | Sn ( |  i } ) t i | d | |  } * | oF + |  i | |  _ , t i | d | |  } - | | d |  _
 n / |  i
 | | |  _
 0 | Sd  S(   Ns   
i   (   s   is   js   selfs   rawdatas   strings   counts   nliness   linenos   rindexs   poss   offset(   s   selfs   is   js   poss   rawdatas   nlines(    (    s    /usr/lib/python2.2/markupbase.pys	   updatepos% s   
s    c 
   s  5 9 |  i } : | d } ; t o | | | !d j p
 t d  < | | | d !d d f j o ? d Sn A t |  } B |  i | |  \ } } C | d j  o D | Sn E | d	 j o F d |  _
 n G xG | | j  oH | | } I | d
 j oW K | | d | !}	 L | d	 j o M |  i |	  n O |  i |	  P | d Sn Q | d j o; R t | |  } S | o T d Sn U | i   } n V | d j o W |  i | |  \ } } n X | |  i
 j o Y | d } nk Z | d j oA [ | d	 j o \ |  i | d |  } n ^ |  i d  n ` |  i d | |  b | d j  o c | Sn q Wd d Sd  S(   Ni   s   <!s$   unexpected call to parse_declarationi   s   -s    ii    s   doctypes   >s   "'s4   abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZs   [s"   unexpected '[' char in declarations!   unexpected %s char in declaration(   s   selfs   rawdatas   is   js	   __debug__s   AssertionErrors   lens   ns
   _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    /usr/lib/python2.2/markupbase.pys   parse_declaration5 sJ   (! c 
   s  h i |  i } j t |  } k | } l xl | | j  om | | } n | d j oo | | | d !} p | d j o r d Sn s | d j o0 t |  i | | d  u |  i
 d |  n w | d | j o y d Sn z | d | j o | d Sn } | | | d !d j o= ~ |  i | d	 d
 }  | d
 j  o  | Sn  q- n  |  i | d |  \ } }  | d j o  d Sn  | d d d d f j o0  |  i | | d   |  i
 d |  n  t |  d |  }	  |	 | |  }  | d
 j  o  | Sn n | d j o  | d | j o  d Sn  |  i | d |  \ } }  | d
 j  o  | Sn  | | d j o  | d } n n | d j o  | d }  x6  | | j  o | | t i j o  | d } qW | | j  oF  | | d j o  | Sn  |  i | |   |  i
 d  n  d SnM  | t i j o  | d } n)  |  i | |   |  i
 d |  q- W d 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   strings
   whitespace(
   s   selfs   is   declstartposs   names   js   cs   ns   ss   rawdatas   meth(    (    s    /usr/lib/python2.2/markupbase.pys   _parse_doctype_subseth sp   	 
 $c    s     |  i | |  \ } }  | d j o  d Sn  |  i }  d | | j o  t i | d |  d Sn  d Sd  S(   Nis   >i   (	   s   selfs
   _scan_names   is   declstartposs   names   js   rawdatas   strings   find(   s   selfs   is   declstartposs   rawdatas   js   name(    (    s    /usr/lib/python2.2/markupbase.pys   _parse_doctype_element s   c    s    |  i }  |  i | |  \ } }  | | | d !}  | d j o  d Sn  | d j o  | d Sn  x d ow |  i | |  \ } }  | d j  o  | Sn  | | | d !}  | d j o  d Sn  | d j o  d | | j o   t i	 | d |  d } n  d S x0  | | | d !t i
 j o  | d } q>W | | o  d Sn n  |  i | |  \ } }  | | | d !}  | o  d Sn  | d j od  t | |  }  | o  | i   } n  d S | | | d !}  | o  d Sn n  | d	 j o  | | d	 j o  d Sn  |  i | d |  \ } }  | d j  o  | Sn  | | | d !}  | o  d Sn n  | d j o  | d Sn q~ Wd  S(
   Ni   s    is   >i    s   (s   )s   '"s   #(   s   selfs   rawdatas
   _scan_names   is   declstartposs   names   js   cs   strings   finds
   whitespaces   _declstringlit_matchs   ms   end(   s   selfs   is   declstartposs   names   js   ms   cs   rawdata(    (    s    /usr/lib/python2.2/markupbase.pys   _parse_doctype_attlist s^    
  
c    s(    |  i | |  \ } }  | d j  o  | Sn  |  i }  x  d o  | | | d !}  | o  d Sn  | d j o  | d Sn  | d j o;  t | |  }  | o  d Sn  | i
   } n7 |  i | |  \ } } | d j  o | Sn qK Wd  S(   Ni    i   is   >s   '"(   s   selfs
   _scan_names   is   declstartposs   names   js   rawdatas   cs   _declstringlit_matchs   ms   end(   s   selfs   is   declstartposs   rawdatas   js   ms   cs   name(    (    s    /usr/lib/python2.2/markupbase.pys   _parse_doctype_notation s&    
c    s  |  i } 	| | | d !d j ox 
| d } xa d oV | | | d !} | o d Sn | t i j o | d } n Pq= Wn
 | } |  i | |  \ } } | d j  o | Sn x d o |  i | | d !} | o d Sn | d j o: t
 | |  } | o | i   } n !d SnV "| d j o #| d Sn7 %|  i | |  \ } } &| d j  o '| Sn q Wd  S(   Ni   s   %ii    s   '"s   >(   s   selfs   rawdatas   is   js   cs   strings
   whitespaces
   _scan_names   declstartposs   names   _declstringlit_matchs   ms   end(   s   selfs   is   declstartposs   cs   rawdatas   names   js   m(    (    s    /usr/lib/python2.2/markupbase.pys   _parse_doctype_entitys<    
	 

c    s   +,|  i } -t |  } .| | j o /t d f Sn 0t | |  } 1| oi 2| i   } 3| i
   } 4| t |  | j o 5t d f Sn 6t i |  | i   f Sn$ 8|  i | |  9|  i d  d  S(   Nis   expected name token(   s   selfs   rawdatas   lens   ns   is   Nones   _declname_matchs   ms   groups   ss   strips   names   strings   lowers   ends	   updateposs   declstartposs   error(   s   selfs   is   declstartposs   names   ms   ns   ss   rawdata(    (    s    /usr/lib/python2.2/markupbase.pys
   _scan_name+s   
 c    s
   <=d  S(   N(    (   s   selfs   data(    (    s    /usr/lib/python2.2/markupbase.pys   unknown_decl<s   (   s   __name__s
   __module__s   __doc__s   __init__s   errors   resets   getposs	   updateposs   _decl_othercharss   parse_declarations   _parse_doctype_subsets   _parse_doctype_elements   _parse_doctype_attlists   _parse_doctype_notations   _parse_doctype_entitys
   _scan_names   unknown_decl(    (    (    s    /usr/lib/python2.2/markupbase.pys
   ParserBase s   	3D9$(   s   __doc__s   res   strings   compiles   matchs   _declname_matchs   _declstringlit_matchs
   ParserBase(   s   res   _declname_matchs
   ParserBases   strings   _declstringlit_match(    (    s    /usr/lib/python2.2/markupbase.pys   ? s   