Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 FøªjÐã@sdddlmZddlmZddlmZddlmZmZm Z m Z ddl m Z m Z e Gdd„deƒƒZdS) é)Úyacc)Úc_ast)ÚCLexer)Ú PLYParserÚ ParseErrorÚ parameterizedÚtemplate)Úfix_switch_casesÚfix_atomic_specifiersc @säeZdZdedddddfdd„Z�dqdd „Zd d „Zd d „Zdd„Zdd„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zd d!„Z�drd"d#„Z�dsd$d%„Zd&d'„Zd(d)„Z�d~Zd=d>„Zd?d@„ZdAdB„ZdCdD„ZdEdF„ZdGdH„ZdIdJ„ZdKdL„ZdMdN„ZdOdP„Z dQdR„Z!dSdT„Z"dUdV„Z#dWdX„Z$dYdZ„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„Z0dqdr„Z1dsdt„Z2dudv„Z3dwdx„Z4dydz„Z5d{d|„Z6d}d~„Z7dd€„Z8d�d‚„Z9dƒd„„Z:d…d†„Z;d‡dˆ„Zd�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¼„ZVeW�d�d€�d�ƒdÂdăZXeW�d‚�dƒ�d„ƒdÄdÅ„ƒZYeW�d…�d†�d‡ƒdÆdÇ„ƒZZeW�dˆ�d‰ƒdÈdÉ„ƒZ[eW�dŠ�d‹�dŒƒdÊdË„ƒZ\eW�d��dŽ�d�ƒdÌdÍ„ƒZ]eW�d��d‘�d’ƒdÎdÏ„ƒZ^eW�d“�d”�d•ƒ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ÿ„Zv�d�d„Zw�d�d„Zx�d�d„Zy�d�d„Zz�d�d „Z{�d �d „Z|�d �d „Z}�d�d„Z~�d�d„Z�d�d„Z€�d�d„Z��d�d„Z‚�d�d„Zƒ�d�d„Z„�d�d„Z…�d�d„Z†�d �d!„Z‡�d"�d#„Zˆ�d$�d%„Z‰�d&�d'„ZŠ�d(�d)„Z‹�d*�d+„ZŒ�d,�d-„Z��d.�d/„ZŽ�d0�d1„Z��d2�d3„Z��d4�d5„Z‘�d6�d7„Z’�d8�d9„Z“�d:�d;„Z”�d<�d=„Z•�d>�d?„Z–�d@�dA„Z—�dB�dC„Z˜�dD�dE„Z™�dF�dG„Zš�dH�dI„Z›�dJ�dK„Zœ�dL�dM„Z��dN�dO„Zž�dP�dQ„ZŸ�dR�dS„Z �dT�dU„Z¡�dV�dW„Z¢�dX�dY„Z£�dZ�d[„Z¤�d\�d]„Z¥�d^�d_„Z¦�d`�da„Z§�db�dc„Z¨�dd�de„Z©�df�dg„Zª�dh�di„Z«�dj�dk„Z¬�dl�dm„Z­�dn�do„Z®�dpS(–ÚCParserTzpycparser.lextabzpycparser.yacctabFÚc Csš||j|j|j|jd�|_|jj|||d�|jj|_ddddddd d d d d dddg}x|D]} |j| ƒq\Wtj|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ÚlextabÚ outputdirZabstract_declaratorZassignment_expressionZdeclaration_listZdeclaration_specifiers_no_typeZ designationZ expressionZidentifier_listZinit_declarator_listZid_init_declarator_listZinitializer_listZparameter_type_listZblock_item_listZtype_qualifier_listZstruct_declarator_listZtranslation_unit_or_empty)ÚmoduleÚstartÚdebugr Z tabmodulerN) Ú_lex_error_funcÚ_lex_on_lbrace_funcÚ_lex_on_rbrace_funcÚ_lex_type_lookup_funcÚclexÚbuildÚtokensZ_create_opt_rulerÚcparserÚdictÚ _scope_stackÚ_last_yielded_token) ÚselfZ lex_optimizeÚlexerrZ yacc_optimizeZyacctabZ yacc_debugZ taboutputdirZrules_with_optZrule©r ú7/tmp/pip-build-_d5lkt3n/pycparser/pycparser/c_parser.pyÚ__init__sF:    zCParser.__init__cCs6||j_|jjƒtƒg|_d|_|jj||j|d�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) debug: Debug flag to YACC N)Úinputrr)rÚfilenameZ reset_linenorrrrÚparse)rÚtextr$rr 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_scopecCs4|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éÿÿÿÿr-)rÚgetÚ _parse_error)rÚnameÚcoordr r r!Ú_add_typedef_name¡s  zCParser._add_typedef_namecCs4|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 scopeNr-r-)rr.r/)rr0r1r r r!Ú_add_identifierªs  zCParser._add_identifiercCs.x(t|jƒD]}|j|ƒ}|dk r |Sq WdS)z8 Is *name* a typedef-name in the current scope? NF)Úreversedrr.)rr0ZscopeZin_scoper r r!Ú_is_type_in_scope´s  zCParser._is_type_in_scopecCs|j||j||ƒƒdS)N)r/Ú_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. )r5)rr0Zis_typer r r!rÇs zCParser._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_tokencCsd|}|}x|jr|j}q Wt|tjƒr0||_|S|}xt|jtjƒsL|j}q6W|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}qW|j|_|jdd…|_x>|D]6}t|tjƒs:t|ƒdkrf|j d|j ƒq:||_|Sq:W|sªt|jtj ƒs”|j d|j ƒtjdg|j d�|_n tjdd„|Dƒ|d j d�|_|S) z- Fixes a declaration. Modifies decl. Nrz Invalid multiple types specifiedzMissing type in declarationÚint)r1cSsg|]}|jD]}|‘qqSr )Únames)Ú.0Úidr0r r r!ú Ssz/CParser._fix_decl_name_type..é) r<rr=r;Údeclnamer0ÚqualsÚIdentifierTyper)r/r1ÚFuncDecl)rr>Útypenamer;Útnr r r!Ú_fix_decl_name_type+s.       zCParser._fix_decl_name_typecCs>|ptgggggd�}|r*||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 * alignment: a list of alignment 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;ÚfunctionÚ alignmentrF)rr'Úinsert)rZdeclspecZnewspecÚkindr'Úspecr r r!Ú_add_declaration_specifierWs z"CParser._add_declaration_specifierc Cspd|dk}g}|djdƒdk r&�n>|dddkrît|dƒdksvt|ddjƒd ksv|j|ddjdƒ rªd }x"|dD]}t|d ƒr„|j}Pq„W|jd |ƒtj|ddjddd|d |ddjd�|dd<|dd=nvt |ddtj tj tj tj fƒ�sd|dd}xt |tjƒ�s8|j}�q W|jdk�rd|ddjd|_|dd=�x|D]ü} | ddk �s‚t‚|�r°tjd|d|d| d| djd�} nBtjd|d|d |d|d| d| jdƒ| jdƒ| djd� } t | jtj tj tj tj fƒ�r| } n|j| |dƒ} |�rT|�rD|j| j| jƒn|j| j| jƒt| ƒ} |j| ƒ�qlW|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. ÚtypedefrOrFÚbitsizeNr>r;érú?r1zInvalid declarationrQ)rGr;rHÚalignr1rN)r0rHrOr;r1rPÚinit) r0rHrZrOÚfuncspecr;r[rWr1r-r-r-r-r-r-r-)r.r)rBr5Úhasattrr1r/rr=r<ÚEnumÚStructÚUnionrIr;rGr*ZTypedefÚDeclrMr2r0r3r r') rrTÚdeclsÚtypedef_namespaceZ is_typedefZ declarationsr1ÚtZ decls_0_tailr>Ú declarationZ fixed_declr r r!Ú_build_declarationspsv &           zCParser._build_declarationscCsLd|dkr|jd|jƒ|j|t|dd�gdd�d}tj||||jd �S) z' Builds a function definition. rVrOzInvalid typedefN)r>r[T)rTrbrcrF)r>Ú param_declsÚbodyr1)r/r1rfrrZFuncDef)rrTr>rgrhrer 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. ÚstructN)rr_r`)rÚtokenr r r!Ú_select_struct_union_classÚsz"CParser._select_struct_union_classÚleftÚLORÚLANDÚORÚXORÚANDÚEQÚNEÚGTÚGEÚLTÚLEÚRSHIFTÚLSHIFTÚPLUSÚMINUSÚTIMESÚDIVIDEÚMODcCs2|ddkrtjgƒ|d<ntj|dƒ|d<dS)zh translation_unit_or_empty : translation_unit | empty rNrF)rZFileAST)rÚpr r r!Úp_translation_unit_or_emptyüs z#CParser.p_translation_unit_or_emptycCs|d|d<dS)z4 translation_unit : external_declaration rrFNr )rr€r r r!Úp_translation_unit_1szCParser.p_translation_unit_1cCs"|dj|dƒ|d|d<dS)zE translation_unit : translation_unit external_declaration rrXrFN)Úextend)rr€r r r!Úp_translation_unit_2 szCParser.p_translation_unit_2cCs|dg|d<dS)z7 external_declaration : function_definition rrFNr )rr€r r r!Úp_external_declaration_1sz CParser.p_external_declaration_1cCs|d|d<dS)z/ external_declaration : declaration rrFNr )rr€r r r!Úp_external_declaration_2sz CParser.p_external_declaration_2cCs|dg|d<dS)zi external_declaration : pp_directive | pppragma_directive rrFNr )rr€r r r!Úp_external_declaration_3sz CParser.p_external_declaration_3cCs g|d<dS)z( external_declaration : SEMI rFNr )rr€r r r!Úp_external_declaration_4%sz CParser.p_external_declaration_4cCs|d|d<dS)z1 external_declaration : static_assert rrFNr )rr€r r r!Úp_external_declaration_5*sz CParser.p_external_declaration_5cCsVt|ƒdkr.tj|dd|j|dƒƒg|d<n$tj|d|d|j|dƒƒg|d<dS)zÈ static_assert : _STATIC_ASSERT LPAREN constant_expression COMMA unified_string_literal RPAREN | _STATIC_ASSERT LPAREN constant_expression RPAREN ééNrrF)r)rZ StaticAssertÚ _token_coord)rr€r r r!Úp_static_assert_declaration/s "z#CParser.p_static_assert_declarationcCs|jd|j|dƒƒdS)z pp_directive : PPHASH zDirectives not supported yetrN)r/rŒ)rr€r r r!Úp_pp_directive8szCParser.p_pp_directivecCsFt|ƒdkr*tj|d|j|dƒƒ|d<ntjd|j|dƒƒ|d<dS)zg pppragma_directive : PPPRAGMA | PPPRAGMA PPPRAGMASTR r‹rXrFr rN)r)rÚPragmarŒ)rr€r r r!Úp_pppragma_directive>s zCParser.p_pppragma_directivec CsNtgggtjdg|j|dƒd�ggd�}|j||d|d|dd�|d<d S) zU function_definition : id_declarator declaration_list_opt compound_statement rAr)r1)rNrQrOr;rPrXr‹)rTr>rgrhrFN)rrrIrŒri)rr€rTr r r!Úp_function_definition_1IszCParser.p_function_definition_1cCs.|d}|j||d|d|dd�|d<dS)zl function_definition : declaration_specifiers id_declarator declaration_list_opt compound_statement rrXr‹é)rTr>rgrhrFN)ri)rr€rTr r r!Úp_function_definition_2[s zCParser.p_function_definition_2cCs|d|d<dS)a_ statement : labeled_statement | expression_statement | compound_statement | selection_statement | iteration_statement | jump_statement | pppragma_directive | static_assert rrFNr )rr€r r r!Ú p_statementjs zCParser.p_statementcCsTt|dtjƒrDt|ƒdkrDtj|d|dg|j|dƒd�|d<n |d|d<dS)zx pragmacomp_or_statement : pppragma_directive statement | statement rr‹rX)Ú block_itemsr1rFN)r<rr�r)ÚCompoundrŒ)rr€r r r!Úp_pragmacomp_or_statement¡s z!CParser.p_pragmacomp_or_statementc Cs¼|d}|ddkrœ|d}tjtjtjf}t|ƒdkr€t|d|ƒr€tjd|d|d|d|d |ddd|djd � g}q°|j|t ddd �gd d �}n|j||dd d �}||d<dS)z˜ decl_body : declaration_specifiers init_declarator_list_opt | declaration_specifiers_no_type id_init_declarator_list_opt rrXNr;rFrNrQrOrP) r0rHrZrOr\r;r[rWr1)r>r[T)rTrbrc) rr_r`r^r)r<rar1rfr)rr€rTÚtyZs_u_or_erbr r r!Ú p_decl_bodyµs0   zCParser.p_decl_bodycCs|d|d<dS)z& declaration : decl_body SEMI rrFNr )rr€r r r!Ú p_declarationòszCParser.p_declarationcCs,t|ƒdkr|dn|d|d|d<dS)zj declaration_list : declaration | declaration_list declaration rXrrFN)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 rXrrNrFN)rU)rr€r r r!Ú"p_declaration_specifiers_no_type_1sz*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 rXrrOrFN)rU)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 rXrrPrFN)rU)rr€r r r!Ú"p_declaration_specifiers_no_type_3sz*CParser.p_declaration_specifiers_no_type_3cCs|j|d|ddƒ|d<dS)z_ declaration_specifiers_no_type : atomic_specifier declaration_specifiers_no_type_opt rXrr;rFN)rU)rr€r r r!Ú"p_declaration_specifiers_no_type_4sz*CParser.p_declaration_specifiers_no_type_4cCs|j|d|ddƒ|d<dS)zb declaration_specifiers_no_type : alignment_specifier declaration_specifiers_no_type_opt rXrrQrFN)rU)rr€r r r!Ú"p_declaration_specifiers_no_type_5sz*CParser.p_declaration_specifiers_no_type_5cCs"|j|d|dddd�|d<dS)zI declaration_specifiers : declaration_specifiers type_qualifier rrXrNT)r'rFN)rU)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 rrXrOT)r'rFN)rU)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 rrXrPT)r'rFN)rU)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 rrXr;T)r'rFN)rU)rr€r r r!Úp_declaration_specifiers_40sz"CParser.p_declaration_specifiers_4cCs|jd|ddƒ|d<dS)z2 declaration_specifiers : type_specifier Nrr;rF)rU)rr€r r r!Úp_declaration_specifiers_55sz"CParser.p_declaration_specifiers_5cCs"|j|d|dddd�|d<dS)zQ declaration_specifiers : declaration_specifiers_no_type type_specifier rrXr;T)r'rFN)rU)rr€r r r!Úp_declaration_specifiers_6:sz"CParser.p_declaration_specifiers_6cCs"|j|d|dddd�|d<dS)zN declaration_specifiers : declaration_specifiers alignment_specifier rrXrQT)r'rFN)rU)rr€r r r!Úp_declaration_specifiers_7?sz"CParser.p_declaration_specifiers_7cCs|d|d<dS)a storage_class_specifier : AUTO | REGISTER | STATIC | EXTERN | TYPEDEF | _THREAD_LOCAL rrFNr )rr€r r r!Úp_storage_class_specifierDsz!CParser.p_storage_class_specifiercCs|d|d<dS)zR function_specifier : INLINE | _NORETURN rrFNr )rr€r r r!Úp_function_specifierNszCParser.p_function_specifiercCs$tj|dg|j|dƒd�|d<dS)a+ type_specifier_no_typeid : VOID | _BOOL | CHAR | SHORT | INT | LONG | FLOAT | DOUBLE | _COMPLEX | SIGNED | UNSIGNED | __INT128 r)r1rFN)rrIrŒ)rr€r r r!Úp_type_specifier_no_typeidTsz"CParser.p_type_specifier_no_typeidcCs|d|d<dS)zó type_specifier : typedef_name | enum_specifier | struct_or_union_specifier | type_specifier_no_typeid | atomic_specifier rrFNr )rr€r r r!Úp_type_specifierdszCParser.p_type_specifiercCs |d}|jjdƒ||d<dS)z= atomic_specifier : _ATOMIC LPAREN type_name RPAREN r‹Z_AtomicrFN)rHr')rr€Útypr r r!Úp_atomic_specifierns zCParser.p_atomic_specifiercCs|d|d<dS)z• type_qualifier : CONST | RESTRICT | VOLATILE | _ATOMIC rrFNr )rr€r r r!Úp_type_qualifieruszCParser.p_type_qualifiercCs0t|ƒdkr|d|dgn|dg|d<dS)z„ init_declarator_list : init_declarator | init_declarator_list COMMA init_declarator r’rr‹rFN)r))rr€r r r!Úp_init_declarator_list}szCParser.p_init_declarator_listcCs,t|dt|ƒdkr|dndd�|d<dS)zb init_declarator : declarator | declarator EQUALS initializer rrXr‹N)r>r[rF)rr))rr€r r r!Úp_init_declarator†szCParser.p_init_declaratorcCs0t|ƒdkr|d|dgn|dg|d<dS)z� id_init_declarator_list : id_init_declarator | id_init_declarator_list COMMA init_declarator r’rr‹rFN)r))rr€r r r!Úp_id_init_declarator_listŒsz!CParser.p_id_init_declarator_listcCs,t|dt|ƒdkr|dndd�|d<dS)zn id_init_declarator : id_declarator | id_declarator EQUALS initializer rrXr‹N)r>r[rF)rr))rr€r r r!Úp_id_init_declarator’szCParser.p_id_init_declaratorcCs"|j|d|dddd�|d<dS)zY specifier_qualifier_list : specifier_qualifier_list type_specifier_no_typeid rrXr;T)r'rFN)rU)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 rrXrNT)r'rFN)rU)rr€r r r!Úp_specifier_qualifier_list_2Ÿsz$CParser.p_specifier_qualifier_list_2cCs|jd|ddƒ|d<dS)z4 specifier_qualifier_list : type_specifier Nrr;rF)rU)rr€r r r!Úp_specifier_qualifier_list_3¤sz$CParser.p_specifier_qualifier_list_3cCs$t|dgg|dggd�|d<dS)zH specifier_qualifier_list : type_qualifier_list type_specifier rrX)rNrQrOr;rPrFN)r)rr€r r r!Úp_specifier_qualifier_list_4©sz$CParser.p_specifier_qualifier_list_4cCs tg|dggggd�|d<dS)z9 specifier_qualifier_list : alignment_specifier r)rNrQrOr;rPrFN)r)rr€r r r!Úp_specifier_qualifier_list_5®sz$CParser.p_specifier_qualifier_list_5cCs|j|d|ddƒ|d<dS)zR specifier_qualifier_list : specifier_qualifier_list alignment_specifier rrXrQrFN)rU)rr€r r r!Úp_specifier_qualifier_list_6³sz$CParser.p_specifier_qualifier_list_6cCs0|j|dƒ}||dd|j|dƒd�|d<dS)z{ struct_or_union_specifier : struct_or_union ID | struct_or_union TYPEID rrXN)r0rbr1rF)rlrŒ)rr€Úklassr r r!Úp_struct_or_union_specifier_1»s z%CParser.p_struct_or_union_specifier_1cCsX|j|dƒ}t|ƒdkr6|dg|j|dƒd�|d<n|d|d|j|dƒd�|d<dS)z³ struct_or_union_specifier : struct_or_union brace_open struct_declaration_list brace_close | struct_or_union brace_open brace_close rr’NrX)r0rbr1rFr‹)rlr)rŒ)rr€r¹r r r!Úp_struct_or_union_specifier_2Æs z%CParser.p_struct_or_union_specifier_2cCs`|j|dƒ}t|ƒdkr:||dg|j|dƒd�|d<n"||d|d|j|dƒd�|d<dS)a… struct_or_union_specifier : struct_or_union ID brace_open struct_declaration_list brace_close | struct_or_union ID brace_open brace_close | struct_or_union TYPEID brace_open struct_declaration_list brace_close | struct_or_union TYPEID brace_open brace_close rrŠrX)r0rbr1rFr’N)rlr)rŒ)rr€r¹r r r!Úp_struct_or_union_specifier_3Øs z%CParser.p_struct_or_union_specifier_3cCs|d|d<dS)zF struct_or_union : STRUCT | UNION rrFNr )rr€r r r!Úp_struct_or_unionëszCParser.p_struct_or_unioncCs:t|ƒdkr|dpg|d<n|d|dp.g|d<dS)z� struct_declaration_list : struct_declaration | struct_declaration_list struct_declaration rXrrFN)r))rr€r r r!Úp_struct_declaration_listós z!CParser.p_struct_declaration_listcCs¬|d}d|dkst‚|ddk r8|j||dd�}nht|dƒdkrˆ|dd}t|tjƒrf|}n tj|ƒ}|j|t|d �gd�}n|j|tddd �gd�}||d<dS) zW struct_declaration : specifier_qualifier_list struct_declarator_list_opt SEMI rrVrOrXN)rTrbr;rF)r>)r>r[)r*rfr)r<rÚNoderIr)rr€rTrbÚnodeZ decl_typer r r!Úp_struct_declaration_1üs$    zCParser.p_struct_declaration_1cCs d|d<dS)z# struct_declaration : SEMI NrFr )rr€r r r!Úp_struct_declaration_2"szCParser.p_struct_declaration_2cCs|dg|d<dS)z1 struct_declaration : pppragma_directive rrFNr )rr€r r r!Úp_struct_declaration_3'szCParser.p_struct_declaration_3cCs0t|ƒdkr|d|dgn|dg|d<dS)zŠ struct_declarator_list : struct_declarator | struct_declarator_list COMMA struct_declarator r’rr‹rFN)r))rr€r r r!Úp_struct_declarator_list,sz CParser.p_struct_declarator_listcCs|dddœ|d<dS)z( struct_declarator : declarator rN)r>rWrFr )rr€r r r!Úp_struct_declarator_15szCParser.p_struct_declarator_1cCsFt|ƒdkr$|d|ddœ|d<ntjddddƒ|ddœ|d<dS)z€ struct_declarator : declarator COLON constant_expression | COLON constant_expression r‹r)r>rWrFNrX)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 rXNrrF)rr^rŒ)rr€r r r!Úp_enum_specifier_1CszCParser.p_enum_specifier_1cCs"tjd|d|j|dƒƒ|d<dS)zG enum_specifier : ENUM brace_open enumerator_list brace_close Nr‹rrF)rr^rŒ)rr€r r r!Úp_enum_specifier_2IszCParser.p_enum_specifier_2cCs&tj|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 rXr’rrFN)rr^rŒ)rr€r r r!Úp_enum_specifier_3NszCParser.p_enum_specifier_3cCsht|ƒdkr*tj|dg|djƒ|d<n:t|ƒdkrD|d|d<n |djj|dƒ|d|d<dS)z™ enumerator_list : enumerator | enumerator_list COMMA | enumerator_list COMMA enumerator rXrrFr‹N)r)rZEnumeratorListr1Z enumeratorsr')rr€r r r!Úp_enumerator_listTs   zCParser.p_enumerator_listcCs tj|d|j|dƒƒ|d<dS)z� alignment_specifier : _ALIGNAS LPAREN type_name RPAREN | _ALIGNAS LPAREN constant_expression RPAREN r‹rrFN)rZAlignasrŒ)rr€r r r!Úp_alignment_specifieraszCParser.p_alignment_specifiercCsbt|ƒdkr(tj|dd|j|dƒƒ}ntj|d|d|j|dƒƒ}|j|j|jƒ||d<dS)zR enumerator : ID | ID EQUALS constant_expression rXrNr‹rF)r)rZ EnumeratorrŒr3r0r1)rr€Z enumeratorr r r!Ú p_enumeratorgs  zCParser.p_enumeratorcCs|d|d<dS)zQ declarator : id_declarator | typeid_declarator rrFNr )rr€r r r!Ú p_declaratorwszCParser.p_declaratorrDÚIDÚtypeidÚTYPEIDÚtypeid_noparencCs|d|d<dS)z1 xxx_declarator : direct_xxx_declarator rrFNr )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 rXrrFN)r@)rr€r r r!Úp_xxx_declarator_2ƒszCParser.p_xxx_declarator_2cCs(tj|dddd|j|dƒd�|d<dS)z' direct_xxx_declarator : yyy rN)rGr;rHrZr1rF)rr=rŒ)rr€r r r!Úp_direct_xxx_declarator_1‰s z!CParser.p_direct_xxx_declarator_1cCs|d|d<dS)z@ direct_xxx_declarator : LPAREN xxx_declarator RPAREN rXrFNr )rr€r r r!Úp_direct_xxx_declarator_2”sz!CParser.p_direct_xxx_declarator_2cCsft|ƒdkr|dngpg}tjdt|ƒdkr6|dn|d||djd�}|j|d|d�|d<dS) z} direct_xxx_declarator : direct_xxx_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET rŠr‹Nr’r)r;ÚdimÚ dim_qualsr1)r>r?rF)r)rÚ ArrayDeclr1r@)rr€rHÚarrr r r!Úp_direct_xxx_declarator_3šsz!CParser.p_direct_xxx_declarator_3cCs^dd„|d|dgDƒ}dd„|Dƒ}tjd|d||djd �}|j|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)rCÚitemr r r!rE±sz5CParser.p_direct_xxx_declarator_4..r‹r’cSs"g|]}|D]}|dk r |‘q qS)Nr )rCZsublistrNr r r!rE³s NrŠr)r;rÖr×r1)r>r?rF)rrØr1r@)rr€Z listed_qualsr×rÙr r r!Úp_direct_xxx_declarator_4©sz!CParser.p_direct_xxx_declarator_4cCsZtjdtj|d|j|dƒƒ|ddk r0|dng|djd�}|j|d|d�|d<dS)zi direct_xxx_declarator : direct_xxx_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET Nr’r‹r)r;rÖr×r1)r>r?rF)rrØrÎrŒr1r@)rr€rÙr r r!Úp_direct_xxx_declarator_5¿s z!CParser.p_direct_xxx_declarator_5cCs|tj|dd|djd�}|jƒjdkrb|jdk rbx.|jjD]"}t|tjƒrNP|j |j |jƒqr?rF) rrJr1r:r;rßÚparamsr<Ú EllipsisParamr3r0r@)rr€ÚfuncÚparamr r r!Úp_direct_xxx_declarator_6Ës   z!CParser.p_direct_xxx_declarator_6cCsn|j|dƒ}tj|dpgd|d�}t|ƒdkrb|d}x|jdk rL|j}q:W||_|d|d<n||d<dS)zm pointer : TIMES type_qualifier_list_opt | TIMES type_qualifier_list_opt pointer rrXN)rHr;r1r‹rF)rŒrZPtrDeclr)r;)rr€r1Z nested_typeZ tail_typer r r!Ú p_pointerès    zCParser.p_pointercCs0t|ƒdkr|dgn|d|dg|d<dS)zs type_qualifier_list : type_qualifier | type_qualifier_list type_qualifier rXrrFN)r))rr€r r r!Úp_type_qualifier_listszCParser.p_type_qualifier_listcCs:t|ƒdkr*|djjtj|j|dƒƒƒ|d|d<dS)zn parameter_type_list : parameter_list | parameter_list COMMA ELLIPSIS rXrr‹rFN)r)rár'rrârŒ)rr€r r r!Úp_parameter_type_list s zCParser.p_parameter_type_listcCsNt|ƒdkr*tj|dg|djƒ|d<n |djj|dƒ|d|d<dS)zz parameter_list : parameter_declaration | parameter_list COMMA parameter_declaration rXrrFr‹N)r)rÚ ParamListr1rár')rr€r r r!Úp_parameter_lists zCParser.p_parameter_listcCsT|d}|ds.tjdg|j|dƒd�g|d<|j|t|dd�gd�d|d<d S) zŸ parameter_declaration : declaration_specifiers id_declarator | declaration_specifiers typeid_noparen_declarator rr;rA)r1rX)r>)rTrbrFN)rrIrŒrfr)rr€rTr r r!Úp_parameter_declaration_1)sz!CParser.p_parameter_declaration_1c Csâ|d}|ds.tjdg|j|dƒd�g|d<t|dƒdkrŽt|dd jƒdkrŽ|j|ddjdƒrŽ|j|t|ddd�gd �d}nHtjd |d d|dp²tj ddddƒ|j|dƒd �}|d}|j ||ƒ}||d<dS)zR parameter_declaration : declaration_specifiers abstract_declarator_opt rr;rA)r1rFrXN)r>r[)rTrbr rN)r0rHrZr;r1r-r-) rrIrŒr)rBr5rfrÚTypenamer=rM)rr€rTr>rKr r r!Úp_parameter_declaration_25s$& z!CParser.p_parameter_declaration_2cCsNt|ƒdkr*tj|dg|djƒ|d<n |djj|dƒ|d|d<dS)ze identifier_list : identifier | identifier_list COMMA identifier rXrrFr‹N)r)rrér1rár')rr€r r r!Úp_identifier_listUs zCParser.p_identifier_listcCs|d|d<dS)z- initializer : assignment_expression rrFNr )rr€r r r!Úp_initializer_1_szCParser.p_initializer_1cCs6|ddkr&tjg|j|dƒƒ|d<n |d|d<dS)z‹ initializer : brace_open initializer_list_opt brace_close | brace_open initializer_list COMMA brace_close rXNrrF)rÚInitListrŒ)rr€r r r!Úp_initializer_2ds zCParser.p_initializer_2cCs–t|ƒdkrN|ddkr |dntj|d|dƒ}tj|g|djƒ|d<nD|ddkrb|dntj|d|dƒ}|djj|ƒ|d|d<dS)z� initializer_list : designation_opt initializer | initializer_list COMMA designation_opt initializer r‹rNrXrFr’)r)rZNamedInitializerrðr1Úexprsr')rr€r[r r r!Úp_initializer_listms  ((zCParser.p_initializer_listcCs|d|d<dS)z. designation : designator_list EQUALS rrFNr )rr€r r r!Ú p_designationyszCParser.p_designationcCs0t|ƒdkr|dgn|d|dg|d<dS)z_ designator_list : designator | designator_list designator rXrrFN)r))rr€r r r!Úp_designator_list�szCParser.p_designator_listcCs|d|d<dS)zi designator : LBRACKET constant_expression RBRACKET | PERIOD identifier rXrFNr )rr€r r r!Ú p_designator‡szCParser.p_designatorc Cs\tjd|dddd…d|dp0tjddddƒ|j|dƒd�}|j||ddƒ|d<dS) zH type_name : specifier_qualifier_list abstract_declarator_opt r rrNNrX)r0rHrZr;r1r;rF)rrìr=rŒrM)rr€rKr r r!Ú p_type_name�szCParser.p_type_namecCs*tjddddƒ}|j||dd�|d<dS)z+ abstract_declarator : pointer Nr)r>r?rF)rr=r@)rr€Z dummytyper r r!Úp_abstract_declarator_1™szCParser.p_abstract_declarator_1cCs|j|d|dƒ|d<dS)zF abstract_declarator : pointer direct_abstract_declarator rXrrFN)r@)rr€r r r!Úp_abstract_declarator_2¡szCParser.p_abstract_declarator_2cCs|d|d<dS)z> abstract_declarator : direct_abstract_declarator rrFNr )rr€r r r!Úp_abstract_declarator_3¦szCParser.p_abstract_declarator_3cCs|d|d<dS)zA direct_abstract_declarator : LPAREN abstract_declarator RPAREN rXrFNr )rr€r r r!Úp_direct_abstract_declarator_1°sz&CParser.p_direct_abstract_declarator_1cCs6tjd|dg|djd�}|j|d|d�|d<dS)zn direct_abstract_declarator : direct_abstract_declarator LBRACKET assignment_expression_opt RBRACKET Nr‹r)r;rÖr×r1)r>r?rF)rrØr1r@)rr€rÙr r r!Úp_direct_abstract_declarator_2´s z&CParser.p_direct_abstract_declarator_2cCsbt|ƒdkr|dngpg}tjtjddddƒt|ƒdkrB|dn|d||j|dƒd�|d<dS)zk direct_abstract_declarator : LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET r’rXNr‹r)r;rÖr×r1rF)r)rrØr=rŒ)rr€rHr r r!Úp_direct_abstract_declarator_3¿s z&CParser.p_direct_abstract_declarator_3cCsFtjdtj|d|j|dƒƒg|djd�}|j|d|d�|d<dS)zZ direct_abstract_declarator : direct_abstract_declarator LBRACKET TIMES RBRACKET Nr‹r)r;rÖr×r1)r>r?rF)rrØrÎrŒr1r@)rr€rÙr r r!Úp_direct_abstract_declarator_4És z&CParser.p_direct_abstract_declarator_4cCsBtjtjddddƒtj|d|j|dƒƒg|j|dƒd�|d<dS)z? direct_abstract_declarator : LBRACKET TIMES RBRACKET Nr‹r)r;rÖr×r1rF)rrØr=rÎrŒ)rr€r r r!Úp_direct_abstract_declarator_5Ôs z&CParser.p_direct_abstract_declarator_5cCs4tj|dd|djd�}|j|d|d�|d<dS)zh direct_abstract_declarator : direct_abstract_declarator LPAREN parameter_type_list_opt RPAREN r‹Nr)rßr;r1)r>r?rF)rrJr1r@)rr€rãr r r!Úp_direct_abstract_declarator_6Ýs z&CParser.p_direct_abstract_declarator_6cCs0tj|dtjddddƒ|j|dƒd�|d<dS)zM direct_abstract_declarator : LPAREN parameter_type_list_opt RPAREN rXNr)rßr;r1rF)rrJr=rŒ)rr€r r r!Úp_direct_abstract_declarator_7çsz&CParser.p_direct_abstract_declarator_7cCs(t|dtƒr|dn|dg|d<dS)zG block_item : declaration | statement rrFN)r<rÛ)rr€r r r!Ú p_block_itemòszCParser.p_block_itemcCs:t|ƒdks|ddgkr"|dn|d|d|d<dS)z_ block_item_list : block_item | block_item_list block_item rXNrrF)r))rr€r r r!Úp_block_item_listúszCParser.p_block_item_listcCs"tj|d|j|dƒd�|d<dS)zA compound_statement : brace_open block_item_list_opt brace_close rXr)r•r1rFN)rr–rŒ)rr€r r r!Úp_compound_statement_1szCParser.p_compound_statement_1cCs&tj|d|d|j|dƒƒ|d<dS)z6 labeled_statement : ID COLON pragmacomp_or_statement rr‹rFN)rZLabelrŒ)rr€r r r!Úp_labeled_statement_1szCParser.p_labeled_statement_1cCs(tj|d|dg|j|dƒƒ|d<dS)zL labeled_statement : CASE constant_expression COLON pragmacomp_or_statement rXr’rrFN)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 pragmacomp_or_statement r‹rrFN)rZDefaultrŒ)rr€r r r!Úp_labeled_statement_3szCParser.p_labeled_statement_3cCs(tj|d|dd|j|dƒƒ|d<dS)zK selection_statement : IF LPAREN expression RPAREN pragmacomp_or_statement r‹rŠNrrF)rÚIfrŒ)rr€r r r!Úp_selection_statement_1szCParser.p_selection_statement_1cCs,tj|d|d|d|j|dƒƒ|d<dS)zZ selection_statement : IF LPAREN expression RPAREN statement ELSE pragmacomp_or_statement r‹rŠérrFN)rrrŒ)rr€r r r!Úp_selection_statement_2szCParser.p_selection_statement_2cCs*ttj|d|d|j|dƒƒƒ|d<dS)zO selection_statement : SWITCH LPAREN expression RPAREN pragmacomp_or_statement r‹rŠrrFN)r rZSwitchrŒ)rr€r r r!Úp_selection_statement_3szCParser.p_selection_statement_3cCs&tj|d|d|j|dƒƒ|d<dS)zN iteration_statement : WHILE LPAREN expression RPAREN pragmacomp_or_statement r‹rŠrrFN)rÚWhilerŒ)rr€r r r!Úp_iteration_statement_1 szCParser.p_iteration_statement_1cCs&tj|d|d|j|dƒƒ|d<dS)zV iteration_statement : DO pragmacomp_or_statement WHILE LPAREN expression RPAREN SEMI rŠrXrrFN)rZDoWhilerŒ)rr€r r r!Úp_iteration_statement_2$szCParser.p_iteration_statement_2cCs2tj|d|d|d|d|j|dƒƒ|d<dS)zx iteration_statement : FOR LPAREN expression_opt SEMI expression_opt SEMI expression_opt RPAREN pragmacomp_or_statement r‹rŠr é rrFN)rÚForrŒ)rr€r r r!Úp_iteration_statement_3(szCParser.p_iteration_statement_3cCsBtjtj|d|j|dƒƒ|d|d|d|j|dƒƒ|d<dS)zp iteration_statement : FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN pragmacomp_or_statement r‹rr’éérFN)rrZDeclListrŒ)rr€r r r!Úp_iteration_statement_4,szCParser.p_iteration_statement_4cCs tj|d|j|dƒƒ|d<dS)z jump_statement : GOTO ID SEMI rXrrFN)rZGotorŒ)rr€r r r!Úp_jump_statement_11szCParser.p_jump_statement_1cCstj|j|dƒƒ|d<dS)z jump_statement : BREAK SEMI rrFN)rÚBreakrŒ)rr€r r r!Úp_jump_statement_25szCParser.p_jump_statement_2cCstj|j|dƒƒ|d<dS)z! jump_statement : CONTINUE SEMI rrFN)rÚContinuerŒ)rr€r r r!Úp_jump_statement_39szCParser.p_jump_statement_3cCs0tjt|ƒdkr|dnd|j|dƒƒ|d<dS)z\ jump_statement : RETURN expression SEMI | RETURN SEMI r’rXNrrF)rÚReturnr)rŒ)rr€r r r!Úp_jump_statement_4=szCParser.p_jump_statement_4cCs4|ddkr$tj|j|dƒƒ|d<n |d|d<dS)z, expression_statement : expression_opt SEMI rNrXrF)rZEmptyStatementrŒ)rr€r r r!Úp_expression_statementCs zCParser.p_expression_statementcCsjt|ƒdkr|d|d<nLt|dtjƒsFtj|dg|djƒ|d<|djj|dƒ|d|d<dS)zn expression : assignment_expression | expression COMMA assignment_expression rXrrFr‹N)r)r<rÚExprListr1ròr')rr€r r r!Ú p_expressionJs  zCParser.p_expressioncCs|d|d<dS)z: assignment_expression : LPAREN compound_statement RPAREN rXrFNr )rr€r r r!Ú#p_parenthesized_compound_expressionWsz+CParser.p_parenthesized_compound_expressioncCs$tj|dg|j|dƒd�|d<dS)z typedef_name : TYPEID r)r1rFN)rrIrŒ)rr€r r r!Úp_typedef_name[szCParser.p_typedef_namecCsDt|ƒdkr|d|d<n&tj|d|d|d|djƒ|d<dS)z› assignment_expression : conditional_expression | unary_expression assignment_operator assignment_expression rXrrFr‹N)r)rZ Assignmentr1)rr€r r r!Úp_assignment_expression_s zCParser.p_assignment_expressioncCs|d|d<dS)aÞ assignment_operator : EQUALS | XOREQUAL | TIMESEQUAL | DIVEQUAL | MODEQUAL | PLUSEQUAL | MINUSEQUAL | LSHIFTEQUAL | RSHIFTEQUAL | ANDEQUAL | OREQUAL rrFNr )rr€r r r!Úp_assignment_operatorms zCParser.p_assignment_operatorcCs|d|d<dS)z. constant_expression : conditional_expression rrFNr )rr€r r r!Úp_constant_expression|szCParser.p_constant_expressioncCsDt|ƒdkr|d|d<n&tj|d|d|d|djƒ|d<dS)zœ conditional_expression : binary_expression | binary_expression CONDOP expression COLON conditional_expression rXrrFr‹rŠN)r)rZ TernaryOpr1)rr€r r r!Úp_conditional_expression€s z CParser.p_conditional_expressioncCsDt|ƒ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 rXrrFr‹N)r)rZBinaryOpr1)rr€r r r!Úp_binary_expression‰s zCParser.p_binary_expressioncCs|d|d<dS)z$ cast_expression : unary_expression rrFNr )rr€r r r!Úp_cast_expression_1£szCParser.p_cast_expression_1cCs&tj|d|d|j|dƒƒ|d<dS)z; cast_expression : LPAREN type_name RPAREN cast_expression rXr’rrFN)rZCastrŒ)rr€r r r!Úp_cast_expression_2§szCParser.p_cast_expression_2cCs|d|d<dS)z* unary_expression : postfix_expression rrFNr )rr€r r r!Úp_unary_expression_1«szCParser.p_unary_expression_1cCs$tj|d|d|djƒ|d<dS)z¸ unary_expression : PLUSPLUS unary_expression | MINUSMINUS unary_expression | unary_operator cast_expression rrXrFN)rÚUnaryOpr1)rr€r r r!Úp_unary_expression_2¯szCParser.p_unary_expression_2cCs:tj|dt|ƒdkr|dn|d|j|dƒƒ|d<dS)z» unary_expression : SIZEOF unary_expression | SIZEOF LPAREN type_name RPAREN | _ALIGNOF LPAREN type_name RPAREN rr‹rXrFN)rr*r)rŒ)rr€r r r!Úp_unary_expression_3¶szCParser.p_unary_expression_3cCs|d|d<dS)zÏ unary_operator : AND | TIMES | PLUS | MINUS | NOT | LNOT rrFNr )rr€r r r!Úp_unary_operatorÀszCParser.p_unary_operatorcCs|d|d<dS)z* postfix_expression : primary_expression rrFNr )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‹rFN)rÚArrayRefr1)rr€r r r!Úp_postfix_expression_2ÎszCParser.p_postfix_expression_2cCs4tj|dt|ƒdkr|dnd|djƒ|d<dS)zœ postfix_expression : postfix_expression LPAREN argument_expression_list RPAREN | postfix_expression LPAREN RPAREN rrŠr‹NrF)rÚFuncCallr)r1)rr€r r r!Úp_postfix_expression_3ÒszCParser.p_postfix_expression_3cCs>tj|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‹rrXrFN)rrÎrŒÚ StructRefr1)rr€Úfieldr r r!Úp_postfix_expression_4ØszCParser.p_postfix_expression_4cCs(tjd|d|d|djƒ|d<dS)z{ postfix_expression : postfix_expression PLUSPLUS | postfix_expression MINUSMINUS r€rXrrFN)rr*r1)rr€r r r!Úp_postfix_expression_5ászCParser.p_postfix_expression_5cCstj|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 rXrŠrFN)rZCompoundLiteral)rr€r r r!Úp_postfix_expression_6çszCParser.p_postfix_expression_6cCs|d|d<dS)z" primary_expression : identifier rrFNr )rr€r r r!Úp_primary_expression_1íszCParser.p_primary_expression_1cCs|d|d<dS)z primary_expression : constant rrFNr )rr€r r r!Úp_primary_expression_2ñszCParser.p_primary_expression_2cCs|d|d<dS)zp primary_expression : unified_string_literal | unified_wstring_literal rrFNr )rr€r r r!Úp_primary_expression_3õszCParser.p_primary_expression_3cCs|d|d<dS)z0 primary_expression : LPAREN expression RPAREN rXrFNr )rr€r r r!Úp_primary_expression_4ûszCParser.p_primary_expression_4cCsB|j|dƒ}tjtj|d|ƒtj|d|dg|ƒ|ƒ|d<dS)za primary_expression : OFFSETOF LPAREN type_name COMMA offsetof_member_designator RPAREN rr‹rŠrFN)rŒrr1rÎr)rr€r1r r r!Úp_primary_expression_5ÿs zCParser.p_primary_expression_5cCs�t|ƒdkr|d|d<nrt|ƒdkrNtj|d|d|d|djƒ|d<n>t|ƒdkr|tj|d|d|djƒ|d<ntdt|ƒƒ‚dS) zì offsetof_member_designator : identifier | offsetof_member_designator PERIOD identifier | offsetof_member_designator LBRACKET expression RBRACKET rXrrFr’r‹rŠz$Unexpected parsing state. len(p): %uN)r)rr3r1r/ÚNotImplementedError)rr€r r r!Úp_offsetof_member_designators  ( "z$CParser.p_offsetof_member_designatorcCsNt|ƒdkr*tj|dg|djƒ|d<n |djj|dƒ|d|d<dS)zœ argument_expression_list : assignment_expression | argument_expression_list COMMA assignment_expression rXrrFr‹N)r)rrr1ròr')rr€r r r!Úp_argument_expression_lists z"CParser.p_argument_expression_listcCs tj|d|j|dƒƒ|d<dS)z identifier : ID rrFN)rrÎrŒ)rr€r r r!Ú p_identifierszCParser.p_identifiercCs d}d}x:|ddd…D]&}|dkr0|d7}q|dkr|d7}qWd }|dkrZtd ƒ‚n|d krjtd ƒ‚d |d|}tj|d|d|j|dƒƒ|d<dS)zÆ constant : INT_CONST_DEC | INT_CONST_OCT | INT_CONST_HEX | INT_CONST_BIN | INT_CONST_CHAR rFrr‹NÚlÚLÚuÚUr z.Constant cannot have more than one u/U suffix.rXz.Constant cannot have more than two l/L suffix.z unsigned zlong rAéýÿÿÿ)rArB)rCrD)Ú ValueErrorrÚConstantrŒ)rr€ZuCountZlCountÚxrdÚprefixr r r!Ú p_constant_1#s   zCParser.p_constant_1cCshd|djƒkrd}n0|dd d kr,d}n|dddkrBd}nd }tj||d|j|dƒƒ|d <d S)zM constant : FLOAT_CONST | HEX_FLOAT_CONST rHrÚfloatÚfÚFrArBz long doubleÚdoublerFNr-)rLrMr-)rArB)ÚlowerrrGrŒ)rr€rdr r r!Ú p_constant_2:szCParser.p_constant_2cCs"tjd|d|j|dƒƒ|d<dS)z¿ constant : CHAR_CONST | WCHAR_CONST | U8CHAR_CONST | U16CHAR_CONST | U32CHAR_CONST ÚcharrrFN)rrGrŒ)rr€r r r!Ú p_constant_3KszCParser.p_constant_3cCsdt|ƒdkr,tjd|d|j|dƒƒ|d<n4|djdd…|ddd…|d_|d|d<dS)z~ unified_string_literal : STRING_LITERAL | unified_string_literal STRING_LITERAL rXÚstringrrFNr-)r)rrGrŒÚvalue)rr€r r r!Úp_unified_string_literalZs  (z CParser.p_unified_string_literalcCsht|ƒdkr,tjd|d|j|dƒƒ|d<n8|djjƒdd…|ddd…|d_|d|d<dS)a unified_wstring_literal : WSTRING_LITERAL | U8STRING_LITERAL | U16STRING_LITERAL | U32STRING_LITERAL | unified_wstring_literal WSTRING_LITERAL | unified_wstring_literal U8STRING_LITERAL | unified_wstring_literal U16STRING_LITERAL | unified_wstring_literal U32STRING_LITERAL rXrSrrFNr-)r)rrGrŒrTÚrstrip)rr€r r r!Úp_unified_wstring_literales ,z!CParser.p_unified_wstring_literalcCs"|d|d<|jd|jdƒƒdS)z brace_open : LBRACE rrFN)Ú set_linenoÚlineno)rr€r r r!Ú p_brace_openvs zCParser.p_brace_opencCs"|d|d<|jd|jdƒƒdS)z brace_close : RBRACE rrFN)rXrY)rr€r r r!Ú p_brace_close|s zCParser.p_brace_closecCs d|d<dS)zempty : NrFr )rr€r r r!Úp_empty‚szCParser.p_emptycCs@|r,|jd|j|j|j|jj|ƒd�ƒn|jd|jjƒdS)Nz before: %s)rYr9zAt end of input)r/rTr6rYrZfind_tok_columnr$)rr€r r r!Úp_error†s zCParser.p_errorN)r F)F)F©rmrn©rmro©rmrp©rmrq©rmrr©rmrsrt©rmrurvrwrx©rmryrz©rmr{r|©rmr}r~r) r^r_r`rarbrcrdrerfrg)rDrÎ)rÏrÐ)rÑrÐ)rDrÎ)rÏrÐ)rÑrÐ)rDrÎ)rÏrÐ)rÑrÐ)rDrÎ)rÏrÐ)rDrÎ)rÏrÐ)rÑrÐ)rDrÎ)rÏrÐ)rÑrÐ)rDrÎ)rÏrÐ)rÑrÐ)rDrÎ)rÏrÐ)rÑrÐ)¯Ú__name__Ú __module__Ú __qualname__rr"r%r(r,r2r3r5rrrrr:r@rMrUrfrirlÚ 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ÍrrÒ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 r rrrrrrrrrrr r!r"r#r$r%r&r'r(r)r+r,r-r.r0r2r5r6r7r8r9r:r;r<r>r?r@rJrPrRrUrWrZr[r\r]r r r r!r sr g     )2,  Y     7=       &                                                                r N)Zplyrr rZc_lexerrZ plyparserrrrrZast_transformsr r r r r r r!Ú s