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__ / c_parser.cpython-35.pyc
Size: Mime:


õ±ÂX$ã@sÄddlZddlmZddlmZddlmZddlmZm	Z	m
Z
mZmZddl
mZeGdd	„d	eƒƒZed
krÀddlZddlZddlZdS)éNé)Úyacc)Úc_ast)ÚCLexer)Ú	PLYParserÚCoordÚ
ParseErrorÚ
parameterizedÚtemplate)Úfix_switch_casesc
@s eZdZdeddddddd„Zddd	d
„Zdd„Zd
d„Zdd„Zdd„Z	dd„Z
dd„Zdd„Zdd„Z
dd„Zdd„Zdd „Zd!d"„Zdd#d$„Zdd%d&„Zd'd(„Zd)d*„ZddZd>d?„Zd@dA„ZdBdC„ZdDdE„ZdFdG„ZdHdI„ZdJdK„ZdLdM„ZdNdO„ZdPdQ„Z dRdS„Z!dTdU„Z"dVdW„Z#dXdY„Z$dZd[„Z%d\d]„Z&d^d_„Z'd`da„Z(dbdc„Z)ddde„Z*dfdg„Z+dhdi„Z,djdk„Z-dldm„Z.dndo„Z/dpdq„Z0drds„Z1dtdu„Z2dvdw„Z3dxdy„Z4dzd{„Z5d|d}„Z6d~d„Z7d€d„Z8d‚dƒ„Z9d„d…„Z:d†d‡„Z;dˆd‰„Z<dŠd‹„Z=dŒd„Z>dŽd„Z?dd‘„Z@d’d“„ZAd”d•„ZBd–d—„ZCd˜d™„ZDdšd›„ZEdœd„ZFdždŸ„ZGd d¡„ZHd¢d£„ZId¤d¥„ZJd¦d§„ZKeLdedfdgƒd­d®„ƒZMeLdhdidjƒd¯d°„ƒZNeLdkdldmƒd±d²„ƒZOeLdndoƒd³d´„ƒZPeLdpdqdrƒdµd¶„ƒZQeLdsdtduƒd·d¸„ƒZReLdvdwdxƒd¹dº„ƒZSeLdydzd{ƒd»d¼„ƒZTd½d¾„ZUd¿dÀ„ZVdÁd„ZWdÃdĄZXdÅdƄZYdÇdȄZZdÉdʄZ[dËd̄Z\dÍd΄Z]dÏdЄZ^dÑd҄Z_dÓdԄZ`dÕdքZad×d؄ZbdÙdڄZcdÛd܄ZddÝdބZedßdà„Zfdádâ„Zgdãdä„Zhdådæ„Zidçdè„Zjdédê„Zkdëdì„Zldídî„Zmdïdð„Zndñdò„Zodódô„Zpdõdö„Zqd÷dø„Zrdùdú„Zsdûdü„Ztdýdþ„Zudÿd„Zvdd„Zwdd„Zxdd„Zydd„Zzd	d
„Z{dd„Z|d
d„Z}dd„Z~dd„Zdd„Z€dd„Zdd„Z‚dd„Zƒdd„Z„dd„Z…dd „Z†d!d"„Z‡d#d$„Zˆd%d&„Z‰d'd(„ZŠd)d*„Z‹d+d,„ZŒd-d.„Zd/d0„ZŽd1d2„Zd3d4„Zd5d6„Z‘d7d8„Z’d9d:„Z“d;d<„Z”d=d>„Z•d?d@„Z–dAdB„Z—dCdD„Z˜dEdF„Z™dGdH„ZšdIdJ„Z›dKdL„ZœdMdN„ZdOdP„ZždQdR„ZŸdSdT„Z dUdV„Z¡dWdX„Z¢dYS(|ÚCParserTzpycparser.lextabzpycparser.yacctabFÚc
Csû|d|jd|jd|jd|jƒ|_|jjd|d|d|ƒ|jj|_dd	d
ddd
ddddddddg}x|D]}	|j|	ƒq•Wtjd|ddd|d|d|d|ƒ|_	t
ƒg|_d|_dS)a Create a new CParser.

            Some arguments for controlling the debug/optimization
            level of the parser are provided. The defaults are
            tuned for release/performance mode.
            The simple rules for using them are:
            *) When tweaking CParser/CLexer, set these to False
            *) When releasing a stable parser, set to True

            lex_optimize:
                Set to False when you're modifying the lexer.
                Otherwise, changes in the lexer won't be used, if
                some lextab.py file exists.
                When releasing with a stable lexer, set to True
                to save the re-generation of the lexer table on
                each run.

            lexer:
                Set this parameter to define the lexer to use if
                you're not using the default CLexer.

            lextab:
                Points to the lex table that's used for optimized
                mode. Only if you're modifying the lexer and want
                some tests to avoid re-generating the table, make
                this point to a local lex table file (that's been
                earlier generated with lex_optimize=True)

            yacc_optimize:
                Set to False when you're modifying the parser.
                Otherwise, changes in the parser won't be used, if
                some parsetab.py file exists.
                When releasing with a stable parser, set to True
                to save the re-generation of the parser table on
                each run.

            yacctab:
                Points to the yacc table that's used for optimized
                mode. Only if you're modifying the parser, make
                this point to a local yacc table file

            yacc_debug:
                Generate a parser.out file that explains how yacc
                built the parsing table from the grammar.

            taboutputdir:
                Set this parameter to control the location of generated
                lextab and yacctab files.
        Z
error_funcZon_lbrace_funcZon_rbrace_funcZtype_lookup_funcÚoptimizeÚlextabZ	outputdirZabstract_declaratorZassignment_expressionZdeclaration_listZdeclaration_specifiers_no_typeZdesignationZ
expressionZidentifier_listZinit_declarator_listZid_init_declarator_listZinitializer_listZparameter_type_listZblock_item_listZtype_qualifier_listZstruct_declarator_listÚmoduleÚstartZtranslation_unit_or_emptyÚdebugZ	tabmoduleN)
Ú_lex_error_funcÚ_lex_on_lbrace_funcÚ_lex_on_rbrace_funcÚ_lex_type_lookup_funcÚclexZbuildÚtokensZ_create_opt_rulerÚcparserÚdictÚ_scope_stackÚ_last_yielded_token)
ÚselfÚlex_optimizeÚlexerrÚ
yacc_optimizeÚyacctabÚ
yacc_debugZtaboutputdirZrules_with_optZrule©r#ú../pycparser/c_parser.pyÚ__init__sF:				
	
zCParser.__init__rcCsS||j_|jjƒtƒg|_d|_|jjd|d|jd|ƒS)a& Parses C code and returns an AST.

            text:
                A string containing the C source code

            filename:
                Name of the file being parsed (for meaningful
                error messages)

            debuglevel:
                Debug level to yacc
        NÚinputrr)rÚfilenameZreset_linenorrrrÚparse)rÚtextr'Z
debuglevelr#r#r$r(„s

		z
CParser.parsecCs|jjtƒƒdS)N)rÚappendr)rr#r#r$Ú_push_scopeœszCParser._push_scopecCs,t|jƒdkst‚|jjƒdS)Nr)ÚlenrÚAssertionErrorÚpop)rr#r#r$Ú
_pop_scopeŸszCParser._pop_scopecCsB|jdj|dƒs-|jd||ƒd|jd|<dS)zC Add a new typedef name (ie a TYPEID) to the current scope
        rTz;Typedef %r previously declared as non-typedef in this scopeNéÿÿÿÿr0)rÚgetÚ_parse_error)rÚnameÚcoordr#r#r$Ú_add_typedef_name£s
