
    ,h                          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y)a  
    pygments.regexopt
    ~~~~~~~~~~~~~~~~~

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

    :copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
    N)escape)commonprefix)groupby)
itemgetterz[\[\^\\\-\]]c                 Z    dt         j                  d dj                  |             z   dz   S )N[c                 (    d| j                         z   S )N\)group)ms    S/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/pygments/regexopt.py<lambda>zmake_charset.<locals>.<lambda>   s    	)9      ])	CS_ESCAPEsubjoin)letterss    r   make_charsetr      s'    92777;KLLsRRr   c           	      r  
 |xr dxs d}| sy| d   
t        |       dk(  r|t        
      z   |z   S 
s|t        | dd d      z   dz   |z   S t        
      dk(  r~g }g }| D ]3  }t        |      dk(  r|j                  |       #|j                  |       5 t        |      dkD  r4|r!|t        |d      z   dz   t	        |      z   |z   S |t	        |      z   |z   S t        |       }|r:t        |      }|t        |      z   t        | D cg c]  }||d 	 c}d      z   |z   S | D cg c]
  }|ddd	    }}t        |      }	|	rAt        |	      |t        t        fd
| D              d      z   t        |	ddd	         z   |z   S |dj                  d t        | 
fd      D              z   |z   S c c}w c c}w )zEReturn a regex that matches any string in the sorted list of strings.)r   r      Nz(?:?|c              3   *   K   | ]
  }|d     y w)N ).0sslens     r   	<genexpr>z"regex_opt_inner.<locals>.<genexpr>H   s     $@1QvY$@s   c              3   L   K   | ]  }t        t        |d          d        yw)r   r   N)regex_opt_innerlist)r   r   s     r   r"   z"regex_opt_inner.<locals>.<genexpr>M   s)      L !eAh4 Ls   "$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plenstrings_revsuffixr'   r!   s             @@r   r$   r$      s   $*KAJE
7|qF5M)K77OGABK??  	 
5zQ	 	A1v{  #A		
 y>A!OD"$==C"9-.0;< < Y 77+EE'"F6{ F6N*9Aqx95AB 	 %,,q1TrT7,K,+&F6{f$@$@@%HIVDbD\"#%01 	1
  L%g/IJL 	LL   : -s   F/
%F4c                 <    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$   )r+   r0   r3   s      r   	regex_optr6   R   s$     WoGOGS11F::r   )r   r   )__doc__rer   os.pathr   	itertoolsr   operatorr   compiler   FIRST_ELEMENTr   r$   r6   r   r   r   <module>r>      sE   	 
     BJJ'	1S5p	;r   