HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/pygments/__pycache__/regexopt.cpython-310.pyc
o

;j��@shdZddlZddlmZddlmZddlmZe�d�Zed�Z	dd�Z
d	d
�Zdd�Zddd�Z
dS)a
    pygments.regexopt
    ~~~~~~~~~~~~~~~~~

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

    :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�escape)�groupby)�
itemgetterz[\[\^\\\-\]]cCsJ|sdSt|�}t|�}t|�D]\}}|||kr"|d|�Sq|S)zJGiven an iterable of strings, returns the longest common leading substring�N)�min�max�	enumerate)�m�s1�s2�i�c�r�E/opt/saltstack/salt/lib/python3.10/site-packages/pygments/regexopt.py�commonprefixs�rcCsdt�dd�d�|��dS)N�[cSsd|��S)N�\)�group)r	rrr�<lambda>"szmake_charset.<locals>.<lambda>r�])�	CS_ESCAPE�sub�join)Zlettersrrr�make_charset!src		s�|rdpd}|s
dS|d�t|�dkr|t��|S�s-|t|dd�d�d|St��dkrlg}g}|D]}t|�dkrG|�|�q9|�|�q9t|�dkrl|rd|t|d�dt|�|S|t|�|St|�}|r�t|��|t|�t�fd	d
�|D�d�|Sdd
�|D�}t|�}|r�t|��|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)�plenrr�
<listcomp>Jsz#regex_opt_inner.<locals>.<listcomp>cSsg|]	}|ddd��qS)N���rrrrrr#Msc3s�|]
}|d��VqdSrrr)�slenrr�	<genexpr>Ss�z"regex_opt_inner.<locals>.<genexpr>r$css"�|]}tt|d�d�VqdS)rrN)�regex_opt_inner�list)r rrrrr&Xs��cs|d�dkS)Nrr)r!)�firstrrrYsz!regex_opt_inner.<locals>.<lambda>)	�lenrr'�appendrr�sortedrr)	�stringsZ
open_parenZclose_parenZ	oneletter�restr!�prefixZstrings_rev�suffixr)r)r"r%rr'%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/r0rrr�	regex_opt]sr2)rr)�__doc__�rer�	itertoolsr�operatorr�compilerZ
FIRST_ELEMENTrrr'r2rrrr�<module>s
8