zCParser._add_typedef_namecCsB|jdj|dƒr-|jd||ƒd|jd|<dS)ze Add a new object, function, or enum member name (ie an ID) to the
            current scope
        rFz;Non-typedef %r previously declared as typedef in this scopeNr0r0)rr1r2)rr3r4r#r#r$Ú_add_identifier¬s
zCParser._add_identifiercCs=x6t|jƒD]%}|j|ƒ}|dk	r|SqWdS)z8 Is *name* a typedef-name in the current scope?
        NF)Úreversedrr1)rr3ZscopeZin_scoper#r#r$Ú_is_type_in_scope¶s
zCParser._is_type_in_scopecCs |j||j||ƒƒdS)N)r2Ú_coord)rÚmsgÚlineÚcolumnr#r#r$rÀszCParser._lex_error_funccCs|jƒdS)N)r+)rr#r#r$rÃszCParser._lex_on_lbrace_funccCs|jƒdS)N)r/)rr#r#r$rÆszCParser._lex_on_rbrace_funccCs|j|ƒ}|S)z§ Looks up types that were previously defined with
            typedef.
            Passed to the lexer for recognizing identifiers that
            are types.
        )r8)rr3Zis_typer#r#r$rÉszCParser._lex_type_lookup_funccCs
|jjS)z§ We need access to yacc's lookahead token in certain cases.
            This is the last token yacc requested from the lexer, so we
            ask the lexer.
        )rZ
last_token)rr#r#r$Ú_get_yacc_lookahead_tokenÒsz!CParser._get_yacc_lookahead_tokencCsŒ|}|}x|jr$|j}qWt|tjƒrD||_|S|}x"t|jtjƒsn|j}qMW|j|_||_|SdS)z  Tacks a type modifier on a declarator, and returns
            the modified declarator.

            Note: the declarator and modifier may be modified
        N)ÚtypeÚ
isinstancerÚTypeDecl)rÚdeclÚmodifierZ
modifier_headZ
modifier_tailZ	decl_tailr#r#r$Ú_type_modify_declûs
	
	zCParser._type_modify_declcCs|}xt|tjƒs'|j}q	W|j|_|j|_xU|D]M}t|tjƒsGt|ƒdkr‡|j	d|j
ƒqG||_|SqGW|sçt|jtjƒsÆ|j	d|j
ƒtjdgd|j
ƒ|_n,tjdd„|Dƒd|dj
ƒ|_|S)	z- Fixes a declaration. Modifies decl.
        rz Invalid multiple types specifiedzMissing type in declarationÚintr4cSs&g|]}|jD]}|‘qqSr#)Únames)Ú.0Úidr3r#r#r$ú
<listcomp>[s	z/CParser._fix_decl_name_type.<locals>.<listcomp>r)r?rr@r>Údeclnamer3ÚqualsÚIdentifierTyper,r2r4ÚFuncDecl)rrAÚtypenamer>Ztnr#r#r$Ú_fix_decl_name_type2s.

	
	zCParser._fix_decl_name_typec	CsY|p$tdgdgdgdgƒ}|rA||j|ƒn||jd|ƒ|S)a‡ Declaration specifiers are represented by a dictionary
            with the entries:
            * qual: a list of type qualifiers
            * storage: a list of storage type qualifiers
            * type: a list of type specifiers
            * function: a list of function specifiers

            This method is given a declaration specifier, and a
            new specifier of a given kind.
            If `append` is True, the new specifier is added to the end of
            the specifiers list, otherwise it's added at the beginning.
            Returns the declaration specifier, with the new
            specifier incorporated.
        ÚqualÚstorager>Úfunctionr)rr*Úinsert)rZdeclspecZnewspecZkindr*Úspecr#r#r$Ú_add_declaration_specifier_s
'z"CParser._add_declaration_specifiercCsd|dk}g}|djdƒdk	r2n‰|dddkr0t|dƒdks˜t|ddjƒd	ks˜|j|ddjdƒrÜd
}x+|dD]}t|dƒr©|j}Pq©W|jd|ƒtjd
|ddjdddddd|ddjƒ|dd<|dd=n‹t	|ddtj
tjtjfƒs»|dd}xt	|tjƒsˆ|j
}qjW|jdkr»|ddjd|_|dd=xZ|D]R}	|	ddk	sÞt‚|r$tjddd|dd|dd|	dd|	djƒ}
netjddd|dd|dd|dd|	dd|	jdƒd|	jdƒd|	djƒ}
t	|
j
tj
tjtjfƒr¶|
}n|j|
|dƒ}|r|rñ|j|j|jƒn|j|j|jƒ|j|ƒqÂW|S)zÿ Builds a list of declarations all sharing the given specifiers.
            If typedef_namespace is true, each declared name is added
            to the "typedef namespace", which also includes objects,
            functions, and enum constants.
        ÚtypedefrPrÚbitsizeNrAr>érú?r4zInvalid declarationrIrJr3rOÚfuncspecrQÚinitr0r0r0r0r0r0r0)r1r,rEr8Úhasattrr4r2rr@r?ÚStructÚUnionrKr>rIr-ZTypedefÚDeclrNr5r3r6r*)rrSÚdeclsÚtypedef_namespaceZ
is_typedefZdeclarationsr4ÚtZdecls_0_tailrAÚdeclarationZ
fixed_declr#r#r$Ú_build_declarationswsn3		

	


	



		zCParser._build_declarationsc	Csod|dkst‚|jd|dtd|ddƒgdd	ƒd
}tjd|d|d|d
|jƒS)z' Builds a function definition.
        rUrPrSr_rArZNr`TrÚparam_declsÚbodyr4)r-rcrrZFuncDefr4)rrSrArdrerbr#r#r$Ú_build_function_definitionÐs	
	z"CParser._build_function_definitioncCs|dkrtjStjSdS)z` Given a token (either STRUCT or UNION), selects the
            appropriate AST class.
        ZstructN)rr\r])rÚtokenr#r#r$Ú_select_struct_union_classàsz"CParser._select_struct_union_classÚleftÚLORÚLANDÚORÚXORÚANDÚEQÚNEÚGTÚGEÚLTÚLEÚRSHIFTÚLSHIFTÚPLUSÚMINUSÚTIMESÚDIVIDEÚMODcCsA|ddkr&tjgƒ|d<ntj|dƒ|d<dS)zh translation_unit_or_empty   : translation_unit
                                        | empty
        rNr)rZFileAST)rÚpr#r#r$Úp_translation_unit_or_emptysz#CParser.p_translation_unit_or_emptycCs|d|d<dS)z4 translation_unit    : external_declaration
        rrNr#)rr|r#r#r$Úp_translation_unit_1
