Your IP : 18.222.167.85
3
\9 � @ sV d Z ddlZejd�jZejd�jZejd�Zejd�Zejd�Z[G dd � 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� e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� ZdZ d
d� Z
d#dd�Zd$dd�Zdd� 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.c C s | j tkrtd��d S )Nz)_markupbase.ParserBase must be subclassed)� __class__r �RuntimeError)�self� r �#/usr/lib64/python3.6/_markupbase.py�__init__ s
zParserBase.__init__c C s t d��d S )Nz.subclasses of ParserBase must override error())�NotImplementedError)r �messager r r �error s zParserBase.errorc C s d| _ d| _d S )N� r )�lineno�offset)r r r r �reset$ s zParserBase.resetc C s | j | jfS )z&Return current line number and offset.)r
r )r r r r �getpos( s zParserBase.getposc C sb ||kr|S | j }|jd||�}|rN| j| | _|jd||�}||d | _n| j| | | _|S )N�
r )�rawdata�countr
�rindexr )r �i�jr Znlines�posr r r � updatepos0 s zParserBase.updatepos� c
C s� | j }|d }|||� dks&td��|||d � dkrB|d S |||d � dkrZdS t|�}|||d � dkr�| j|�S || d kr�| j|�S | j||�\}}|d
k r�|S |dkr�d| _�x||k �r�|| }|dk�r||d |� }|dk�r| j|� n
| j|� |d S |dk�r@t ||�}|�s6dS |j
� }n�|d
k�r\| j||�\} }nt|| jk�rr|d }n^|d k�r�|dk�r�| j|d |�}n$|dk�r�| jd| � n
| jd� n| jd|| � |d
k r�|S q�W dS )N� z<!z$unexpected call to parse_declarationr �>�-r z--�[r Zdoctypez"'Z4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ�attlist�linktype�link�elementz&unsupported '[' char in %s declarationz"unexpected '[' char in declarationz!unexpected %r char in declaration)r r ���r"