Hacked By AnonymousFox

Current Path : /proc/thread-self/root/proc/self/root/opt/alt/python311/lib64/python3.11/lib2to3/pgen2/__pycache__/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/opt/alt/python311/lib64/python3.11/lib2to3/pgen2/__pycache__/pgen.cpython-311.pyc

�

c��f6���ddlmZmZmZGd�dej��ZGd�de��ZGd�de��ZGd�d	e��Z	d
d�Z
dS)�)�grammar�token�tokenizec��eZdZdS)�PgenGrammarN)�__name__�
__module__�__qualname__���9/opt/alt/python311/lib64/python3.11/lib2to3/pgen2/pgen.pyrrs�������Drrc�~�eZdZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zdd�Zd�Zd�ZdS)�ParserGeneratorNc�N�d}|�t|d���}|j}||_||_t	j|j��|_|���|�	��\|_
|_|�
|��i|_|�
��dS)Nzutf-8)�encoding)�open�close�filename�streamr�generate_tokens�readline�	generator�gettoken�parse�dfas�startsymbol�first�addfirstsets)�selfrr�close_streams    r
�__init__zParserGenerator.__init__s������>��(�W�5�5�5�F�!�<�L� ��
����!�1�&�/�B�B����
�
����&*�j�j�l�l�#��	�4�#��#��L�N�N�N���
��������rc	��t��}t|j�����}|���|�|j��|�d|j��|D]-}dt|j	��z}||j	|<||j
|<�.|D�]}|j|}g}|D]�}g}t|j�
����D]C\}	}
|�|�||	��|�|
��f���D|jr*|�d|�|��f��|�|����|j�|��||�||��f|j|j	|<��|j	|j|_|S)N��)r�listr�keys�sort�remover�insert�len�
symbol2number�
number2symbol�sorted�arcs�items�append�
make_label�index�isfinal�states�
make_first�start)r�c�names�name�i�dfar4�stater.�label�nexts           r
�make_grammarzParserGenerator.make_grammars����M�M���T�Y�^�^�%�%�&�&��
�
�
����
���T�%�&�&�&�
���Q��(�)�)�)��	&�	&�D��c�!�/�*�*�*�A�$%�A�O�D�!�!%�A�O�A����	O�	O�D��)�D�/�C��F��
$�
$����#)�%�*�*:�*:�*<�*<�#=�#=�N�N�K�E�4��K�K�����E�!:�!:�C�I�I�d�O�O� L�M�M�M�M��=�7��K�K��C�I�I�e�$4�$4� 5�6�6�6��
�
�d�#�#�#�#�
�H�O�O�F�#�#�#�-3�T�_�_�Q��5M�5M�,N�A�F�1�?�4�(�)�)��/�$�"2�3����rc�~�|j|}i}t|��D]}|�||��}d||<�|S�Nr)rr-r1)rr7r9�rawfirstrr=�ilabels       r
r5zParserGenerator.make_first4sM���:�d�#�����H�%�%�	�	�E��_�_�Q��.�.�F��E�&�M�M��rc���t|j��}|d���r�||jvrI||jvr
|j|S|j�|j|df��||j|<|St
t|d��}t|t��s
J|���|tj
vs
J|���||jvr
|j|S|j�|df��||j|<|S|ddvs
J|���t|��}|d���rH||j
vr
|j
|S|j�tj|f��||j
|<|Stj|}||jvr
|j|S|j�|df��||j|<|S)Nr#)�"�')r*�labels�isalphar+�symbol2labelr0�getattrr�
isinstance�int�tok_name�tokens�eval�keywords�NAMEr�opmap)rr7r=rC�itoken�values      r
r1zParserGenerator.make_label=s����Q�X������8�����)	"����'�'��A�N�*�*��>�%�0�0��H�O�O�Q�_�U�%;�T�$B�C�C�C�,2�A�N�5�)�!�M�!���t�4�4��!�&�#�.�.�5�5��5�5�.����/�/�/��/�/�/��Q�X�%�%��8�F�+�+��H�O�O�V�T�N�3�3�3�'-�A�H�V�$�!�M���8�z�)�)�)�5�)�)�)���K�K�E��Q�x���!�!�
"��A�J�&�&��:�e�,�,��H�O�O�U�Z��$7�8�8�8�(.�A�J�u�%�!�M�!��u�-���Q�X�%�%��8�F�+�+��H�O�O�V�T�N�3�3�3�'-�A�H�V�$�!�Mrc��t|j�����}|���|D] }||jvr|�|���!dS�N)r%rr&r'r�	calcfirst)rr8r9s   r
rzParserGenerator.addfirstsetsksa���T�Y�^�^�%�%�&�&��
�
�
�����	%�	%�D��4�:�%�%����t�$�$�$��	%�	%rc
�.�|j|}d|j|<|d}i}i}|j���D]�\}}||jvrh||jvr"|j|}|�t	d|z���n"|�|��|j|}|�|��|||<�vd||<|di||<��i}	|���D]4\}}
|
D],}||	vr!t	d|�d|�d|�d|	|�����||	|<�-�5||j|<dS)Nr#zrecursion for rule %rrzrule z is ambiguous; z is in the first sets of z as well as )rrr.r/�
ValueErrorrW�update)rr9r;r<�totalset�overlapcheckr=r>�fset�inverse�itsfirst�symbols            r
rWzParserGenerator.calcfirstss����i��o����
�4���A������� �:�+�+�-�-�
	1�
	1�K�E�4���	�!�!��D�J�&�&��:�e�,�D��|�(�)@�4�)G�H�H�H�$��N�N�5�)�)�)��:�e�,�D�����%�%�%�&*��U�#�#�"#����',�a�j��U�#�#���+�1�1�3�3�	(�	(�O�E�8�"�
