
    Yh                     `    d dl Z  G d de      Z G d de      Z G d de      Zd Zd	 Zd
 Zy)    Nc                   "    e Zd ZdZdZddZd Zy)Coordz Coordinates of a syntactic element. Consists of:
            - File name
            - Line number
            - (optional) column number, for the Lexer
    )filelinecolumn__weakref__Nc                 .    || _         || _        || _        y Nr   r   r   )selfr   r   r   s       d/var/www/django-portfolio.reubendavern.link/venv/lib/python3.12/site-packages/pycparser/plyparser.py__init__zCoord.__init__   s    		    c                 x    | j                   d| j                  }| j                  r|d| j                  z  z  }|S )N:z:%sr   )r   strs     r   __str__zCoord.__str__   s2    DII.;;ut{{22
r   r
   )__name__
__module____qualname____doc__	__slots__r   r    r   r   r   r      s    
 :I
r   r   c                       e Zd Zy)
ParseErrorN)r   r   r   r   r   r   r   r      s    r   r   c                   &    e Zd Zd ZddZd Zd Zy)	PLYParserc                     |dz   }d }|d||_         d|z  |_        t        | j                  |j                  |       y)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<   y )N   r   r   )r   ps     r   optrulez+PLYParser._create_opt_rule.<locals>.optrule*   s    Q4AaDr   z : empty
| zp_%sN)r   r   setattr	__class__)r   rulenameoptnamer#   s       r   _create_opt_rulezPLYParser._create_opt_rule#   sD    
 V#	 18B!G+ 0 0':r   Nc                 F    t        | j                  j                  ||      S )Nr   )r   clexfilename)r   linenor   s      r   _coordzPLYParser._coord1   s"    YY'' 	r   c                     |j                   j                   j                  j                  dd|j                  |            }|dk  rd}|j                  |      |z
  }| j	                  |j                  |      |      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_crr   s        r   _token_coordzPLYParser._token_coord7   sh    
 ''--''--dAqxx	7JKQ;G((9%1{{188I.77r   c                 "    t        |d|      )Nz: )r   )r   msgcoords      r   _parse_errorzPLYParser._parse_errorB   s    UC011r   r
   )r   r   r   r(   r-   r7   r;   r   r   r   r   r   "   s    ;	82r   r   c                        fd}|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                     | _         | S r
   )_params)	rule_funcparamss    r   decoratezparameterized.<locals>.decorateP   s    "	r   r   )r@   rA   s   ` r   parameterizedrB   F   s     Or   c                    d}t        |       D ]s  }|j                  d      st        | |      }t        |d      s.t	        | |       |j
                  t        | |       S|rVt        j                  dt        d       d}u | S )z Class decorator to generate rules from parameterized rule templates.

    See `parameterized` for more information on parameterized rules.
    Fp_r>   z@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   templaterT   V   s    
 !X 0	%S),Fvy)Y' >>-'V4-MMZ&#$& ,0()0* Jr   c                 
   j                   D ]s  \  }}fd}j                  j                  d|      j                  d|      |_        j                  j                  d|      |_        t	        | |j                  |       u y)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                      | |       y r
   r   )r   r"   funcs     r   
param_rulez'_create_param_rules.<locals>.param_rule}   s    qMr   xxxyyyN)r>   r   replacer   r$   )rP   rW   rY   rZ   rX   s    `   r   rL   rL   t   sv     LL 
6S	 "\\11%=EEeSQ
"mm33E3?
 	Z((*5
6r   )	rM   objectr   	Exceptionr   r   rB   rT   rL   r   r   r   <module>r^      s<    F $ " !!2 !2H <6r   