<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
B
    ÍAÒ[W?  ã               @   sX   d Z ddlZe d¡jZe d¡jZe d¡Ze d¡Ze d¡Z[G dd	„ d	e	ƒZ
dS )
a  Shared support for scanning document type declarations in HTML and XHTML.

Backported for python-future from Python 3.3. Reason: ParserBase is an
old-style class in the Python 2.7 source of markupbase.py, which I suspect
might be the cause of sporadic unit-test failures on travis-ci.org with
test_htmlparser.py.  The test failures look like this:

    ======================================================================

ERROR: test_attr_entity_replacement (future.tests.test_htmlparser.AttributesStrictTestCase)

----------------------------------------------------------------------

Traceback (most recent call last):
  File "/home/travis/build/edschofield/python-future/future/tests/test_htmlparser.py", line 661, in test_attr_entity_replacement
    [("starttag", "a", [("b", "&><"'")])])
  File "/home/travis/build/edschofield/python-future/future/tests/test_htmlparser.py", line 93, in _run_check
    collector = self.get_collector()
  File "/home/travis/build/edschofield/python-future/future/tests/test_htmlparser.py", line 617, in get_collector
    return EventCollector(strict=True)
  File "/home/travis/build/edschofield/python-future/future/tests/test_htmlparser.py", line 27, in __init__
    html.parser.HTMLParser.__init__(self, *args, **kw)
  File "/home/travis/build/edschofield/python-future/future/backports/html/parser.py", line 135, in __init__
    self.reset()
  File "/home/travis/build/edschofield/python-future/future/backports/html/parser.py", line 143, in reset
    _markupbase.ParserBase.reset(self)

TypeError: unbound method reset() must be called with ParserBase instance as first argument (got EventCollector instance instead)

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 Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ ZdZ	dd„ Z
d#dd„Zd$dd„Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"S )%Ú
ParserBaseziParser base class which provides some common support methods used
    by the SGML/HTML and XHTML parsers.c             C   s   | j tkrtdƒ‚d S )Nz)_markupbase.ParserBase must be subclassed)Ú	__class__r   ÚRuntimeError)Úself© r   úM/opt/alt/python37/lib/python3.7/site-packages/future/backports/_markupbase.pyÚ__init__6   s    
zParserBase.__init__c             C   s   t dƒ‚d S )Nz.subclasses of ParserBase must override error())ÚNotImplementedError)r   Úmessager   r   r   Úerror;   s    zParserBase.errorc             C   s   d| _ d| _d S )Né   r   )ÚlinenoÚoffset)r   r   r   r   Úreset?   s    zParserBase.resetc             C   s   | j | jfS )z&Return current line number and offset.)r   r   )r   r   r   r   ÚgetposC   s    zParserBase.getposc             C   sb   ||kr|S | j }| d||¡}|rN| j| | _| d||¡}||d  | _n| j| | | _|S )NÚ
r   )ÚrawdataÚcountr   Úrindexr   )r   ÚiÚjr   ZnlinesÚposr   r   r   Ú	updateposK   s    zParserBase.updateposÚ c       
      C   sð  | j }|d }|||… dks&tdƒ‚|||d … dkrB|d S |||d … dkrZdS t|ƒ}|||d … dkr€|  |¡S || d	kr–|  |¡S |  ||¡\}}|d
