tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Z\¬Qc@sEdZddlZddlZddlmZddd„ƒYZdS(sk
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.
iÿÿÿÿN(tPyParset HyperParsercBsteZd„Zd„Zd„Zd„Zded„ZdZe    j
e    j dZ e    j
dZ d„Zd    „ZRS(
cCsï||_|j|_}tj|j|jƒ}d„}||j|ƒƒ}|jsx|jD]„}t    ||dƒ}t
|ƒd}    d|}
|j |j |    |
ƒdƒ|j |j|    ƒƒ} | d
k    sâ|dkrbPqbqbW|j| pùdƒn_|jd|ƒ} | r%| d}    nd}    d|}
|j |j |    |
ƒdƒ|jdƒ|jd     |_|
|_|jƒ|_gtt|jƒƒD]8} | dkoÒ|j| d|j| ddk^q|_|j|ƒd
S( s[Initialize the HyperParser to analyze the surroundings of the given
        index.
        cSstt|ƒƒS(N(tinttfloat(tindex((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/HyperParser.pyt
index2linesis.0s%d.ends 
itconsoles1.0iþÿÿÿN(teditwinttextRtParsert indentwidthttabwidthRtcontext_use_ps1tnum_context_linestmaxtreprtset_strtgettfind_good_parse_startt_build_char_in_string_functNonetset_lot tag_prevrangetstrtrawtextt stopatindextget_last_stmt_bracketingt
bracketingtrangetlentisopenert    set_index(tselfRRRtparserRtlnotcontexttstartatt startatindexRtbodtrti((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/HyperParser.pyt__init__s:            
 
     TcCst|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(siSet the index to which the functions relate. Note that it must be
        in the same statement.
        is0The index given is before the analyzed statementiN(
RRRRRt
ValueErrortindexinrawtextt indexbracketRR(R RR+((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/HyperParser.pyRHs+         !!cCs/|j|jo.|j|j|jddkS(s5Is the index given to the HyperParser is in a string?it"t'(R-R.(RR,RR(R ((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/HyperParser.pyt is_in_string[scCs0|j|j p/|j|j|jddkS(s:Is the index given to the HyperParser is in a normal code?it#R-R.(R0R-R.(RR,RR(R ((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/HyperParser.pyt
is_in_codebss([{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(s’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.
        iis%s-%dcN(
RR,RRRtminRRRR(R topenerst    mustclosetbracketingleveltbeforetaftert beforeindext
afterindex((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/HyperParser.pytget_surrounding_bracketshs0    
   +   )s     
\t_cCs€|}x1||kr9||d|jkr9|d8}q    W||krx|||jksotj|||!ƒrx|}n||S(Ni(t    _id_charst_id_first_charstkeywordt    iskeyword(R RtlimittposR(((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/HyperParser.pyt_eat_identifier˜s&    c
   Csr|jƒstdƒ‚n|j}|j}|j}||d}|j}|}t}xxÏ||kr||d|jkr|d8}q_| rÉ||krÉ||ddkrÉ|d8}t}q_||kr*|dkr*|||dddkr*|d8}||d}||dd}q_Pq_|s8Pn|j|||ƒ}|rl||}|}t    }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(
s‚Return a string with the Python expression which ends at the given
        index, which is empty if there is no real one.
        s?get_expression should only be called if index is inside a code.iit.R0is([s'"trRbBuU(
R1R*RRR,R+tTruet_whitespace_charsRBtFalse(
R RRt
brck_indext
brck_limitRAtlast_identifier_post postdot_phasetrettlevel((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/HyperParser.pytget_expression¡sb                 #  
    
 
     '
#    (t__name__t
__module__R)RR/R1RGR:RFtstringt ascii_letterstdigitsR<R=RBRN(((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/HyperParser.pyRs    7            '         ((t__doc__RQR>tidlelibRR(((s[/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/HyperParser.pyt<module>    s