Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 13.59.22.143
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : pyparse.cpython-311.pyc
�

Tf�M���dZddlZed��\ZZZZZejdej	ej
z��jZejdej	��j
Zejdej	ejz��j
Zejdej	��j
Zejdej	��j
Zejd	ej	��j
ZGd
�de��Ze�ed��d
��Ze�d�dD����e�d�dD����e�d�dD����Gd�d��ZedkrddlmZedd���dSdS)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��eZdZdZd�ZdS)�ParseMapapDict 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��dS)N�x�)�self�keys  �8/usr/local/python-3.11/lib/python3.11/idlelib/pyparse.py�__missing__zParseMap.__missing__rs���s�N)�__name__�
__module__�__qualname__�__doc__rrr
rrrfs-������	�	�����r
r�rc#�RK�|]"}t|��td��fV��#dS)�(N��ord��.0�cs  r�	<genexpr>rx�3����/�/�A�c�!�f�f�c�#�h�h�
�/�/�/�/�/�/r
z({[c#�RK�|]"}t|��td��fV��#dS)�)Nrrs  rrryrr
z)}]c#�RK�|]"}t|��t|��fV��#dS�Nrrs  rrrzs3����2�2�!�c�!�f�f�c�!�f�f�
�2�2�2�2�2�2r
z"'\
#c�b�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�ZdS)�Parserc�"�||_||_dSr)�indentwidth�tabwidth)r	r#r$s   r�__init__zParser.__init__s��&��� ��
�
�
r
c�d�t|��dks|ddksJ�||_d|_dS)Nr����
)�len�code�study_level)r	�ss  r�set_codezParser.set_code�s7���1�v�v��{�{�a��e�t�m�m�m�+���	�����r
c��|jd}}t|��}td��D]�}|�dd|��}|dkrnc|�dd|��dz}t	|||��}|r3||�����s|���}n|}��|�Dt	|��}|r1||�����s|���}|S|dz}t	||��x}r6|���\}}||��s|}t	||��x}�6|S)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(�)r*r)�range�rfind�_synchre�start�span)	r	�is_char_in_stringr*�pos�limit�tries�i�mr,s	         r�find_good_parse_startzParser.find_good_parse_start�sm���I�t�c��
�D�	�	���1�X�X�		�		�E��
�
�5�!�U�+�+�A��1�u�u����
�
�4��A�&�&��*�A���q�%�(�(�A��
�*�*�1�7�7�9�9�5�5�
��g�g�i�i�����E�E��;�����A��
 �*�*�1�7�7�9�9�5�5�
 ��g�g�i�i���J�
�!�G���D�!�$�$�$�a�	��6�6�8�8�D�A�q�$�$�Q�'�'�
����D�!�$�$�$�a�	��
r
c�v�|dks|j|dz
dksJ�|dkr|j|d�|_dSdS)zx Throw away the start of the string.

        Intended to be called with the result of find_good_parse_start().
        rr/r(N)r*)r	�los  r�set_loz
Parser.set_lo�sL��
�Q�w�w�$�)�B�q�D�/�T�1�1�1�1�
��6�6��	�"�#�#��D�I�I�I��6r
c��|jdkrdSd|_|j}|�t��}|�dd��}|�dd��}|�dd��}|�dd��}|�dd��}t
}d	x}}d	gx|_}|j}d	t|��}}||k�r�||}	|dz}|	dkr�|	dkr|dz}|d	kr||���8|	d
kr|dz}�D|	dkr|r|dz
}�R|	dks|	d
kr�|	}
||dz
|dz�|
dzkr|
dz}
|}t|
��dz
}||z}||kr}||}	|dz}|	dkr�||dz
||z�|
kr||z}ng|	dkr|dz}|d	kr|d	kr||��nD�X|	dkr||ksJ�||dkr|dz}|dz}�}||k�}|dz
|krt}nt}��2|	dkr |�d|��}|d	ksJ���X|	dksJ�||ksJ�||dkr|dz}|dz|krt}|dz}||k���|tkr|tkr
|d	krt}||_|t
k|d|kksJ�|d|kr
||��dSdS)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}.
        r/N�xxxxxxxx�x�xxxx�xxz
