3 \9@sRddlZejdjZejdjZejdZejdZejdZ[GdddZdS) Nz[a-zA-Z][-_.a-zA-Z0-9]*\s*z(\'[^\']*\'|"[^"]*")\s*z--\s*>z ]\s*]\s*>z]\s*>c@seZdZddZddZddZddZd d Zd Zd d Z d"ddZ d#ddZ ddZ ddZ ddZddZddZddZdd Zd!S)$ ParserBasecCs|jtkrtddS)Nz)_markupbase.ParserBase must be subclassed) __class__r RuntimeError)selfr#/usr/lib64/python3.6/_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)N)r r)rrrrgetpos(szParserBase.getposcCsb||kr |S|j}|jd||}|rN|j||_|jd||}||d|_n|j|||_|S)N r )rawdatacountr rindexr)rijrZnlinesposrrr updatepos0s zParserBase.updateposc Cs|j}|d}|||ddkr*|dS|||ddkrBdSt|}|||ddkrh|j|S||dkr~|j|S|j||\}}|dkr|S|d krd|_x||kr||}|dkr||d|}|d kr|j|n |j||dS|d kr&t||}|sdS|j }n|d krB|j||\} }nt||jkrX|d}n^|dkr|d kr~|j |d|}n$|dkr|j d|n |j dn|j d|||dkr|SqWdS)Nr >-rz--[rZdoctypez"'Z4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZattlistlinktypelinkelementz&unsupported '[' char in %s declarationz"unexpected '[' char in declarationz!unexpected %r char in declaration)rrr">rr rr!r") rlen parse_commentparse_marked_section _scan_name_decl_othercharsZ handle_decl unknown_decl_declstringlit_matchend_parse_doctype_subsetr ) rrrrnZdecltypecdatamnamerrrparse_declaration@sX                 zParserBase.parse_declarationr cCs|j}|j|d|\}}|dkr&|S|d kr@tj||d}n4|dkrZtj||d}n|jd ||d||s|dS|r|jd}|j||d||jdS)Nrtempcdataignoreincludercdataifelseendifz+unknown status keyword %r in marked sectionr >r4r3r5r6r7>r:r9r8r") rr&_markedsectionclosesearch_msmarkedsectioncloser startr(r*)rrreportrZsectNamermatchrrrr%s zParserBase.parse_marked_sectioncCsj|j}|||ddkr$|jdtj||d}|sZhandle_commentr*)rrr?rr@rrrrr$s  zParserBase.parse_commentc Cs4|j}t|}|}x||kr.||}|dkr4|||d}|dkrNdS|dkrt|j||d|jd||d|krdS|d|krdS|||ddkr|j|dd }|dkr|Sq|j|d|\}}|dkrdS|dkr |j||d|jd|t|d|} | ||}|dkr,|Sq|dkr|d|krPdS|j|d|\}}|dkrr|S||dkr,|d}q|dkr|d}x&||kr||jr|d}qW||kr||dkr|S|j|||jdndSq|jr|d}q|j|||jd|qWdS)NrrEr!rDr"r"r")rr#rr r$r&getattrisspace) rr declstartposrr,rr-sr0methrrrr+sn                 z ParserBase._parse_doctype_subsetcCsF|j||\}}|dkrdS|j}d||dkrB|jd|dSdS)Nr rr"r"r")r&rfind)rrrKr0rrrrr_parse_doctype_elementsz!ParserBase._parse_doctype_elementcCs|j}|j||\}}|||d}|dkr2d S|dkrB|dSxv|j||\}}|dkrb|S|||d}|dkr~d S|dkrd||dkr|jd|d}nd Sx |||djr|d}qW||dsd Sn|j||\}}|||d}|s d S|dkrLt||}|r.|j}ndS|||d}|sLdS|dkr||ddkrldS|j|d|\}}|dkr|S|||d}|sdS|dkrF|dSqFWdS)Nr rrr()z'"#r"r"r"r"r"r"r"r"r")rr&rNrJr)r*)rrrKrr0rr-r/rrr_parse_doctype_attlistsZ       z!ParserBase._parse_doctype_attlistcCs|j||\}}|dkr|S|j}xl|||d}|ss