Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib64/python3.7/site-packages/Cython/Plex/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/site-packages/Cython/Plex/__pycache__/Traditional.cpython-37.pyc

B

Z��Z�@stddlmZddlmZmZmZmZmZmZm	Z	m
Z
mZmZddl
mZGdd�de�Zdd�ZGd	d
�d
e�ZdS)�)�absolute_import�)
�Alt�Seq�Rep�Rep1�Opt�Any�AnyBut�Bol�Eol�Char)�	PlexErrorc@seZdZdS)�RegexpSyntaxErrorN)�__name__�
__module__�__qualname__�rr�J/opt/alt/python37/lib64/python3.7/site-packages/Cython/Plex/Traditional.pyrsrcCst|���S)zk
    Convert traditional string representation of regular expression |s|
    into Plex representation.
    )�REParser�parse_re)�srrr�resrc@sleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)rcCs||_d|_d|_|��dS)N���r)r�i�end�next)�selfrrrr�__init__szREParser.__init__cCs&|��}|js"|�dt|j��|S)Nz
Unexpected %s)�	parse_altr�error�repr�c)rrrrrr"szREParser.parse_recCsJ|��}|jdkrF|g}x$|jdkr<|��|�|���qWt|�}|S)z#Parse a set of alternative regexps.�|)�	parse_seqr"r�appendr)rr�re_listrrrr(s
zREParser.parse_altcCs0g}x"|js&|jdkr&|�|���qWt|�S)zParse a sequence of regexps.z|))rr"r%�	parse_modr)rr&rrrr$3szREParser.parse_seqcCsZ|��}xL|jsT|jdkrT|jdkr.t|�}n|jdkrBt|�}nt|�}|��q
W|S)z7Parse a primitive regexp followed by *, +, ? modifiers.z*+?�*�+)�
parse_primrr"rrrr)rrrrrr':s



zREParser.parse_modcCs�|��}|dkrtd�}nl|dkr(t}n^|dkr6t}nP|dkrR|��}|�d�n4|dkrn|��}|�d�n|d	kr~|��}t|�}|S)
zParse a primitive regexp.�.�
�^�$�(�)�[�]�\)�getr
rrr�expect�
parse_charsetr
)rr"rrrrr*Gs"
zREParser.parse_primcCs�g}d}|jdkrd}|��|jdkr:|�d�|��x~|js�|jdkr�|��}|jdkr�|�d�dkr�|��|��}x8tt|�t|�d�D]}|�t|��q�Wq<|�|�q<Wd�	|�}|r�t
|�St|�SdS)z5Parse a charset. Does not include the surrounding [].rr-rr2�-�N)r"rr%rr4�	lookahead�range�ord�chr�joinr
r	)rZ	char_list�invertZc1Zc2�a�charsrrrr6\s(



zREParser.parse_charsetcCs>|j}|jd}|_|t|�kr.|||_nd|_d|_dS)zAdvance to the next char.rr8N)rr�lenr"r)rrrrrrrusz
REParser.nextcCs"|jr|�d�|j}|��|S)NzPremature end of string)rr r"r)rr"rrrr4s

zREParser.getcCs*|j|}|t|j�kr"|j|SdSdS)zLook ahead n chars.r8N)rrAr)r�n�jrrrr9�s

zREParser.lookaheadcCs*|j|kr|��n|�dt|��dS)zj
        Expect to find character |c| at current position.
        Raises an exception otherwise.
        z
Missing %sN)r"rr r!)rr"rrrr5�s

zREParser.expectcCstdt|j�|j|f��dS)z1Raise exception to signal syntax error in regexp.z,Syntax error in regexp %s at position %d: %sN)rr!rr)rZmessrrrr �szREParser.errorN)rrrrrrr$r'r*r6rr4r9r5r rrrrrs


rN)�
__future__rZRegexpsrrrrrr	r
rrr
ZErrorsrrr�objectrrrrr�<module>	s
0