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__/Regexps.cpython-37.pyc

B

Z��ZP?�@s�ddlmZddlZyddlmZWn ek
rDddlmZYnXddlmZdZ	dZ
d	Zed
�Z
dd�Zd
d�Zdd�Zdd�Zdd�ZGdd�de�Zdd�ZGdd�de�ZGdd�de�Ze�ZGdd�de�ZGdd �d e�ZGd!d"�d"e�ZGd#d$�d$e�ZGd%d&�d&e�Ze�Zd'e_d(e_ d)d*�Z!d+d,�Z"d-d.�Z#d/d0�Z$e$d1�Z%d2e%_d3e%_ dDd4d5�Z&d6d7�Z'd8d9�Z(d:d;�Z)d<d=�Z*ee	�Z+d>e+_d?e+_ ee
�Z,d@e,_dAe,_ ee�Z-dBe-_dCe-_ dS)E�)�absolute_importN)�maxsize)�maxint�)�ErrorsZbol�eol�eof�
cCs�t|�}|��d}t|�}g}xj||kr�t||�}|d}|d7}x,||krr|t||�krr|d7}|d7}qHW|�|�|�|�q"W|S)z�
    Return a list of character codes consisting of pairs
    [code1a, code1b, code2a, code2b,...] which cover all
    the characters in |s|.
    rr)�list�sort�len�ord�append)�sZ	char_list�i�n�result�code1�code2�r�F/opt/alt/python37/lib64/python3.7/site-packages/Cython/Plex/Regexps.py�chars_to_ranges"s

rcCsPt|td��}t|td�d�}||krHtd�td�}||||fSdSdS)z�
    If the range of characters from code1 to code2-1 includes any
    lower case letters, return the corresponding upper case range.
    �a�zr�AN)�maxr
�min)rr�code3�code4�drrr�uppercase_range9sr cCsPt|td��}t|td�d�}||krHtd�td�}||||fSdSdS)z�
    If the range of characters from code1 to code2-1 includes any
    upper case letters, return the corresponding lower case range.
    r�ZrrN)rr
r)rrrrrrrr�lowercase_rangeGsr"cs&�fdd�tdt��d�D�}t|�S)z�
    Given a list of codes as returned by chars_to_ranges, return
    an RE which will match a character in any of the ranges.
    cs"g|]}t�|�|d��qS)r)�	CodeRange)�.0r)�	code_listrr�
<listcomp>ZszCodeRanges.<locals>.<listcomp>r�)�ranger�Alt)r%�re_listr)r%r�
CodeRangesUsr+cCsB|tkr|kr4nntt|t�tttd|��St||�SdS)z�
    CodeRange(code1, code2) is an RE which matches any character
    with a code |c| in the range |code1| <= |c| < |code2|.
    rN)�nl_coder)�RawCodeRange�
RawNewline)rrrrrr#^s

r#c@sdeZdZdZdZdZdZdd�Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Zdd�ZdS)�REaRE is the base class for regular expression constructors.
    The following operators are defined on REs:

         re1 + re2         is an RE which matches |re1| followed by |re2|
         re1 | re2         is an RE which matches either |re1| or |re2|
    rNcCstd|jj��dS)aM
        This method should add states to |machine| to implement this
        RE, starting at |initial_state| and ending at |final_state|.
        If |match_bol| is true, the RE must be able to match at the
        beginning of a line. If nocase is true, upper and lower case
        letters should be treated as equivalent.
        z %s.build_machine not implementedN)�NotImplementedError�	__class__�__name__)�self�machine�
initial_state�final_state�	match_bol�nocaserrr�
build_machine{s	zRE.build_machinecCs"|��}|�|�|�||�|S)z~
        Given a state |s| of machine |m|, return a new state
        reachable from |s| on character |c| or epsilon.
        )�	new_state�link_to�add_transition)r3�mr5�crrrr�	build_opt�s
