ok

Mini Shell

Direktori : /opt/alt/python36/lib64/python3.6/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/idlelib/__pycache__/hyperparser.cpython-36.opt-2.pyc

3

��2aR2�@s�ddlmZddlZddlmZeejejd�Zeejd�Z	dd�e
d�D�Zdd�e
d�D�ZGd	d
�d
�Z
edkr�ddlmZed
dd�dS)�)�	iskeywordN)�pyparse�_cCsg|]}t|�tk�qS�)�chr�_ASCII_ID_CHARS)�.0�xrr�0/opt/alt/python36/lib64/python3.6/hyperparser.py�
<listcomp>sr�cCsg|]}t|�tk�qSr)r�_ASCII_ID_FIRST_CHARS)rr	rrr
rsc@s\eZdZdd�Zdd�Zdd�Zdd�Zddd�Zed
ddh�Z	e
dd��ZdZdd�Z
dS)�HyperParserc
sJ|�_|j�_}tj|j|j�}dd�}||j|��}|js�xh|jD]^}t	||d�}t
|�d}	d|}
|j|j|	|
�d�|j
|j|	��}|dk	s�|dkrFPqFW|j|p�d�nF|jd|�}|r�|d}	nd	}	d|}
|j|j|	|
�d�|jd�|jdd
��_|
�_|j��_�fdd�tt�j��D��_�j|�dS)NcSstt|��S)N)�int�float)�indexrrr
�
index2line"sz(HyperParser.__init__.<locals>.index2line�z.0z%d.endz 
rZconsolez1.0�cs4g|],}|dko.�j|d�j|ddk�qS)rr)�
bracketing)r�i)�selfrr
rKsz(HyperParser.__init__.<locals>.<listcomp>���)�editwin�textrZParserZindentwidthZtabwidthrZcontext_use_ps1Znum_context_lines�max�reprZset_code�getZfind_good_parse_startZ_build_char_in_string_funcZset_loZ
tag_prevrange�code�rawtext�stopatindexZget_last_stmt_bracketingr�range�len�isopener�	set_index)
rrrr�parserrZlno�contextZstartatZstartatindexr Zbod�rr)rr
�__init__s:



zHyperParser.__init__cCs�t|j�t|jj||j��}|dkr2td|��||_d|_x@|jt|j�dkr~|j|jdd|jkr~|jd7_q@W|jt|j�dkr�|j|jdd|jkr�|j	|jdr�|jd7_dS)Nrz(Index %s precedes the analyzed statementr)
r"rrrr �
ValueError�indexinrawtext�indexbracketrr#)rrr*rrr
r$QszHyperParser.set_indexcCs&|j|jo$|j|j|jddkS)Nr�"�')r,r-)r#r+rr)rrrr
�is_in_stringfszHyperParser.is_in_stringcCs(|j|jp&|j|j|jddkS)Nr�#r,r-)r/r,r-)r#r+rr)rrrr
�
is_in_codenszHyperParser.is_in_code�([{FcCsN|j|jd}|j}xb|j|sN|j|j|d|ksN|j|d|krx|d8}|dkrbdSt||j|d�}qW|jd}x,|t|j�kr�|j|d|kr�|d7}q�W|jjd|jt|j�|j|df�}|t|j�k�s|j|dt|j�k�r|�rdS|j}n.|jjd|jt|j�|j|ddf�}||fS)Nrrz%s-%dc)	rr+r#r�minr"rrr )rZopenersZ	mustcloseZbracketinglevelZbefore�afterZbeforeindexZ
afterindexrrr
�get_surrounding_bracketsts0
""z$HyperParser.get_surrounding_brackets�True�False�NonecCsbt}|}x<||krDt||d�dkrD|t||d�rD|d8}q
W||ko`t||d�dk�rx0|d|kr�d||d|�j�r�|d8}qfW|d|kr�d||d|�j�r�|d8}|d|kr�d||d|�j�r�|d8}|||�j��s&dSn ||k�r&tt||��s&dS||k�rZt|||���rZ|||�|jk�rZdS||S)Nrr��arr)�_IS_ASCII_ID_CHAR�ord�isidentifier�_IS_ASCII_ID_FIRST_CHARr�_ID_KEYWORDS)�cls�str�limit�posZis_ascii_id_charrrrr
�_eat_identifier�s.
&$$

zHyperParser._eat_identifierz 	
\c
Cs�|j�std��|j}|j}|j}||d}|j}|}d}�x�x�||krf||d|jkrf|d8}qB|r�||kr�||ddkr�|d8}d}qB||kr�|dkr�|||dddkr�|d8}||d}||dd}qBPqBW|s�P|j|||�}|�r||}|}d}q@||k�r�||d}	x.|dk�rV||dd|	k�rV|d8}�q*W||d|k�rlP||d}|d8}||d}|}||d	k�r�n@||d
k�r�x*|dk�r�||ddk�r�|d8}�q�W|}Pq@Pq@W|||j�S)Nz?get_expression should only be called if index is inside a code.rTr�.r/rFz([z'"ZrRbBuU)r0r)rrr+r*�_whitespace_charsrC)
rrrZ
brck_indexZ
brck_limitrBZlast_identifier_posZ
postdot_phase�ret�levelrrr
�get_expression�sb

"zHyperParser.get_expressionN)r1F)�__name__�
__module__�__qualname__r(r$r.r0r4�	frozensetr>�classmethodrCrErHrrrr
rs7
,:r�__main__)�mainz"idlelib.idle_test.test_hyperparserr)�	verbosity)�keywordr�stringZidlelibrrLZ
ascii_letters�digitsrr
r!r:r=rrIZunittestrOrrrr
�<module>s

Zerion Mini Shell 1.0