k r²|S |dkrÀd| _x(||k rê|| }|dkr||d |… }|dkr|  |¡ n
|  |¡ |d S |dkr@t	||ƒ}|s6dS | 
¡ }nœ|dkr\|  ||¡\}	}n€|| jkrr|d }nj|d	krÊ|dkr˜|  |d |¡}n0|tddddgƒkr¾|  d| ¡ n
|  d¡ n|  d||  ¡ |d
k rÄ|S qÄW dS )Né   z<!z$unexpected call to parse_declarationr   ú>)ú-r   éÿÿÿÿz--ú[r   Zdoctyper   z"'Z4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZÚattlistZlinktypeÚlinkÚelementz&unsupported '[' char in %s declarationz"unexpected '[' char in declarationz!unexpected %r char in declaration)r   ÚAssertionErrorÚlenÚparse_commentÚparse_marked_sectionÚ
_scan_nameÚ_decl_othercharsZhandle_declÚunknown_declÚ_declstringlit_matchÚendÚ_parse_doctype_subsetÚsetr   )
r   r   r   r   ÚnZdecltypeÚcÚdataÚmÚnamer   r   r   Úparse_declaration[   sZ    











zParserBase.parse_declarationr   c             C   sÞ   | j }|||d … dks"tdƒ‚|  |d |¡\}}|dk rB|S |tddddd	gƒkrjt ||d ¡}n>|td
ddgƒkrŽt ||d ¡}n|  d||d |…  ¡ |s°dS |rÔ| d¡}|  	||d |… ¡ | 
d¡S )Né   z<![z)unexpected call to parse_marked_section()r   ZtempZcdataÚignoreZincludeZrcdataÚifÚelseZendifz+unknown status keyword %r in marked sectionr   )r   r"   r&   r,   Ú_markedsectioncloseÚsearchÚ_msmarkedsectioncloser   Ústartr(   r*   )r   r   Úreportr   ZsectNamer   Úmatchr   r   r   r%   ­   s     
zParserBase.parse_marked_sectionc             C   sj   | j }|||d … dkr$|  d¡ t ||d ¡}|s<dS |r`| d¡}|  ||d |… ¡ | d¡S )Né   z<!--z"unexpected call to parse_comment()r   r   )r   r   Ú_commentcloser8   r:   Zhandle_commentr*   )r   r   r;   r   r<   r   r   r   r   r$   Ã   s    

zParserBase.parse_commentc       
      C   s@  | j }t|ƒ}|}x&||k r:|| }|dkr@|||d … }|dkrNdS |dkrt|  ||d ¡ |  d| ¡ |d |kr„dS |d |kr”dS |||d … dkrÄ| j|d	d
}|d	k r|S q|  |d |¡\}}|dkrädS |tddddgƒkr|  ||d ¡ |  d| ¡ t| d| ƒ}	|	||ƒ}|d	k r8|S q|dkr–|d |kr\dS |  |d |¡\}}|d	k r~|S || dkr8|d }q|dkr
|d }x&||k rÎ||  ¡ rÎ|d }qªW ||k r|| dkrì|S |  ||¡ |  d¡ ndS q| ¡ r|d }q|  ||¡ |  d| ¡ qW dS )Nú<r   r   z<!r   z*unexpected char in internal subset (in %r)r=   z<!--r   )r;   r   r!   ZentityZnotationz)unknown declaration %r in internal subsetZ_parse_doctype_ú%ú;ú]r   z%unexpected char after internal subsetz%unexpected char %r in internal subset)	r   r#   r   r   r$   r&   r,   ÚgetattrÚisspace)
r   r   Údeclstartposr   r-   r   r.   Úsr1   Zmethr   r   r   r+   Ñ   sn    










z ParserBase._parse_doctype_subsetc             C   sF   |   ||¡\}}|dkrdS | j}d||d … krB| d|¡d S dS )Nr   r   r   )r&   r   Úfind)r   r   rE   r1   r   r   r   r   r   Ú_parse_doctype_element  s    z!ParserBase._parse_doctype_elementc             C   sÀ  | j }|  ||¡\}}|||d … }|dkr2dS |dkrB|d S xv|  ||¡\}}|dk rb|S |||d … }|dkr~dS |dkràd||d … kr¨| d|¡d }ndS x |||d …  ¡ rÌ|d }q®W ||d … sðdS n|  ||¡\}}|||d … }|s
dS |dkrLt||ƒ}|r.| ¡ }ndS |||d … }|sLdS |d	kr¨||d … d	krldS |  |d |¡\}}|dk rŽ|S |||d … }|s¨dS |dkrF|d S qFW d S )
Nr   r   r   r   r   ú(ú)z'"ú#)r   r&   rG   rD   r)   r*   )r   r   rE   r   r1   r   r.   r0   r   r   r   Ú_parse_doctype_attlist  sZ    




z!ParserBase._parse_doctype_attlistc             C   s”   |   ||¡\}}|dk r|S | j}xl|||d … }|s<dS |dkrL|d S |dkrpt||ƒ}|sfdS | ¡ }q$|   ||¡\}}|dk r$|S q$W d S )Nr   r   r   r   z'")r&   r   r)   r*   )r   r   rE   r1   r   r   r.   r0   r   r   r   Ú_parse_doctype_notationX  s$    

z"ParserBase._parse_doctype_notationc             C   sì   | j }|||d … dkrV|d }x6|||d … }|s<dS | ¡ rN|d }q$P q$W n|}|  ||¡\}}|dk rv|S xp| j ||d … }|s’dS |dkr¸t||ƒ}|r²| ¡ }qädS qx|dkrÈ|d S |  ||¡\}}|dk rx|S qxW d S )Nr   r@   r   r   z'"r   )r   rD   r&   r)   r*   )r   r   rE   r   r   r.   r1   r0   r   r   r   Ú_parse_doctype_entityo  s8    


z ParserBase._parse_doctype_entityc             C   s†   | j }t|ƒ}||krdS t||ƒ}|r\| ¡ }| ¡ }|t|ƒ |krLdS | ¡ | ¡ fS |  ||¡ |  d|||d …  ¡ d S )N)Nr   zexpected name token at %ré   )	r   r#   Ú_declname_matchÚgroupÚstripÚlowerr*   r   r   )r   r   rE   r   r-   r0   rF   r1   r   r   r   r&   “  s    
zParserBase._scan_namec             C   s   d S )Nr   )r   r/   r   r   r   r(   ¥  s    zParserBase.unknown_declN)r   )r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r'   r2   r%   r$   r+   rH   rL   rM   rN   r&   r(   r   r   r   r   r   2   s"   R

C9$r   )rW   ÚreÚcompiler<   rP   r)   r>   r7   r9   Úobjectr   r   r   r   r   Ú<module>!   s   


