
    fXf                          d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ  ej	        d          Z
 ed          Zd Zd	 ZddZdS )a  
    pygments.regexopt
    ~~~~~~~~~~~~~~~~~

    An algorithm that generates optimized regexes for matching long lists of
    literal strings.

    :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)escape)commonprefix)groupby)
itemgetterz[\[\^\\\-\]]c                 l    dt                               d d                    |                     z   dz   S )N[c                 0    d|                                  z   S )N\)group)ms    V/var/www/html/Qu*py/bism/lib/python3.11/site-packages/pip/_vendor/pygments/regexopt.py<lambda>zmake_charset.<locals>.<lambda>   s    		)9      ])	CS_ESCAPEsubjoin)letterss    r   make_charsetr      s0    992777;K;KLLLsRRr   c           	        	
 |rdpd}| sdS | d         	t          |           dk    r|t          	          z   |z   S 	s!|t          | dd         d          z   dz   |z   S t          	          dk    rg }g }| D ]@}t          |          dk    r|                    |           +|                    |           At          |          dk    r@|r)|t          |d          z   dz   t	          |          z   |z   S |t	          |          z   |z   S t          |           }|rAt          |          
|t          |          z   t          
fd	| D             d          z   |z   S d
 | D             }t          |          }|rWt          |          |t          t          fd| D                       d          z   t          |ddd                   z   |z   S |d                    d t          | 	fd          D                       z   |z   S )zEReturn a regex that matches any string in the sorted list of strings.)r   r      Nz(?:?|c                 $    g | ]}|d          S N ).0splens     r   
<listcomp>z#regex_opt_inner.<locals>.<listcomp>?   s!    999Aqx999r   c                 $    g | ]}|d d d         S )Nr   )r   r    s     r   r"   z#regex_opt_inner.<locals>.<listcomp>B   s"    ,,,q1TTrT7,,,r   c              3   .   K   | ]}|d           V  d S r   r   )r   r    slens     r   	<genexpr>z"regex_opt_inner.<locals>.<genexpr>H   s-      $@$@1QvvY$@$@$@$@$@$@r   r$   c              3   \   K   | ]'}t          t          |d                    d          V  (dS )r   r   N)regex_opt_innerlist)r   r   s     r   r'   z"regex_opt_inner.<locals>.<genexpr>M   sR       L L !eAh44 L L L L L Lr   c                 (    | d         d         k    S )Nr   r   )r    firsts    r   r   z!regex_opt_inner.<locals>.<lambda>N   s    1q9I r   )	lenr   r)   appendr   r   sortedr   r   )strings
open_parenclose_paren	oneletterrestr    prefixstrings_revsuffixr,   r!   r&   s            @@@r   r)   r)      s   $*K rAJE
7||qF5MM)K77  OGABBK???  	 
5zzQ	 	 	A1vv{{  ####Ay>>A <!OD"$=$==C"9--.0;< < Y 7 77+EE'""F 6{{ F6NN*99999995AAB 	 -,G,,,K+&&F 16{{f$@$@$@$@$@$@$@@@%HHIVDDbD\""#%01 	1
  L L%g/I/I/I/IJJL L L 	L 	LL  r   r   c                 L    t          |           } |t          | d          z   |z   S )zReturn a compiled regex that matches any string in the given list.

    The strings to match must be literal strings, not regexes.  They will be
    regex-escaped.

    *prefix* and *suffix* are pre- and appended to the final regex.
    ()r/   r)   )r0   r5   r7   s      r   	regex_optr:   R   s)     WooGOGS111F::r   )r   r   )__doc__rer   os.pathr   	itertoolsr   operatorr   compiler   FIRST_ELEMENTr   r)   r:   r   r   r   <module>rB      s   	 	 
			                              BJ''	
1S S S5 5 5p	; 	; 	; 	; 	; 	;r   