HEX
Server: Apache
System: Linux srv1.prosuiteplus.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: prosuiteplus (1001)
PHP: 8.3.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/pygments/__pycache__/regexopt.cpython-38.pyc
U

`a�[�@sldZddlZddlmZddlmZddlmZddlmZe�	d�Z
ed�Zdd	�Zd
d�Z
dd
d�ZdS)a
    pygments.regexopt
    ~~~~~~~~~~~~~~~~~

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

    :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�escape)�commonprefix)�groupby)�
itemgetterz
[\^\\\-\]]cCsdt�dd�d�|��dS)N�[cSsd|��S)N�\)�group)�m�r
�3/usr/lib/python3/dist-packages/pygments/regexopt.py�<lambda>�zmake_charset.<locals>.<lambda>��])�	CS_ESCAPE�sub�join)Zlettersr
r
r�make_charsetsrc		s�|rdp
d}|sdS|d�t|�dkr8|t��|S�sZ|t|dd�d�d|St��dkr�g}g}|D]&}t|�dkr�|�|�qr|�|�qrt|�dkr�|r�|t|d�dt|�|S|t|�|St|�}|�rt|��|t|�t�fd	d
�|D�d�|Sdd
�|D�}t|�}|�rpt|��|tt�fdd
�|D��d�t|ddd��|S|d�dd
�t|�fdd��D��|S)zEReturn a regex that matches any string in the sorted list of strings.�)rr�Nz(?:�?�|csg|]}|�d��qS�Nr
��.0�s)�plenr
r�
<listcomp>@sz#regex_opt_inner.<locals>.<listcomp>cSsg|]}|ddd��qS)N���r
rr
r
rrCsc3s|]}|d��VqdSrr
r)�slenr
r�	<genexpr>Isz"regex_opt_inner.<locals>.<genexpr>rcss |]}tt|d�d�VqdS)rrN)�regex_opt_inner�list)rrr
r
rr Ns�cs|d�dkS)Nrr
)r)�firstr
rrOr
z!regex_opt_inner.<locals>.<lambda>)	�lenrr!�appendrr�sortedrr)	�stringsZ
open_parenZclose_parenZ	oneletter�restr�prefixZstrings_rev�suffixr
)r#rrrr!sj����
�����
���r!rcCst|�}|t|d�|S)z�Return 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'r)r*r
r
r�	regex_optSsr,)rr)�__doc__�rer�os.pathr�	itertoolsr�operatorr�compilerZ
FIRST_ELEMENTrr!r,r
r
r
r�<module>s
8