Hacked By AnonymousFox

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



��Yf�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@sUeZdZdZdd�Zdd�Zdd�Zdd	�Zd
dd�Zd
S)
�StringTranslatePseudoMappingaTUtility class to be used with str.translate()

    This Mapping class wraps a given dict. When a value for a key is
    requested via __getitem__() or get(), the key is looked up in the
    given dict. If found there, the value from the dict is returned.
    Otherwise, the default value given upon initialization is returned.

    This allows using str.translate() to make some replacements, and to
    replace all characters for which no replacement was specified with
    a given character instead of leaving them as-is.

    For example, to replace everything except whitespace with 'x':

    >>> whitespace_chars = ' \t\n\r'
    >>> preserve_dict = {ord(c): ord(c) for c in whitespace_chars}
    >>> mapping = StringTranslatePseudoMapping(preserve_dict, ord('x'))
    >>> text = "a + b\tc\nd"
    >>> text.translate(mapping)
    'x x x\tx\nx'
    cCs4||_||_|j|dd�}||_dS)NcSs
|||�S)N�)�key�_getZ_defaultrr�4/opt/alt/python35/lib64/python3.5/idlelib/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__�__doc__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>t|�dks(|ddks(t�||_d|_dS)Nr��
���)r�AssertionError�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:
rrr)r r�range�rfind�start�span)
rZis_char_in_string�_synchrer �pos�limitZtries�i�mr"rrr�find_good_parse_start�s8
	
	zParser.find_good_parse_startcCsO|dks)|j|ddks)t�|dkrK|j|d�|_dS)Nrrr)r 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)r1)r2r3rrrr4�sz)}]ccs'|]}t|�t|�fVqdS)N)r1)r2r3rrrr4�sz"'\
#r�xc
Cs�|jdkrdSd|_|j}|j|j�}|jdd�}|jdd�}|jdd�}|jdd�}|jdd�}t}d}}dg|_}|j}dt|�}}x�||krf||}	|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�||ks�t	�||dkr�|d}|d}q�q�W|d|kr�t
}q�t}q�|	dkr|jd|�}|dks�t	�q�|	dkst	�||ks)t	�||dkrY|d}|d|krYt
}|d}q�W|t
kr�|tkr�|dkr�t}||_|tk|d|kks�t	�|d|kr�||�dS)NrZxxxxxxxxr6ZxxxxZxxz
xrrr0r5�"�'���\�#rr)r!r �	translate�_tran�replace�C_NONE�	goodlines�appendrr�C_STRING_FIRST_LINE�C_STRING_NEXT_LINES�find�C_BACKSLASH�	C_BRACKET�continuation)
rr rH�levelZlnorAZ	push_goodr+�n�chZquoteZfirstlno�wrrr�_study1�s�		
	





"








	
	"zParser._study1cCs|j�|jS)N)rMrH)rrrr�get_continuation_typegs
zParser.get_continuation_typecCs�|jdkrdS|j�d|_|j|j}}t|�d}t|�}x||r�|sjt�|}x@t||d||�D]#}|jdd|d�d}q�Wt||�r�|d}qXPqXW|dkr�|dks�t�|}|||_	|_
d}g}|j}	|dfg}
xZ||kr�t|||�}|r�|j
�}|d}x*||kr�||dkr�|d}qoW||kr�||}|}||kr�P||}
|
dkr|	|�|
j|t|�f�|
}|d}q2|
dkrS|r'|d
=|
}|d}|
j|t|�f�q2|
d	ksk|
d
kr�|
j|t|�df�|
}t|||�j
�}|
j|t|�f�q2|
dkr2|
j|t|�df�|jd||�d}|dkst�|
j|t|�f�q2|
dksDt�|d}||ks`t�||dkr~|
||}|d}q2W||_|r�|d|_t|
�|_dS)Nr9rrr�z 	
z([{z)]}r7r8r<r;rr)r!rMr rArrr$r%�_junkre�
stmt_start�stmt_endrB�_chew_ordinaryre�end�_match_stringrerE�lastch�lastopenbracketpos�tuple�stmt_bracketing)rr rAr+�p�qZnothingrV�stackZ
push_stackZ
bracketingr,ZnewprKrrr�_study2|s�
		"!
	






	
zParser._study2cCs|j�|jtkst�|j}|j}t|�}|jdd|�d}}|d}x�||kr�t||�}|r�|j	�d}d}Pqg|j
d|�d}}qgW|}}x||dkr�|d}q�W|j}t|||�j|j
��|S)Nrrrz 	)r]rHrGrrWr rr%�_itemrerTrEr�
expandtabsr)r�jr rJZorigir+r,Zextrarrr�compute_bracket_indent�s&
		

	zParser.compute_bracket_indentcCs#|j�|j}|d|dS)Nrr9r���)rMrA)rrArrr�get_num_lines_in_stmts
	zParser.get_num_lines_in_stmtcCs
|j�|jtkst�|j}|j}x||dkrQ|d}q4W|}|jd|�d}d}}x	||kr�||}|dkr�|d}|d}q{|dkr�|r�|d}|d}q{|dks�|dkrt|||�j�}q{|d	kr Pq{|dkrv|d
krv|dksX||ddkrv||dd
krvd}Pq{|d}q{W|r�|d}t	j
d|||��dk}|s�|}x||d
kr�|d}q�Wt||j|�j|j
��dS)Nz 	rrrz([{z)]}r7r8r<�=z=<>!z\s*\\z 	
)r]rHrFrr rQrErUrT�re�matchrr_r)rr r+�startpos�endpos�foundrIrKrrr�compute_backslash_indentsJ
		





 
"zParser.compute_backslash_indentcCsg|j�|j|j}}|}|j}x*||krX||dkrX|d}q/W|||�S)Nz 	r)r]rQrRr )rr+rJr`r rrr�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]�_closerer rQ)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
r#r(r-r/r>�updaterr1rMrNr]rarcrjrkrmrorWrprYrqrrrrr�s.3	�m	5r)re�sys�collectionsrr$r@rFrCrDrG�compile�VERBOSE�	MULTILINE�searchr(rfrP�DOTALLrUr^rnrSrrrrrr�<module>s"	*

Hacked By AnonymousFox1.0, Coded By AnonymousFox