zRE.build_optcCs
t||�S)N)�Seq)r3�otherrrr�__add__�sz
RE.__add__cCs
t||�S)N)r))r3rArrr�__or__�sz	RE.__or__cCs|jr|jS|��SdS)N)�str�calc_str)r3rrr�__str__�sz
RE.__str__cCst|t�s|�||d�dS)NzPlex.RE instance)�
isinstancer/�
wrong_type)r3�num�valuerrr�check_re�s
zRE.check_recCs"t|�td�kr|�||d�dS)N��string)�typerH)r3rIrJrrr�check_string�szRE.check_stringcCs8|�||�t|�dkr4t�d||jjt|�f��dS)NrzOInvalid value for argument %d of Plex.%s.Expected a string of length 1, got: %s)rOrrZPlexValueErrorr1r2�repr)r3rIrJrrr�
check_char�sz
RE.check_charcCsLt|�tjkr$d|jj|jjf}n
t|�j}t�d||jj||f��dS)Nz%s.%s instancez<Invalid type for argument %d of Plex.%s (expected %s, got %s)rN�typesZInstanceTyper1�
__module__r2rZ
PlexTypeError)r3rIrJZexpectedZgotrrrrH�s
z
RE.wrong_type)r2rS�__qualname__�__doc__�nullable�match_nlrDr9r?rBrCrFrKrOrQrHrrrrr/os
r/cCs>t|�dkr$tt|�t|�d�}nt|�}dt|�|_|S)z;
    Char(c) is an RE which matches the character |c|.
    rzChar(%s))rr#r
�
SpecialSymbolrPrD)r>rrrr�Char�s
rYc@s<eZdZdZdZdZdZdZdZdd�Z	dd�Z
dd	�ZdS)
r-z�
    RawCodeRange(code1, code2) is a low-level RE which matches any character
    with a code |c| in the range |code1| <= |c| < |code2|, where the range
    does not include newline. For internal use only.
    rNcCs&||f|_t||�|_t||�|_dS)N)r(r r")r3rrrrr�__init__�s
zRawCodeRange.__init__cCsP|r|�||t�}|�|j|�|rL|jr8|�|j|�|jrL|�|j|�dS)N)r?�BOLr<r(r r")r3r=r5r6r7r8rrrr9�szRawCodeRange.build_machinecCsd|j|jfS)NzCodeRange(%d,%d))rr)r3rrrrEszRawCodeRange.calc_str)r2rSrTrUrVrWr(r r"rZr9rErrrrr-�s
r-c@s eZdZdZdZdZdd�ZdS)�_RawNewlinezd
    RawNewline is a low-level RE which matches a newline character.
    For internal use only.
    rrcCs8|r|�||t�}|�||t�}|�ttdf|�dS)Nr)r?r[�EOLr<r,)r3r=r5r6r7r8rrrrr9sz_RawNewline.build_machineN)r2rSrTrUrVrWr9rrrrr\sr\c@s,eZdZdZdZdZdZdd�Zdd�ZdS)rXzx
    SpecialSymbol(sym) is an RE which matches the special input
    symbol |sym|, which is one of BOL, EOL or EOF.
    rNcCs
||_dS)N)�sym)r3r^rrrrZ#szSpecialSymbol.__init__cCs.|r|jtkr|�||t�}|�|j|�dS)N)r^r]r?r[r<)r3r=r5r6r7r8rrrr9&szSpecialSymbol.build_machine)	r2rSrTrUrVrWr^rZr9rrrrrXsrXc@s(eZdZdZdd�Zdd�Zdd�ZdS)	r@z]Seq(re1, re2, re3...) is an RE which matches |re1| followed by
    |re2| followed by |re3|...cGs�d}x*t|�D]\}}|�||�|o*|j}qW||_||_t|�}d}x,|rt|d8}||}|jrjd}P|jsJPqJW||_dS)Nrr)�	enumeraterKrVr*rrW)r3r*rVr�rerWrrrrZ2s"zSeq.__init__cCs�|j}t|�dkr|�|�nb|}t|�}xTt|�D]H\}	}
|	|dkrR|��}n|}|
�|||||�|}|
jpz|oz|
j}q4WdS)Nrr)r*rr;r_r:r9rWrV)r3r=r5r6r7r8r*�s1rrr`�s2rrrr9Es
zSeq.build_machinecCsdd�tt|j��S)NzSeq(%s)�,)�join�maprDr*)r3rrrrEUszSeq.calc_strN)r2rSrTrUrZr9rErrrrr@.sr@c@s(eZdZdZdd�Zdd�Zdd�ZdS)	r)zRAlt(re1, re2, re3...) is an RE which matches either |re1| or
    |re2| or |re3|...cGs�||_d}d}g}g}d}xJ|D]B}|�||�|jrF|�|�d}n
|�|�|jrZd}|d7}q W||_||_||_||_dS)Nrr)r*rKrVrrW�nullable_res�non_nullable_res)r3r*rVrWrfrgrr`rrrrZ]s&


