Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
pycparser / __pycache__ / plyparser.cpython-35.pyc
Size: Mime:


õ±ÂX¦ã@sjGdd„deƒZGdd„deƒZGdd„deƒZdd„Zdd	„Zd
d„ZdS)
c@s7eZdZdZdZddd„Zd	d
„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ú../pycparser/plyparser.pyÚ__init__s		zCoord.__init__cCs4d|j|jf}|jr0|d|j7}|S)Nz%s:%sz:%s)rrr)rÚstrrrrÚ__str__s	z
Coord.__str__)zfilezlinezcolumnz__weakref__)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r	rrrrrrsrc@seZdZdS)Ú
ParseErrorN)rr
rrrrrrsrc@sCeZdZdd„Zddd„Zdd„Zdd	„ZdS)
Ú	PLYParsercCsP|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
        Z_optcSs|d|d<dS)Néér)rÚprrrÚoptrule)sz+PLYParser._create_opt_rule.<locals>.optrulez%s : empty
| %szp_%sN)rrÚsetattrÚ	__class__)rZrulenameZoptnamerrrrÚ_create_opt_rule"s


zPLYParser._create_opt_ruleNcCstd|jjd|d|ƒS)Nrrr)rÚclexÚfilename)rÚlinenorrrrÚ_coord0szPLYParser._coordcCse|jjjjdd|j|ƒƒ}|dkr9d}|j|ƒ|}|j|j|ƒ|ƒS)zÖ Returns the coordinates for the YaccProduction objet 'p' indexed
            with 'token_idx'. The coordinate includes the 'lineno' and
            'column'. Both follow the lex semantic, starting from 1.
        Ú
rréÿÿÿÿ)ÚlexerÚlexdataÚrfindÚlexposrr)rrZ	token_idxÚlast_crrrrrÚ_token_coord6s
'zPLYParser._token_coordcCstd||fƒ‚dS)Nz%s: %s)r)rÚmsgÚcoordrrrÚ_parse_errorAszPLYParser._parse_error)rr
rrrr%r(rrrrr!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
ˆ|_|S)N)Ú_params)Z	rule_func)ÚparamsrrÚdecorateOs	zparameterized.<locals>.decorater)r*r+r)r*rÚ
parameterizedEs
r,cCsbx[t|ƒD]M}|jdƒr
t||ƒ}t|dƒr
t||ƒt||ƒq
W|S)z Class decorator to generate rules from parameterized rule templates.

    See `parameterized` for more information on parameterized rules.
    Úp_r))ÚdirÚ
startswithÚgetattrÚhasattrÚdelattrÚ_create_param_rules)ÚclsZ	attr_nameÚmethodrrrÚtemplateUs
r6csxxˆjD]m\}}‡fdd†}ˆjjd|ƒjd|ƒ|_ˆjjd|ƒ|_t||j|ƒq
WdS)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ˆ||ƒdS)Nr)rr)ÚfuncrrÚ
param_rulelsz'_create_param_rules.<locals>.param_ruleÚxxxÚyyyN)r)rÚreplacerr)r4r7r9r:r8r)r7rr3cs
$r3N)ÚobjectrÚ	Exceptionrrr,r6r3rrrrÚ<module>s
$