K i `ddlZGddeZGddeZGddeZdZd Zd Zy) Nc"eZdZdZdZddZdZy)Coordz Coordinates of a syntactic element. Consists of: - File name - Line number - (optional) column number, for the Lexer )filelinecolumn __weakref__Nc.||_||_||_yNrrr)selfrrrs Y/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/pycparser/plyparser.py__init__zCoord.__init__s   cx|jd|j}|jr|d|jzz }|S)N:z:%sr )r strs r __str__z Coord.__str__s2DII. ;;ut{{22 rr )__name__ __module__ __qualname____doc__ __slots__rrrr rr s :I rrc eZdZy) ParseErrorN)rrrrrr rrsrrc&eZdZdZddZdZdZy) PLYParserc|dz}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 _opt _optc|d|d<y)Nrr)r ps r optrulez+PLYParser._create_opt_rule..optrule*sQ4AaDrz : empty | zp_%sN)rrsetattr __class__)r rulenameoptnamer#s r _create_opt_rulezPLYParser._create_opt_rule#sD V# 18B!G+ 0 0':rNcFt|jj||S)Nr )rclexfilename)r linenors r _coordzPLYParser._coord1s"YY'' rc|jjjjdd|j|}|dkrd}|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)lexerlexdatarfindlexposr-r,)r r" token_idxlast_crrs r _token_coordzPLYParser._token_coord7sh ''--''--dAqxx 7JK Q;G((9%1{{188I.77rc"t|d|)Nz: )r)r msgcoords r _parse_errorzPLYParser._parse_errorBsUC011rr )rrrr(r-r7r;rrr rr"s ; 82rrcfd}|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_funcparamss r decoratezparameterized..decoratePs" rr)r@rAs` r parameterizedrBFs Orc d}t|D]s}|jdst||}t|ds.t |||j t ||S|rVtjdtdd}u|S)z Class decorator to generate rules from parameterized rule templates. See `parameterized` for more information on parameterized rules. Fp_r>z@parsing methods must have __doc__ for pycparser to work properly) stacklevelT) dir startswithgetattrhasattrdelattrr_create_param_ruleswarningswarnRuntimeWarning)clsissued_nodoc_warning attr_namemethods r templaterTVs !X0    %S),Fvy)Y'>>-'V4-MMZ&#$&,0()0* Jrc jD]s\}}fd}jjd|jd||_jjd||_t ||j|uy)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||yr r)r r"funcs r param_rulez'_create_param_rules..param_rule}s qMrxxxyyyN)r>rreplacerr$)rPrWrYrZrXs ` r rLrLtsvLL 6S "\\11%=EEeSQ "mm33E3?  Z((*5 6r) rMobjectr ExceptionrrrBrTrLrrr r^s<F$"!!2!2H  <6r