관리-도구
편집 파일: _markupbase.cpython-39.opt-1.pyc
a R�f9 � @ sV d Z ddlZe�d�jZe�d�jZe�d�Ze�d�Ze�d�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 tu rtd��d S )Nz)_markupbase.ParserBase must be subclassed)� __class__r �RuntimeError��self� r �0/opt/alt/python39/lib64/python3.9/_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�offsetr r r r �reset$ s zParserBase.resetc C s | j | jfS )z&Return current line number and offset.r r r r r �getpos( s zParserBase.getposc C sb ||kr|S | j }|�d||�}|rN| j| | _|�d||�}||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 }|||d � dkr*|d S |||d � dv rBdS t|�}|||d � dkrh| �|�S || dkr~| �|�S | �||�\}}|dk r�|S |d kr�d | _||k �r�|| }|dkr�||d |� }|d kr�| �|� n | �|� |d S |dv �r t||�}|�sdS |� � }n�|dv �r<| �||�\} }nt|| jv �rR|d }n^|dk�r�|d k�rx| � |d |�}n$|d v �r�| �d| � n | �d� n| �d|| � |dk r�|S q�dS )N� r �>)�-r ���z--�[r Zdoctyper z"'Z4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ> �attlist�link�elementZlinktypez&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_subsetr ) r r r r �nZdecltype�c�data�m�namer r r �parse_declaration@ sZ �zParserBase.parse_declarationr c C s� | j }| �|d |�\}}|dk r&|S |dv r@t�||d �}n8|dv rZt�||d �}n| �d||d |� � d }|s�dS |r�|�d�}| �||d |� � |�d�S )N� r > Zinclude�ignoreZcdataZrcdataZtemp> Zendif�else�ifz+unknown status keyword %r in marked sectionr ) r r'