Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/pycparser/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/pycparser/__pycache__/plyparser.cpython-311.pyc

�

�܋f��t�ddlZGd�de��ZGd�de��ZGd�de��Zd�Zd	�Zd
�ZdS)�Nc�$�eZdZdZdZdd�Zd�ZdS)�Coordz� Coordinates of a syntactic element. Consists of:
            - File name
            - Line number
            - (optional) column number, for the Lexer
    )�file�line�column�__weakref__Nc�0�||_||_||_dS�N�rrr)�selfrrrs    �d/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pycparser/plyparser.py�__init__zCoord.__init__s����	���	������c�P�|j�d|j��}|jr
|d|jzz
}|S)N�:z:%sr)r�strs  r
�__str__z
Coord.__str__s3������D�I�I�.���;�2��u�t�{�2�2���
rr
)�__name__�
__module__�__qualname__�__doc__�	__slots__rr�rr
rr
sH��������
:�I�����
����rrc��eZdZdS)�
ParseErrorN)rrrrrr
rrs�������rrc�(�eZdZd�Zdd�Zd�Zd�ZdS)�	PLYParserc�x�|dz}d�}|�d|��|_d|z|_t|j|j|��dS)z� Given a rule name, creates an optional ply.yacc rule
            for it. The name of the optional rule is
            <rulename>_opt
        �_optc��|d|d<dS)N�rr)r�ps  r
�optrulez+PLYParser._create_opt_rule.<locals>.optrule*s���Q�4�A�a�D�D�Drz : empty
| zp_%sN)rr�setattr�	__class__)r�rulename�optnamer#s    r
�_create_opt_rulezPLYParser._create_opt_rule#s[��
�V�#��	�	�	�18�����B���!�G�+������� 0�'�:�:�:�:�:rNc�:�t|jj||���S)Nr)r�clex�filename)r�linenors   r
�_coordzPLYParser._coord1s'����Y�'������	rc��|jjj�dd|�|����}|dkrd}|�|��|z
}|�|�|��|��S)z� Returns the coordinates for the YaccProduction object 'p' indexed
            with 'token_idx'. The coordinate includes the 'lineno' and
            'column'. Both follow the lex semantic, starting from 1.
        �
r���)�lexer�lexdata�rfind�lexposr-r,)rr"�	token_idx�last_crrs     r
�_token_coordzPLYParser._token_coord7sr��
�'�-�'�-�-�d�A�q�x�x�	�7J�7J�K�K���Q�;�;��G��(�(�9�%�%��1���{�{�1�8�8�I�.�.��7�7�7rc�*�t|�d|�����)Nz: )r)r�msg�coords   r
�_parse_errorzPLYParser._parse_errorBs���U�U�U�C�C�0�1�1�1rr
)rrrr(r-r7r;rrr
rr"sU������;�;�;�����	8�	8�	8�2�2�2�2�2rrc����fd�}|S)a� Decorator to create parameterized rules.

    Parameterized rule methods must be named starting with 'p_' and contain
    'xxx', and their docstrings may contain 'xxx' and 'yyy'. These will be
    replaced by the given parameter tuples. For example, ``p_xxx_rule()`` with
    docstring 'xxx_rule  : yyy' when decorated with
    ``@parameterized(('id', 'ID'))`` produces ``p_id_rule()`` with the docstring
    'id_rule  : ID'. Using multiple tuples produces multiple rules.
    c����|_|Sr
)�_params)�	rule_func�paramss �r
�decoratezparameterized.<locals>.decoratePs���"�	���rr)r@rAs` r
�
parameterizedrBFs#���������Orc�(�d}t|��D]}|�d��rht||��}t|d��rHt	||��|j�t
||���_|stjdtd���d}��|S)	z� Class decorator to generate rules from parameterized rule templates.

    See `parameterized` for more information on parameterized rules.
    F�p_r>Nz@parsing methods must have __doc__ for pycparser to work properly�)�
stacklevelT)
�dir�
startswith�getattr�hasattr�delattrr�_create_param_rules�warnings�warn�RuntimeWarning)�cls�issued_nodoc_warning�	attr_name�methods    r
�templaterTVs���
!����X�X�0�0�	�����%�%�	0��S�)�,�,�F��v�y�)�)�
0���Y�'�'�'��>�-�'��V�4�4�4�4�-�0��M�Z�&�#$�&�&�&�&�,0�(���Jrc����jD]t\}}�fd�}�j�d|���d|��|_�j�d|��|_t	||j|���udS)a Create ply.yacc rules based on a parameterized rule function

    Generates new methods (one per each pair of parameters) based on the
    template rule function `func`, and attaches them to `cls`. The rule
    function's parameters must be accessible via its `_params` attribute.
    c� ���||��dSr
r)rr"�funcs  �r
�
param_rulez'_create_param_rules.<locals>.param_rule}s����D��q�M�M�M�M�Mr�xxx�yyyN)r>r�replacerr$)rPrWrYrZrXs `   r
rLrLts�����L�
6�
6���S�	�	�	�	�	�"�\�1�1�%��=�=�E�E�e�S�Q�Q�
��"�m�3�3�E�3�?�?�
��	��Z�(�*�5�5�5�5�
6�
6r)	rM�objectr�	ExceptionrrrBrTrLrrr
�<module>r^s������������F����$"�!�!�!�!��!�!�!�!2�!2�!2�!2�!2��!2�!2�!2�H
�
�
� ���<6�6�6�6�6r

Hacked By AnonymousFox1.0, Coded By AnonymousFox