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

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|�tkru|}g}|j}x9tt|�D](}||dkrXt|�p[d�q7Wdj|�}n||_d|_dS(NiRRi(	ttypetUnicodeTypetappendtmaptordtchrtjointstrtstudy_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(RtNonetlentrangetrfindtstarttspan(
Rtis_char_in_stringt_synchreRtpostlimitttriestitmts((s%/sys/lib/python2.7/idlelib/PyParse.pytfind_good_parse_start�s8
	
cCs#|dkr|j||_ndS(Ni(R(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||krK||}	|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�|dkr�|d}n|d}q���|d|kr�t	}q�t
}q�n|	dkr|jd|�}q�n||dkr>|d}|d|kr>t}q>n|d}q�W|t	kry|t
kry|dkryt
}n||_|d|kr�||�ndS(NitxxxxxxxxRtxxxxtxxs
xs
iRRt"t'iis\t#i�(RRt	translatet_trantreplacetC_NONEt	goodlinesRRtC_STRING_FIRST_LINEtC_STRING_NEXT_LINEStfindtC_BACKSLASHt	C_BRACKETtcontinuation(
RRR7tleveltlnoR1t	push_goodR!tntchtquotetfirstlnotw((s%/sys/lib/python2.7/idlelib/PyParse.pyt_study1�s�		
	















	
		cCs|j�|jS(N(R@R7(R((s%/sys/lib/python2.7/idlelib/PyParse.pytget_continuation_typePs
cCs�|jdkrdS|j�d|_|j|j}}t|�d}t|�}xp|r�|}x@t||d||�D]#}|jdd|d�d}q�Wt||�r�|d}qXPqXW|dkr�|}n|||_|_	d}g}|j
}	|dfg}
x?||krUt|||�}|r�|j�}|d}x*||kr}||dkr}|d}qTW||kr�||}n|}||kr�Pq�n||}
|
dkr�|�|
j
|t|�f�|
}|d}qn|
dkrJ|r|d	=n|
}|d}|
j
|t|�f�qn|
d
ksb|
dkr�|
j
|t|�df�|
}t
|||�j�}|
j
|t|�f�qn|
dkr|
j
|t|�df�|jd||�d}|
j
|t|�f�qn|d}||dkrH|
||}n|d}qW||_|ru|d	|_nt|
�|_dS(
Niis
iRs 	
s([{s)]}i�R*R+R,(RR@RR1RRRt_junkret
stmt_starttstmt_endRt_chew_ordinaryretendt_match_stringreR4tlastchtlastopenbracketposttupletstmt_bracketing(RRR1R!tptqtnothingRHtstackt
push_stackt
bracketingR"tnewpR<((s%/sys/lib/python2.7/idlelib/PyParse.pyt_study2es�
		"!
		







	cCs|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(Ns
iis 	(RSRIRRRt_itemreRFR4Rt
expandtabsR(RtjRR;torigiR!R"textra((s%/sys/lib/python2.7/idlelib/PyParse.pytcompute_bracket_indent�s$
		

	cCs#|j�|j}|d|dS(Ni�i�(R@R1(RR1((s%/sys/lib/python2.7/idlelib/PyParse.pytget_num_lines_in_stmt�s
	cCs�|j�|j}|j}x||dkr<|d}qW|}|jd|�d}d}}x||krq||}|dkr�|d}|d}qf|dkr�|r�|d}n|d}qf|dks�dkr�|||�j�}qf|d	krPqf|dkrd|d
krd|dksF||ddkrd||dd
krdd}Pqf|d}qfW|r�|d}tjd|||!�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 	
(RSRRCR4RGRFtretmatchRRRUR(RRR!tstartpostendpostfoundR8R<((s%/sys/lib/python2.7/idlelib/PyParse.pytcompute_backslash_indent�sH
		





 
"cCsd|j�|j|j}}|}|j}x*||krX||dkrX|d}q/W|||!S(Ns 	i(RSRCRDR(RR!R;RVR((s%/sys/lib/python2.7/idlelib/PyParse.pytget_base_indent_string/s
	cCs|j�|jdkS(Nt:(RSRH(R((s%/sys/lib/python2.7/idlelib/PyParse.pytis_block_opener:s
cCs#|j�t|j|j�dk	S(N(RSt_closereRRCR(R((s%/sys/lib/python2.7/idlelib/PyParse.pytis_block_closer@s
cCs|j�|jS(N(RSRI(R((s%/sys/lib/python2.7/idlelib/PyParse.pytget_last_open_bracket_posGs
cCs|j�|jS(N(RSRK(R((s%/sys/lib/python2.7/idlelib/PyParse.pytget_last_stmt_bracketingPs
N(t__name__t
__module__RRRRR$R&R@RARSRYRZRaRbRdRfRIRgRKRh(((s%/sys/lib/python2.7/idlelib/PyParse.pyRps$		3			�	m				5				((R\tsysRR0R5R2R3R6tcompiletVERBOSEt	MULTILINEtsearchRR]RBtDOTALLRGRTReRER.R<R
RR	tunicodeR
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].