File: //opt/saltstack/salt/lib/python3.10/site-packages/pygments/__pycache__/regexopt.cpython-310.pyc
o
;j� � @ sh d Z ddlZddlmZ ddlmZ ddlmZ e�d�Zed�Z dd� Z
d d
� Zdd� Zddd�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[\[\^\\\-\]]c C sJ | sdS t | �}t| �}t|�D ]\}}||| kr"|d|� S q|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�commonprefix s �r c C s dt �dd� d�| �� d S )N�[c S s d| � � S )N�\)�group)r r r r �<lambda>"