+
    i<  c                   sR   R t RRRRRRRRRRRR	R
RRRRRRRRR/t/ RRbRRbRRbRRbRRbRR	bRRbRRbRRbRRbRRbRRbR R bR!R!bR"R"bR#R#bR$R$b/ R%R%bR&R&bR'R'bR(R(bR)R)bR*R*bR+R+bR,R,bR-R-bR.R.bR/R/bR0R0bR1R1bR2R2bR3RbR4R4bR5R6bCR7RR8R8/Ct ! R9 R:]4      tR; R< ltR= R> ltRAR? ltR@# )Ban  
Keymap contains functions for parsing keyspecs and turning keyspecs into
appropriate sequences.

A keyspec is a string representing a sequence of key presses that can
be bound to a command. All characters other than the backslash represent
themselves. In the traditional manner, a backslash introduces an escape
sequence.

pyrepl uses its own keyspec format that is meant to be a strict superset of
readline's KEYSEQ format. This means that if a spec is found that readline
accepts that this doesn't, it should be logged as a bug. Note that this means
we're using the '\C-o' style of readline's keyspec, not the 'Control-o' sort.

The extension to readline is that the sequence \<KEY> denotes the
sequence of characters produced by hitting KEY.

Examples:
'a'      - what you get when you hit the 'a' key
'\EOA'  - Escape - O - A (up, on my terminal)
'\<UP>' - the up arrow key
'\<up>' - ditto (keynames are case-insensitive)
'\C-o', '\c-o'  - control-o
'\M-.'  - meta-period
'\E.'   - ditto (that's how meta works for pyrepl)
'\<tab>', '\<TAB>', '\t', '\011', '\x09', '\X09', '\C-i', '\C-I'
   - all of these are the tab character.
\Z'Z"ZaZZbZZeZfZnZ
rZtZ	ZvZZ	backspaceZdeleteZdownZendZenterZescapeZf1Zf2Zf3Zf4Zf5Zf6Zf7Zf8Zf9Zf10Zf11Zf12Zf13Zf14Zf15Zf16Zf17Zf18Zf19Zf20Zhomeinsertleftz	page downzpage upreturnrightZspaceZ ZtabZupc                   s    ] tR t^htRtR# )KeySpecError N)Z__name__Z
__module__Z__qualname__Z__firstlineno__Z__static_attributes__r
       '/usr/lib64/python3.14/_pyrepl/keymap.pyr	   r	   h   s    r   r	   c                sF    V ^8  d   QhR\         R\        \         ,          /# )   keysr   )strlistZformat   "r   __annotate__r   l   s      S T#Y r   c                sn    ^ p. pV\        V 4      8  d!   \        W4      w  r1VP                  V4       K0  V# )z3Parse keys in keyspec format to a sequence of keys.)len_parse_single_key_sequenceZextend)r   sr   Zks   &   r   
parse_keysr   l   s3    	AA
c$i-)$2	Hr   c                st    V ^8  d   QhR\         R\        R\        \        \         ,          \        3,          /# )r   keyr   r   )r   intZtupler   r   r   r   r   r   v   s3     L LC LC LE$s)S.4I Lr   c                 s|   ^ p^ pRpV'       Eg   V\        V 4      8  Ed   W,          R8X  Ed   W^,           ,          P                  4       pV\        9   d   \        V,          pV^,          pKh  VR8X  dr   W^,           ,          R8w  d%   \        RV^,           \	        V 4      3,          4      hV'       d%   \        RV^,           \	        V 4      3,          4      h^pV^,          pK  VR8X  ds   W^,           ,          R8w  d%   \        RV^,           \	        V 4      3,          4      hV'       d%   \        R	V^,           \	        V 4      3,          4      h^pV^,          pEKY  VP                  4       '       d4   W^,           V^,            p\        \        V^4      4      pV^,          pEK  VR
8X  d4   W^,           V^,            p\        \        V^4      4      pV^,          pEK  VR8X  d   V P                  RV4      pVR8X  d%   \        RV^,           \	        V 4      3,          4      hW^,           V P                  4       pV\        9  d%   \        RWA^,           \	        V 4      3,          4      h\        V,          pV^,           pEK  \        R\	        V4      V^,           \	        V 4      3,          4      hW,          pV^,          pEK  V'       dE   \        V4      ^8X  d   \        \        V4      ^,          4      pMVR9   d   RV 2pM\        R4      hV.V3pV'       d   V^ ,          P                  ^ R4       V# )i    Z r    cZ-z*\C must be followed by `-' (char %d of %s)zdoubled \C- (char %d of %s)Zmz*\M must be followed by `-' (char %d of %s)zdoubled \M- (char %d of %s)ZxZ<Z>z)unterminated \< starting at char %d of %sz*unrecognised keyname `%s' at char %d of %sz,unknown backslash escape %s at char %d of %szctrl z\C- followed by invalid keyr   i>   r   r   )r   Zlower_escapesr	   ZreprZisdigitZchrr   Zfind	_keynamesZordr   )	r   r   ZctrlZmetaZretr   r   r   Zresults	   &&       r   r   r   v   s   DD
Cca#c(l6T>E
  "AH}qkQc1u:$&Eq5$s),-  &6!a%c9KK  Qc1u:$&Eq5$s),-  &6!a%c9KK  QAA&#a)nQcAA&#a*oQcHHS!$7&Dq5$s),-  a%!n**,i'&DAtCy12   nE"BAwAtCy12 
 &CFAs8q=c#ho&C%%#-C=>>UAXFq	F#Mr   c                 s   / pV P                  4        FI  w  r4\        V\        4      '       d   VR ,          pM	V^ ,          pWBP                  V/ 4      VR,          &   KK  	  VP                  4        FR  w  r4W9   d;   \	        V4      ^8w  d   \        RVP                  4       : R24      hWA,          W#&   KE  \        WA4      W#&   KT  	  V# ):N   N:r   NNzkey definitions for z clash)ZitemsZ
isinstanceZbytesZ
setdefaultr   r	   Zvaluescompile_keymap)ZkeymapZemptyr   r   ZvalueZfirsts   &&    r   r   r      s    
Alln
c5!!GEFE+0UBB( % ggi
>5zQ"U\\^#UVV#E1AF   Hr   N)r   )Z__doc__r   r   Z	Exceptionr	   r   r   r   r
   r   r   <module>r      s  *< 	$%%h% F% 
5	%
 T% f% 	$% 	$% 	$% 	$% 	$% 	$% 	$% 	$% 	$%  
5!%" 
5#%$ 
5%%& 
5'%( 
5)%* 
5+%, 
5-%. 
5/%0 
51%2 
53%4 
55%6 F7%8 h9%: F;%< =%> y?%@ dA%B WC%D SE%F 
4$I%	P	9 	L^r   