(�
(���W�$�$�$�*�&*�d�d�F�F�F�E�E�E�7�6�?�?�&L�M�M�M�#(�����
(�$��
�4���rc�t�i}d}|jtjk�r|jtjkr)|���|jtjk�)|�tj��}|�tjd��|���\}}|�tj��|�	||��}t|��}|�|��t|��}|||<|�|}|jtjk��||fS)N�:)�typer�	ENDMARKER�NEWLINEr�expectrQ�OP�	parse_rhs�make_dfar*�simplify_dfa)	rrrr9�a�zr;�oldlen�newlens	         r
rzParserGenerator.parse�s	�������i�5�?�*�*��)�u�}�,�,��
�
�����)�u�}�,�,��;�;�u�z�*�*�D��K�K���#�&�&�&��>�>�#�#�D�A�q��K�K��
�&�&�&��-�-��1�%�%�C���X�X�F����c�"�"�"���X�X�F��D��J��"�"��#�i�5�?�*�*�$�[� � rc
���t|t��sJ�t|t��sJ��fd�}�fd��t||��|��g}|D]�}i}|jD]1}|jD]'\}}	|� �|	|�|i�����(�2t
|�����D]R\}}
|D]}|j|
krn&�t|
|��}|�|��|�	||���S��|S)Nc�$��i}�||��|SrVr)r<�base�
addclosures  �r
�closurez)ParserGenerator.make_dfa.<locals>.closure�s����D��J�u�d�#�#�#��Krc���t|t��sJ�||vrdSd||<|jD]\}}|��||���dSrA)rK�NFAStater.)r<rqr=r>rrs    �r
rrz,ParserGenerator.make_dfa.<locals>.addclosure�sg����e�X�.�.�.�.�.���}�}����D��K�$�z�
+�
+���t��=��J�t�T�*�*�*��
+�
+r)
rKru�DFAState�nfasetr.�
setdefaultr-r/r0�addarc)
rr6�finishrsr4r<r.�nfastater=r>rw�strrs
            @r
rizParserGenerator.make_dfa�s{���
�%��*�*�*�*�*��&�(�+�+�+�+�+�	�	�	�	�	�	+�	+�	+�	+�	+��7�7�5�>�>�6�2�2�3���
	(�
	(�E��D�!�L�
E�
E��#+�=�E�E�K�E�4��(�"�
�4������)C�)C�D�D�D��E�"(��
�
���!5�!5�
(�
(�
��v� �&�&�B��y�F�*�*���+�"�&�&�1�1�B��M�M�"�%�%�%����R��'�'�'�'�
(��
rc�l�td|��|g}t|��D]�\}}td|||urdpd��|jD]l\}}||vr|�|��}	n$t	|��}	|�|��|�td|	z���Xtd||	fz���m��dS)NzDump of NFA for�  State�(final)�z	    -> %d�    %s -> %d)�print�	enumerater.r2r*r0)
rr9r6rz�todor:r<r=r>�js
          r
