AlkantarClanX12

Your IP : 18.216.42.122


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/_markupbase.cpython-310.pyc

o

6��f=9�@sVdZddlZe�d�jZe�d�jZe�d�Ze�d�Ze�d�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
Zdd�Z	d!dd�Z
d!dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd S)"�
ParserBaseziParser base class which provides some common support methods used
    by the SGML/HTML and XHTML parsers.cCs|jtur	td��dS)Nz)_markupbase.ParserBase must be subclassed)�	__class__r�RuntimeError��self�r�2/opt/alt/python310/lib64/python3.10/_markupbase.py�__init__s

��zParserBase.__init__cCsd|_d|_dS)N�r��lineno�offsetrrrr�reset s
zParserBase.resetcCs|j|jfS)z&Return current line number and offset.rrrrr�getpos$szParserBase.getposcCsd||kr|S|j}|�d||�}|r(|j||_|�d||�}||d|_|S|j|||_|S)N�
r
)�rawdata�countr�rindexr
)r�i�jrZnlines�posrrr�	updatepos,s�zParserBase.updatepos�c
Cs�|j}|d}|||�dksJd��|||d�dkr!|dS|||d�dvr-dSt|�}|||d�dkr@|�|�S||d	krK|�|�S|�||�\}}|d
krY|S|dkr`d|_||kr�||}|dkr�||d|�}|dkr�|�|�|dS|�|�|dS|d
vr�t||�}|s�dS|�	�}n>|dvr�|�||�\}	}n1||jvr�|d}n'|d	kr�|dkr�|�
|d|�}n|dvr�td|��td��td||��|d
kr�|S||ksddS)N��<!z$unexpected call to parse_declarationr
�>)�-r���z--�[rZdoctyperz"'Z4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ>Zlinktype�element�link�attlistz&unsupported '[' char in %s declarationz"unexpected '[' char in declarationz!unexpected %r char in declaration)r�len�
parse_comment�parse_marked_section�
_scan_name�_decl_othercharsZhandle_decl�unknown_decl�_declstringlit_match�end�_parse_doctype_subset�AssertionError)
rrrr�nZdecltype�c�data�m�namerrr�parse_declaration<s\



�



�'zParserBase.parse_declarationr
cCs�|j}|||d�dksJd��|�|d|�\}}|dkr!|S|dvr.t�||d�}n|dvr;t�||d�}ntd||d|���|sKdS|r]|�d�}|�||d|��|�d�S)	N�z<![z)unexpected call to parse_marked_section()r>�ignoreZcdataZrcdataZtempZinclude>Zendif�if�elsez+unknown status keyword %r in marked sectionr)	rr%�_markedsectionclose�search�_msmarkedsectioncloser+�startr'r))rr�reportrZsectNamer�matchrrrr$�s$�

zParserBase.parse_marked_sectioncCsh|j}|||d�dkrtd��t�||d�}|sdS|r/|�d�}|�||d|��|�d�S)N��<!--z"unexpected call to parse_comment()rr)rr+�
_commentcloser7r9Zhandle_commentr))rrr:rr;rrrrr#�s

zParserBase.parse_commentc
Cs|j}t|�}|}||k�r||}|dkr�|||d�}|dkr$dS|dkr6|�||d�td|��|d|kr>dS|d|krFdS|||d�dkr^|j|d	d
�}|d	kr]|Sq	|�|d|�\}}|dkrndS|dvr�|�||d�td|��t|d
|�}	|	||�}|d	kr�|Snt|dkr�|d|kr�dS|�|d|�\}}|d	kr�|S||dkr�|d}nM|dkr�|d}||kr�||��r�|d}||kr�||��s�||kr�||dkr�|S|�||�td��dS|��r�|d}n|�||�td|��||ksdS)N�<rrrr
z*unexpected char in internal subset (in %r)r<r=r)r:>ZentityrZnotationr!z)unknown declaration %r in internal subsetZ_parse_doctype_�%�;�]rz%unexpected char after internal subsetz%unexpected char %r in internal subset)rr"rr+r#r%�getattr�isspace)
rr�declstartposrr,rr-�sr0Zmethrrrr*�s|
��
���
�?z ParserBase._parse_doctype_subsetcCsF|�||�\}}|dkrdS|j}d||d�vr!|�d|�dSdS)Nrrr
)r%r�find)rrrEr0rrrrr�_parse_doctype_element�sz!ParserBase._parse_doctype_elementcCs�|j}|�||�\}}|||d�}|dkrdS|dkr!|dS	|�||�\}}|dkr0|S|||d�}|dkr>dS|dkrvd||d�vrS|�d|�d}ndS|||d���rm|d}|||d���s_||d�sudSn|�||�\}}|||d�}|s�dS|dvr�t||�}|r�|��}ndS|||d�}|s�dS|d	kr�||d�d	kr�dS|�|d|�\}}|dkr�|S|||d�}|s�dS|dkr�|dSq")
Nr
rrrr�(�)�'"�#)rr%rGrDr(r))rrrErr0rr-r/rrr�_parse_doctype_attlists`��

�z!ParserBase._parse_doctype_attlistcCs�|�||�\}}|dkr|S|j}	|||d�}|sdS|dkr&|dS|dvr8t||�}|s3dS|��}n|�||�\}}|dkrF|Sq)Nrr
rrrK)r%rr(r))rrrEr0rrr-r/rrr�_parse_doctype_notation=s&

�z"ParserBase._parse_doctype_notationcCs�|j}|||d�dkr*|d}	|||d�}|sdS|��r'|d}nnqn|}|�||�\}}|dkr:|S	|j||d�}|sHdS|dvrZt||�}|rX|��}ndS|dkrb|dS|�||�\}}|dkrp|Sq;)Nr
r@rrrKr)rrDr%r(r))rrrErrr-r0r/rrr�_parse_doctype_entityTs>
�

�z ParserBase._parse_doctype_entitycCs�|j}t|�}||kr
dSt||�}|r.|��}|��}|t|�|kr&dS|��|��fS|�||�td|||d���)N)Nrzexpected name token at %r�)	rr"�_declname_match�group�strip�lowerr)rr+)rrrErr,r/rFr0rrrr%xs
�zParserBase._scan_namecCsdS)Nr)rr.rrrr'�szParserBase.unknown_declN)r
)�__name__�
__module__�__qualname__�__doc__r	rrrr&r1r$r#r*rHrMrNrOr%r'rrrrrs"

Q
F9$r)
rX�re�compiler;rQr(r>r6r8rrrrr�<module>s