szCParser.p_translation_unit_1cCs7|ddk	r%|dj|dƒ|d|d<dS)zE translation_unit    : translation_unit external_declaration
        rWNrr)Úextend)rr|r#r#r$Úp_translation_unit_2szCParser.p_translation_unit_2cCs|dg|d<dS)z7 external_declaration    : function_definition
        rrNr#)rr|r#r#r$Úp_external_declaration_1sz CParser.p_external_declaration_1cCs|d|d<dS)z/ external_declaration    : declaration
        rrNr#)rr|r#r#r$Úp_external_declaration_2"sz CParser.p_external_declaration_2cCs|dg|d<dS)zi external_declaration    : pp_directive
                                    | pppragma_directive
        rrNr#)rr|r#r#r$Úp_external_declaration_3'sz CParser.p_external_declaration_3cCsd|d<dS)z( external_declaration    : SEMI
        Nrr#)rr|r#r#r$Úp_external_declaration_4-sz CParser.p_external_declaration_4cCs |jd|j|dƒƒdS)z  pp_directive  : PPHASH
        zDirectives not supported yetrN)r2Ú_token_coord)rr|r#r#r$Úp_pp_directive2s	zCParser.p_pp_directivecCsat|ƒdkr;tj|d|j|dƒƒ|d<n"tjd|j|dƒƒ|d<dS)zg pppragma_directive      : PPPRAGMA
                                    | PPPRAGMA PPPRAGMASTR
        érWrr
rN)r,rZPragmar…)rr|r#r#r$Úp_pppragma_directive8s)zCParser.p_pppragma_directivecCsztdgdgdtjdgd|j|dƒƒgdgƒ}|jd|d	|dd
|dd|d
ƒ|d<dS)zU function_definition : id_declarator declaration_list_opt compound_statement
        rOrPr>rDr4rrQrSrArdrWrer‡rN)rrrKr…rf)rr|rSr#r#r$Úp_function_definition_1Ds		

zCParser.p_function_definition_1c
CsB|d}|jd|d|dd|dd|dƒ|d	<d
S)zl function_definition : declaration_specifiers id_declarator declaration_list_opt compound_statement
        rrSrArWrdr‡reérN)rf)rr|rSr#r#r$Úp_function_definition_2Us
	

zCParser.p_function_definition_2cCs|d|d<dS)a7 statement   : labeled_statement
                        | expression_statement
                        | compound_statement
                        | selection_statement
                        | iteration_statement
                        | jump_statement
                        | pppragma_directive
        rrNr#)rr|r#r#r$Úp_statement`s	zCParser.p_statementcCs|d}|ddkrí|d}tjtjtjf}t|ƒdkrºt|d|ƒrºtjddd|dd	|d	d
