Your IP : 3.143.17.175


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

3

��2a�N�@sddlZed�\ZZZZZejdejej	B�j
Zejdej�jZ
ejdejejB�jZejdej�jZejdej�jZejdej�jZGd	d
�d
e�Zejed�d�Zejd
d�dD��ejdd�dD��ejdd�dD��Gdd�d�Zedk�rddlmZeddd�dS)�N�z�
    ^
    [ \t]*
    (?: while
    |   else
    |   def
    |   return
    |   assert
    |   break
    |   class
    |   continue
    |   elif
    |   try
    |   except
    |   raise
    |   import
    |   yield
    )
    \b
z'
    [ \t]*
    (?: \# \S .* )?
    \n
aK
    \""" [^"\\]* (?:
                     (?: \\. | "(?!"") )
                     [^"\\]*
                 )*
    (?: \""" )?

|   " [^"\\\n]* (?: \\. [^"\\\n]* )* "?

|   ''' [^'\\]* (?:
                   (?: \\. | '(?!'') )
                   [^'\\]*
                )*
    (?: ''' )?

|   ' [^'\\\n]* (?: \\. [^'\\\n]* )* '?
zM
    [ \t]*
    [^\s#\\]    # if we match, m.end()-1 is the interesting char
z_
    \s*
    (?: return
    |   break
    |   continue
    |   raise
    |   pass
    )
    \b
z
    [^[\](){}#'"\\]+
c@seZdZdd�ZdS)�ParseMapcCsdS)N�x�)�self�keyrr�,/opt/alt/python36/lib64/python3.6/pyparse.py�__missing__rszParseMap.__missing__N)�__name__�
__module__�__qualname__r	rrrrrfsr�rccs|]}t|�td�fVqdS)�(N)�ord)�.0�crrr�	<genexpr>xsrz({[ccs|]}t|�td�fVqdS)�)N)r)rrrrrrysz)}]ccs|]}t|�t|�fVqdS)N)r)rrrrrrzsz"'\
#c@s�eZdZdd�Zdd�Zdefdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS)�ParsercCs||_||_dS)N)�indentwidth�tabwidth)rrrrrr�__init__szParser.__init__cCs||_d|_dS)Nr)�code�study_level)r�srrr�set_code�szParser.set_codeNc
Cs�|jd}}|sdSt|�}xftd�D]Z}|jdd|�}|dkrBP|jdd|�d}||||�}|r|||j��r||j�}P|}q&W|dkr�||�}|r�||j��r�|j�}|S|d}x.|||�}|r�|j�\}	}||	�s�|	}q�Pq�W|S)Nrz:
r�
�)r�len�range�rfind�start�span)
rZis_char_in_string�_synchrer�pos�limitZtries�i�mrrrr�find_good_parse_start�s8	
zParser.find_good_parse_startcCs|dkr|j|d�|_dS)Nr)r)r�lorrr�set_lo�sz
Parser.set_loc
Cs�|jdkrdSd|_|j}|jt�}|jdd�}|jdd�}|jdd�}|jdd�}|jdd�}t}d}}dg|_}|j}dt|�}}�x�||k�rn||}	|d}|	dkr�q�|	dkr�|d}|dkr�||�q�|	d	kr�|d}q�|	d
k�r|r�|d}q�|	dk�s|	dk�r$|	}
||d|d
�|
dk�r>|
d}
|}t|
�d}||}x�||k�r||}	|d}|	dk�r��qX||d||�|
k�r�||}P|	dk�r�|d}|dk�rX|dk�r�||�P�qX|	dk�rX||dk�r�|d}|d}�qX�qXW|d|k�rt	}q�t
}q�|	dk�r<|jd|�}q�||dk�rd|d}|d|k�rdt}|d}q�W|t	k�r�|t
k�r�|dk�r�t
}||_|d|k�r�||�dS)NrZxxxxxxxx�xZxxxxZxxz
xrrrr�"�'���\�#���)rr�	translate�trans�replace�C_NONE�	goodlines�appendr�C_STRING_FIRST_LINE�C_STRING_NEXT_LINES�find�C_BACKSLASH�	C_BRACKET�continuation)
rrr>�levelZlnor7Z	push_goodr&�n�chZquoteZfirstlno�wrrr�_study1�s�










zParser._study1cCs|j�|jS)N)rCr>)rrrr�get_continuation_typeTszParser.get_continuation_typecCs�|jdkrdS|j�d|_|j|j}}t|�d}t|�}xX|r�|}x4t||d||�D]}|jdd|d�d}q`Wt||�r�|d}q@Pq@W|dkr�|}|||_|_	d}g}|j
}	|dfg}
�x�||k�rxt|||�}|�rD|j�}|d}x&||k�r ||dk�r |d}�q�W||k�r4||}|}||k�rDP||}
|
dk�r~|	|�|
j
|t|�f�|
}|d}q�|
dk�r�|�r�|d=|
}|d}|
j
|t|�f�q�|
d	k�s�|
d
k�r|
j
|t|�df�|
}t
|||�j�}|
j
|t|�f�q�|
dk�rL|
j
|t|�df�|jd||�d}|
j
|t|�f�q�|d}||dk�rn|
||}|d}q�W||_|�r�|d
nd|_t|
�|_dS)Nr.rrr�z 	
z([{z)]}r,r-r1r2r2)rrCrr7rrr �_junkre�
stmt_start�stmt_endr8�_chew_ordinaryre�end�_match_stringrer;�lastch�lastopenbracketpos�tuple�stmt_bracketing)rrr7r&�p�qZnothingrL�stackZ
push_stackZ
bracketingr'ZnewprArrr�_study2Xs�








zParser._study2cCs�|j�|j}|j}t|�}|jdd|�d}}|d}xj||kr|t||�}|rf|j�d}d}Pq<|jd|�d}}q<W|}}x||dkr�|d}q�W|j}t|||�j	|j
��|S)Nrrrz 	)rSrMrrr �_itemrerJr;r�
expandtabsr)r�jrr@Zorigir&r'Zextrarrr�compute_bracket_indent�s$

zParser.compute_bracket_indentcCs|j�|j}|d|dS)Nrr.r2���)rCr7)rr7rrr�get_num_lines_in_stmt�szParser.get_num_lines_in_stmtcCs~|j�|j}|j}x||dkr,|d}qW|}|jd|�d}d}}x�||k�r||}|dkrx|d}|d}qL|dkr�|r�|d}|d}qL|dks�|dkr�t|||�j�}qL|d	kr�PqL|dko�|d
ko�|dks�||ddko�||dd
k�rd}PqL|d}qLW|�r8|d}tjd|||��dk}|�s`|}x||d
k�r^|d}�qDWt||j|�j	|j
��dS)Nz 	rrrz([{z)]}r,r-r1�=z=<>!z\s*\\z 	
)rSrrGr;rKrJ�re�matchrrUr)rrr&�startpos�endpos�foundr?rArrr�compute_backslash_indent�sH

zParser.compute_backslash_indentcCsN|j�|j|j}}|}|j}x ||kr@||dkr@|d}q"W|||�S)Nz 	r)rSrGrHr)rr&r@rVrrrr�get_base_indent_string5szParser.get_base_indent_stringcCs|j�|jdkS)N�:)rSrL)rrrr�is_block_openerAszParser.is_block_openercCs|j�t|j|j�dk	S)N)rS�_closererrG)rrrr�is_block_closerFszParser.is_block_closercCs|j�|jS)N)rSrO)rrrr�get_last_stmt_bracketingKszParser.get_last_stmt_bracketing)r
rrrrr#r(r*rCrDrSrWrYr`rarcrerfrrrrr}s <	{
9r�__main__)�mainzidlelib.idle_test.test_pyparser.)�	verbosity)r[rr6r<r9r:r=�compile�VERBOSE�	MULTILINE�searchr#r\rF�DOTALLrKrTrdrI�dictr�fromkeysr4�updaterr
Zunittestrhrrrr�<module>
s2	Z


?>