Hacked By AnonymousFox

Current Path : /opt/alt/python310/lib64/python3.10/lib2to3/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/lib2to3/__pycache__/patcomp.cpython-310.opt-2.pyc

o

6��f��@s�	dZddlZddlmZmZmZmZmZmZddl	m
Z
ddl	mZGdd�de�Z
d	d
�ZGdd�de�Zejejejdd
�Zdd�Zdd�Zdd�ZdS)z#Guido van Rossum <guido@python.org>�N�)�driver�literals�token�tokenize�parse�grammar)�pytree)�pygramc@seZdZdS)�PatternSyntaxErrorN)�__name__�
__module__�__qualname__�rr�6/opt/alt/python310/lib64/python3.10/lib2to3/patcomp.pyrsrc	csP�	tjtjtjh}t�t�|�j�}|D]}|\}}}}}||vr%|VqdS�N)	r�NEWLINE�INDENT�DEDENTr�generate_tokens�io�StringIO�readline)	�input�skip�tokensZ	quintuple�type�value�start�endZ	line_textrrr�tokenize_wrappers���r c@s:eZdZd
dd�Zddd�Zdd�Zd
d	d
�Zdd�ZdS)�PatternCompilerNcCs\	|durtj|_tj|_n
t�|�|_t�|j�|_tj|_	tj
|_tj|jt
d�|_dS)N)Zconvert)r
Zpattern_grammarrZpattern_symbols�symsrZload_grammarZSymbolsZpython_grammarZ	pygrammarZpython_symbols�pysymsZDriver�pattern_convert)�selfZgrammar_filerrr�__init__(s
zPatternCompiler.__init__Fc
Csd	t|�}z
|jj||d�}Wntjy#}ztt|��d�d}~ww|r-|�|�|fS|�|�S)N)�debug)r rZparse_tokensrZ
ParseErrorr�str�compile_node)r%rr'Z	with_treer�root�errr�compile_pattern7s��
zPatternCompiler.compile_patternc
sF	|j�jjkr
|jd}|j�jjkr>�fdd�|jddd�D�}t|�dkr-|dStjdd�|D�ddd�}|��S|j�jj	krf�fdd�|jD�}t|�dkrY|dStj|gddd�}|��S|j�jj
kr���|jdd��}t�|�}|��Sd}|j}t|�d	kr�|djt
jkr�|dj}|dd�}d}t|�dkr�|d
j�jjkr�|d
}|dd
�}��||�}|du�r|j}	|	d}
|
jt
jkr�d}tj}n(|
jt
jkr�d}tj}n|
jt
jkr���|	d�}}t|	�dkr���|	d	�}|dk�s	|dk�r|��}tj|gg||d�}|du�r||_|��S)Nrc�g|]}��|��qSr�r)��.0Zch�r%rr�
<listcomp>O�z0PatternCompiler.compile_node.<locals>.<listcomp>�rcSsg|]}|g�qSrr)r0�arrrr2Rs��min�maxcr-rr.r/r1rrr2Vr3�����)rr"ZMatcher�childrenZAlternatives�lenr	�WildcardPattern�optimizeZAlternativeZNegatedUnit�
compile_basicZNegatedPatternr�EQUALrZRepeater�STARZHUGE�PLUS�LBRACE�get_int�name)
r%�nodeZalts�pZunits�patternrF�nodes�repeatr<�childr7r8rr1rr)Cs`




zPatternCompiler.compile_nodecCs:|d}|jtjkrtt�|j��}t�t	|�|�S|jtj
kry|j}|��rB|tvr1t
d|��|dd�r;t
d��t�t|�S|dkrId}n|�d�s_t|j|d�}|dur_t
d|��|dd�rq|�|djd�g}nd}t�||�S|jdkr�|�|d�S|jd	kr�|�|d�}tj|ggddd
�SdS)NrzInvalid token: %rrzCan't have details for token�any�_zInvalid symbol: %r�(�[r6)rr�STRINGr(rZ
evalStringrr	ZLeafPattern�_type_of_literal�NAME�isupper�	TOKEN_MAPr�
startswith�getattrr#r)r<ZNodePatternr>)r%rJrKrGrrZcontent�
subpatternrrrr@�s8


�zPatternCompiler.compile_basiccCs
t|j�Sr)�intr)r%rGrrrrE�s
zPatternCompiler.get_intr)FF)rr
rr&r,r)r@rErrrrr!&s


G#r!)rSrQ�NUMBERZTOKENcCs*|d��r	tjS|tjvrtj|SdS)Nr)�isalpharrSrZopmap)rrrrrR�s


rRcCs<	|\}}}}|s||jvrtj|||d�Stj|||d�S)N)�context)Z
number2symbolr	ZNodeZLeaf)rZ
raw_node_inforrr\r<rrrr$�s
r$cCst��|�Sr)r!r,)rIrrrr,�sr,)�
__author__rZpgen2rrrrrr�r	r
�	Exceptionrr �objectr!rSrQrZrUrRr$r,rrrr�<module>s$ 
�		

Hacked By AnonymousFox1.0, Coded By AnonymousFox