a �DOgEm�@s$dZddlZddlZddlTejeks.Jd��eehZee e hZ e e hZeehZeeehBZdZdd�eD�Zejfdd �Zd d �Zd d �Zd-dd�ZejdZde>dZdZee fdd�Z!dd�Z"dd�Z#dd�Z$dd�Z%dd�Z&dd �Z'd!d"�Z(d#d$�Z)d%d&�Z*d'd(�Z+d)d*�Z,d.d+d,�Z-dS)/zInternal support module for sre�N)�*zSRE module mismatch))�ii1)�si)�i�)iEi�i�)i�i�)i�i�)i�i�)i�i�)i�i�)i�i�)i�i�)i�i�)i�i�)i�i�)i2i�)i4i�)i>i�)iAi�)iBi�i�)iJi�)ici�)i�iK�)iai�)i�i�cs.i|]&}|D]��t�fdd�|D���q qS)c3s|]}�|kr|VqdS�N�)�.0�j��ir�#/usr/lib64/python3.9/sre_compile.py� N�z.)�tuple)r�trr r � Ns �rcCs ||@r||M}||B|@Srr)�flags� add_flags� del_flags� TYPE_FLAGSrrr �_combine_flagsQs rcCs�|j}t}t}t}t}t}d} d} d} |t@r\|t@s\|t@rPt j } t j } t } n t j } t j} |D�]|\} } | |v�rr|t@s�|| �|| �n�|t@r�|t| �|| �n�| | �s�|| �|| �n�| | �}| s�|t| �||�n�|| v�r|t| �||�nh|t�||�}|d�| tu�r2|t�|f| |D]}|t�||��q@|t�||�|||<q`| tu�rt| | | | �\}}|t@�r�|t@�r�|t�n(|�s�|t�n| �s�|t�n|t�||�}|d�t|||�||�|||<q`| tu�r*|t@�r |t�n|t�q`| |v�r6|t@�rLt d| f��t!| d��r�| t"u�rn|t#�n|t$�||�}|d�|| d�|| d�t%|| d|�|t&�||�|||<nl|t'�||�}|d�|| d�|| d�t%|| d|�||�|||<| t"u�r,|t(�n|t)�q`| t*u�r�| \}}}}|�rj|t+�||dd�t%||t,|||��|�r�|t+�||ddd�q`| |v�r�|| �q`| |v�rD|| �||�}|d�| ddk�r�|d�n*| d�-�\}}||k�rt d��||�t%|| d|�|t&�||�|||<q`| t.u�r�|| �||�}|d�t%|| |�|t&�||�|||<q`| t/u�r�|| �|t0@�r�t1�2| | �} |t@�r�t3�2| | �} n|t@�r�t4�2| | �} || �q`| t5u�r�|| �g}|j}| dD]N} ||�}|d�t%|| |�|t6�|||��|d�||�|||<�q|t�|D]}||�|||<�qlq`| t7u�r�|| �|t@�r�t8| } n|t@�r�t9| } || �q`| t:u�r |t@�s�|| �n,|t@�r�|t;�n| �s |t<�n|t=�|| d�q`| t>u�r�|| �|| dd�||�}|d�t%|| d|�| d�r�|t6�||�}|d�||�|d||<t%|| d|�||�|||<n||�|d||<q`t d| f��q`dS)Nrz*internal: unsupported template operator %r��z(look-behind requires fixed-width patternz%internal: unsupported operand type %r)?�append�len�_LITERAL_CODES�_REPEATING_CODES�_SUCCESS_CODES� _ASSERT_CODES�SRE_FLAG_IGNORECASE�SRE_FLAG_LOCALE�SRE_FLAG_UNICODE�_sre�unicode_iscased�unicode_tolower�_ignorecase_fixes� ascii_iscased� ascii_tolower�OP_LOCALE_IGNORE� OP_IGNORE�OP_UNICODE_IGNORE� IN_UNI_IGNORE� NOT_LITERAL�NEGATE�LITERAL�FAILURE�IN�_optimize_charset� IN_LOC_IGNORE� IN_IGNORE�_compile_charset�ANY�SRE_FLAG_DOTALL�ANY_ALL�SRE_FLAG_TEMPLATE�error�_simple� MAX_REPEAT� REPEAT_ONE�MIN_REPEAT_ONE�_compile�SUCCESS�REPEAT� MAX_UNTIL� MIN_UNTIL� SUBPATTERN�MARKr�getwidth�CALL�AT�SRE_FLAG_MULTILINE� AT_MULTILINE�get� AT_LOCALE� AT_UNICODE�BRANCH�JUMP�CATEGORY� CH_LOCALE� CH_UNICODE�GROUPREF�GROUPREF_LOC_IGNORE�GROUPREF_IGNORE�GROUPREF_UNI_IGNORE�GROUPREF_EXISTS)�code�patternr�emit�_len� LITERAL_CODES�REPEATING_CODES� SUCCESS_CODES� ASSERT_CODES�iscased�tolower�fixes�op�av�lo�skip�k�charset�hascased�grouprr�p�hi�tail� tailappend�skipyes�skipnorrr r>WsB                                                                r>cCs�|j}|D]�\}}||�|tur$q |tur6||�q |tusF|tur`||d�||d�q |turt|�|�q |tur�|�|�q |tur�|t @r�|t |�q�|t @r�|t |�q�||�q t d|f��q |t�dS)Nrrz%internal: unsupported set operator %r)rr-r.�RANGE�RANGE_UNI_IGNORE�CHARSET�extend� BIGCHARSETrOr rPr!rQr9r/)rgrrWrYrbrcrrr r4 s,      r4c Cs�g}g}td�}d}|D�]�\}} �z,|tur�|rv|| �} d|| <|rd| |vrd|| D] } d|| <qV|s~|| �r~d}nd|| <n�|tu�r&t| d| dd�} |�r|r�t|| �D]*} d|| <| |vr�|| D] } d|| <q�q�nt|| �D] } d|| <q�|�s$tt|| ��}n| D]} d|| <�qn(|tu�r@|�|| f�n|�|| f�WnXt�y�t |�dk�r~|dd7}Yq"|�r�d}|tu�r�t }|�|| f�Yn0qq"qg}d}|� d|�}|dk�rҐq&t |�dk�r�d}�q&|� d|�}|dk�r|�|t |�f��q&|�||f��q�|du�r�|D]>\}}||dk�rZ|�t|f�n|�t||dff��q4||7}|�s�t |�t |�k�r�||fS||fSt |�dk�r�t |�}|�t |f�||7}||fSt|�}i}td�}d}t�}tdd d�D]V} || | d�}||v�r2|||| d<n$||| d<||<|d7}||7}�qt |�}|gt|�|dd�<|�t|f�||7}||fS) N�FrTr�i�ri)� bytearrayr.rp�range�map�anyr-r� IndexErrorrrq�find� _mk_bitmaprr�bytes�_bytes_to_codesrt)rgr_�fixupra�outrl�charmaprhrbrcrdrf�rr �runs�qrj�data�comps�mapping�block�chunkrrr r1$s�                   r1�rs0111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111cs8|�t�ddd�����fdd�tt��d� �D�S)N�����cs"g|]}��|�|�d��qS)rr)rr �� _CODEBITS�_int�srr � �s�z_mk_bitmap..r)� translate� _BITS_TRANSrxr)�bitsr�r�rr�r r}�s�r}cCs@t|��d�}|jtjksJ�t|�|jt|�ks8J�|��S)N�I)� memoryview�cast�itemsizer"�CODESIZEr�tolist)�b�arrr r�srcCsDt|�dkrdS|d\}}|tur<|dduo:t|d�S|tvS)NrFrr�)rrCr:� _UNIT_CODES)rjrbrcrrr r:�s   r:cCsndgt|�}tdt|��D]L}||d}||||kr\|dkrNd||<q||d}q,|d||<q|S)aj Generate an overlap table for the following prefix. An overlap table is a table of the same size as the prefix which informs about the potential self-overlap for each index in the prefix: - if overlap[i] == 0, prefix[i:] can't overlap prefix[0:...] - if overlap[i] == k with 0 < k <= i, prefix[i-k+1:i+1] overlaps with prefix[0:k] rr)rrx)�prefix�tabler �idxrrr �_generate_overlap_table�s  r�cCs$|t@s dS|t@rtjStjSdSr)rr!r"r#r&)rrrr � _get_iscased�s r�cCs�g}|j}d}t|�}|jD]�\}}|turF|r<||�r<q�||�q|tur�|\}} } } t|| | �} | t@rz| t@rzq�t| | �\} }}|dur�|dur�t |�}n|dur�t |�|}|� | �|s�q�qq�q||dfS||dfS)NTF) rr�r�r.rCrrr �_get_literal_prefixrrs)rXrr�� prefixappend� prefix_skipr_rbrcrirrrj�flags1�prefix1� prefix_skip1�got_allrrr r��s4        r�c Csd|js dS|jd\}}|tur"qP|\}}}}t|||�}|t@r|t@rdSqt|�}|turz|rp||�rpdS||fgS|tur�g}|j} |dD]B} | s�dS| d\}}|tur�|r�||�s�| ||f�q�dSq�|S|t u�r`|}|�r\|D]f\}}|tu�r||��rZdSq�|t ur�|ddk�r4dSt t |t |d|dd���r�dSq�|SdS)Nrri��)r�rCrrr r�r.rMrr0rprzryrx) rXrrbrcrirrr_rg� charsetappendrjrrr �_get_charset_prefixsN           r�c Cs||��\}}|tkrt}|dkr8|�tdd||g�dSg}d}g}|t@rT|t@srt||�\}}}|srt||�}|j} | t�t |�} | d�d} |r�t } |dur�|r�| t B} n |r�| t B} | | �|tkr�| |�n| t�|dt�}| t |t��|�r@| t |��|du�rt |�}| |�|�|�|�t|��n(|�rht|�\}} | �r\J�t|||�t |�| || <dS)Nr�)rE�MAXCODErs�INFOrr r�r�rr�SRE_INFO_PREFIX�SRE_INFO_LITERAL�SRE_INFO_CHARSET�minr�r1r4) rWrXrrdrkr�r�rgr�rYre�maskrhrrr � _compile_info0sR            r�cCst|ttf�Sr)� isinstance�strr~)�objrrr �isstringksr�cCs8|jj|B}g}t|||�t||j|�|�t�|Sr)�staterr�r>r�rr?)rjrrWrrr �_codens    r�cCsdd�dd�|D��S)N�[%s]�, css$|]}dtjdd|fVqdS)z%#0*xrN)r"r��r�xrrr r ~rz_hex_code..)�join�rWrrr � _hex_code}sr�csNddl�t��d�ttt��d���������fdd���dt���dS)Nrrc s�dd�����fdd� }��fdd�}�d7��}||k�r�|��|}|d7}t|}|tttttttfvrx||�q2|tt t t t t ttfvr��|}|d7}||d|t|�f�q2|tu�r�|}|d7}tt|�}|dd�d ks�J�|||dd��q2|tu�rV�|}|d7}tt|�}|dd �d k�sBJ�|||d d��q2|ttttfv�r��|}|||||d��|d||�||7}q2|ttfv�r�||d �\}} |d 7}||d || t|�t| �f�q2|tu�r||t�||dt���|dt7}q2|tu�rʈ|}|d7}t d�!�fdd��||dt"j#�D���} |||| �|dt"j#7}�d7�t$|�D].} |t�||dt���|dt7}�q��d8�q2|t%t&t't(t)fv�r��|}|d7}|||�q2|t*u�r(�|}|||||d�|d7}q2|t+u�r��|}|||||d�|�r��|d||�||7}|��|}|�r�|d|||d�n|t��qL|d7}q2|t,t-t.fv�r�||d�\}} } | t/k�r�d} |||| | ||d��|d||�||7}q2|t0u�rJ�||d �\}}||||||d�|d 7}q2|t1t2fv�r��||d �\}}||||||d��|d ||�||7}q2|t3u�rĈ||d�\}}} } | t/k�r�d} |||t4|�| | ||d�|d�|t5@�r��|d|d�\}}|d|�|d����|�}|ddd�!dd�|D��dd�!t6t|����|7�|d���|���|7�|t7@�r��d7�|d���||��d8�||7}q2t8|��q2�d8�dS)N)�tocsX|dur"��|�|d|ff7}td����vr6dndfd�dd�t|�dS)Nz(to %d)z%*d%s �:�.z r��end)�add�print)r��args)�labels�level� offset_width�startrr �print_�s  �z!dis..dis_..print_cs"td�d�d�t|�dS)N� rr�)r�)r�)r�r�rr �print_2�sz"dis..dis_..print_2rz %#02x (%r)��AT_� � CATEGORY_rz%#02x %#02x (%r-%r)rurc3s|]}|�tj�j�VqdSr)�to_bytesr"r�� byteorderr�)�sysrr r �s�z$dis..dis_..�branch� MAXREPEATr��z prefix_skipz prefixr�r�css|]}d|VqdS)z%#02xNrr�rrr r �rz(%r)�z overlap�in)9�OPCODESr?r/r5r7rArBr-r.r,�LITERAL_IGNORE�NOT_LITERAL_IGNORE�LITERAL_UNI_IGNORE�NOT_LITERAL_UNI_IGNORE�LITERAL_LOC_IGNORE�NOT_LITERAL_LOC_IGNORE�chrrGr��ATCODESrO�CHCODESr0r3r+r2rprqrrr�r�rt�listr�r"r�rxrDrRrTrUrSrNrMr@r<r=r�rV�ASSERT� ASSERT_NOTr��binr�ryr�� ValueError)r�r�r�r�r rb�argrerdrkr�r r��maxr� prefix_lenr�r��rW�dis_r�r�r�r�)r�r r��s�  � �        �     �               �   zdis..dis_)r��setrr�r�rr�r �dis�sr�c Cs�t|�r|}t�||�}nd}t||�}|t@r>t�t|�|jj}dg|jj }|� �D]\}}|||<q\t � |||jj B||jj d|t|��S)Nr)r�� sre_parse�parser��SRE_FLAG_DEBUGr�r�r�� groupdict�groups�itemsr"�compilerr)rjrrXrW� groupindex� indexgrouprfr rrr r�s"   �r�)NNN)r).�__doc__r"r�� sre_constants�MAGICr.r,rr@� MIN_REPEATr;rr?r/rr�r�rr5r0r�� _equivalencesr%rrr>r4r1r�r�r�r��intr}rr:r�r�r�r�r�r�r�r�r�r�rrrr � sJ  4�� 3    ,;