|dd|dddd
dd|djƒg}q|jd|dt	ddddƒgddƒ}n"|jd|d|dddƒ}||d<dS)z˜ decl_body : declaration_specifiers init_declarator_list_opt
                      | declaration_specifiers_no_type id_init_declarator_list_opt
        rrWNr>rr3rJrOrPrYrQrZrVr4rSr_rAr`T)
rr\r]ÚEnumr,r?r^r4rcr)rr|rSZtyZs_u_or_er_r#r#r$Úp_decl_bodyts.

%	



		
	zCParser.p_decl_bodycCs|d|d<dS)z& declaration : decl_body SEMI
        rrNr#)rr|r#r#r$Ú
p_declaration°szCParser.p_declarationcCs6t|ƒdkr|dn|d|d|d<dS)zj declaration_list    : declaration
                                | declaration_list declaration
        rWrrN)r,)rr|r#r#r$Úp_declaration_list¹szCParser.p_declaration_listcCs%|j|d|ddƒ|d<dS)z] declaration_specifiers_no_type  : type_qualifier declaration_specifiers_no_type_opt
        rWrrOrN)rT)rr|r#r#r$Ú"p_declaration_specifiers_no_type_1Äsz*CParser.p_declaration_specifiers_no_type_1cCs%|j|d|ddƒ|d<dS)zf declaration_specifiers_no_type  : storage_class_specifier declaration_specifiers_no_type_opt
        rWrrPrN)rT)rr|r#r#r$Ú"p_declaration_specifiers_no_type_2Ész*CParser.p_declaration_specifiers_no_type_2cCs%|j|d|ddƒ|d<dS)za declaration_specifiers_no_type  : function_specifier declaration_specifiers_no_type_opt
        rWrrQrN)rT)rr|r#r#r$Ú"p_declaration_specifiers_no_type_3Îsz*CParser.p_declaration_specifiers_no_type_3cCs+|j|d|ddddƒ|d<dS)zI declaration_specifiers  : declaration_specifiers type_qualifier
        rrWrOr*TrN)rT)rr|r#r#r$Úp_declaration_specifiers_1Ôsz"CParser.p_declaration_specifiers_1cCs+|j|d|ddddƒ|d<dS)zR declaration_specifiers  : declaration_specifiers storage_class_specifier
        rrWrPr*TrN)rT)rr|r#r#r$Úp_declaration_specifiers_2Ùsz"CParser.p_declaration_specifiers_2cCs+|j|d|ddddƒ|d<dS)zM declaration_specifiers  : declaration_specifiers function_specifier
        rrWrQr*TrN)rT)rr|r#r#r$Úp_declaration_specifiers_3Þsz"CParser.p_declaration_specifiers_3cCs+|j|d|ddddƒ|d<dS)zS declaration_specifiers  : declaration_specifiers type_specifier_no_typeid
        rrWr>r*TrN)rT)rr|r#r#r$Úp_declaration_specifiers_4ãsz"CParser.p_declaration_specifiers_4cCs!|jd|ddƒ|d<dS)z2 declaration_specifiers  : type_specifier
        Nrr>r)rT)rr|r#r#r$Úp_declaration_specifiers_5èsz"CParser.p_declaration_specifiers_5cCs+|j|d|ddddƒ|d<dS)zQ declaration_specifiers  : declaration_specifiers_no_type type_specifier
        rrWr>r*TrN)rT)rr|r#r#r$Úp_declaration_specifiers_6ísz"CParser.p_declaration_specifiers_6cCs|d|d<dS)zß storage_class_specifier : AUTO
                                    | REGISTER
                                    | STATIC
                                    | EXTERN
                                    | TYPEDEF
        rrNr#)rr|r#r#r$Úp_storage_class_specifierósz!CParser.p_storage_class_specifiercCs|d|d<dS)z& function_specifier  : INLINE
        rrNr#)rr|r#r#r$Úp_function_specifierüszCParser.p_function_specifiercCs0tj|dgd|j|dƒƒ|d<dS)a+ type_specifier_no_typeid  : VOID
                                      | _BOOL
                                      | CHAR
                                      | SHORT
                                      | INT
                                      | LONG
                                      | FLOAT
                                      | DOUBLE
                                      | _COMPLEX
                                      | SIGNED
                                      | UNSIGNED
                                      | __INT128
        rr4rN)rrKr…)rr|r#r#r$Úp_type_specifier_no_typeidsz"CParser.p_type_specifier_no_typeidcCs|d|d<dS)zÄ type_specifier  : typedef_name
                            | enum_specifier
                            | struct_or_union_specifier
                            | type_specifier_no_typeid
        rrNr#)rr|r#r#r$Úp_type_specifierszCParser.p_type_specifiercCs|d|d<dS)zo type_qualifier  : CONST
                            | RESTRICT
                            | VOLATILE
        rrNr#)rr|r#r#r$Úp_type_qualifierszCParser.p_type_qualifiercCs<t|ƒdkr'|d|dgn
|dg|d<dS)z„ init_declarator_list    : init_declarator
                                    | init_declarator_list COMMA init_declarator
        rŠrr‡rN)r,)rr|r#r#r$Úp_init_declarator_list szCParser.p_init_declarator_listcCs=td|ddt|ƒdkr,|dndƒ|d<dS)zb init_declarator : declarator
                            | declarator EQUALS initializer
        rArrZrWr‡Nr)rr,)rr|r#r#r$Úp_init_declarator)szCParser.p_init_declaratorcCs<t|ƒdkr'|d|dgn
|dg|d<dS)z id_init_declarator_list    : id_init_declarator
                                       | id_init_declarator_list COMMA init_declarator
        rŠrr‡rN)r,)rr|r#r#r$Úp_id_init_declarator_list/sz!CParser.p_id_init_declarator_listcCs=td|ddt|ƒdkr,|dndƒ|d<dS)zn id_init_declarator : id_declarator
                               | id_declarator EQUALS initializer
        rArrZrWr‡Nr)rr,)rr|r#r#r$Úp_id_init_declarator5szCParser.p_id_init_declaratorcCs+|j|d|ddddƒ|d<dS)zY specifier_qualifier_list    : specifier_qualifier_list type_specifier_no_typeid
        rrWr>r*TrN)rT)rr|r#r#r$Úp_specifier_qualifier_list_1=sz$CParser.p_specifier_qualifier_list_1cCs+|j|d|ddddƒ|d<dS)zO specifier_qualifier_list    : specifier_qualifier_list type_qualifier
        rrWrOr*TrN)rT)rr|r#r#r$Úp_specifier_qualifier_list_2Bsz$CParser.p_specifier_qualifier_list_2cCs!|jd|ddƒ|d<dS)z4 specifier_qualifier_list  : type_specifier
        Nrr>r)rT)rr|r#r#r$Úp_specifier_qualifier_list_3Gsz$CParser.p_specifier_qualifier_list_3c	CsLtd|ddgdgdgƒ}|j||ddddƒ|d	<d
S)zH specifier_qualifier_list  : type_qualifier_list type_specifier
        rOrrPr>rQrWr*TrN)rrT)rr|rSr#r#r$Úp_specifier_qualifier_list_4Ls%z$CParser.p_specifier_qualifier_list_4c	CsF|j|dƒ}|d|dddd|j|dƒƒ|d<dS)z{ struct_or_union_specifier   : struct_or_union ID
                                        | struct_or_union TYPEID
        rr3rWr_Nr4r)rhr…)rr|Úklassr#r#r$Úp_struct_or_union_specifier_1Us

z%CParser.p_struct_or_union_specifier_1c	CsF|j|dƒ}|ddd|dd|j|dƒƒ|d<dS)	zd struct_or_union_specifier : struct_or_union brace_open struct_declaration_list brace_close
        rr3Nr_r‡r4rWr)rhr…)rr|r§r#r#r$Úp_struct_or_union_specifier_2_s

z%CParser.p_struct_or_union_specifier_2c	CsJ|j|dƒ}|d|dd|dd|j|dƒƒ|d<dS)	zÙ struct_or_union_specifier   : struct_or_union ID brace_open struct_declaration_list brace_close
                                        | struct_or_union TYPEID brace_open struct_declaration_list brace_close
        rr3rWr_rŠr4rN)rhr…)rr|r§r#r#r$Úp_struct_or_union_specifier_3hs


z%CParser.p_struct_or_union_specifier_3cCs|d|d<dS)zF struct_or_union : STRUCT
                            | UNION
        rrNr#)rr|r#r#r$Úp_struct_or_unionrszCParser.p_struct_or_unioncCsIt|ƒdkr)|dpg|d<n|d|dp=g|d<dS)z struct_declaration_list     : struct_declaration
                                        | struct_declaration_list struct_declaration
        rWrrN)r,)rr|r#r#r$Úp_struct_declaration_listzsz!CParser.p_struct_declaration_listc	Csü|d}d|dks t‚|ddk	rO|jd|d|dƒ}nŸt|dƒdkrÄ|dd	}t|tjƒrŽ|}ntj|ƒ}|jd|dtd
|ƒgƒ}n*|jd|dtd
dddƒgƒ}||d	<dS)zW struct_declaration : specifier_qualifier_list struct_declarator_list_opt SEMI
        rrUrPrWNrSr_r>rrArZ)r-rcr,r?rZNoderKr)rr|rSr_ZnodeZ	decl_typer#r#r$Úp_struct_declaration_1ƒs$
				zCParser.p_struct_declaration_1cCsd|d<dS)z# struct_declaration : SEMI
        Nrr#)rr|r#r#r$Úp_struct_declaration_2©szCParser.p_struct_declaration_2cCs<t|ƒdkr'|d|dgn
|dg|d<dS)zŠ struct_declarator_list  : struct_declarator
                                    | struct_declarator_list COMMA struct_declarator
        rŠrr‡rN)r,)rr|r#r#r$Úp_struct_declarator_list®sz CParser.p_struct_declarator_listcCsd|dddi|d<dS)z( struct_declarator : declarator
        rArrVNrr#)rr|r#r#r$Úp_struct_declarator_1·szCParser.p_struct_declarator_1cCs`t|ƒdkr3d|dd|di|d<n)dtjdddƒd|di|d<dS)z€ struct_declarator   : declarator COLON constant_expression
                                | COLON constant_expression
        r‡rArrVrNrW)r,rr@)rr|r#r#r$Úp_struct_declarator_2¼s!zCParser.p_struct_declarator_2cCs-tj|dd|j|dƒƒ|d<dS)zM enum_specifier  : ENUM ID
                            | ENUM TYPEID
        rWNrr)rrr…)rr|r#r#r$Úp_enum_specifier_1ÅszCParser.p_enum_specifier_1cCs-tjd|d|j|dƒƒ|d<dS)zG enum_specifier  : ENUM brace_open enumerator_list brace_close
        Nr‡rr)rrr…)rr|r#r#r$Úp_enum_specifier_2ËszCParser.p_enum_specifier_2cCs1tj|d|d|j|dƒƒ|d<dS)z› enum_specifier  : ENUM ID brace_open enumerator_list brace_close
                            | ENUM TYPEID brace_open enumerator_list brace_close
        rWrŠrrN)rrr…)rr|r#r#r$Úp_enum_specifier_3ÐszCParser.p_enum_specifier_3cCs†t|ƒdkr9tj|dg|djƒ|d<nIt|ƒdkr\|d|d<n&|djj|dƒ|d|d<dS)z™ enumerator_list : enumerator
                            | enumerator_list COMMA
                            | enumerator_list COMMA enumerator
        rWrrr‡N)r,rZEnumeratorListr4Zenumeratorsr*)rr|r#r#r$Úp_enumerator_listÖs'zCParser.p_enumerator_listcCs‡t|ƒdkr:tj|dd|j|dƒƒ}n)tj|d|d|j|dƒƒ}|j|j|jƒ||d<dS)zR enumerator  : ID
                        | ID EQUALS constant_expression
        rWrNr‡r)r,rZ
