/opt/imh/python3.13/lib/python3.13/idlelib/__pycache__
Edit: /opt/imh/python3.13/lib/python3.13/idlelib/__pycache__/pyparse.cpython-313.pyc (18030B)
eM F S r SSKr\" S5 u rrrrr\R " S\R \R - 5 R r\R " S\R 5 R r\R " S\R \R - 5 R r\R " S\R 5 R r\R " S\R 5 R r\R " S \R 5 R r " S
S\5 r\R- \" S5 S
5 r\R1 S S 5 5 \R1 S S 5 5 \R1 S S 5 5 " S S5 r\S:X a SSKJr \" SSS9 gg)a Define partial Python code Parser used by editor and hyperparser.
Instances of ParseMap are used with str.translate.
The following bound search and match functions are defined:
_synchre - start of popular statement;
_junkre - whitespace or comment line;
_match_stringre: string, possibly without closer;
_itemre - line that may have bracket structure start;
_closere - line that must be followed by dedent.
_chew_ordinaryre - non-special characters.
N 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 \ rS rSrSrS rSrg)ParseMapf aT Dict subclass that maps anything not in dict to 'x'.
This is designed to be used with str.translate in study1.
Anything not specifically mapped otherwise becomes 'x'.
Example: replace everything except whitespace with 'x'.
>>> keepwhite = ParseMap((ord(c), ord(c)) for c in ' \t\n\r')
>>> "a + b\tc\nd".translate(keepwhite)
'x x x\tx\nx'
c g)Nx )selfkeys 5/opt/imh/python3.13/lib/python3.13/idlelib/pyparse.py__missing__ParseMap.__missing__r s r N)__name__
__module____qualname____firstlineno____doc__r
__static_attributes__r r r r r f s r r r c # N # U H n[ U5 [ S 5 4v M g7f)(Nord.0cs r
r x /Ac!fc#h
#%z({[c # N # U H n[ U5 [ S 5 4v M g7f))Nr r s r r r y r r z)}]c # N # U H n[ U5 [ U5 4v M g 7fNr r s r r r z s 2z!c!fc!f
zr z"'\
#c h \ rS rSrS rS rS rS rS rS r S r
S rS
rS r
S rS
rS rS rSrg)Parser} c Xl X l g r$ )indentwidthtabwidth)r
r) r* s r __init__Parser.__init__ s
&
r c R [ U5 S:X d US S:X d eXl SU l g )Nr
)lencodestudy_level)r
ss r set_codeParser.set_code s* 1v{aetm++ r c \ U R Sp2[ U5 n[ S5 Hv nUR SSU5 nUS: a O\UR SSU5 S- n[ X&U5 nU( a- U" UR 5 5 ( d UR 5 n OUnMx Uc? [ U5 nU( a+ U" UR 5 5 ( d UR 5 nU$ US- n[ X&5 =n( a5 UR
5 u pU" U5 ( d Un[ X&5 =n( a M5 U$ )a
Return index of a good place to begin parsing, as close to the
end of the string as possible. This will be the start of some
popular stmt like "if" or "def". Return None if none found:
the caller should pass more prior context then, if possible, or
if not (the entire program text up until the point of interest
has already been tried) pass 0 to set_lo().
This will be reliable iff given a reliable is_char_in_string()
function, meaning that when it says "no", it's absolutely
guaranteed that the char is not in a string.
Nr z:
r r/ )r1 r0 rangerfind_synchrestartspan) r
is_char_in_stringr1 poslimittriesimr3 s r find_good_parse_startParser.find_good_parse_start s IItc
D 1XE
5!U+A1u
4A&*A%(A*177955ggiE ; A*177955ggiJ
!GD$$a$668DA$Q'' D$$a$
r c v US:X d U R US-
S:X d eUS: a U R US U l gg)zgThrow away the start of the string.
Intended to be called with the result of find_good_parse_start().
r r7 r/ N)r1 )r
los r set_lo
Parser.set_lo sA
Qw$))BqD/T111
6 "#DI r c U R S: a gSU l U R nUR [ 5 nUR SS5 nUR SS5 nUR SS5 nUR SS5 nUR SS5 n[
nS =p4S /=U l nUR nS [ U5 pXx: Gak X n US- nU S:X a M U S:X a US- nUS :X a U" U5 M2 U S
:X a US- nM? U S:X a U( a US-
nMS U S:X d U S
:X a U n
XS-
US- U
S- :X a U
S- n
Un[ U
5 S-
nX|- nXx: am X n US- nU S:X a M XS-
X|- U
:X a X|- nO`U S:X a US- nUS :X a US :X a U" U5 O@MJ U S:X a Xx: d eX S:X a US- nUS- nMk Xx: a Mm US-
U:X a [ nO[ nGM U S:X a UR SU5 nUS : d eGM9 U S:X d eXx: d eX S:X a US- nUS- U:X a [ nUS- nXx: a GMk U[ :w a U[ :w a US : a [ nX l U[
:H US U:H :X d eUS U:w a U" U5 gg)zFind the line numbers of non-continuation lines.
As quickly as humanly possible , find the line numbers (0-
based) of the non-continuation lines.
Creates self.{goodlines, continuation}.
r7 Nxxxxxxxxxxxxxxxz
xr/ r r r" "' \#r. )r2 r1 translatetransreplaceC_NONE goodlinesappendr0 C_STRING_FIRST_LINEC_STRING_NEXT_LINESfindC_BACKSLASH C_BRACKETcontinuation)
r
r1 r_ levellnorX push_goodrA nchquotefirstlnows
r _study1Parser._study1 s q yy~~e$||J,||FC(||D#&||D#&||E4( &'S($$ #d)1eB!A SyTzAgA:cNSy Sy!AIESyB#I!AaC=EAI-!AIEJNCeB!ASy aC}-CTz!Ag6$z )#! Tz uu7d?"%'CaC 3 e@ aH, (;':SyIIdA&Av
v::5L5w$AgQ3!8#.L!Ak et
// 33 $L( &IbMS,@AAAR=CcN r c : U R 5 U R $ r$ )rh r_ r
s r get_continuation_typeParser.get_continuation_typeK s r c U R S: a gU R 5 SU l U R U R p![ U5 S-
n[ U5 nU( a^ U( d eUn[ X#S-
X# 5 H nUR
SSUS-
5 S- nM [ X5 ( a US-
nOO U( a M^ US:X a
US:X d eUnUWsU l U l Sn/ nUR n US4/n
XE: Ga [ XU5 nU( aH UR 5 nUS-
nX4: a X S; a US-
nX4: a
X S; a M X4: a X nUnXE: a GOcX n
U
S; a- U " U5 U
R U[ U5 45 U
nUS- nM U
S ; a/ U( a US
U
nUS- nU
R U[ U5 45 M U
S:X d U
S:X aZ U
R U[ U5 S- 45 U
n[ XU5 R 5 nU
R U[ U5 45 GM3 U
S
:X a[ U
R U[ U5 S- 45 UR SXE5 S- nUS: d eU
R U[ U5 45 GM U
S:X d eUS- nXE: d eX S:w a XU - nUS- nXE: a GM Xpl U( a US
OSU l [# U
5 U l g)a
study1 was sufficient to determine the continuation status,
but doing more requires looking at every character. study2
does this for the last interesting statement in the block.
Creates:
self.stmt_start, stmt_end
slice indices of last interesting stmt
self.stmt_bracketing
the bracketing structure of the last interesting stmt; for
example, for the statement "say(boo) or die",
stmt_bracketing will be ((0, 0), (0, 1), (2, 0), (2, 1),
(4, 0)). Strings and comments are treated as brackets, for
the matter.
self.lastch
last interesting character before optional trailing comment
self.lastopenbracketpos
if continuation is C_BRACKET, index of last open bracket
rP Nr7 r/ r
([{)]}r. rN rO rS rR )r2 rh r1 rX r0 r8 r9 _junkre
stmt_startstmt_endrY _chew_ordinaryreend_match_stringrer\ lastchlastopenbracketpostuplestmt_bracketing)r
r1 rX rA pqnothingry stack
push_stack
bracketingrB newprd s r _study2Parser._study2O s &