AlkantarClanX12

Your IP : 18.118.193.223


Current Path : /opt/alt/python33/lib64/python3.3/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/idlelib/__pycache__/HyperParser.cpython-33.pyo

�
��fB)c@sEdZddlZddlZddlmZGdd�d�ZdS(uk
HyperParser
===========
This module defines the HyperParser class, which provides advanced parsing
abilities for the ParenMatch and other extensions.
The HyperParser uses PyParser. PyParser is intended mostly to give information
on the proper indentation of code. HyperParser gives some information on the
structure of code, used by extensions to help the user.
iN(uPyParsecBs�|EeZdZdd�Zdd�Zdd�Zdd�Zd	dd
d�ZdZ	e
je
jd
Z
e
jd
Zdd�Zdd�ZdS(uHyperParserc
s�|�_|j�_}tj|j|j�}dd�}||j|��}|jsx�|jD]�}t	||d�}t
|�d}	d|}
|j|j|	|
�d�|j
|j|	��}|d
k	s�|dkrePqeqeW|j|p�d�n_|jd|�}|r(|d}	nd	}	d|}
|j|j|	|
�d�|jd�|jd
d��_|
�_|j��_�fdd
�tt�j��D��_�j|�d
S(u[Initialize the HyperParser to analyze the surroundings of the given
        index.
        cSstt|��S(N(uintufloat(uindex((u8/opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyu
index2linesu(HyperParser.__init__.<locals>.index2lineiu.0u%d.endu 
iuconsoleu1.0NicsBg|]8}|dko;�j|d�j|ddk�qS(ii(u
bracketing(u.0ui(uself(u8/opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyu
<listcomp>Cs	u(HyperParser.__init__.<locals>.<listcomp>i����(ueditwinutextuPyParseuParseruindentwidthutabwidthuindexucontext_use_ps1unum_context_linesumaxurepruset_strugetufind_good_parse_startu_build_char_in_string_funcuNoneuset_lou
tag_prevrangeustrurawtextustopatindexuget_last_stmt_bracketingu
bracketingurangeulenuisopeneru	set_index(
uselfueditwinuindexutextuparseru
index2lineulnoucontextustartatustartatindexustopatindexubodur((uselfu8/opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyu__init__s:		



	uHyperParser.__init__cCst|j�t|jj||j��}|dkrFtd��n||_d|_xP|jt|j�dkr�|j|jdd|jkr�|jd7_q[W|jt|j�dkr|j|jdd|jkr|j	|jdr|jd7_ndS(uiSet the index to which the functions relate. Note that it must be
        in the same statement.
        iu0The index given is before the analyzed statementiN(
ulenurawtextutextugetustopatindexu
ValueErroruindexinrawtextuindexbracketu
bracketinguisopener(uselfuindexuindexinrawtext((u8/opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyu	set_indexHs+		!!uHyperParser.set_indexcCs/|j|jo.|j|j|jddkS(u5Is the index given to the HyperParser is in a string?iu"u'(u"u'(uisopeneruindexbracketurawtextu
bracketing(uself((u8/opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyuis_in_string[suHyperParser.is_in_stringcCs0|j|jp/|j|j|jddkS(u:Is the index given to the HyperParser is in a normal code?iu#u"u'(u#u"u'(uisopeneruindexbracketurawtextu
bracketing(uself((u8/opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyu
is_in_codebsuHyperParser.is_in_codeu([{c
Cs�|j|jd}|j}x{|j|sc|j|j|d|ksc|j|d|kr�|d8}|dkr}dSt||j|d�}q W|jd}x:|t|j�kr�|j|d|kr�|d7}q�W|jjd|j	t|j�|j|df�}|t|j�ksQ|j|dt|j�krg|r[dS|j	}n;|jjd|j	t|j�|j|ddf�}||fS(u�If the index given to the HyperParser is surrounded by a bracket
        defined in openers (or at least has one before it), return the
        indices of the opening bracket and the closing bracket (or the
        end of line, whichever comes first).
        If it is not surrounded by brackets, or the end of line comes before
        the closing bracket and mustclose is True, returns None.
        iiu%s-%dcN(
u
bracketinguindexbracketuisopenerurawtextuNoneuminulenutextuindexustopatindex(uselfuopenersu	mustcloseubracketinglevelubeforeuafterubeforeindexu
afterindex((u8/opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyuget_surrounding_bracketshs0	

+ )u$HyperParser.get_surrounding_bracketsu 	
\u_cCs�|}x1||kr9||d|jkr9|d8}q	W||kr{|||jksrtj|||��r{|}n||S(Ni(u	_id_charsu_id_first_charsukeywordu	iskeyword(uselfustrulimituposui((u8/opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyu_eat_identifier�s&	uHyperParser._eat_identifierc
	Csu|j�std��n|j}|j}|j}||d}|j}|}d
}xx�||kr�||d|jkr�|d8}q_|r�||kr�||ddkr�|d8}d
}q_||kr*|dkr*|||dddkr*|d8}||d}||dd}q_Pq_|s8Pn|j|||�}|rl||}|}d}q\||kr`||d}	x2|dkr�||dd|	kr�|d8}q�W||d|kr�Pn||d}|d8}||d}|}||dkrqa||dkr\x.|dkrR||dd	krR|d8}q%W|}nPq\Pq\|||j�S(u�Return a string with the Python expression which ends at the given
        index, which is empty if there is no real one.
        u?get_expression should only be called if index is inside a code.iiu.u#iu([u'"urRbBuUTF(
u
is_in_codeu
ValueErrorurawtextu
bracketinguindexbracketuindexinrawtextuTrueu_whitespace_charsu_eat_identifieruFalse(
uselfurawtextu
bracketingu
brck_indexu
brck_limituposulast_identifier_posu
postdot_phaseuretulevel((u8/opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyuget_expression�sb				#
 
	

	'
#	uHyperParser.get_expressionNF(u__name__u
__module__u__qualname__u__init__u	set_indexuis_in_stringu
is_in_codeuFalseuget_surrounding_bracketsu_whitespace_charsustringu
ascii_lettersudigitsu	_id_charsu_id_first_charsu_eat_identifieruget_expression(u
__locals__((u8/opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyuHyperParsers7'
	uHyperParser(u__doc__ustringukeyworduidlelibuPyParseuHyperParser(((u8/opt/alt/python33/lib64/python3.3/idlelib/HyperParser.pyu<module>	s