Enumeratorr…r6r3r4)rr|Z
enumeratorr#r#r$Úp_enumeratorãs
zCParser.p_enumeratorcCs|d|d<dS)zQ declarator  : id_declarator
                        | typeid_declarator
        rrNr#)rr|r#r#r$Úp_declaratorószCParser.p_declaratorrGÚIDÚtypeidÚTYPEIDÚtypeid_noparencCs|d|d<dS)z1 xxx_declarator  : direct_xxx_declarator
        rrNr#)rr|r#r#r$Úp_xxx_declarator_1ùszCParser.p_xxx_declarator_1cCs"|j|d|dƒ|d<dS)z9 xxx_declarator  : pointer direct_xxx_declarator
        rWrrN)rC)rr|r#r#r$Úp_xxx_declarator_2ÿszCParser.p_xxx_declarator_2cCs<tjd|dddddd|j|dƒƒ|d<dS)z' direct_xxx_declarator   : yyy
        rIrr>NrJr4r)rr@r…)rr|r#r#r$Úp_direct_xxx_declarator_1s
	
z!CParser.p_direct_xxx_declarator_1cCs|d|d<dS)z@ direct_xxx_declarator   : LPAREN xxx_declarator RPAREN
        rWrNr#)rr|r#r#r$Úp_direct_xxx_declarator_2sz!CParser.p_direct_xxx_declarator_2c
Cs—t|ƒdkr|dngp%g}tjdddt|ƒdkrS|dn|dd|d|d	jƒ}|jd
|d	d|ƒ|d<dS)
z} direct_xxx_declarator   : direct_xxx_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET
        ér‡r>NÚdimrŠÚ	dim_qualsr4rrArBr)r,rÚ	ArrayDeclr4rC)rr|rJÚarrr#r#r$Úp_direct_xxx_declarator_3s(	&z!CParser.p_direct_xxx_declarator_3c
Cs‡dd„|d|dgDƒ}dd„|Dƒ}tjddd|d	d
|d|djƒ}|jd
|dd|ƒ|d<dS)zÿ direct_xxx_declarator   : direct_xxx_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET
                                    | direct_xxx_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET
        cSs.g|]$}t|tƒr!|n|g‘qSr#)r?Úlist)rFÚitemr#r#r$rH,s	z5CParser.p_direct_xxx_declarator_4.<locals>.<listcomp>r‡rŠcSs/g|]%}|D]}|dk	r|‘qqS)Nr#)rFZsublistrOr#r#r$rH.s	
r>NrÁrÀrÂr4rrArBr)rrÃr4rC)rr|Zlisted_qualsrÂrÄr#r#r$Úp_direct_xxx_declarator_4$s		
z!CParser.p_direct_xxx_declarator_4c
Cs…tjdddtj|d|j|dƒƒd|ddkrK|dngd|djƒ}|jd	|dd
|ƒ|d<dS)zi direct_xxx_declarator   : direct_xxx_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET
        r>NrÁrŠrÂr‡r4rrArBr)rrÃr¸r…r4rC)rr|rÄr#r#r$Úp_direct_xxx_declarator_5:s	" z!CParser.p_direct_xxx_declarator_5cCs±tjd|dddd|djƒ}|jƒjdkr|jdk	rx=|jjD]/}t|tjƒrsP|j	|j
|jƒqZW|jd|dd	|ƒ|d
<dS)z¹ direct_xxx_declarator   : direct_xxx_declarator LPAREN parameter_type_list RPAREN
                                    | direct_xxx_declarator LPAREN identifier_list_opt RPAREN
        Úargsr‡r>Nr4rÚLBRACErArBr)rrLr4r=r>rÊÚparamsr?Ú
EllipsisParamr6r3rC)rr|ÚfuncZparamr#r#r$Úp_direct_xxx_declarator_6Fs	

z!CParser.p_direct_xxx_declarator_6cCs|j|dƒ}tjd|dp(gddd|ƒ}t|ƒdkr|d}x|jdk	rt|j}qYW||_|d|d<n
||d<dS)	zm pointer : TIMES type_qualifier_list_opt
                    | TIMES type_qualifier_list_opt pointer
        rrJrWr>Nr4r‡r)r…rZPtrDeclr,r>)rr|r4Znested_typeZ	tail_typer#r#r$Ú	p_pointercs(

	zCParser.p_pointercCs<t|ƒdkr|dgn|d|dg|d<dS)zs type_qualifier_list : type_qualifier
                                | type_qualifier_list type_qualifier
        rWrrN)r,)rr|r#r#r$Úp_type_qualifier_listszCParser.p_type_qualifier_listcCsMt|ƒdkr;|djjtj|j|dƒƒƒ|d|d<dS)zn parameter_type_list : parameter_list
                                | parameter_list COMMA ELLIPSIS
        rWrr‡rN)r,rÌr*rrÍr…)rr|r#r#r$Úp_parameter_type_list‡s)zCParser.p_parameter_type_listcCsct|ƒdkr9tj|dg|djƒ|d<n&|djj|dƒ|d|d<dS)zz parameter_list  : parameter_declaration
                            | parameter_list COMMA parameter_declaration
        rWrrr‡N)r,rÚ	ParamListr4rÌr*)rr|r#r#r$Úp_parameter_lists'zCParser.p_parameter_listcCss|d}|ds?tjdgd|j|dƒƒg|d<|jd|dtd|dƒgƒd	|d	<d
S)zŸ parameter_declaration   : declaration_specifiers id_declarator
                                    | declaration_specifiers typeid_noparen_declarator
        rr>rDr4rSr_rArWrN)rrKr…rcr)rr|rSr#r#r$Úp_parameter_declaration_1¤s

	z!CParser.p_parameter_declaration_1cCs<|d}|ds?tjdgd|j|dƒƒg|d<t|dƒdkrÅt|ddjƒdkrÅ|j|ddjdƒrÅ|jd|dtd|d	d
dƒgƒd}nitjdd
d|dd|d	pútj	dddƒd|j|d	ƒƒ}|d}|j
||ƒ}||d<dS)zR parameter_declaration   : declaration_specifiers abstract_declarator_opt
        rr>rDr4rrSr_rArWrZNr3r
rJrOr0r0)rrKr…r,rEr8rcrÚTypenamer@rN)rr|rSrArMr#r#r$Úp_parameter_declaration_2°s"

3	&	

z!CParser.p_parameter_declaration_2cCsct|ƒdkr9tj|dg|djƒ|d<n&|djj|dƒ|d|d<dS)ze identifier_list : identifier
                            | identifier_list COMMA identifier
        rWrrr‡N)r,rrÓr4rÌr*)rr|r#r#r$Úp_identifier_listÏs'zCParser.p_identifier_listcCs|d|d<dS)z- initializer : assignment_expression
        rrNr#)rr|r#r#r$Úp_initializer_1ÙszCParser.p_initializer_1cCsG|ddkr5tjg|j|dƒƒ|d<n|d|d<dS)z‹ initializer : brace_open initializer_list_opt brace_close
                        | brace_open initializer_list COMMA brace_close
        rWNrr)rÚInitListr…)rr|r#r#r$Úp_initializer_2Þs%zCParser.p_initializer_2cCsÃt|ƒdkri|ddkr,|dntj|d|dƒ}tj|g|djƒ|d<nV|ddkrƒ|dntj|d|dƒ}|djj|ƒ|d|d<dS)z initializer_list    : designation_opt initializer
                                | initializer_list COMMA designation_opt initializer
        r‡rNrWrrŠ)r,rZNamedInitializerrÚr4Úexprsr*)rr|rZr#r#r$Úp_initializer_listçs4#4zCParser.p_initializer_listcCs|d|d<dS)z. designation : designator_list EQUALS
        rrNr#)rr|r#r#r$Ú
