Your IP : 216.73.216.85


Current Path : /opt/alt/python37/lib/python3.7/site-packages/pygments/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/pygments/__pycache__/regexopt.cpython-37.opt-1.pyc

B

ͽ�\�@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-2019 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
�B/opt/alt/python37/lib/python3.7/site-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}x.|D]&}t|�dkr�|�|�qt|�|�qtWt|�dkr�|r�|t|d�dt|�|S|t|�|St|�}|�rt|��|t|�t�fd	d
�|D�d�|Sdd
�|D�}t|�}|�rtt|��|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
)rrr
r
rrCsc3s|]}|d��VqdS)Nr
)rr)�slenr
r�	<genexpr>Isz"regex_opt_inner.<locals>.<genexpr>rcss |]}tt|d�d�VqdS)rrN)�regex_opt_inner�list)rrr
r
rrNscs|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!rrrrs:
(6rrcCst|�}|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__�rerZos.pathr�	itertoolsr�operatorr�compilerZ
FIRST_ELEMENTrrr*r
r
r
r�<module>s
8