�dump_nfazParserGenerator.dump_nfa�s���
���&�&�&��w��!�$���	7�	7�H�A�u��)�Q���� =�I� C��D�D�D�$�z�	
7�	
7���t��4�<�<��
�
�4�(�(�A�A��D�	�	�A��K�K��%�%�%��=��+��/�*�*�*�*��.�E�1�:�5�6�6�6�6�	
7�	7�	7rc	�*�td|��t|��D]r\}}td||jrdpd��t|j�����D],\}}td||�|��fz���-�sdS)NzDump of DFA forr~rr�r�)r�r�r3r-r.r/r2)rr9r;r:r<r=r>s       r
�dump_dfazParserGenerator.dump_dfa�s���
���&�&�&�!�#���	A�	A�H�A�u��)�Q��
� ;�)� A�r�B�B�B�%�e�j�&6�&6�&8�&8�9�9�
A�
A���t��n��s�y�y����'?�?�@�@�@�@�
A�	A�	Arc���d}|rnd}t|��D]X\}}t|dzt|����D]2}||}||kr"||=|D]}|�||���d}n�3�Y|�ldSdS)NTFr)r��ranger*�
unifystate)rr;�changesr:�state_ir��state_jr<s        r
rjzParserGenerator.simplify_dfa�s������	��G�'��n�n�	
�	
�
��7��q��s�C��H�H�-�-���A�!�!�f�G��'�)�)���F�%(�?�?�E�!�,�,�W�g�>�>�>�>�"&����
*���	�	�	�	�	rc��|���\}}|jdkr||fSt��}t��}|�|��|�|��|jdkr`|���|���\}}|�|��|�|��|jdk�`||fS)N�|)�	parse_altrTruryr)rrkrl�aa�zzs     r
rhzParserGenerator.parse_rhs�s����~�~�����1��:�����a�4�K����B����B��I�I�a�L�L�L�
�H�H�R�L�L�L��*��#�#��
�
�����~�~�'�'���1��	�	�!�����������	�*��#�#�
�r�6�Mrc�4�|���\}}|jdvs|jtjtjfvrV|���\}}|�|��|}|jdv�7|jtjtjfv�V||fS)N)�(�[)�
parse_itemrTrcrrQ�STRINGry)rrk�br7�ds     r
r�zParserGenerator.parse_alt
s������ � ���1��z�Z�'�'��y�U�Z���6�6�6��?�?�$�$�D�A�q�
�H�H�Q�K�K�K��A�	�z�Z�'�'��y�U�Z���6�6�6��!�t�rc��|jdkrd|���|���\}}|�tjd��|�|��||fS|���\}}|j}|dvr||fS|���|�|��|dkr||fS||fS)Nr��])�+�*r�)rTrrhrfrrgry�
parse_atom)rrkrlrTs    r
r�zParserGenerator.parse_items����:�����M�M�O�O�O��>�>�#�#�D�A�q��K�K���#�&�&�&�
�H�H�Q�K�K�K��a�4�K��?�?�$�$�D�A�q��J�E��J�&�&��!�t���M�M�O�O�O�
�H�H�Q�K�K�K���|�|��!�t���!�t�rc���|jdkrO|���|���\}}|�tjd��||fS|jtjtjfvrOt��}t��}|�
||j��|���||fS|�d|j|j��dS)Nr��)z+expected (...) or NAME or STRING, got %s/%s)rTrrhrfrrgrcrQr�rury�raise_error)rrkrls   r
r�zParserGenerator.parse_atom(s����:�����M�M�O�O�O��>�>�#�#�D�A�q��K�K���#�&�&�&��a�4�K�
�Y�5�:�u�|�4�
4�
4��
�
�A��
�
�A�
�H�H�Q��
�#�#�#��M�M�O�O�O��a�4�K����J�!�Y��
�
4�
4�
4�
4�
4rc��|j|ks
|�.|j|kr#|�d|||j|j��|j}|���|S)Nzexpected %s/%s, got %s/%s)rcrTr�r)rrcrTs   r
rfzParserGenerator.expect9sd���9�����!2�t�z�U�7J�7J����8�!�5�$�)�T�Z�
A�
A�
A��
���
�
�����rc��t|j��}|dtjtjfvr4t|j��}|dtjtjfv�4|\|_|_|_|_|_	dS)Nr#)
r>rr�COMMENT�NLrcrT�begin�end�line)r�tups  r
rzParserGenerator.gettokenAsr���4�>�"�"���!�f��)�8�;�7�7�7��t�~�&�&�C��!�f��)�8�;�7�7�7�AD�>��	�4�:�t�z�4�8�T�Y�Y�Yrc
��|rG	||z}n@#d�|gttt|����z��}YnxYwt	||j|jd|jd|jf���)N� r#r)�joinr%�map�str�SyntaxErrorrr�r�)r�msg�argss   r
r�zParserGenerator.raise_errorHs����	=�
=��D�j����
=��h�h��u�t�C��T�N�N�';�';�;�<�<��������#��
�t�x��{� $����T�Y� 8�9�9�	9s	�
�;ArV)rr	r
r!r?r5r1rrWrrir�r�rjrhr�r�r�rfrr�rrr
rr
s4������
�
�
�
����2���,"�,"�,"�\%�%�%�$�$�$�<!�!�!�0"�"�"�H7�7�7� A�A�A����*���"������(4�4�4�"����E�E�E�9�9�9�9�9rrc��eZdZd�Zdd�ZdS)ruc��g|_dSrV)r.)rs r
r!zNFAState.__init__Ss
����	�	�	rNc��|�t|t��sJ�t|t��sJ�|j�||f��dSrV)rKr�rur.r0�rr>r=s   r
ryzNFAState.addarcVsP���}�
�5�#� 6� 6�}�}�6��$��)�)�)�)�)��	���%���'�'�'�'�'rrV)rr	r
r!ryrrr
ruruQs7���������(�(�(�(�(�(rruc�*�eZdZd�Zd�Zd�Zd�ZdZdS)rvc���t|t��sJ�ttt|����t��sJ�t|t��sJ�||_||v|_i|_dSrV)rK�dictr>�iterrurwr3r.)rrw�finals   r
r!zDFAState.__init__]so���&�$�'�'�'�'�'��$�t�F�|�|�,�,�h�7�7�7�7�7��%��*�*�*�*�*�����������	�	�	rc��t|t��sJ�||jvsJ�t|t��sJ�||j|<dSrV)rKr�r.rvr�s   r
ryzDFAState.addarcesS���%��%�%�%�%�%��D�I�%�%�%�%��$��)�)�)�)�)���	�%���rc�`�|j���D]\}}||ur
||j|<�dSrV)r.r/)r�old�newr=r>s     r
r�zDFAState.unifystateksA���9�?�?�,�,�	'�	'�K�E�4��s�{�{�#&��	�%� ��	'�	'rc�,�t|t��sJ�|j|jkrdSt|j��t|j��krdS|j���D]$\}}||j�|��urdS�%dS)NFT)rKrvr3r*r.r/�get)r�otherr=r>s    r
�__eq__zDFAState.__eq__ps����%��*�*�*�*�*��<�5�=�(�(��5��t�y�>�>�S���_�_�,�,��5��9�?�?�,�,�	�	�K�E�4��5�:�>�>�%�0�0�0�0��u�u�1��trN)rr	r
r!ryr�r��__hash__rrr
rvrv[sQ��������� � � �'�'�'�
����H�H�Hrrv�Grammar.txtc�H�t|��}|���SrV)rr?)r�ps  r
�generate_grammarr��s����!�!�A��>�>���rN)r�)r�rrr�Grammarr�objectrrurvr�rrr
�<module>r�s���
'�&�&�&�&�&�&�&�&�&�	�	�	�	�	�'�/�	�	�	�E9�E9�E9�E9�E9�f�E9�E9�E9�N
(�(�(�(�(�v�(�(�(�#�#�#�#�#�v�#�#�#�J�����r

Hacked By AnonymousFox1.0, Coded By AnonymousFox