p_designationószCParser.p_designationcCs<t|ƒdkr|dgn|d|dg|d<dS)z_ designator_list : designator
                            | designator_list designator
        rWrrN)r,)rr|r#r#r$Úp_designator_listûszCParser.p_designator_listcCs|d|d<dS)zi designator  : LBRACKET constant_expression RBRACKET
                        | PERIOD identifier
        rWrNr#)rr|r#r#r$Úp_designatorszCParser.p_designatorcCsstjddd|ddd|dp9tjdddƒd	|j|dƒƒ}|j||ddƒ|d
<dS)zH type_name   : specifier_qualifier_list abstract_declarator_opt
        r3r
rJrrOr>rWNr4r)rrÖr@r…rN)rr|rMr#r#r$Úp_type_names	zCParser.p_type_namecCs9tjdddƒ}|jd|d|dƒ|d<dS)z+ abstract_declarator     : pointer
        NrArBrr)rr@rC)rr|Z	dummytyper#r#r$Úp_abstract_declarator_1s	zCParser.p_abstract_declarator_1cCs"|j|d|dƒ|d<dS)zF abstract_declarator     : pointer direct_abstract_declarator
        rWrrN)rC)rr|r#r#r$Úp_abstract_declarator_2szCParser.p_abstract_declarator_2cCs|d|d<dS)z> abstract_declarator     : direct_abstract_declarator
        rrNr#)rr|r#r#r$Úp_abstract_declarator_3szCParser.p_abstract_declarator_3cCs|d|d<dS)zA direct_abstract_declarator  : LPAREN abstract_declarator RPAREN rWrNr#)rr|r#r#r$Úp_direct_abstract_declarator_1)sz&CParser.p_direct_abstract_declarator_1c
CsStjddd|ddgd|djƒ}|jd|dd	|ƒ|d
<dS)zn direct_abstract_declarator  : direct_abstract_declarator LBRACKET assignment_expression_opt RBRACKET
        r>NrÁr‡rÂr4rrArBr)rrÃr4rC)rr|rÄr#r#r$Úp_direct_abstract_declarator_2-s	
z&CParser.p_direct_abstract_declarator_2cCsKtjdtjdddƒd|ddgd|j|dƒƒ|d<dS)	zS direct_abstract_declarator  : LBRACKET assignment_expression_opt RBRACKET
        r>NrÁrWrÂr4rr)rrÃr@r…)rr|r#r#r$Úp_direct_abstract_declarator_38s
	
z&CParser.p_direct_abstract_declarator_3c
Csktjdddtj|d|j|dƒƒdgd|djƒ}|jd|dd	|ƒ|d
<dS)zZ direct_abstract_declarator  : direct_abstract_declarator LBRACKET TIMES RBRACKET
        r>NrÁr‡rÂr4rrArBr)rrÃr¸r…r4rC)rr|rÄr#r#r$Úp_direct_abstract_declarator_4As	"z&CParser.p_direct_abstract_declarator_4cCsctjdtjdddƒdtj|d|j|dƒƒdgd|j|dƒƒ|d<dS)	z? direct_abstract_declarator  : LBRACKET TIMES RBRACKET
        r>NrÁr‡rÂr4rr)rrÃr@r¸r…)rr|r#r#r$Úp_direct_abstract_declarator_5Ls
	"z&CParser.p_direct_abstract_declarator_5cCsMtjd|dddd|djƒ}|jd|dd|ƒ|d	<dS)
zh direct_abstract_declarator  : direct_abstract_declarator LPAREN parameter_type_list_opt RPAREN
        rÊr‡r>Nr4rrArBr)rrLr4rC)rr|rÎr#r#r$Úp_direct_abstract_declarator_6Us
	
z&CParser.p_direct_abstract_declarator_6c	CsEtjd|ddtjdddƒd|j|dƒƒ|d<dS)zM direct_abstract_declarator  : LPAREN parameter_type_list_opt RPAREN
        rÊrWr>Nr4rr)rrLr@r…)rr|r#r#r$Úp_direct_abstract_declarator_7_s	
z&CParser.p_direct_abstract_declarator_7cCs2t|dtƒr|dn
|dg|d<dS)zG block_item  : declaration
                        | statement
        rrN)r?rÆ)rr|r#r#r$Úp_block_itemjszCParser.p_block_itemcCsIt|ƒdks%|ddgkr/|dn|d|d|d<dS)z_ block_item_list : block_item
                            | block_item_list block_item
        rWNrr)r,)rr|r#r#r$Úp_block_item_listrszCParser.p_block_item_listcCs0tjd|dd|j|dƒƒ|d<dS)zA compound_statement : brace_open block_item_list_opt brace_close Zblock_itemsrWr4rrN)rZCompoundr…)rr|r#r#r$Úp_compound_statement_1ys	
