⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parse.y

📁 gcc-2.95.3 Linux下最常用的C编译器
💻 Y
📖 第 1 页 / 共 5 页
字号:
|	name DOT_TK SUPER_TK OP_TK argument_list CP_TK error		{yyerror ("';' expected"); RECOVER;}|	name DOT_TK SUPER_TK OP_TK CP_TK error		{yyerror ("';' expected"); RECOVER;};statement_expression: 	assignment|	pre_increment_expression|	pre_decrement_expression|	post_increment_expression|	post_decrement_expression|	method_invocation|	class_instance_creation_expression;if_then_statement:	IF_TK OP_TK expression CP_TK statement		{ 		  $$ = build_if_else_statement ($2.location, $3, 						$5, NULL_TREE);		}|	IF_TK error		{yyerror ("'(' expected"); RECOVER;}|	IF_TK OP_TK error		{yyerror ("Missing term"); RECOVER;}|	IF_TK OP_TK expression error		{yyerror ("')' expected"); RECOVER;};if_then_else_statement:	IF_TK OP_TK expression CP_TK statement_nsi ELSE_TK statement		{ $$ = build_if_else_statement ($2.location, $3, $5, $7); };if_then_else_statement_nsi:	IF_TK OP_TK expression CP_TK statement_nsi ELSE_TK statement_nsi		{ $$ = build_if_else_statement ($2.location, $3, $5, $7); };switch_statement:	switch_expression		{		  enter_block ();		}	switch_block		{ 		  /* Make into "proper list" of COMPOUND_EXPRs.		     I.e. make the last statment also have its own		     COMPOUND_EXPR. */		  maybe_absorb_scoping_blocks ();		  TREE_OPERAND ($1, 1) = exit_block ();		  $$ = build_debugable_stmt (EXPR_WFL_LINECOL ($1), $1);		};switch_expression:	SWITCH_TK OP_TK expression CP_TK		{ 		  $$ = build (SWITCH_EXPR, NULL_TREE, $3, NULL_TREE);		  EXPR_WFL_LINECOL ($$) = $2.location;		}|	SWITCH_TK error		{yyerror ("'(' expected"); RECOVER;}|	SWITCH_TK OP_TK error		{yyerror ("Missing term or ')'"); DRECOVER(switch_statement);}|	SWITCH_TK OP_TK expression CP_TK error		{yyerror ("'{' expected"); RECOVER;};/* Default assignment is there to avoid type node on switch_block   node. */switch_block:	OCB_TK CCB_TK		{ $$ = NULL_TREE; }|	OCB_TK switch_labels CCB_TK		{ $$ = NULL_TREE; }|	OCB_TK switch_block_statement_groups CCB_TK		{ $$ = NULL_TREE; }|	OCB_TK switch_block_statement_groups switch_labels CCB_TK		{ $$ = NULL_TREE; };switch_block_statement_groups: 	switch_block_statement_group|	switch_block_statement_groups switch_block_statement_group;switch_block_statement_group:	switch_labels block_statements;switch_labels:	switch_label|	switch_labels switch_label;switch_label:	CASE_TK constant_expression REL_CL_TK		{ 		  tree lab = build1 (CASE_EXPR, NULL_TREE, $2);		  EXPR_WFL_LINECOL (lab) = $1.location;		  java_method_add_stmt (current_function_decl, lab);		}|	DEFAULT_TK REL_CL_TK		{ 		  tree lab = build1 (DEFAULT_EXPR, NULL_TREE, NULL_TREE);		  EXPR_WFL_LINECOL (lab) = $1.location;		  java_method_add_stmt (current_function_decl, lab);		}|	CASE_TK error		{yyerror ("Missing or invalid constant expression"); RECOVER;}|	CASE_TK constant_expression error		{yyerror ("':' expected"); RECOVER;}|	DEFAULT_TK error		{yyerror ("':' expected"); RECOVER;};while_expression:	WHILE_TK OP_TK expression CP_TK		{ 		  tree body = build_loop_body ($2.location, $3, 0);		  $$ = build_new_loop (body);		};while_statement:	while_expression statement		{ $$ = finish_loop_body (0, NULL_TREE, $2, 0); }|	WHILE_TK error		{YYERROR_NOW; yyerror ("'(' expected"); RECOVER;}|	WHILE_TK OP_TK error		{yyerror ("Missing term and ')' expected"); RECOVER;}|	WHILE_TK OP_TK expression error		{yyerror ("')' expected"); RECOVER;};while_statement_nsi:	while_expression statement_nsi		{ $$ = finish_loop_body (0, NULL_TREE, $2, 0); };do_statement_begin:	DO_TK		{ 		  tree body = build_loop_body (0, NULL_TREE, 1);		  $$ = build_new_loop (body);		}	/* Need error handing here. FIXME */;do_statement: 	do_statement_begin statement WHILE_TK OP_TK expression CP_TK SC_TK		{ $$ = finish_loop_body ($4.location, $5, $2, 1); };for_statement:	for_begin SC_TK expression SC_TK for_update CP_TK statement		{ $$ = finish_for_loop (EXPR_WFL_LINECOL ($3), $3, $5, $7); }|	for_begin SC_TK SC_TK for_update CP_TK statement		{ 		  $$ = finish_for_loop (0, NULL_TREE, $4, $6);		  /* We have not condition, so we get rid of the EXIT_EXPR */		  LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY ($$), 0) = 		    empty_stmt_node;		}|	for_begin SC_TK error		{yyerror ("Invalid control expression"); RECOVER;}|	for_begin SC_TK expression SC_TK error		{yyerror ("Invalid update expression"); RECOVER;}|	for_begin SC_TK SC_TK error		{yyerror ("Invalid update expression"); RECOVER;};for_statement_nsi:	for_begin SC_TK expression SC_TK for_update CP_TK statement_nsi		{ $$ = finish_for_loop (EXPR_WFL_LINECOL ($3), $3, $5, $7);}|	for_begin SC_TK SC_TK for_update CP_TK statement_nsi		{ 		  $$ = finish_for_loop (0, NULL_TREE, $4, $6);		  /* We have not condition, so we get rid of the EXIT_EXPR */		  LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY ($$), 0) = 		    empty_stmt_node;		};for_header:	FOR_TK OP_TK		{ 		  /* This scope defined for local variable that may be                     defined within the scope of the for loop */		  enter_block (); 		}|	FOR_TK error		{yyerror ("'(' expected"); DRECOVER(for_1);}|	FOR_TK OP_TK error		{yyerror ("Invalid init statement"); RECOVER;};for_begin:	for_header for_init		{ 		  /* We now declare the loop body. The loop is                     declared as a for loop. */		  tree body = build_loop_body (0, NULL_TREE, 0);		  $$ =  build_new_loop (body);		  IS_FOR_LOOP_P ($$) = 1;		  /* The loop is added to the current block the for                     statement is defined within */		  java_method_add_stmt (current_function_decl, $$);		};for_init:			/* Can be empty */		{ $$ = empty_stmt_node; }|	statement_expression_list		{ 		  /* Init statement recorded within the previously                     defined block scope */		  $$ = java_method_add_stmt (current_function_decl, $1);		}|	local_variable_declaration		{ 		  /* Local variable are recorded within the previously		     defined block scope */		  $$ = NULL_TREE;		}|	statement_expression_list error		{yyerror ("';' expected"); DRECOVER(for_init_1);};for_update:			/* Can be empty */		{$$ = empty_stmt_node;}|	statement_expression_list		{ $$ = build_debugable_stmt (BUILD_LOCATION (), $1); };statement_expression_list:	statement_expression		{ $$ = add_stmt_to_compound (NULL_TREE, NULL_TREE, $1); }|	statement_expression_list C_TK statement_expression		{ $$ = add_stmt_to_compound ($1, NULL_TREE, $3); }|	statement_expression_list C_TK error		{yyerror ("Missing term"); RECOVER;};break_statement:	BREAK_TK SC_TK		{ $$ = build_bc_statement ($1.location, 1, NULL_TREE); }|	BREAK_TK identifier SC_TK		{ $$ = build_bc_statement ($1.location, 1, $2); }|	BREAK_TK error		{yyerror ("Missing term"); RECOVER;}|	BREAK_TK identifier error		{yyerror ("';' expected"); RECOVER;};continue_statement:	CONTINUE_TK SC_TK		{ $$ = build_bc_statement ($1.location, 0, NULL_TREE); }|       CONTINUE_TK identifier SC_TK		{ $$ = build_bc_statement ($1.location, 0, $2); }|	CONTINUE_TK error		{yyerror ("Missing term"); RECOVER;}|	CONTINUE_TK identifier error		{yyerror ("';' expected"); RECOVER;};return_statement:	RETURN_TK SC_TK		{ $$ = build_return ($1.location, NULL_TREE); }|	RETURN_TK expression SC_TK		{ $$ = build_return ($1.location, $2); }|	RETURN_TK error		{yyerror ("Missing term"); RECOVER;}|	RETURN_TK expression error		{yyerror ("';' expected"); RECOVER;};throw_statement:	THROW_TK expression SC_TK		{ 		  $$ = build1 (THROW_EXPR, NULL_TREE, $2);		  EXPR_WFL_LINECOL ($$) = $1.location;		}|	THROW_TK error		{yyerror ("Missing term"); RECOVER;}|	THROW_TK expression error		{yyerror ("';' expected"); RECOVER;};synchronized_statement:	synchronized OP_TK expression CP_TK block		{ 		  $$ = build (SYNCHRONIZED_EXPR, NULL_TREE, $3, $5);		  EXPR_WFL_LINECOL ($$) = 		    EXPR_WFL_LINECOL (MODIFIER_WFL (SYNCHRONIZED_TK));		}|	synchronized OP_TK expression CP_TK error		{yyerror ("'{' expected"); RECOVER;}|	synchronized error		{yyerror ("'(' expected"); RECOVER;}|	synchronized OP_TK error CP_TK		{yyerror ("Missing term"); RECOVER;}|	synchronized OP_TK error		{yyerror ("Missing term"); RECOVER;};synchronized:	MODIFIER_TK		{		  if ((1 << $1) != ACC_SYNCHRONIZED)		    fatal ("synchronized was '%d' - yyparse", (1 << $1));		};try_statement:	TRY_TK block catches		{ $$ = build_try_statement ($1.location, $2, $3); }|	TRY_TK block finally		{ $$ = build_try_finally_statement ($1.location, $2, $3); }|	TRY_TK block catches finally		{ $$ = build_try_finally_statement 		    ($1.location, build_try_statement ($1.location,						       $2, $3), $4);		}|	TRY_TK error		{yyerror ("'{' expected"); DRECOVER (try_statement);};catches:	catch_clause|	catches catch_clause		{ 		  TREE_CHAIN ($2) = $1;		  $$ = $2;		};catch_clause:	catch_clause_parameter block		{ 		  java_method_add_stmt (current_function_decl, $2);		  exit_block ();		  $$ = $1;		}catch_clause_parameter:	CATCH_TK OP_TK formal_parameter CP_TK		{ 		  /* We add a block to define a scope for		     formal_parameter (CCBP). The formal parameter is		     declared initialized by the appropriate function		     call */		  tree ccpb = enter_block ();		  tree init = build_assignment (ASSIGN_TK, $2.location, 						TREE_PURPOSE ($3), 						soft_exceptioninfo_call_node);		  declare_local_variables (0, TREE_VALUE ($3),					   build_tree_list (TREE_PURPOSE ($3),							    init));		  $$ = build1 (CATCH_EXPR, NULL_TREE, ccpb);		  EXPR_WFL_LINECOL ($$) = $1.location;		}|	CATCH_TK error		{yyerror ("'(' expected"); RECOVER;}|	CATCH_TK OP_TK error 		{yyerror ("Missing term or ')' expected"); DRECOVER (2);}|	CATCH_TK OP_TK error CP_TK /* That's for () */		{yyerror ("')' expected"); DRECOVER (1);};finally:	FINALLY_TK block		{ $$ = $2; }|	FINALLY_TK error		{yyerror ("'{' expected"); RECOVER; };/* 19.12 Production from 15: Expressions  */primary:	primary_no_new_array|	array_creation_expression;primary_no_new_array:	literal|	THIS_TK		{ $$ = build_this ($1.location); }|	OP_TK expression CP_TK		{$$ = $2;}|	class_instance_creation_expression|	field_access|	method_invocation|	array_access	/* type DOT_TK CLASS_TK doens't work. So we split the rule	   'type' into its components. Missing is something for array,	   which will complete the reference_type part. FIXME */|	name DOT_TK CLASS_TK	       /* Added, JDK1.1 class literals */		{ $$ = parse_jdk1_1_error ("named class literals"); }|	primitive_type DOT_TK CLASS_TK /* Added, JDK1.1 class literals */		{ $$ = build_class_ref ($1); }|	VOID_TK DOT_TK CLASS_TK	       /* Added, JDK1.1 class literals */		{ $$ = build_class_ref (void_type_node); }        /* Added, JDK1.1 inner classes. Documentation is wrong           refering to a 'ClassName' (class_name) rule that doesn't           exist. Used name instead.  */|	name DOT_TK THIS_TK		{ $$ = parse_jdk1_1_error ("class literals"); }|	OP_TK expression error 		{yyerror ("')' expected"); RECOVER;}|	name DOT_TK error		{yyerror ("'class' or 'this' expected" ); RECOVER;}|	primitive_type DOT_TK error		{yyerror ("'class' expected" ); RECOVER;}|	VOID_TK DOT_TK error		{yyerror ("'class' expected" ); RECOVER;};class_instance_creation_expression:	NEW_TK class_type OP_TK argument_list CP_TK		{ $$ = build_new_invocation ($2, $4); }|	NEW_TK class_type OP_TK CP_TK		{ $$ = build_new_invocation ($2, NULL_TREE); }        /* Added, JDK1.1 inner classes but modified to use           'class_type' instead of 'TypeName' (type_name) mentionned           in the documentation but doesn't exist. */|	NEW_TK class_type OP_TK argument_list CP_TK class_body		{ $$ = parse_jdk1_1_error ("inner class instance creation"); }|	NEW_TK class_type OP_TK CP_TK class_body         		{ $$ = parse_jdk1_1_error ("inner class instance creation"); }        /* Added, JDK1.1 inner classes, modified to use name or	   primary instead of primary solely which couldn't work in	   all situations.  */|	something_dot_new identifier OP_TK CP_TK|	something_dot_new identifier OP_TK CP_TK class_body|	something_dot_new identifier OP_TK argument_list CP_TK|	something_dot_new identifier OP_TK argument_list CP_TK class_body|	NEW_TK error SC_TK 		{yyerror ("'(' expected"); DRECOVER(new_1);}|	NEW_TK class_type error		{yyerror ("'(' expected"); RECOVER;}|	NEW_TK class_type OP_TK error		{yyerror ("')' or term expected"); RECOVER;}|	NEW_TK class_type OP_TK argument_list error		{yyerror ("')' expected"); RECOVER;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -