+
     h   c                   s    R t ^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIHt ]P                  ! R4      t
]! ^ 4      tR tR tR
R	 ltR# )z
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                 sj    R \         P                  R RP                  V 4      4      ,           R,           # )Z[c                 s0    R V P                  4       ,           # )Z\)group)Zm   &B/usr/lib/python3.14/site-packages/pip/_vendor/pygments/regexopt.py<lambda>Zmake_charset.<locals>.<lambda>   s    	)9     Z])	CS_ESCAPEZsubjoin)Zlettersr   r   make_charsetr      s'    92777;KLLsRRr   c           	     s  a
a T;'       d    R;'       g    RpV '       g   R# V ^ ,          o
\        V 4      ^8X  d   V\        S
4      ,           V,           # S
'       g)   V\        V R,          R4      ,           R,           V,           # \        S
4      ^8X  d   . p. pV  F7  p\        V4      ^8X  d   VP                  V4       K&  VP                  V4       K9  	  \        V4      ^8  dS   V'       d2   V\        VR4      ,           R,           \	        V4      ,           V,           # V\	        V4      ,           V,           # \        V 4      pV'       dH   \        V4      pV\        V4      ,           \        V  Uu. uF  qUVR NK	  	  upR4      ,           V,           # V  Uu. uF  qURRR1,          NK  	  pp\        V4      p	V	'       dS   \        V	4      oV\        \        V3R lV  4       4      R4      ,           \        V	RRR1,          4      ,           V,           # VRP                  R	 \        V V
3R
 l4       4       4      ,           V,           # u upi u upi )zEReturn a regex that matches any string in the sorted list of strings.Z)r	   :   NNz(?:Z?Z|Nc              3   s.   <"   T F
  qR S)  x  K  	  R # 5i)N ).0sslens   & r   	<genexpr>"regex_opt_inner.<locals>.<genexpr>H   s     $@1vYs   c              3   sZ   "   T F!  p\        \        V^,          4      R4      x  K#  	  R# 5i)r   r	   N)regex_opt_innerZlist)r   r   s   & r   r   r   M   s*      LJU !eAh44Js   )+c                 s*   < V ^ ,          S^ ,          8H  # )i    r   )r   firsts   &r   r   Z!regex_opt_inner.<locals>.<lambda>N   s    1q9Ir   i)	Zlenr    r   Zappendr   r   sortedr   r   )stringsZ
open_parenZclose_parenZ	oneletterZrestr   prefixZplenZstrings_revsuffixr   r   s   &&        @@r   r   r      s   $$**KAJE
7|qF5M)K77OGBK??  	 
5zQ	A1v{  #A	 
 y>A!OD"$==C"9-.0;< < Y 77+EE'"F6{ F6N*9Ax95AB 	 %,,GqTrT77GK,+&F6{f$@$@@%HIVDbD\"#%01 	1
  L%g/IJL 	LL   : -s   0I
I
c                sL    \        V 4      p V\        V R4      ,           V,           # )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.
Z()r   r   )r   r   r   s   &&&r   	regex_optr   R   s$     WoGOGS11F::r   )r	   r	   )Z__doc__Zrer    Zos.pathr   Z	itertoolsr   Zoperatorr   Zcompiler
   ZFIRST_ELEMENTr   r   r   r   r   r   <module>r      sC   	 
     JJ'	1S5p	;r   