asda?‰PNG  IHDR ? f ??C1 sRGB ??é gAMA ±? üa pHYs ? ??o¨d GIDATx^íüL”÷e÷Y?a?("Bh?_ò???¢§?q5k?*:t0A-o??¥]VkJ¢M??f?±8\k2íll£1]q?ù???T a bYh3@sddlZddlZddlZddlZddlmZddlmZdZddZ ddZ e e ej Z e d ej Zd d ZGd d d eZddZedkrddlmZeddddddlmZeedS)N)idleConf) DelegatorFcCsd|d|dS)z9Return a named group pattern matching list of alternates.z(?P<%s>|))join)nameZ alternatesr-/usr/local/lib/python3.9/idlelib/colorizer.pyany sr c Csdtdtjd}ddttD}dtd|d}tddg}d }|d }|d }|d }|d }td||||g} |d|d|d| dtddgS)Nz\bKEYWORDcSs(g|] }|ds|tjvrt|qS)_) startswithkeywordkwliststr).0rrrr s  zmake_pat..z([^.'\"\\#]\b|^)BUILTINCOMMENTz#[^\n]*z(?i:r|u|f|fr|rf|b|br|rb)?z'[^'\\\n]*(\\.[^'\\\n]*)*'?z"[^"\\\n]*(\\.[^"\\\n]*)*"?z''''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?z'"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?STRINGrSYNCz\n)r rrdirbuiltins) kwZ builtinlistbuiltincommentZ stringprefixZsqstringZdqstringZ sq3stringZ dq3stringstringrrr make_pats  rz\s+(\w+)cCs^t}t|d}t|dd}t|d}|j|d|d||d|d|dddS)zcSet color options of Text widget. If ColorDelegator is used, this should be called first. ZnormalZcursor foregroundZhilite background)rrZinsertbackgroundZselectforegroundZselectbackgroundZinactiveselectbackgroundN)r CurrentTheme GetHighlightZconfig)textthemeZ normal_colorsZ cursor_colorZ select_colorsrrr color_config&s  r$c@seZdZdZddZddZddZdd Zd d Zdd dZ dddZ dddZ ddZ d ddZ ddZddZddZd S)!ColorDelegatora-Delegator for syntax highlighting (text coloring). Instance variables: delegate: Delegator below this one in the stack, meaning the one this one delegates to. Used to track state: after_id: Identifier for scheduled after event, which is a timer for colorizing the text. allow_colorizing: Boolean toggle for applying colorizing. colorizing: Boolean flag when colorizing is in process. stop_colorizing: Boolean flag to end an active colorizing process. cCs*t||t|_t|_|dS)N)r__init__ init_stateprogidprog LoadTagDefsselfrrr r&Ks  zColorDelegator.__init__cCsd|_d|_d|_d|_dS)z1Initialize variables that track colorizing state.NTF)after_idallow_colorizingstop_colorizing colorizingr+rrr r'RszColorDelegator.init_statecCs\|jdur|dt|||durL||d|j|ddn d|_d|_ dS)aSet the delegate for this instance. A delegate is an instance of a Delegator class and each delegate points to the next delegator in the stack. This allows multiple delegators to be chained together for a widget. The bottom delegate for a colorizer is a Text widget. If there is a delegate, also start the colorizing process. Nz<>1.0endTF) delegateZunbindr setdelegate config_colorsbindtoggle_colorize_event notify_ranger/r.)r,r3rrr r4Ys   zColorDelegator.setdelegatecCs4|jD]\}}|j|fi|q |ddS)z4Configure text widget tags with colors from tagdefs.ZselN)tagdefsitemsZ tag_configureZ tag_raise)r,tagZcnfrrr r5pszColorDelegator.config_colorsc Cszt}t|dt|dt|dt|dt|dddddddt|dt|d d |_trvtd |jdS) z.Create dictionary of tag names to text colors.rrrrZ definitionN)rrerrorhit) rr rr DEFINITIONrTODOERRORr=r9)rr r!r9DEBUGprint)r,r#rrr r*vs       zColorDelegator.LoadTagDefsNcCs6||}|j||||||dt|dS)z:Insert chars into widget at index and mark for colorizing.+%dcN)indexr3insertr8len)r,rDcharstagsrrr rEs zColorDelegator.insertcCs&||}|j||||dS)z5Delete chars between indexes and mark for colorizing.N)rDr3deleter8r,Zindex1index2rrr rIs zColorDelegator.deletecCsb|d|||jr$tr tddS|jrzcolorizing stopped)rY tag_removeZ tag_prevrangerDminZ tag_namesgetr9r(search groupdictr:spanrNr)matchr2updater/rArB)r,nextitemheadtailrGZ lines_to_getokZmarkliner;mkeyvalueabZm1rrr rXsj          zColorDelegator.recolorize_maincCs|jD]}||ddqdS)zRemove all colorizing tags.r1r2N)r9ra)r,r;rrr removecolors's zColorDelegator.removecolors)N)N)N)N)__name__ __module__ __qualname____doc__r&r'r4r5r*rErIr8rSr7rPrXrtrrrr r%;s    "?r%c Csddlm}m}ddlm}||}|dtt| ddd\}}|d|d|d fd }||d d }|j dd d| d|| t |||} t} | | dS)Nr)ToplevelText) PercolatorzTest ColorDelegator+rMz 700x250+%d+%dabif True: int ('1') # keyword, builtin, string, comment elif False: print(0) else: float(None) if iF + If + IF: 'keyword matching must respect case' if'': x or'' # valid keyword-string no-space combinations async def f(): await g() # All valid prefixes for unicode and byte strings should be colored. 'x', '''x''', "x", """x""" r'x', u'x', R'x', U'x', f'x', F'x' fr'x', Fr'x', fR'x', FR'x', rf'x', rF'x', Rf'x', RF'x' b'x',B'x', br'x',Br'x',bR'x',BR'x', rb'x', rB'x',Rb'x',RB'x' # Invalid combinations of legal characters should be half colored. ur'x', ru'x', uf'x', fu'x', UR'x', ufr'x', rfu'x', xf'x', fx'x' Zwhite)rZboth)expandfillrE)tkinterryrzZidlelib.percolatorr{titlemapintZgeometrysplitpackrEZ focus_setr$r%Z insertfilter) parentryrzr{topxysourcer"pdrrr _color_delegator-s      r__main__)mainz idlelib.idle_test.test_colorizerr]) verbosityexit)run)rrrerVZidlelib.configrZidlelib.delegatorrrAr rcompileSr(r)r$r%rruZunittestrZidlelib.idle_test.htestrrrrr s&  s"