zCParser.p_compound_statement_1cCs1tj|d|d|j|dƒƒ|d<dS)z( labeled_statement : ID COLON statement rr‡rN)rZLabelr…)rr|r#r#r$Úp_labeled_statement_1szCParser.p_labeled_statement_1cCs4tj|d|dg|j|dƒƒ|d<dS)z> labeled_statement : CASE constant_expression COLON statement rWrŠrrN)rZCaser…)rr|r#r#r$Úp_labeled_statement_2ƒszCParser.p_labeled_statement_2cCs-tj|dg|j|dƒƒ|d<dS)z- labeled_statement : DEFAULT COLON statement r‡rrN)rZDefaultr…)rr|r#r#r$Úp_labeled_statement_3‡szCParser.p_labeled_statement_3cCs4tj|d|dd|j|dƒƒ|d<dS)z= selection_statement : IF LPAREN expression RPAREN statement r‡rÀNrr)rÚIfr…)rr|r#r#r$Úp_selection_statement_1‹szCParser.p_selection_statement_1cCs8tj|d|d|d|j|dƒƒ|d<dS)zL selection_statement : IF LPAREN expression RPAREN statement ELSE statement r‡rÀérrN)rròr…)rr|r#r#r$Úp_selection_statement_2szCParser.p_selection_statement_2cCs7ttj|d|d|j|dƒƒƒ|d<dS)zA selection_statement : SWITCH LPAREN expression RPAREN statement r‡rÀrrN)rrZSwitchr…)rr|r#r#r$Úp_selection_statement_3“szCParser.p_selection_statement_3cCs1tj|d|d|j|dƒƒ|d<dS)z@ iteration_statement : WHILE LPAREN expression RPAREN statement r‡rÀrrN)rZWhiler…)rr|r#r#r$Úp_iteration_statement_1˜szCParser.p_iteration_statement_1cCs1tj|d|d|j|dƒƒ|d<dS)zH iteration_statement : DO statement WHILE LPAREN expression RPAREN SEMI rÀrWrrN)rZDoWhiler…)rr|r#r#r$Úp_iteration_statement_2œszCParser.p_iteration_statement_2cCs?tj|d|d|d|d|j|dƒƒ|d<dS)zj iteration_statement : FOR LPAREN expression_opt SEMI expression_opt SEMI expression_opt RPAREN statement r‡rÀrôé	rrN)rÚForr…)rr|r#r#r$Úp_iteration_statement_3 szCParser.p_iteration_statement_3cCsWtjtj|d|j|dƒƒ|d|d|d|j|dƒƒ|d<dS)zb iteration_statement : FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN statement r‡rrŠéérN)rrúZDeclListr…)rr|r#r#r$Úp_iteration_statement_4¤s%zCParser.p_iteration_statement_4cCs*tj|d|j|dƒƒ|d<dS)z  jump_statement  : GOTO ID SEMI rWrrN)rZGotor…)rr|r#r#r$Úp_jump_statement_1©szCParser.p_jump_statement_1cCs#tj|j|dƒƒ|d<dS)z jump_statement  : BREAK SEMI rrN)rZBreakr…)rr|r#r#r$Úp_jump_statement_2­szCParser.p_jump_statement_2cCs#tj|j|dƒƒ|d<dS)z! jump_statement  : CONTINUE SEMI rrN)rZContinuer…)rr|r#r#r$Úp_jump_statement_3±szCParser.p_jump_statement_3cCsBtjt|ƒdkr"|dnd|j|dƒƒ|d<dS)z\ jump_statement  : RETURN expression SEMI
                            | RETURN SEMI
        rŠrWNrr)rZReturnr,r…)rr|r#r#r$Úp_jump_statement_4µszCParser.p_jump_statement_4cCsD|ddkr2tj|j|dƒƒ|d<n|d|d<dS)z, expression_statement : expression_opt SEMI rNrWr)rZEmptyStatementr…)rr|r#r#r$Úp_expression_statement»s"zCParser.p_expression_statementcCs‡t|ƒdkr#|d|d<n`t|dtjƒs]tj|dg|djƒ|d<|djj|dƒ|d|d<dS)zn expression  : assignment_expression
                        | expression COMMA assignment_expression
        rWrrr‡N)r,r?rÚExprListr4rÜr*)rr|r#r#r$Úp_expressionÂs$zCParser.p_expressioncCs0tj|dgd|j|dƒƒ|d<dS)z typedef_name : TYPEID rr4rN)rrKr…)rr|r#r#r$Úp_typedef_nameÏszCParser.p_typedef_namecCsVt|ƒdkr#|d|d<n/tj|d|d|d|djƒ|d<dS)z› assignment_expression   : conditional_expression
                                    | unary_expression assignment_operator assignment_expression
        rWrrr‡N)r,rZ
Assignmentr4)rr|r#r#r$Úp_assignment_expressionÓszCParser.p_assignment_expressioncCs|d|d<dS)aÞ assignment_operator : EQUALS
                                | XOREQUAL
                                | TIMESEQUAL
                                | DIVEQUAL
                                | MODEQUAL
                                | PLUSEQUAL
                                | MINUSEQUAL
                                | LSHIFTEQUAL
                                | RSHIFTEQUAL
                                | ANDEQUAL
                                | OREQUAL
        rrNr#)rr|r#r#r$Úp_assignment_operatorás