xr(rrr�"�'���\�#r')r+r*�	translate�trans�replace�C_NONE�	goodlines�appendr)�C_STRING_FIRST_LINE�C_STRING_NEXT_LINES�find�C_BACKSLASH�	C_BRACKET�continuation)
r	r*rU�level�lnorN�	push_goodr9�n�ch�quote�firstlno�ws
             r�_study1zParser._study1�s�����q� � ��F�����y���~�~�e�$�$���|�|�J��,�,���|�|�F�C�(�(���|�|�D�#�&�&���|�|�D�#�&�&���|�|�E�4�(�(��������&'�S�(�����$�	��#�d�)�)�1���!�e�e��a��B��!��A��S�y�y���T�z�z��A�g���A�:�:��I�c�N�N�N���S�y�y���	����S�y�y��&�!�A�I�E���S�y�y�B�#�I�I�����!��A�a�C��=�E�A�I�-�-�!�A�I�E�����J�J��N���a�C���!�e�e��a��B��!��A��S�y�y� ��A�a�C��!��G�}��-�-��a�C����T�z�z�!�A�g����6�6�$��z�z� )�	�#����!� ��T�z�z� �1�u�u�u�u���7�d�?�?�"%��'�C��a�C�� �3�!�e�e�@�a��H�,�,�(;���':����S�y�y��I�I�d�A�&�&���A�v�v�v�v����:�:�:�:��q�5�5�5�5��A�w�$����A�g���Q�3�!�8�8�#.�L��!��A�k�!�e�e�t
�/�/�/�� 3�3�3���	�	�$�L�(�����&�I�b�M�S�,@�A�A�A�A��R�=�C����I�c�N�N�N�N�N� �r
c�8�|���|jSr)r^rU�r	s r�get_continuation_typezParser.get_continuation_typeKs��������� � r
c�P�|jdkrdS|���d|_|j|j}}t	|��dz
}t	|��}|r^|sJ�|}t||dz
||��D]}|�dd|dz
��dz}� t||��r|dz
}nn|�^|dkr
|dksJ�|}||c|_|_	d}g}|j
}	|dfg}
||k�rt|||��}|rV|���}|dz
}||kr||dvr|dz
}||kr
||dv�||kr||}|}||kr�n�||}
|
dvr7|	|��|
�
|t	|��f��|
}|dz}��|
d	vr1|r|d
=|
}|dz}|
�
|t	|��f����|
dks|
dkrr|
�
|t	|��dzf��|
}t|||�����}|
�
|t	|��f����f|
d
kro|
�
|t	|��dzf��|�d||��dz}|dksJ�|
�
|t	|��f�����|
dksJ�|dz}||ksJ�||dkr|
||z}|dz}||k��||_|r|d
nd|_t#|
��|_dS)am
        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
        rFNr/r(r�� 	
�([{�)]}r'rDrErIrH)r+r^r*rNr)r0r1�_junkre�
stmt_start�stmt_endrO�_chew_ordinaryre�end�_match_stringrerR�lastch�lastopenbracketpos�tuple�stmt_bracketing)r	r*rNr9�p�q�nothingrm�stack�
push_stack�
bracketingr:�newprZs              r�_study2zParser._study2Os���&��q� � ��F�����������)�T�^�i���	�N�N�Q�����I�I���
	��H�H�1��A� ��1�Q�3���1��>�>�
1�
1���J�J�t�Q��!��,�,�q�0�����a� � �
��a�C�����
	�
��6�6���6�6�6�6��A�)*�A�&����������\�
��!�f�X�
��!�e�e� ��q�!�,�,�A��
��u�u�w�w���1�H���1�f�f��a��G�!3�!3��!��A��1�f�f��a��G�!3�!3���6�6�!�!�W�F�����6�6���a��B��U�{�{��
�1�
�
�
��!�!�1�c�%�j�j�/�2�2�2����a�C����U�{�{��"��b�	����a�C���!�!�1�c�%�j�j�/�2�2�2���S�y�y�B�#�I�I��!�!�1�c�%�j�j��l�"3�4�4�4���#�D�!�Q�/�/�3�3�5�5���!�!�1�c�%�j�j�/�2�2�2���S�y�y��!�!�1�c�%�j�j��l�"3�4�4�4��I�I�d�A�q�)�)�A�-���1�u�u�u�u��!�!�1�c�%�j�j�/�2�2�2����:�:�:�:��!��A��q�5�5�5�5��A�w�$����d�1�g����!��A�{�!�e�e�B���/4�">�%��)�)�$���$�Z�0�0����r
c��|���|jtksJ�|j}|j}t|��}|�dd|��dzx}}|dz}||krMt||��}|r|���dz
}d}nE|�	d|��dzx}}||k�M|x}}||dvr|dz}||dv�|j
}t|||��|j����|zS)zpReturn number of spaces the next line should be indented.

        Line continuation must be C_BRACKET.
        r(rr/� 	)
