HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib/python3.10/site-packages/pycparser/__pycache__/plyparser.cpython-310.pyc
o

�h�@sTddlZGdd�de�ZGdd�de�ZGdd�de�Zdd	�Zd
d�Zdd
�ZdS)�Nc@s&eZdZdZdZddd�Zdd�ZdS)	�Coordz� Coordinates of a syntactic element. Consists of:
            - File name
            - Line number
            - (optional) column number, for the Lexer
    )�file�line�column�__weakref__NcCs||_||_||_dS�N�rrr)�selfrrr�r
�F/usr/local/CyberCP/lib/python3.10/site-packages/pycparser/plyparser.py�__init__s
zCoord.__init__cCs(d|j|jf}|jr|d|j7}|S)Nz%s:%sz:%sr)r	�strr
r
r�__str__sz
Coord.__str__r)�__name__�
__module__�__qualname__�__doc__�	__slots__rrr
r
r
rr
s

rc@seZdZdS)�
ParseErrorN)rrrr
r
r
rrsrc@s.eZdZdd�Zd
dd�Zdd�Zdd	�ZdS)�	PLYParsercCs<|d}dd�}d||f|_d||_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
        �_optcSs|d|d<dS)N�rr
�r	�pr
r
r�optrule*�z+PLYParser._create_opt_rule.<locals>.optrulez%s : empty
| %szp_%sN)rr�setattr�	__class__)r	�rulename�optnamerr
r
r�_create_opt_rule#s

zPLYParser._create_opt_ruleNcCst|jj||d�S)Nr)r�clex�filename)r	�linenorr
r
r�_coord1s
�zPLYParser._coordcCsF|jjj�dd|�|��}|dkrd}|�|�|}|�|�|�|�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_crrr
r
r�_token_coord7s
zPLYParser._token_coordcCstd||f��)Nz%s: %s)r)r	�msg�coordr
r
r�_parse_errorBrzPLYParser._parse_errorr)rrrr r$r-r0r
r
r
rr"s

rcs�fdd�}|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.
    cs
�|_|Sr)�_params)�	rule_func��paramsr
r�decoratePszparameterized.<locals>.decorater
)r4r5r
r3r�
parameterizedFs
r6cCsld}t|�D]-}|�d�r3t||�}t|d�r3t||�|jdur't||�q|s3tjdt	dd�d}q|S)	z� Class decorator to generate rules from parameterized rule templates.

    See `parameterized` for more information on parameterized rules.
    F�p_r1Nz@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�methodr
r
r�templateVs"




��rGcsV�jD]%\}}�fdd�}�j�d|��d|�|_�j�d|�|_t||j|�qdS)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.
    cs�||�dSrr
r��funcr
r�
param_rule}sz'_create_param_rules.<locals>.param_rule�xxx�yyyN)r1r�replacerr)rCrIrKrLrJr
rHrr?ts�r?)	r@�objectr�	Exceptionrrr6rGr?r
r
r
r�<module>s
$