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

📄 parse.y

📁 gcc-2.95.3 Linux下最常用的C编译器
💻 Y
📖 第 1 页 / 共 5 页
字号:
|	something_dot_new error		{YYERROR_NOW; yyerror ("Identifier expected"); RECOVER;}|	something_dot_new identifier error		{yyerror ("'(' expected"); RECOVER;};something_dot_new:		/* Added, not part of the specs. */	name DOT_TK NEW_TK|	primary DOT_TK NEW_TK;argument_list:	expression		{ 		  $$ = tree_cons (NULL_TREE, $1, NULL_TREE);		  ctxp->formal_parameter_number = 1; 		}|	argument_list C_TK expression		{		  ctxp->formal_parameter_number += 1;		  $$ = tree_cons (NULL_TREE, $3, $1);		}|	argument_list C_TK error		{yyerror ("Missing term"); RECOVER;};array_creation_expression:	NEW_TK primitive_type dim_exprs		{ $$ = build_newarray_node ($2, $3, 0); }|	NEW_TK class_or_interface_type dim_exprs		{ $$ = build_newarray_node ($2, $3, 0); }|	NEW_TK primitive_type dim_exprs dims		{ $$ = build_newarray_node ($2, $3, CURRENT_OSB (ctxp));}|	NEW_TK class_or_interface_type dim_exprs dims		{ $$ = build_newarray_node ($2, $3, CURRENT_OSB (ctxp));}        /* Added, JDK1.1 anonymous array. Initial documentation rule           modified */|	NEW_TK class_or_interface_type dims array_initializer		{ $$ = parse_jdk1_1_error ("anonymous array"); }|	NEW_TK primitive_type dims array_initializer		{ $$ = parse_jdk1_1_error ("anonymous array"); }|	NEW_TK error CSB_TK		{yyerror ("'[' expected"); DRECOVER ("]");}|	NEW_TK error OSB_TK		{yyerror ("']' expected"); RECOVER;};dim_exprs:	dim_expr		{ $$ = build_tree_list (NULL_TREE, $1); }|	dim_exprs dim_expr		{ $$ = tree_cons (NULL_TREE, $2, $$); };dim_expr:	OSB_TK expression CSB_TK		{ 		  EXPR_WFL_LINECOL ($2) = $1.location;		  $$ = $2;		}|	OSB_TK expression error		{yyerror ("']' expected"); RECOVER;}|	OSB_TK error		{		  yyerror ("Missing term");		  yyerror ("']' expected");		  RECOVER;		};dims:					OSB_TK CSB_TK		{ 		  int allocate = 0;		  /* If not initialized, allocate memory for the osb                     numbers stack */		  if (!ctxp->osb_limit)		    {		      allocate = ctxp->osb_limit = 32;		      ctxp->osb_depth = -1;		    }		  /* If capacity overflown, reallocate a bigger chuck */		  else if (ctxp->osb_depth+1 == ctxp->osb_limit)		    allocate = ctxp->osb_limit << 1;		  		  if (allocate)		    {		      allocate *= sizeof (int);		      if (ctxp->osb_number)			ctxp->osb_number = (int *)xrealloc (ctxp->osb_number,							    allocate);		      else			ctxp->osb_number = (int *)xmalloc (allocate);		    }		  ctxp->osb_depth++;		  CURRENT_OSB (ctxp) = 1;		}|	dims OSB_TK CSB_TK		{ CURRENT_OSB (ctxp)++; }|	dims OSB_TK error		{ yyerror ("']' expected"); RECOVER;};field_access:	primary DOT_TK identifier		{ $$ = make_qualified_primary ($1, $3, $2.location); }		/*  FIXME - REWRITE TO: 		{ $$ = build_binop (COMPONENT_REF, $2.location, $1, $3); } */|	SUPER_TK DOT_TK identifier		{		  tree super_wfl = 		    build_wfl_node (super_identifier_node);		  EXPR_WFL_LINECOL (super_wfl) = $1.location;		  $$ = make_qualified_name (super_wfl, $3, $2.location);		}|	SUPER_TK error		{yyerror ("Field expected"); DRECOVER (super_field_acces);};method_invocation:	name OP_TK CP_TK		{ $$ = build_method_invocation ($1, NULL_TREE); }|	name OP_TK argument_list CP_TK		{ $$ = build_method_invocation ($1, $3); }|	primary DOT_TK identifier OP_TK CP_TK		{ 		  if (TREE_CODE ($1) == THIS_EXPR)		    $$ = build_this_super_qualified_invocation 		      (1, $3, NULL_TREE, 0, $2.location);		  else		    {		      tree invok = build_method_invocation ($3, NULL_TREE);		      $$ = make_qualified_primary ($1, invok, $2.location);		    }		}|	primary DOT_TK identifier OP_TK argument_list CP_TK		{ 		  if (TREE_CODE ($1) == THIS_EXPR)		    $$ = build_this_super_qualified_invocation 		      (1, $3, $5, 0, $2.location);		  else		    {		      tree invok = build_method_invocation ($3, $5);		      $$ = make_qualified_primary ($1, invok, $2.location);		    }		}|	SUPER_TK DOT_TK identifier OP_TK CP_TK		{ 		  $$ = build_this_super_qualified_invocation 		    (0, $3, NULL_TREE, $1.location, $2.location);		}|	SUPER_TK DOT_TK identifier OP_TK argument_list CP_TK		{		  $$ = build_this_super_qualified_invocation 		    (0, $3, $5, $1.location, $2.location);		}        /* Screws up thing. I let it here until I'm convinced it can           be removed. FIXME|	primary DOT_TK error		{yyerror ("'(' expected"); DRECOVER(bad);} */|	SUPER_TK DOT_TK error CP_TK		{ yyerror ("'(' expected"); DRECOVER (method_invocation); }|	SUPER_TK DOT_TK error DOT_TK		{ yyerror ("'(' expected"); DRECOVER (method_invocation); };array_access:	name OSB_TK expression CSB_TK		{ $$ = build_array_ref ($2.location, $1, $3); }|	primary_no_new_array OSB_TK expression CSB_TK		{ $$ = build_array_ref ($2.location, $1, $3); }|	name OSB_TK error		{		  yyerror ("Missing term and ']' expected");		  DRECOVER(array_access);		}|	name OSB_TK expression error		{		  yyerror ("']' expected");		  DRECOVER(array_access);		}|	primary_no_new_array OSB_TK error		{		  yyerror ("Missing term and ']' expected");		  DRECOVER(array_access);		}|	primary_no_new_array OSB_TK expression error		{		  yyerror ("']' expected");		  DRECOVER(array_access);		};postfix_expression:	primary|	name|	post_increment_expression|	post_decrement_expression;post_increment_expression:	postfix_expression INCR_TK		{ $$ = build_incdec ($2.token, $2.location, $1, 1); };post_decrement_expression:	postfix_expression DECR_TK		{ $$ = build_incdec ($2.token, $2.location, $1, 1); };unary_expression:	pre_increment_expression|	pre_decrement_expression|	PLUS_TK unary_expression		{$$ = build_unaryop ($1.token, $1.location, $2); }|	MINUS_TK unary_expression		{$$ = build_unaryop ($1.token, $1.location, $2); }|	unary_expression_not_plus_minus|	PLUS_TK error		{yyerror ("Missing term"); RECOVER}|	MINUS_TK error		{yyerror ("Missing term"); RECOVER};pre_increment_expression:	INCR_TK unary_expression		{$$ = build_incdec ($1.token, $1.location, $2, 0); }|	INCR_TK error		{yyerror ("Missing term"); RECOVER};pre_decrement_expression:	DECR_TK unary_expression		{$$ = build_incdec ($1.token, $1.location, $2, 0); }|	DECR_TK error		{yyerror ("Missing term"); RECOVER};unary_expression_not_plus_minus:	postfix_expression|	NOT_TK unary_expression		{$$ = build_unaryop ($1.token, $1.location, $2); }|	NEG_TK unary_expression 		{$$ = build_unaryop ($1.token, $1.location, $2); }|	cast_expression|       NOT_TK error		{yyerror ("Missing term"); RECOVER}|       NEG_TK error		{yyerror ("Missing term"); RECOVER};cast_expression:		/* Error handling here is potentially weak */	OP_TK primitive_type dims CP_TK unary_expression		{ 		  tree type = $2;		  while (CURRENT_OSB (ctxp)--)		    type = build_java_array_type (type, -1);		  ctxp->osb_depth--;		  $$ = build_cast ($1.location, type, $5); 		}|	OP_TK primitive_type CP_TK unary_expression		{ $$ = build_cast ($1.location, $2, $4); }|	OP_TK expression CP_TK unary_expression_not_plus_minus		{ $$ = build_cast ($1.location, $2, $4); }|	OP_TK name dims CP_TK unary_expression_not_plus_minus		{ 		  char *ptr;		  while (CURRENT_OSB (ctxp)--)		    obstack_1grow (&temporary_obstack, '[');		  ctxp->osb_depth--;		  obstack_grow0 (&temporary_obstack, 				 IDENTIFIER_POINTER (EXPR_WFL_NODE ($2)),				 IDENTIFIER_LENGTH (EXPR_WFL_NODE ($2)));		  ptr = obstack_finish (&temporary_obstack);		  EXPR_WFL_NODE ($2) = get_identifier (ptr);		  $$ = build_cast ($1.location, $2, $5);		}|	OP_TK primitive_type OSB_TK error		{yyerror ("']' expected, invalid type expression");}|       OP_TK error		{	          if (ctxp->prevent_ese != lineno)		    yyerror ("Invalid type expression"); RECOVER;		  RECOVER;		}|	OP_TK primitive_type dims CP_TK error		{yyerror ("Missing term"); RECOVER;}|	OP_TK primitive_type CP_TK error		{yyerror ("Missing term"); RECOVER;}|	OP_TK name dims CP_TK error		{yyerror ("Missing term"); RECOVER;};multiplicative_expression:	unary_expression|	multiplicative_expression MULT_TK unary_expression		{ 		  $$ = build_binop (BINOP_LOOKUP ($2.token), 				    $2.location, $1, $3);		}|	multiplicative_expression DIV_TK unary_expression		{		  $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,				    $1, $3); 		}|	multiplicative_expression REM_TK unary_expression		{		  $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,				    $1, $3); 		}|	multiplicative_expression MULT_TK error		{yyerror ("Missing term"); RECOVER;}|	multiplicative_expression DIV_TK error		{yyerror ("Missing term"); RECOVER;}|	multiplicative_expression REM_TK error		{yyerror ("Missing term"); RECOVER;};additive_expression:	multiplicative_expression|	additive_expression PLUS_TK multiplicative_expression		{		  $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,				    $1, $3); 		}|	additive_expression MINUS_TK multiplicative_expression		{		  $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,				    $1, $3); 		}|	additive_expression PLUS_TK error		{yyerror ("Missing term"); RECOVER;}|	additive_expression MINUS_TK error		{yyerror ("Missing term"); RECOVER;};shift_expression:	additive_expression|	shift_expression LS_TK additive_expression		{		  $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,				    $1, $3); 		}|	shift_expression SRS_TK additive_expression		{		  $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,				    $1, $3); 		}|	shift_expression ZRS_TK additive_expression		{		  $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,				    $1, $3); 		}|	shift_expression LS_TK error		{yyerror ("Missing term"); RECOVER;}|	shift_expression SRS_TK error		{yyerror ("Missing term"); RECOVER;}|	shift_expression ZRS_TK error		{yyerror ("Missing term"); RECOVER;};relational_expression:	shift_expression|	relational_expression LT_TK shift_expression		{		  $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,				    $1, $3); 		}|	relational_expression GT_TK shift_expression		{		  $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,				    $1, $3); 		}|	relational_expression LTE_TK shift_expression		{		  $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,				    $1, $3); 		}|	relational_expression GTE_TK shift_expression		{		  $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,				    $1, $3); 		}|	relational_expression INSTANCEOF_TK reference_type		{ $$ = build_binop (INSTANCEOF_EXPR, $2.location, $1, $3); }|	relational_expression LT_TK error		{yyerror ("Missing term"); RECOVER;}|	relational_expression GT_TK error		{yyerror ("Missing term"); RECOVER;}|	relational_expression LTE_TK error		{yyerror ("Missing term"); RECOVER;}|	relational_expression GTE_TK error		{yyerror ("Missing term"); RECOVER;}|	relational_expression INSTANCEOF_TK error		{yyerror ("Invalid reference type"); RECOVER;};equality_expression:	relational_expression|	equality_expression EQ_TK relational_expression		{		  $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,				    $1, $3); 		}|	equality_expression NEQ_TK relational_expression		{		  $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,				    $1, $3); 		}|	equality_expression EQ_TK error		{yyerror ("Missing term"); RECOVER;}|	equality_expression NEQ_TK error		{yyerror ("Missing term"); RECOVER;};and_expression:	equality_expression|	and_expression AND_TK equality_expression		{		  $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,				    $1, $3); 		}|	and_expression AND_TK error		{yyerror ("Missing term"); RECOVER;};exclusive_or_expression:	and_expression|	exclusive_or_expression XOR_TK and_expression		{		  $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,				    $1, $3); 		}|	exclusive_or_expression XOR_TK error		{yyerror ("Missing term"); RECOVER;};inclusive_or_expression:	exclusive_or_expression|	inclusive_or_expression OR_TK exclusive_or_expression		{		  $$ = build_binop (BINOP_LOOKUP ($2.token), $2.location,				    $

⌨️ 快捷键说明

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