eaiovnaovbqoebvqoeavibavo B  f9@sVdZddlZedjZedjZedZedZedZ[Gdd d Z dS) zShared 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@seZdZdZddZddZddZdd Zd d Zd Z d dZ d#ddZ d$ddZ ddZ ddZddZddZddZddZd d!Zd"S)% ParserBaseziParser base class which provides some common support methods used by the SGML/HTML and XHTML parsers.cCs|jtkrtddS)Nz)_markupbase.ParserBase must be subclassed) __class__r RuntimeError)selfr0/opt/alt/python37/lib64/python3.7/_markupbase.py__init__s zParserBase.__init__cCs tddS)Nz.subclasses of ParserBase must override error())NotImplementedError)rmessagerrrerror szParserBase.errorcCsd|_d|_dS)Nr)linenooffset)rrrrreset$szParserBase.resetcCs |j|jfS)z&Return current line number and offset.)r r)rrrrgetpos(szParserBase.getposcCsb||kr |S|j}|d||}|rN|j||_|d||}||d|_n|j|||_|S)N r )rawdatacountr rindexr)rijrZnlinesposrrr updatepos0s zParserBase.updateposc Cs|j}|d}|||dks&td|||ddkrB|dS|||ddkrZdSt|}|||ddkr||S||d kr||S|||\}}|d kr|S|d krd |_x||kr||}|dkr||d|}|d kr||n |||dS|d kr@t ||}|s6dS| }n|dkr\|||\} }nt||jkrr|d}n^|d kr|d kr| |d|}n$|dkr| d|n | dn| d|||d kr|SqWdS)Nz)-rz--[rZdoctyperz"'Z4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ>attlistlinktypeelementlinkz&unsupported '[' char in %s declarationz"unexpected '[' char in declarationz!unexpected %r char in declaration) rAssertionErrorlen parse_commentparse_marked_section _scan_name_decl_othercharsZ handle_decl unknown_decl_declstringlit_matchend_parse_doctype_subsetr ) rrrrnZdecltypecdatamnamerrrparse_declaration@sZ                  zParserBase.parse_declarationr cCs|j}|||ddks"td||d|\}}|dkrB|S|dkr\t||d}n4|dkrvt||d}n|d||d||sdS|r|d}|||d|| dS) Nzincludercdataignorecdatatemp>ifendifelsez+unknown status keyword %r in marked sectionr) rr#r'_markedsectionclosesearch_msmarkedsectioncloser startr)r+)rrreportrZsectNamermatchrrrr&s  zParserBase.parse_marked_sectioncCsj|j}|||ddkr$|dt||d}|srr!entitynotationz)unknown declaration %r in internal subsetZ_parse_doctype_%;]rz%unexpected char after internal subsetz%unexpected char %r in internal subset)rr$rr r%r'getattrisspace) rr declstartposrr-rr.sr1Zmethrrrr,sn                 z ParserBase._parse_doctype_subsetcCsF|||\}}|dkrdS|j}d||dkrB|d|dSdS)Nrrr )r'rfind)rrrLr1rrrrr_parse_doctype_elementsz!ParserBase._parse_doctype_elementcCs|j}|||\}}|||d}|dkr2dS|dkrB|dSxv|||\}}|dkrb|S|||d}|dkr~dS|dkrd||dkr|d|d}ndSx |||dr|d}qW||dsdSn|||\}}|||d}|s dS|dkrLt||}|r.|}ndS|||d}|sLdS|d kr||dd krldS||d|\}}|dkr|S|||d}|sdS|dkrF|dSqFWdS) Nr rrrr()z'"#)rr'rNrKr*r+)rrrLrr1rr.r0rrr_parse_doctype_attlistsZ       z!ParserBase._parse_doctype_attlistcCs|||\}}|dkr|S|j}xl|||d}|srrrrrs