zAlt.__init__cCs`x |jD]}|�|||||�qW|jr\|r:|�||t�}x |jD]}|�|||d|�qBWdS)Nr)rfr9rgr?r[)r3r=r5r6r7r8r`rrrr9sszAlt.build_machinecCsdd�tt|j��S)NzAlt(%s)rc)rdrerDr*)r3rrrrE|szAlt.calc_strN)r2rSrTrUrZr9rErrrrr)Ys	r)c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�Rep1z@Rep1(re) is an RE which matches one or more repetitions of |re|.cCs&|�d|�||_|j|_|j|_dS)Nr)rKr`rVrW)r3r`rrrrZ�sz
Rep1.__init__cCsN|��}|��}|�|�|j�||||p0|jj|�|�|�|�|�dS)N)r:r;r`r9rW)r3r=r5r6r7r8rarbrrrr9�s

zRep1.build_machinecCs
d|jS)NzRep1(%s))r`)r3rrrrE�sz
Rep1.calc_strN)r2rSrTrUrZr9rErrrrrh�srhc@s0eZdZdZdZdZdd�Zdd�Zdd�ZdS)	�
SwitchCasez�
    SwitchCase(re, nocase) is an RE which matches the same strings as RE,
    but treating upper and lower case letters according to |nocase|. If
    |nocase| is true, case is ignored, otherwise it is not.
    NcCs ||_||_|j|_|j|_dS)N)r`r8rVrW)r3r`r8rrrrZ�szSwitchCase.__init__cCs|j�|||||j�dS)N)r`r9r8)r3r=r5r6r7r8rrrr9�szSwitchCase.build_machinecCs|jrd}nd}d||jfS)N�NoCase�Casez%s(%s))r8r`)r3�namerrrrE�szSwitchCase.calc_str)	r2rSrTrUr`r8rZr9rErrrrri�sriz8
    Empty is an RE which matches the empty string.
    �EmptycCs$tttt|���}dt|�|_|S)z@
    Str1(s) is an RE which matches the literal string |s|.
    zStr(%s))r@�tuplererYrPrD)rrrrr�Str1�srocGsHt|�dkrt|d�Stttt|���}dd�tt|��|_|SdS)z�
    Str(s) is an RE which matches the literal string |s|.
    Str(s1, s2, s3, ...) is an RE which matches any of |s1| or |s2| or |s3|...
    rrzStr(%s)rcN)rror)rnrerdrPrD)�strsrrrr�Str�s
rqcCstt|��}dt|�|_|S)zH
    Any(s) is an RE which matches any character in the string |s|.
    zAny(%s))r+rrPrD)rrrrr�Any�srrcCs:t|�}|�dt�|�t�t|�}dt|�|_|S)zp
    AnyBut(s) is an RE which matches any character (including
    newline) which is not in the string |s|.
    rz
AnyBut(%s))r�insertrrr+rPrD)r�rangesrrrr�AnyBut�s
rurLzT
    AnyChar is an RE which matches any single character (including a newline).
    �AnyCharc	Cs�|r*tt|�t|�d�}d||f|_n\g}x@tdt|�d�D],}|�tt||�t||d�d��q@Wt|�}dt|�|_|S)a
    Range(c1, c2) is an RE which matches any single character in the range
    |c1| to |c2| inclusive.
    Range(s) where |s| is a string of even length is an RE which matches
    any single character in the ranges |s[0]| to |s[1]|, |s[2]| to |s[3]|,...
    rzRange(%s,%s)rr'z	Range(%s))r#r
rDr(rrr)rP)rarbrrtrrrr�Range�s,rwcCst|t�}d||_|S)zI
    Opt(re) is an RE which matches either |re| or the empty string.
    zOpt(%s))r)rmrD)r`rrrr�Opts

rxcCstt|��}d||_|S)zJ
    Rep(re) is an RE which matches zero or more repetitions of |re|.
    zRep(%s))rxrhrD)r`rrrr�Reps
rycCst|dd�S)z�
    NoCase(re) is an RE which matches the same strings as RE, but treating
    upper and lower case letters as equivalent.
    r)r8)ri)r`rrrrjsrjcCst|dd�S)z�
    Case(re) is an RE which matches the same strings as RE, but treating
    upper and lower case letters as distinct, i.e. it cancels the effect
    of any enclosing NoCase().
    r)r8)ri)r`rrrrk srkz=
    Bol is an RE which matches the beginning of a line.
    �Bolz7
    Eol is an RE which matches the end of a line.
    �Eolz9
    Eof is an RE which matches the end of the file.
    �Eof)N).�
__future__rrR�sysrr�ImportErrorrLrr[r]ZEOFr
r,rr r"r+r#�objectr/rYr-r\r.rXr@r)rhrirmrUrDrorqrrrurvrwrxryrjrkrzr{r|rrrr�<module>	sb	n+'!