zCParser.p_assignment_operatorcCs|d|d<dS)z. constant_expression : conditional_expression rrNr#)rr|r#r#r$Úp_constant_expressionðszCParser.p_constant_expressioncCsVt|ƒdkr#|d|d<n/tj|d|d|d|djƒ|d<dS)zœ conditional_expression  : binary_expression
                                    | binary_expression CONDOP expression COLON conditional_expression
        rWrrr‡rÀN)r,rZ	TernaryOpr4)rr|r#r#r$Úp_conditional_expressionôsz CParser.p_conditional_expressioncCsVt|ƒdkr#|d|d<n/tj|d|d|d|djƒ|d<dS)ak binary_expression   : cast_expression
                                | binary_expression TIMES binary_expression
                                | binary_expression DIVIDE binary_expression
                                | binary_expression MOD binary_expression
                                | binary_expression PLUS binary_expression
                                | binary_expression MINUS binary_expression
                                | binary_expression RSHIFT binary_expression
                                | binary_expression LSHIFT binary_expression
                                | binary_expression LT binary_expression
                                | binary_expression LE binary_expression
                                | binary_expression GE binary_expression
                                | binary_expression GT binary_expression
                                | binary_expression EQ binary_expression
                                | binary_expression NE binary_expression
                                | binary_expression AND binary_expression
                                | binary_expression OR binary_expression
                                | binary_expression XOR binary_expression
                                | binary_expression LAND binary_expression
                                | binary_expression LOR binary_expression
        rWrrr‡N)r,rZBinaryOpr4)rr|r#r#r$Úp_binary_expressionýszCParser.p_binary_expressioncCs|d|d<dS)z$ cast_expression : unary_expression rrNr#)rr|r#r#r$Úp_cast_expression_1szCParser.p_cast_expression_1cCs1tj|d|d|j|dƒƒ|d<dS)z; cast_expression : LPAREN type_name RPAREN cast_expression rWrŠrrN)rZCastr…)rr|r#r#r$Úp_cast_expression_2szCParser.p_cast_expression_2cCs|d|d<dS)z* unary_expression    : postfix_expression rrNr#)rr|r#r#r$Úp_unary_expression_1szCParser.p_unary_expression_1cCs,tj|d|d|djƒ|d<dS)z¸ unary_expression    : PLUSPLUS unary_expression
                                | MINUSMINUS unary_expression
                                | unary_operator cast_expression
        rrWrN)rÚUnaryOpr4)rr|r#r#r$Úp_unary_expression_2#szCParser.p_unary_expression_2cCsMtj|dt|ƒdkr)|dn|d|j|dƒƒ|d<dS)zx unary_expression    : SIZEOF unary_expression
                                | SIZEOF LPAREN type_name RPAREN
        rr‡rWrN)rrr,r…)rr|r#r#r$Úp_unary_expression_3*s#zCParser.p_unary_expression_3cCs|d|d<dS)zÏ unary_operator  : AND
                            | TIMES
                            | PLUS
                            | MINUS
                            | NOT
                            | LNOT
        rrNr#)rr|r#r#r$Úp_unary_operator3szCParser.p_unary_operatorcCs|d|d<dS)z* postfix_expression  : primary_expression rrNr#)rr|r#r#r$Úp_postfix_expression_1=szCParser.p_postfix_expression_1cCs,tj|d|d|djƒ|d<dS)zG postfix_expression  : postfix_expression LBRACKET expression RBRACKET rr‡rN)rÚArrayRefr4)rr|r#r#r$Úp_postfix_expression_2AszCParser.p_postfix_expression_2cCsDtj|dt|ƒdkr)|dnd|djƒ|d<dS)zœ postfix_expression  : postfix_expression LPAREN argument_expression_list RPAREN
                                | postfix_expression LPAREN RPAREN
        rrÀr‡Nr)rÚFuncCallr,r4)rr|r#r#r$Úp_postfix_expression_3EszCParser.p_postfix_expression_3cCsQtj|d|j|dƒƒ}tj|d|d||djƒ|d<dS)zÿ postfix_expression  : postfix_expression PERIOD ID
                                | postfix_expression PERIOD TYPEID
                                | postfix_expression ARROW ID
                                | postfix_expression ARROW TYPEID
        r‡rrWrN)rr¸r…Ú	StructRefr4)rr|Úfieldr#r#r$Úp_postfix_expression_4Ks"zCParser.p_postfix_expression_4cCs0tjd|d|d|djƒ|d<dS)z{ postfix_expression  : postfix_expression PLUSPLUS
                                | postfix_expression MINUSMINUS
        r|rWrrN)rrr4)rr|r#r#r$Úp_postfix_expression_5TszCParser.p_postfix_expression_5cCs"tj|d|dƒ|d<dS)zÇ postfix_expression  : LPAREN type_name RPAREN brace_open initializer_list brace_close
                                | LPAREN type_name RPAREN brace_open initializer_list COMMA brace_close
        rWrÀrN)rZCompoundLiteral)rr|r#r#r$Úp_postfix_expression_6ZszCParser.p_postfix_expression_6cCs|d|d<dS)z" primary_expression  : identifier rrNr#)rr|r#r#r$Úp_primary_expression_1`szCParser.p_primary_expression_1cCs|d|d<dS)z  primary_expression  : constant rrNr#)rr|r#r#r$Úp_primary_expression_2dszCParser.p_primary_expression_2cCs|d|d<dS)zp primary_expression  : unified_string_literal
                                | unified_wstring_literal
        rrNr#)rr|r#r#r$Úp_primary_expression_3hszCParser.p_primary_expression_3cCs|d|d<dS)z0 primary_expression  : LPAREN expression RPAREN rWrNr#)rr|r#r#r$Úp_primary_expression_4nszCParser.p_primary_expression_4cCsY|j|dƒ}tjtj|d|ƒtj|d|dg|ƒ|ƒ|d<dS)za primary_expression  : OFFSETOF LPAREN type_name COMMA offsetof_member_designator RPAREN
        rr‡rÀrN)r…rrr¸r)rr|r4r#r#r$Úp_primary_expression_5rszCParser.p_primary_expression_5cCsÜt|ƒdkr#|d|d<nµt|ƒdkr…tj|d|j|dƒƒ}tj|d|d||djƒ|d<nSt|ƒdkrÂtj|d|d|djƒ|d<ntdt|ƒƒ‚dS)	zì offsetof_member_designator : identifier
                                         | offsetof_member_designator PERIOD identifier
                                         | offsetof_member_designator LBRACKET expression RBRACKET
        rWrrrŠr‡rÀz$Unexpected parsing state. len(p): %uN)r,rr¸r…rr4rÚNotImplementedError)rr|rr#r#r$Úp_offsetof_member_designatorzs".+z$CParser.p_offsetof_member_designatorcCsct|ƒdkr9tj|dg|djƒ|d<n&|djj|dƒ|d|d<dS)zœ argument_expression_list    : assignment_expression
                                        | argument_expression_list COMMA assignment_expression
        rWrrr‡N)r,rrr4rÜr*)rr|r#r#r$Úp_argument_expression_list‰s'z"CParser.p_argument_expression_listcCs*tj|d|j|dƒƒ|d<dS)z identifier  : ID rrN)rr¸r…)rr|r#r#r$Úp_identifier“szCParser.p_identifiercCs-tjd|d|j|dƒƒ|d<dS)z constant    : INT_CONST_DEC
                        | INT_CONST_OCT
                        | INT_CONST_HEX
                        | INT_CONST_BIN
        rDrrN)rÚConstantr…)rr|r#r#r$Úp_constant_1—szCParser.p_constant_1cCs-tjd|d|j|dƒƒ|d<dS)zM constant    : FLOAT_CONST
                        | HEX_FLOAT_CONST
        ÚfloatrrN)rr&r…)rr|r#r#r$Úp_constant_2 szCParser.p_constant_2cCs-tjd|d|j|dƒƒ|d<dS)zH constant    : CHAR_CONST
                        | WCHAR_CONST
        ÚcharrrN)rr&r…)rr|r#r#r$Úp_constant_3§szCParser.p_constant_3cCs€t|ƒdkr>tjd|d|j|dƒƒ|d<n>|djdd…|ddd…|d_|d|d<dS)z~ unified_string_literal  : STRING_LITERAL
                                    | unified_string_literal STRING_LITERAL
        rWÚstringrrNr0)r,rr&r…Úvalue)rr|r#r#r$Úp_unified_string_literal³s
&0z CParser.p_unified_string_literalcCs†t|ƒdkr>tjd|d|j|dƒƒ|d<nD|djjƒdd…|ddd…|d_|d|d<dS)z unified_wstring_literal : WSTRING_LITERAL
                                    | unified_wstring_literal WSTRING_LITERAL
        rWr,rrNr0)r,rr&r…r-Úrstrip)rr|r#r#r$Úp_unified_wstring_literal¾s
&6z!CParser.p_unified_wstring_literalcCs+|d|d<|jd|jdƒƒdS)z  brace_open  :   LBRACE
        rrN)Ú
set_linenoÚlineno)rr|r#r#r$Úp_brace_openÉszCParser.p_brace_opencCs+|d|d<|jd|jdƒƒdS)z  brace_close :   RBRACE
        rrN)r1r2)rr|r#r#r$Ú
p_brace_closeÏszCParser.p_brace_closecCsd|d<dS)zempty : Nrr#)rr|r#r#r$Úp_emptyÕszCParser.p_emptycCs[|rA|jd|j|jd|jd|jj|ƒƒƒn|jd|jjƒdS)Nz
before: %sr2r<zAt end of input)r2r-r9r2rZfind_tok_columnr')rr|r#r#r$Úp_errorÙs
zCParser.p_errorN©úleftrj©r8rk©r8zOR©r8rm©r8rn©r8rorp©r8rqrrrsrt©r8rurv©r8zPLUSzMINUS©r8ryrzr{)
r7r9r:r;r<r=r>r?r@rA)úidúID)r¹rº)r»rº)rBrC)r¹rº)r»rº)rBrC)r¹rº)r»rº)rBrC)r¹rº)rBrC)r¹rº)r»rº)rBrC)r¹rº)r»rº)rBrC)r¹rº)r»rº)rBrC)r¹rº)r»rº)£Ú__name__Ú
__module__Ú__qualname__rr%r(r+r/r5r6r8rrrrr=rCrNrTrcrfrhZ
precedencer}r~r€rr‚rƒr„r†rˆr‰r‹rŒrŽrrr‘r’r“r”r•r–r—r˜r™ršr›rœrržrŸr r¡r¢r£r¤r¥r¦r¨r©rªr«r¬r­r®r¯r°r±r²r³r´rµr¶r·r	r¼r½r¾r¿rÅrÈrÉrÏrÐrÑrÒrÔrÕr×rØrÙrÛrÝrÞrßràrárârãrärårærçrèrérêrërìrírîrïrðrñrórõrör÷rørûrþrÿrrrrrrrrr	r
rrr
rrrrrrrrrrrrrr r!r#r$r%r'r)r+r.r0r3r4r5r6r#r#r#r$rsZg	

	)7-Y
	<				
	
	&		

	
	
		

		
	
	rÚ__main__)ÚreZplyrr
rÚc_lexerrZ	plyparserrrrr	r
Zast_transformsrrrDÚpprintÚtimeÚsysr#r#r#r$Ú<module>	s (ÿÿÿÿÿÿÙ