AlkantarClanX12

Your IP : 3.129.211.116


Current Path : /opt/alt/python34/lib64/python3.4/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/__pycache__/_markupbase.cpython-34.pyc

�
e f9�@s}dZddlZejd�jZejd�jZejd�Zejd�Zejd�Z[Gdd	�d	�Z	dS)
z�Shared support for scanning document type declarations in HTML and XHTML.

This module is used as a foundation for the html.parser module.  It has no
documented public API and should not be used directly.

�Nz[a-zA-Z][-_.a-zA-Z0-9]*\s*z(\'[^\']*\'|"[^"]*")\s*z--\s*>z	]\s*]\s*>z]\s*>c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdZ	d
d�Z
ddd�Zddd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"S)#�
ParserBaseziParser base class which provides some common support methods used
    by the SGML/HTML and XHTML parsers.cCs"|jtkrtd��ndS)Nz)_markupbase.ParserBase must be subclassed)�	__class__r�RuntimeError)�self�r�0/opt/alt/python34/lib64/python3.4/_markupbase.py�__init__szParserBase.__init__cCstd��dS)Nz.subclasses of ParserBase must override error())�NotImplementedError)r�messagerrr�error szParserBase.errorcCsd|_d|_dS)N�r)�lineno�offset)rrrr�reset$s	zParserBase.resetcCs|j|jfS)z&Return current line number and offset.)r
r)rrrr�getpos(szParserBase.getposcCs�||kr|S|j}|jd||�}|rm|j||_|jd||�}||d|_n|j|||_|S)N�
r)�rawdata�countr
�rindexr)r�i�jrZnlines�posrrr�	updatepos0s	zParserBase.updatepos�c
Cst|j}|d}|||�dks5td��|||d�dkrW|dS|||d�dkrudSt|�}|||d�dkr�|j|�S||d	kr�|j|�S|j||�\}}|d
kr�|S|dkrd|_nxh||kro||}|dkro||d|�}|dkrZ|j|�n
|j|�|dS|dkr�t	||�}|s�dS|j
�}n�|d
kr�|j||�\}	}n�||jkr�|d}nv|d	krG|dkr|j|d|�}q\|dkr7|jd|�q\|jd�n|jd||�|d
kr|SqWdS)N�z<!z$unexpected call to parse_declarationr�>�-rz--�[rZdoctypez"'Z4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ�attlist�linktype�link�elementz&unsupported '[' char in %s declarationz"unexpected '[' char in declarationz!unexpected %r char in declaration)rr���r">r�elementr�linkr")
r�AssertionError�len�
parse_comment�parse_marked_section�
_scan_name�_decl_othercharsZhandle_decl�unknown_decl�_declstringlit_match�end�_parse_doctype_subsetr)
rrrr�nZdecltype�c�data�m�namerrr�parse_declaration@sZ	
"




zParserBase.parse_declarationrcCs|j}|||d�dks/td��|j|d|�\}}|dkr[|S|dkr�tj||d�}nD|dkr�tj||d�}n|jd
||d|��|s�dS|r|jd�}|j||d|��n|j	d�S)N�z<![z)unexpected call to parse_marked_section()r�temp�cdata�ignore�include�rcdata�if�else�endifz+unknown status keyword %r in marked sectionr>r7�includer:r6�ignore>r=�if�elser")
rr%r)�_markedsectionclose�search�_msmarkedsectioncloser�startr+r-)rr�reportrZsectNamer�matchrrrr(�s 	&zParserBase.parse_marked_sectioncCs�|j}|||d�dkr3|jd�ntj||d�}|sSdS|r�|jd�}|j||d|��n|jd�S)N�z<!--z"unexpected call to parse_comment()rrr")rr�
_commentcloserCrEZhandle_commentr-)rrrFrrGrrrrr'�s	zParserBase.parse_commentc
Cs�|j}t|�}|}x�||kr�||}|dkr�|||d�}|dkrddS|dkr�|j||d�|jd|�n|d|kr�dS|d|kr�dS|||d�dkr|j|dd	�}|d	kr|Sqn|j|d|�\}}|dkr1dS|dkre|j||d�|jd|�nt|d|�}	|	||�}|d	kr�|Sq|dkr|d|kr�dS|j|d|�\}}|d	kr�|S||dkr�|d}q�q|dkr�|d}x*||krH||j�rH|d}qW||kr�||dkri|S|j||�|jd�q�dSq|j�r�|d}q|j||�|jd|�qWdS)N�<rrz<!z*unexpected char in internal subset (in %r)rHz<!--rFrrr!�entity�notationz)unknown declaration %r in internal subsetZ_parse_doctype_�%�;�]rz%unexpected char after internal subsetz%unexpected char %r in internal subsetr"r"r"r"r">�element�attlistrLrKr"r"r")rr&rrr'r)�getattr�isspace)
rr�declstartposrr/rr0�sr3�methrrrr.�sn	


z ParserBase._parse_doctype_subsetcCs_|j||�\}}|dkr(dS|j}d||d�kr[|jd|�dSdS)Nrrr"r"r")r)r�find)rrrTr3rrrrr�_parse_doctype_element�s	z!ParserBase._parse_doctype_elementcCsC|j}|j||�\}}|||d�}|dkrEd	S|dkrY|dSx�|j||�\}}|dkr�|S|||d�}|dkr�d
S|dkr)d||d�kr�|jd|�d}ndSx(|||d�j�r|d}q�W||d�sAdSn|j||�\}}|||d�}|s_d
S|dkr�t||�}|r�|j�}ndS|||d�}|s�dSn|dkr'||d�dkr�dS|j|d|�\}}|dkr|S|||d�}|s'dSn|dkr\|dSq\WdS)Nrrrr�(�)z'"�#r"r"r"r"r"r"r"r"r")rr)rWrSr,r-)rrrTrr3rr0r2rrr�_parse_doctype_attlistsZ	z!ParserBase._parse_doctype_attlistcCs�|j||�\}}|dkr(|S|j}x�|||d�}|sRdS|dkrf|dS|dkr�t||�}|s�dS|j�}q4|j||�\}}|dkr4|Sq4WdS)Nrrrz'"r"r")r)rr,r-)rrrTr3rrr0r2rrr�_parse_doctype_notation=s$	z"ParserBase._parse_doctype_notationcCs<|j}|||d�dkro|d}xE|||d�}|sNdS|j�rg|d}q0Pq0Wn|}|j||�\}}|dkr�|Sx�|j||d�}|s�dS|dkr�t||�}|r�|j�}q4dSq�|dkr|dS|j||�\}}|dkr�|Sq�WdS)	NrrMrz'"rr"r"r")rrSr)r,r-)rrrTrrr0r3r2rrr�_parse_doctype_entityTs8	

z ParserBase._parse_doctype_entitycCs�|j}t|�}||kr%dSt||�}|r�|j�}|j�}|t|�|krldS|j�|j�fS|j||�|jd|||d��dS)Nrzexpected name token at %r�r")Nr"r")Nr")	rr&�_declname_match�group�strip�lowerr-rr)rrrTrr/r2rUr3rrrr)xs		zParserBase._scan_namecCsdS)Nr)rr1rrrr+�szParserBase.unknown_declN)�__name__�
__module__�__qualname__�__doc__rrrrrr*r4r(r'r.rXr\r]r^r)r+rrrrrs"
RC9$r)
rg�re�compilerGr`r,rIrBrDrrrrr�<module>s