HEX
Server: Apache/2.4.65 (Unix) OpenSSL/1.1.1k
System: Linux vps109042.inmotionhosting.com 4.18.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64
User: cisa (1010)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //opt/imh/python3.13/lib/python3.13/idlelib/__pycache__/pyparse.cpython-313.pyc
�

��e�M��F�SrSSKr\"S5urrrrr\R"S\R\R-5Rr\R"S\R5Rr\R"S\R\R-5Rr\R"S\R5Rr\R"S\R5Rr\R"S	\R5Rr"S
S\5r\R-\"S5S
5r\R1SS55 \R1SS55 \R1SS55 "SS5r\S:XaSSKJr \"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��\rSrSrSrSrSrg)�ParseMap�faTDict 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)N�x�)�self�keys  �5/opt/imh/python3.13/lib/python3.13/idlelib/pyparse.py�__missing__�ParseMap.__missing__rs���r	N)�__name__�
__module__�__qualname__�__firstlineno__�__doc__r
�__static_attributes__r	rrrrfs��	�rr�rc#�N# �UHn[U5[S54v� M g7f)�(N��ord��.0�cs  r�	<genexpr>rx����/��A�c�!�f�c�#�h�
����#%z({[c#�N# �UHn[U5[S54v� M g7f)�)Nrrs  rrryrr z)}]c#�N# �UHn[U5[U54v� M g7f�Nrrs  rrrzs���2�z�!�c�!�f�c�!�f�
�z�r z"'\
#c�h�\rSrSrSrSrSrSrSrSr	Sr
S	rS
rSr
SrS
rSrSrSrg)�Parser�}c��XlX lgr$)�indentwidth�tabwidth)r
r)r*s   r�__init__�Parser.__init__s
��&�� �
rc�R�[U5S:XdUSS:XdeXlSUlg)Nr����
)�len�code�study_level)r
�ss  r�set_code�Parser.set_code�s*���1�v��{�a��e�t�m�+�+��	���rc�\�URSp2[U5n[S5HvnURSSU5nUS:a O\URSSU5S-n[	X&U5nU(a-U"UR55(dUR5n OUnMx Uc?[	U5nU(a+U"UR55(dUR5nU$US-n[	X&5=n(a5UR
5up�U"U5(dUn[	X&5=n(aM5U$)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.
Nrz:
rr/�)r1r0�range�rfind�_synchre�start�span)	r
�is_char_in_stringr1�pos�limit�tries�i�mr3s	         r�find_good_parse_start�Parser.find_good_parse_start�s���I�I�t�c�
�D�	���1�X�E��
�
�5�!�U�+�A��1�u���
�
�4��A�&��*�A���%�(�A��*�1�7�7�9�5�5��g�g�i����E���;����A��*�1�7�7�9�5�5��g�g�i���J�
�!�G���D�$�$�a�$��6�6�8�D�A�$�Q�'�'����D�$�$�a�$��
rc�v�US:XdURUS-
S:XdeUS:�aURUSUlgg)zgThrow away the start of the string.

Intended to be called with the result of find_good_parse_start().
rr7r/N)r1)r
�los  r�set_lo�
Parser.set_lo�sA��
�Q�w�$�)�)�B�q�D�/�T�1�1�1�
��6��	�	�"�#��D�I�rc��URS:�agSUlURnUR[5nUR	SS5nUR	SS5nUR	SS5nUR	SS5nUR	SS5n[
nS	=p4S	/=UlnURnS	[U5p�Xx:GakXn	US-nU	S:XaMU	S:XaUS-nUS	:XaU"U5 M2U	S
:XaUS-nM?U	S:XaU(aUS-
nMSU	S:XdU	S
:Xa�U	n
XS-
US-U
S-:XaU
S-n
Un[U
5S-
nX|-nXx:amXn	US-nU	S:XaMXS-
X|-U
:XaX|-nO`U	S:XaUS-nUS	:XaUS	:XaU"U5 O@MJU	S:XaXx:deXS:XaUS-nUS-nMkXx:aMmUS-
U:Xa[nO[nGMU	S:XaURSU5nUS	:�deGM9U	S:XdeXx:deXS:XaUS-nUS-U:Xa[nUS-nXx:aGMkU[:waU[:waUS	:�a[nX lU[
:HUSU:H:XdeUSU:wa	U"U5 gg)z�Find the line numbers of non-continuation lines.

As quickly as humanly possible <wink>, find the line numbers (0-
based) of the non-continuation lines.
Creates self.{goodlines, continuation}.
r7N�xxxxxxxx�x�xxxx�xxz
xr/rrr"�"�'���\�#r.)r2r1�	translate�trans�replace�C_NONE�	goodlines�appendr0�C_STRING_FIRST_LINE�C_STRING_NEXT_LINES�find�C_BACKSLASH�	C_BRACKET�continuation)
r
r1r_�level�lnorX�	push_goodrA�n�ch�quote�firstlno�ws
             r�_study1�Parser._study1�s������q� ������y�y���~�~�e�$���|�|�J��,���|�|�F�C�(���|�|�D�#�&���|�|�D�#�&���|�|�E�4�(�������&'�S�(�����$�$�	��#�d�)�1��e���B��!��A��S�y���T�z��A�g���A�:��c�N���S�y���	����S�y��!�A�I�E���S�y�B�#�I����!��A�a�C�=�E�A�I�-�!�A�I�E�����J��N���C���e���B��!��A��S�y� ��a�C���}��-��C����T�z�!�A�g����6�$��z� )�#��!� ��T�z� �u��u��7�d�?�"%��'�C��a�C�� �3�e�@�a��H�,�(;��':����S�y��I�I�d�A�&���A�v�
�v����:��:��5�L�5��w�$���A�g���Q�3�!�8�#.�L��!��A�k�e�t
�/�/�� 3�3���	�$�L�(����&�I�b�M�S�,@�A�A�A��R�=�C���c�N� rc�:�UR5 UR$r$)rhr_�r
s r�get_continuation_type�Parser.get_continuation_typeKs������� � � rc��URS:�agUR5 SUlURURp![	U5S-
n[	U5nU(a^U(deUn[X#S-
X#5HnUR
SSUS-
5S-nM [X5(aUS-
nOO	U(aM^US:Xa
US:XdeUnUWsUlUl	Sn/nURn	US4/n
XE:Ga�[XU5nU(aHUR5nUS-
nX4:�aXS;aUS-
nX4:�a
XS;aMX4:�aXnUnXE:�aGOcXn
U
S;a-U	"U5 U
RU[	U545 U
nUS-nM�U
S	;a/U(aUS
	U
nUS-nU
RU[	U545 M�U
S:XdU
S:XaZU
RU[	U5S-45 U
n[XU5R5nU
RU[	U545 GM3U
S
:Xa[U
RU[	U5S-45 URSXE5S-nUS:�deU
RU[	U545 GM�U
S:XdeUS-nXE:deXS:waX�U-nUS-nXE:aGM�XplU(aUS
OSUl[#U
5Ulg)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
rPNr7r/r�� 	
�([{�)]}r.rNrOrSrR)r2rhr1rXr0r8r9�_junkre�
stmt_start�stmt_endrY�_chew_ordinaryre�end�_match_stringrer\�lastch�lastopenbracketpos�tuple�stmt_bracketing)r
r1rXrA�p�q�nothingry�stack�
push_stack�
bracketingrB�newprds              r�_study2�Parser._study2Os���&���q� ����������)�)�T�^�^�i��	�N�Q�����I����H�1��A� ��Q�3����>���J�J�t�Q��!��,�q�0��?�
�� � ��a�C����a�
��6���6�M�6��A�)*�A�&����������\�\�
��!�f�X�
��e� ��!�,�A���u�u�w���1�H���f���G�!3��!��A��f���G�!3��6�!�W�F����6����B��U�{��1�
��!�!�1�c�%�j�/�2����a�C����U�{���b�	����a�C���!�!�1�c�%�j�/�2���S�y�B�#�I��!�!�1�c�%�j��l�"3�4���#�D�Q�/�3�3�5���!�!�1�c�%�j�/�2���S�y��!�!�1�c�%�j��l�"3�4��I�I�d�A�)�A�-���1�u��u��!�!�1�c�%�j�/�2����:��:��!��A��5�L�5��w�$���1�g����!��A�{�e�B��/4�%��)�$���$�Z�0��rc��UR5 UR[:XdeURnURn[U5nUR
SSU5S-=pEUS-nX:aE[X!5nU(aUR5S-
nSnOCURSU5S-=pQX:aMEU=pX!S;aUS-nX!S;aMURn[X%URUR55U-$)z`Return number of spaces the next line should be indented.

Line continuation must be C_BRACKET.
r/rr7� 	)
r�r_r^rzr1r0r9�_itemrerwr\r)�
expandtabsr*)r
�jr1rc�origirArB�extras        r�compute_bracket_indent�Parser.compute_bracket_indent�s��
	
����� � �I�-�-�-��#�#���y�y����I���J�J�t�Q��*�Q�.�.��
�a�C���e��� �A���E�E�G�a�K������	�	�$��*�Q�.�.���e��M�A��'�U�"��a�C���'�U�"��$�$�E��4�!�9�'�'��
�
�6�7�%�?�?rc�P�UR5 URnUSUS-
$)z�Return number of physical lines in last stmt.

The statement doesn't have to be an interesting statement.  This is
intended to be called when continuation is C_BACKSLASH.
r.���)rhrX)r
rXs  r�get_num_lines_in_stmt�Parser.get_num_lines_in_stmt�s)��	
�����N�N�	���}�y��}�,�,rc��UR5 UR[:XdeURnURnXS;aUS-nXS;aMUnURSU5S-nS=pVX$:a�XnUS;aUS-nUS-nOvUS;aU(aUS-
nUS-nO^US:XdUS:Xa[
XU5R5nO7US	:XaO7US:Xa%US
:XaUS:XdXS-
S;aXS-S
:waSnOUS-nX$:aM�U(a US-n[R"SXU5S
LnU(dUnXS;aUS-nXS;aM[XRURUR55S-$)z�Return number of spaces the next line should be indented.

Line continuation must be C_BACKSLASH.  Also assume that the new
line is the first one following the initial line of the stmt.
r�r7r/rrqrrrNrOrS�=z=<>!z\s*\\Nrp)
r�r_r]r1rtr\rxrw�re�matchr0r�r*)r
r1rA�startpos�endpos�foundr`rds        r�compute_backslash_indent�Parser.compute_backslash_indent�s���	
����� � �K�/�/�/��y�y���O�O���g����!��A��g��������4��*�Q�.������j���B��U�{���	���a�C���u���!�A�I�E��a�C���s��b�C�i�#�D�V�4�8�8�:���s����!���c�	���F�d�Q�3�i�v�5��!��9��#�����a�C��+�j�.��!��A��H�H�X�t�f�~�6�$�>�E���A��'��(��a�C���'��(��4����*�5�5�%)�]�]�4�5�78�9�	9rc��UR5 URURp!UnURnX2:aXCS;aUS-nX2:a
XCS;aMXAU$)zPReturn the leading whitespace on the initial line of the last
interesting stmt.
r�r7)r�rtrur1)r
rArcr�r1s     r�get_base_indent_string�Parser.get_base_indent_string,s[��	
��������
�
�1�
���y�y���e���5�(��A��A��e���5�(��a�y�rc�@�UR5 URS:H$)z<Return True if the last interesting statement opens a block.�:)r�ryrks r�is_block_opener�Parser.is_block_opener8s�������{�{�c�!�!rc�f�UR5 [URUR5SL$)z=Return True if the last interesting statement closes a block.N)r��_closerer1rtrks r�is_block_closer�Parser.is_block_closer=s%��������	�	�4�?�?�3�4�?�?rc�:�UR5 UR$)zzReturn bracketing structure of the last interesting statement.

The returned tuple is in the format defined in _study2().
)r�r|rks r�get_last_stmt_bracketing�Parser.get_last_stmt_bracketingBs��
	
�����#�#�#r)r1r_rXr)ryrzr|rurtr2r*N)rrrrr+r4rCrGrhrlr�r�r�r�r�r�r�r�rr	rrr&r&}sP��!��
2�h'�D�L!�y1�v@�>-�79�r
�"�
@�
$rr&�__main__)�mainzidlelib.idle_test.test_pyparserP)�	verbosity)rr�r8rWr]rZr[r^�compile�VERBOSE�	MULTILINE�searchr:r�rs�DOTALLrxr�r�rv�dictr�fromkeysrU�updater&r�unittestr�r	rr�<module>r�s����
�$)��8�!���)��i��:�:��&�Z�Z�"�,�,��' �&!'��'	�.
�*�*���Z�Z�	���	��*�*�� �Z�Z�"�)�)��!� #�U�!�*
�*�*���Z�Z������:�:�	��Z�Z�	���	� �:�:���Z�Z�����

�t�
�"	���%��*�c�*�����/��/�/����/��/�/����2�z�2�2�K$�K$�\�z����	)�Q�7�r