rxrUrTrnr*r)r1�_itemrerkrRr#�
expandtabsr$)r	�jr*rY�origir9r:�extras        r�compute_bracket_indentzParser.compute_bracket_indent�s1��
	
������� �I�-�-�-�-��#���y����I�I���J�J�t�Q��*�*�Q�.�.���
�a�C���!�e�e���a� � �A��
/��E�E�G�G�a�K������	�	�$��*�*�Q�.�.��A��!�e�e��M�A���q�'�U�"�"��a�C���q�'�U�"�"��$�E��4��!��9�'�'��
�6�6�7�7�%�?�?r
c�Z�|���|j}|d|dz
S)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'���)r^rN)r	rNs  r�get_num_lines_in_stmtzParser.get_num_lines_in_stmt�s+��	
�������N�	���}�y��}�,�,r
c��|���|jtksJ�|j}|j}||dvr|dz}||dv�|}|�d|��dz}dx}}||kr�||}|dvr|dz}|dz}n~|dvr
|r|dz
}|dz}nm|dks|dkr$t
|||�����}n=|d	krn<|dkr+|d
kr%|dks
||dz
dvr||dzd
krd}n|dz}||k��|r$|dz}tj	d|||���d
u}|s|}||dvr|dz}||dv�t||j|��|j����dzS)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.
        rzr/r(rrerfrDrErI�=z=<>!z\s*\\Nrd)
rxrUrSr*rhrRrlrk�re�matchr)r|r$)r	r*r9�startpos�endpos�foundrVrZs        r�compute_backslash_indentzParser.compute_backslash_indent�s��	
������� �K�/�/�/�/��y���O���1�g�����!��A��1�g���������4��*�*�Q�.�������&�j�j��a��B��U�{�{���	���a�C����u����&�!�A�I�E��a�C����s���b�C�i�i�#�D�!�V�4�4�8�8�:�:����s�����!����c�	�	���F�F�d�1�Q�3�i�v�5�5���!��9��#�#�����a�C��+�&�j�j�.�	?��!��A��H�X�t�A�f�H�~�6�6�$�>�E��	��A��q�'��(�(��a�C���q�'��(�(��4����)�*�5�5�%)�]�4�4�5�5�78�9�	9r
c��|���|j|j}}|}|j}||kr||dvr|dz}||kr
||dv�|||�S)z`Return the leading whitespace on the initial line of the last
        interesting stmt.
        rzr/)rxrhrir*)r	r9rYr}r*s     r�get_base_indent_stringzParser.get_base_indent_string,sq��	
���������
�1��
���y���!�e�e��Q��5�(�(��A��A��!�e�e��Q��5�(�(��A�a�C�y�r
c�@�|���|jdkS)z<Return True if the last interesting statement opens a block.�:)rxrmr`s r�is_block_openerzParser.is_block_opener8s���������{�c�!�!r
c�b�|���t|j|j��duS)z=Return True if the last interesting statement closes a block.N)rx�_closerer*rhr`s r�is_block_closerzParser.is_block_closer=s(����������	�4�?�3�3�4�?�?r
c�8�|���|jS)z�Return bracketing structure of the last interesting statement.

        The returned tuple is in the format defined in _study2().
        )rxrpr`s r�get_last_stmt_bracketingzParser.get_last_stmt_bracketingBs��
	
�������#�#r
N)rrrr%r-r;r>r^rarxr�r�r�r�r�r�r�rr
rr!r!}s�������!�!�!����
2�2�2�h'�'�'�D�D�D�L!�!�!�y1�y1�y1�v@�@�@�>-�-�-�79�79�79�r
�
�
�"�"�"�
@�@�@�
$�$�$�$�$r
r!�__main__)�mainzidlelib.idle_test.test_pyparserF)�	verbosity)rr�r0rMrSrPrQrT�compile�VERBOSE�	MULTILINE�searchr2r�rg�DOTALLrlr{r�rj�dictr�fromkeysrK�updater!r�unittestr�rr
r�<module>r�sX����
�	�	�	�$)�5��8�8�!���)��i��2�:��&�Z�"�,��' � �&!'�'	�.�"�*���Z�	���	��"�*�� �Z�"�)��!�� #�!�*�"�*���Z������2�:�	��Z�	�	��	� �2�:���Z�����

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