Your IP : 3.147.6.122


Current Path : /opt/alt/python35/lib64/python3.5/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/idlelib/__pycache__/PyParse.cpython-35.opt-2.pyc



���]�O�@sddlZddlZddlmZed�\ZZZZZ	ej
dejejB�j
Zej
dej�jZej
dejejB�jZej
dej�jZej
dej�jZej
d	ej�jZGd
d�de�ZGdd
�d
�ZdS)�N)�Mapping�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@sOeZdZdd�Zdd�Zdd�Zdd�Zd	d
d�Zd	S)�StringTranslatePseudoMappingcCs4||_||_|j|dd�}||_dS)NcSs
|||�S)N�)�key�_getZ_defaultrr�,/opt/alt/python35/lib64/python3.5/PyParse.pyrysz3StringTranslatePseudoMapping.__init__.<locals>._get)�
_non_defaultsZ_default_value�getr)�selfZnon_defaults�
default_valuerrrr�__init__us		z%StringTranslatePseudoMapping.__init__cCs
|j|�S)N)r)r�itemrrr�__getitem__}sz(StringTranslatePseudoMapping.__getitem__cCs
t|j�S)N)�lenr	)rrrr�__len__�sz$StringTranslatePseudoMapping.__len__cCs
t|j�S)N)�iterr	)rrrr�__iter__�sz%StringTranslatePseudoMapping.__iter__NcCs
|j|�S)N)r)rr�defaultrrrr
�sz StringTranslatePseudoMapping.get)�__name__�
__module__�__qualname__r
rrrr
rrrrr`s
rc@sBeZdZdd�Zdd�Zdedd�Zdd	�ZiZej	d
d�dD��ej	d
d�dD��ej	dd�dD��e
eded��Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�ZdZd%d&�ZdZd'd(�ZdS))�ParsercCs||_||_dS)N)�indentwidth�tabwidth)rrrrrrr
�s	zParser.__init__cCs||_d|_dS)Nr)�str�study_level)r�srrr�set_str�s	zParser.set_strNc
CsI|jd}}|sdSt|�}x�td�D]}|jdd|�}|dkr[P|jdd|�d}||||�}|r�||j��r�|j�}P|}q3W|dkr�||�}|r�||j��r�|j�}|S|d}xA|||�}|r@|j�\}	}||	�sA|	}qPqW|S)Nrz:
r�
�)rr�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�sz
Parser.set_loccs'|]}t|�td�fVqdS)�(N)�ord)�.0�crrr�	<genexpr>�szParser.<genexpr>z({[ccs'|]}t|�td�fVqdS)�)N)r.)r/r0rrrr1�sz)}]ccs'|]}t|�t|�fVqdS)N)r.)r/r0rrrr1�sz"'\
#r�xc
Csp|jdkrdSd|_|j}|j|j�}|jdd�}|jdd�}|jdd�}|jdd�}|jdd�}t}d}}dg|_}|j}dt|�}}xO||kr||}	|d}|	dkr�q�|	dkr.|d}|dkr�||�q�|	d	krG|d}q�|	d
krf|r�|d}q�|	dks~|	dkr�|	}
||d|d
�|
dkr�|
d}
|}t|
�d}||}x�||kr�||}	|d}|	dkrq�||d||�|
kr+||}P|	dkrg|d}|dkr�|dkrc||�Pq�|	dkr�||dkr�|d}|d}q�q�W|d|kr�t	}q�t
}q�|	dkr�|jd|�}q�||dkr|d}|d|krt}|d}q�W|t	krI|t
krI|dkrIt
}||_|d|krl||�dS)Nr Zxxxxxxxxr3ZxxxxZxxz
xrrr-r2�"�'���\�#���)rr�	translate�_tran�replace�C_NONE�	goodlines�appendr�C_STRING_FIRST_LINE�C_STRING_NEXT_LINES�find�C_BACKSLASH�	C_BRACKET�continuation)
rrrF�level�lnor?Z	push_goodr(�n�ch�quoteZfirstlno�wrrr�_study1�s�		
	





"








	
	zParser._study1cCs|j�|jS)N)rMrF)rrrr�get_continuation_typegs
zParser.get_continuation_typecCsg|jdkrdS|j�d|_|j|j}}t|�d}t|�}xp|r�|}x@t||d||�D]#}|jdd|d�d}q�Wt||�r�|d}qXPqXW|dkr�|}|||_|_	d}g}|j
}	|dfg}
x$||kr7t|||�}|r�|j�}|d}x*||krz||dkrz|d}qQW||kr�||}|}||kr�P||}
|
dkr�|	|�|
j
|t|�f�|
}|d}q|
dkr5|r	|d=|
}|d}|
j
|t|�f�q|
d	ksM|
d
kr�|
j
|t|�df�|
}t
|||�j�}|
j
|t|�f�q|
dkr|
j
|t|�df�|jd||�d}|
j
|t|�f�q|d}||dkr*|
||}|d}qW||_|rT|d
|_t|
�|_dS)Nr6r rr�z 	
z([{z)]}r4r5r9r:r:)rrMrr?rr!r"�_junkre�
stmt_start�stmt_endr@�_chew_ordinaryre�end�_match_stringrerC�lastch�lastopenbracketpos�tuple�stmt_bracketing)rrr?r(�p�qZnothingrV�stackZ
push_stackZ
bracketingr)ZnewprJrrr�_study2|s�
		"!
	






	
zParser._study2cCs|j�|j}|j}t|�}|jdd|�d}}|d}x�||kr�t||�}|r�|j�d}d}PqR|jd|�d}}qRW|}}x||dkr�|d}q�W|j}t|||�j	|j
��|S)Nrrr z 	)r]rWrrr"�_itemrerTrCr�
expandtabsr)r�jrrIZorigir(r)�extrarrr�compute_bracket_indent�s$
		

	zParser.compute_bracket_indentcCs#|j�|j}|d|dS)Nr r6r:���)rMr?)rr?rrr�get_num_lines_in_stmts
	zParser.get_num_lines_in_stmtcCs�|j�|j}|j}x||dkr<|d}qW|}|jd|�d}d}}x	||krn||}|dkr�|d}|d}qf|dkr�|r�|d}|d}qf|dks�|dkr�t|||�j�}qf|d	krPqf|dkra|d
kra|dksC||ddkra||dd
krad}Pqf|d}qfW|r�|d}tjd|||��dk}|s�|}x||d
kr�|d}q�Wt||j|�j	|j
��dS)Nz 	r rrz([{z)]}r4r5r9�=z=<>!z\s*\\z 	
)r]rrQrCrUrT�re�matchrr_r)rrr(�startpos�endpos�foundrGrJrrr�compute_backslash_indentsH
		





 
"zParser.compute_backslash_indentcCsg|j�|j|j}}|}|j}x*||krX||dkrX|d}q/W|||�S)Nz 	r )r]rQrRr)rr(rIr`rrrr�get_base_indent_stringFs
	zParser.get_base_indent_stringcCs|j�|jdkS)N�:)r]rV)rrrr�is_block_openerQs
zParser.is_block_openercCs#|j�t|j|j�dk	S)N)r]�_closererrQ)rrrr�is_block_closerWs
zParser.is_block_closercCs|j�|jS)N)r]rW)rrrr�get_last_open_bracket_pos^s
z Parser.get_last_open_bracket_poscCs|j�|jS)N)r]rY)rrrr�get_last_stmt_bracketinggs
zParser.get_last_stmt_bracketing)rrrr
rr%r*r,r<�updaterr.rMrNr]rbrdrkrlrnrprWrqrYrrrrrrr�s.3	�m	5r)rf�sys�collectionsrr!r>rDrArBrE�compile�VERBOSE�	MULTILINE�searchr%rgrP�DOTALLrUr^rorSrrrrrr�<module>s"	*

?>