Plan 9 from Bell Labs’s /usr/web/sources/contrib/stallion/root/sys/lib/python2.7/idlelib/PyParse.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�`^c@s�ddlZddlZed�\ZZZZZejdej	ej
B�jZejdej	�j
Zejdej	ejB�j
Zejdej	�j
Zejdej	�j
Zejdej	�j
Zd	gd
ZxdD]Zdeee�<q�xd
D]Zdeee�<qWxdD]Zeeee�<q'Wdje�Z[yeed��ZWnek
r�dZnXddd��YZdS(i�Nis�
    ^
    [ \t]*
    (?: while
    |   else
    |   def
    |   return
    |   assert
    |   break
    |   class
    |   continue
    |   elif
    |   try
    |   except
    |   raise
    |   import
    |   yield
    )
    \b
s'
    [ \t]*
    (?: \# \S .* )?
    \n
sK
    \""" [^"\\]* (?:
                     (?: \\. | "(?!"") )
                     [^"\\]*
                 )*
    (?: \""" )?

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

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

|   ' [^'\\\n]* (?: \\. [^'\\\n]* )* '?
sM
    [ \t]*
    [^\s#\\]    # if we match, m.end()-1 is the interesting char
s_
    \s*
    (?: return
    |   break
    |   continue
    |   raise
    |   pass
    )
    \b
s
    [^[\](){}#'"\\]+
txis({[t(s)}]t)s"'\
#ttParsercBs�eZd�Zd�Zded�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�ZdZd
�ZdZd�ZRS(cCs||_||_dS(N(tindentwidthttabwidth(tselfRR((s%/sys/lib/python2.7/idlelib/PyParse.pyt__init__rs	cCs�t|�dks(|ddks(t�t|�tkr�|}g}|j}x9tt|�D](}||dkr�t|�p�d�q_Wdj|�}n||_	d|_
dS(Nii�s
iRR(tlentAssertionErrorttypetUnicodeTypetappendtmaptordtchrtjointstrtstudy_level(RRt	uniphooeytpushtraw((s%/sys/lib/python2.7/idlelib/PyParse.pytset_strvs(	&	c
CsT|jd}}|sdSt|�}x�td�D]�}|jdd|�}|dkr^Pn|jdd|�d}||||�}|r�||j��r�|j�}Pn|}q3W|dkr||�}|r�|j��r�j�}n|S|d}xC|||�}|rL|j�\}	}||	�sM|	}qMq
Pq
|S(Nis:
is
i(RtNoneR	trangetrfindtstarttspan(
Rtis_char_in_stringt_synchreRtpostlimitttriestitmts((s%/sys/lib/python2.7/idlelib/PyParse.pytfind_good_parse_start�s8
	
cCsL|dks)|j|ddks)t�|dkrH|j||_ndS(Niis
(RR
(Rtlo((s%/sys/lib/python2.7/idlelib/PyParse.pytset_lo�s)c
Cs
|jdkrdSd|_|j}|jt�}|jdd�}|jdd�}|jdd�}|jdd�}|jdd�}t}d}}dg|_}|j}dt|�}}x�||kr�||}	|d}|	dkr�n|	dkr4|d}|dkr�||�q�q�n|	d	krP|d}q�n|	d
kru|r�|d}q�q�n|	dks�|	dkr�}
||d|d
!|
dkr�|
d}
n|}t|
�d}||}x||kr�||}	|d}|	dkrq�||d||!|
kr=||}Pn|	dkr�|d}|dkr�dkrx||�nPq��|	dkr�|ks�t	�||dkr�|d}n|d}q���|d|kr�
}q�t}q�n|	dkr,|jd|�}|dks�t	�q�n|	dks>t	�||ksPt	�||dkr�|d}|d|kr�t
}q�n|d}q�W|t
kr�|tkr�|dkr�t}n||_|tk|d|kks�	�|d|kr	||�ndS(NitxxxxxxxxRtxxxxtxxs
xs
iRRt"t'iis\t#i�(RRt	translatet_trantreplacetC_NONEt	goodlinesR
R	R
tC_STRING_FIRST_LINEtC_STRING_NEXT_LINEStfindtC_BACKSLASHt	C_BRACKETtcontinuation(
RRR8tleveltlnoR2t	push_goodR"tntchtquotetfirstlnotw((s%/sys/lib/python2.7/idlelib/PyParse.pyt_study1�s�		
	















	
		"cCs|j�|jS(N(RAR8(R((s%/sys/lib/python2.7/idlelib/PyParse.pytget_continuation_typePs
cCs�|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��|}n|||_	|_
d}g}|j}	|dfg}
xu||kr�t|||�}|r�|j
�}|d}x*||kr�||dkr�|d}qrW||kr�||}n|}||kr�Pq�n||}
|
dkr|	|�|
j|t|�f�|
}|d}q5n|
dkrh|r9|d	=n|
}|d}|
j|t|�f�q5n|
d
ks�|
dkr�|
j|t|�df�|
}t|||�j
�}|
j|t|�f�q5n|
dkrM|
j|t|�df�|jd||�d}|dks.t�|
j|t|�f�q5n|
d
ks_t�|d}||ks{t�||dkr�|
||}n|d}q5W||_|r�|d	|_nt|
�|_dS(Niis
iRs 	
s([{s)]}i�R+R,R-s\(RRARR2R	R
RRt_junkret
stmt_starttstmt_endR
t_chew_ordinaryretendt_match_stringreR5tlastchtlastopenbracketposttupletstmt_bracketing(RRR2R"tptqtnothingRItstackt
push_stackt
bracketingR#tnewpR=((s%/sys/lib/python2.7/idlelib/PyParse.pyt_study2es�
		"!
		







	cCs|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(Ns
iis 	(RTR8R7R
RJRR	Rt_itemreRGR5Rt
expandtabsR(RtjRR<torigiR"R#textra((s%/sys/lib/python2.7/idlelib/PyParse.pytcompute_bracket_indent�s&
		

	cCs#|j�|j}|d|dS(Ni�i�(RAR2(RR2((s%/sys/lib/python2.7/idlelib/PyParse.pytget_num_lines_in_stmt�s
	cCs
|j�|jtkst�|j}|j}x||dkrQ|d}q4W|}|jd|�d}d}}x||kr�||}|dkr�|d}|d}q{|dkr�r�|d}n|d}q{|dks�dkrt|||�j�}q{|d	kr#Pq{|dkry|d
kry|dks[||ddkry||dd
kryd}Pq{|d}q{W|r�|d}t	j
d|||!�dk}n|s�}x!||d
kr�d}q�Wnt||j|!j
|j��dS(Ns 	is
is([{s)]}R+R,R-t=s=<>!s\s*\\s 	
(RTR8R6R
RRDR5RHRGtretmatchRR	RVR(RRR"tstartpostendpostfoundR9R=((s%/sys/lib/python2.7/idlelib/PyParse.pytcompute_backslash_indent�sJ
		





 
"cCsd|j�|j|j}}|}|j}x*||krX||dkrX|d}q/W|||!S(Ns 	i(RTRDRER(RR"R<RWR((s%/sys/lib/python2.7/idlelib/PyParse.pytget_base_indent_string/s
	cCs|j�|jdkS(Nt:(RTRI(R((s%/sys/lib/python2.7/idlelib/PyParse.pytis_block_opener:s
cCs#|j�t|j|j�dk	S(N(RTt_closereRRDR(R((s%/sys/lib/python2.7/idlelib/PyParse.pytis_block_closer@s
cCs|j�|jS(N(RTRJ(R((s%/sys/lib/python2.7/idlelib/PyParse.pytget_last_open_bracket_posGs
cCs|j�|jS(N(RTRL(R((s%/sys/lib/python2.7/idlelib/PyParse.pytget_last_stmt_bracketingPs
N(t__name__t
__module__RRRRR%R'RARBRTRZR[RbRcReRgRJRhRLRi(((s%/sys/lib/python2.7/idlelib/PyParse.pyRps$		3			�	m				5				((R]tsysRR1R6R3R4R7tcompiletVERBOSEt	MULTILINEtsearchRR^RCtDOTALLRHRURfRFR/R=RRRtunicodeRt	NameErrorRR(((s%/sys/lib/python2.7/idlelib/PyParse.pyt<module>s8	







Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].