
    #	h                     `    S SK r  " S S\5      r " S S\5      r " S S\5      rS rS	 rS
 rg)    Nc                   ,    \ rS rSrSrSrSS jrS rSrg)	Coord   zuCoordinates of a syntactic element. Consists of:
- File name
- Line number
- (optional) column number, for the Lexer
)filelinecolumn__weakref__Nc                 (    Xl         X l        X0l        g Nr   r   r   )selfr   r   r   s       E/var/www/html/env/lib/python3.13/site-packages/pycparser/plyparser.py__init__Coord.__init__   s    		    c                     U R                   < SU R                  < 3nU R                  (       a  USU R                  -  -  nU$ )N:z:%sr   )r   strs     r   __str__Coord.__str__   s2    DII.;;ut{{22
r   )r   r   r   r   )	__name__
__module____qualname____firstlineno____doc__	__slots__r   r   __static_attributes__ r   r   r   r      s    
 :I
r   r   c                       \ rS rSrSrg)
ParseError   r   N)r   r   r   r   r   r   r   r   r    r       s    Tr   r    c                   0    \ rS rSrS rSS jrS rS rSrg)		PLYParser"   c                     US-   nS nU< SU< 3Ul         SU-  Ul        [        U R                  UR                  U5        g)zmGiven a rule name, creates an optional ply.yacc rule
for it. The name of the optional rule is
<rulename>_opt
_optc                     US   US'   g )N   r   r   )r   ps     r   optrule+PLYParser._create_opt_rule.<locals>.optrule*   s    Q4AaDr   z : empty
| zp_%sN)r   r   setattr	__class__)r   rulenameoptnamer*   s       r   _create_opt_rulePLYParser._create_opt_rule#   sD    
 V#	 18B!G+ 0 0':r   Nc                 @    [        U R                  R                  UUS9$ )Nr   )r   clexfilename)r   linenor   s      r   _coordPLYParser._coord1   s"    YY'' 	r   c                     UR                   R                   R                  R                  SSUR                  U5      5      nUS:  a  SnUR                  U5      U-
  nU R	                  UR                  U5      U5      $ )zReturns 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lexposr6   r5   )r   r)   	token_idxlast_crr   s        r   _token_coordPLYParser._token_coord7   sh    
 ''--''--dAqxx	7JKQ;G((9%1{{188I.77r   c                 &    [        U< SU< 35      e)Nz: )r    )r   msgcoords      r   _parse_errorPLYParser._parse_errorB   s    UC011r   r   r   )	r   r   r   r   r0   r6   rA   rF   r   r   r   r   r#   r#   "   s    ;	82r   r#   c                     ^  U 4S jnU$ )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                    > TU l         U $ r   )_params)	rule_funcparamss    r   decorateparameterized.<locals>.decorateP   s    "	r   r   )rL   rM   s   ` r   parameterizedrO   F   s     Or   c                 .   Sn[        U 5       H  nUR                  S5      (       d  M  [        X5      n[        US5      (       d  M9  [	        X5        UR
                  b  [        X5        M^  U(       a  Mg  [        R                  " S[        SS9  SnM     U $ )zClass decorator to generate rules from parameterized rule templates.

See `parameterized` for more information on parameterized rules.
Fp_rJ   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   templatera   V   s    
 !X	%%S,Fvy))' >>-'4--MMZ&#$& ,0() * Jr   c                   ^ TR                    Hs  u  p#U4S jnTR                  R                  SU5      R                  SU5      Ul        TR                  R                  SU5      Ul        [	        XR                  U5        Mu     g)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                    > T" X5        g r   r   )r   r)   funcs     r   
param_rule'_create_param_rules.<locals>.param_rule}   s
    Mr   xxxyyyN)rJ   r   replacer   r,   )r]   rd   rg   rh   re   s    `   r   rY   rY   t   sm     LL	 "\\11%=EEeSQ
"mm33E3?
 	((*5 !r   )	rZ   objectr   	Exceptionr    r#   rO   ra   rY   r   r   r   <module>rl      s<    F $ " !!2 !2H <6r   