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

📄 objc-parse.y

📁 gcc-2.95.3 Linux下最常用的C编译器
💻 Y
📖 第 1 页 / 共 5 页
字号:
	| after_type_declarator '(' parmlist_or_identifiers  %prec '.'		{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }/*	| after_type_declarator '(' error ')'  %prec '.'		{ $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);		  poplevel (0, 0, 0); }  */	| after_type_declarator '[' expr ']'  %prec '.'		{ $$ = build_nt (ARRAY_REF, $1, $3); }	| after_type_declarator '[' ']'  %prec '.'		{ $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }	| '*' type_quals after_type_declarator  %prec UNARY		{ $$ = make_pointer_declarator ($2, $3); }	/* ??? Yuck.  setattrs is a quick hack.  We can't use	   prefix_attributes because $1 only applies to this	   declarator.  We assume setspecs has already been done.	   setattrs also avoids 5 reduce/reduce conflicts (otherwise multiple	   attributes could be recognized here or in `attributes').  */	| attributes setattrs after_type_declarator		{ $$ = $3; }	| TYPENAME	| OBJECTNAME	;/* Kinds of declarator that can appear in a parameter list   in addition to notype_declarator.  This is like after_type_declarator   but does not allow a typedef name in parentheses as an identifier   (because it would conflict with a function with that typedef as arg).  */parm_declarator:	  parm_declarator '(' parmlist_or_identifiers  %prec '.'		{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }/*	| parm_declarator '(' error ')'  %prec '.'		{ $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);		  poplevel (0, 0, 0); }  */	| parm_declarator '[' expr ']'  %prec '.'		{ $$ = build_nt (ARRAY_REF, $1, $3); }	| parm_declarator '[' ']'  %prec '.'		{ $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }	| '*' type_quals parm_declarator  %prec UNARY		{ $$ = make_pointer_declarator ($2, $3); }	/* ??? Yuck.  setattrs is a quick hack.  We can't use	   prefix_attributes because $1 only applies to this	   declarator.  We assume setspecs has already been done.	   setattrs also avoids 5 reduce/reduce conflicts (otherwise multiple	   attributes could be recognized here or in `attributes').  */	| attributes setattrs parm_declarator		{ $$ = $3; }	| TYPENAME	;/* A declarator allowed whether or not there has been   an explicit typespec.  These cannot redeclare a typedef-name.  */notype_declarator:	  notype_declarator '(' parmlist_or_identifiers  %prec '.'		{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }/*	| notype_declarator '(' error ')'  %prec '.'		{ $$ = build_nt (CALL_EXPR, $1, NULL_TREE, NULL_TREE);		  poplevel (0, 0, 0); }  */	| '(' notype_declarator ')'		{ $$ = $2; }	| '*' type_quals notype_declarator  %prec UNARY		{ $$ = make_pointer_declarator ($2, $3); }	| notype_declarator '[' expr ']'  %prec '.'		{ $$ = build_nt (ARRAY_REF, $1, $3); }	| notype_declarator '[' ']'  %prec '.'		{ $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }	/* ??? Yuck.  setattrs is a quick hack.  We can't use	   prefix_attributes because $1 only applies to this	   declarator.  We assume setspecs has already been done.	   setattrs also avoids 5 reduce/reduce conflicts (otherwise multiple	   attributes could be recognized here or in `attributes').  */	| attributes setattrs notype_declarator		{ $$ = $3; }	| IDENTIFIER	;struct_head:	  STRUCT		{ $$ = NULL_TREE; }	| STRUCT attributes		{ $$ = $2; }	;union_head:	  UNION		{ $$ = NULL_TREE; }	| UNION attributes		{ $$ = $2; }	;enum_head:	  ENUM		{ $$ = NULL_TREE; }	| ENUM attributes		{ $$ = $2; }	;structsp:	  struct_head identifier '{'		{ $$ = start_struct (RECORD_TYPE, $2);		  /* Start scope of tag before parsing components.  */		}	  component_decl_list '}' maybe_attribute 		{ $$ = finish_struct ($<ttype>4, $5, chainon ($1, $7)); }	| struct_head '{' component_decl_list '}' maybe_attribute		{ $$ = finish_struct (start_struct (RECORD_TYPE, NULL_TREE),				      $3, chainon ($1, $5));		}	| struct_head identifier		{ $$ = xref_tag (RECORD_TYPE, $2); }	| union_head identifier '{'		{ $$ = start_struct (UNION_TYPE, $2); }	  component_decl_list '}' maybe_attribute		{ $$ = finish_struct ($<ttype>4, $5, chainon ($1, $7)); }	| union_head '{' component_decl_list '}' maybe_attribute		{ $$ = finish_struct (start_struct (UNION_TYPE, NULL_TREE),				      $3, chainon ($1, $5));		}	| union_head identifier		{ $$ = xref_tag (UNION_TYPE, $2); }	| enum_head identifier '{'		{ $<itype>3 = suspend_momentary ();		  $$ = start_enum ($2); }	  enumlist maybecomma_warn '}' maybe_attribute		{ $$= finish_enum ($<ttype>4, nreverse ($5), chainon ($1, $8));		  resume_momentary ($<itype>3); }	| enum_head '{'		{ $<itype>2 = suspend_momentary ();		  $$ = start_enum (NULL_TREE); }	  enumlist maybecomma_warn '}' maybe_attribute		{ $$= finish_enum ($<ttype>3, nreverse ($4), chainon ($1, $7));		  resume_momentary ($<itype>2); }	| enum_head identifier		{ $$ = xref_tag (ENUMERAL_TYPE, $2); }	;maybecomma:	  /* empty */	| ','	;maybecomma_warn:	  /* empty */	| ','		{ if (pedantic && ! flag_isoc9x)		    pedwarn ("comma at end of enumerator list"); }	;component_decl_list:	  component_decl_list2		{ $$ = $1; }	| component_decl_list2 component_decl		{ $$ = chainon ($1, $2);		  pedwarn ("no semicolon at end of struct or union"); }	;component_decl_list2:	/* empty */		{ $$ = NULL_TREE; }	| component_decl_list2 component_decl ';'		{ $$ = chainon ($1, $2); }	| component_decl_list2 ';'		{ if (pedantic)		    pedwarn ("extra semicolon in struct or union specified"); }	/* foo(sizeof(struct{ @defs(ClassName)})); */	| DEFS '(' CLASSNAME ')'		{		  tree interface = lookup_interface ($3);		  if (interface)		    $$ = get_class_ivars (interface);		  else		    {		      error ("Cannot find interface declaration for `%s'",			     IDENTIFIER_POINTER ($3));		      $$ = NULL_TREE;		    }		}	;/* There is a shift-reduce conflict here, because `components' may   start with a `typename'.  It happens that shifting (the default resolution)   does the right thing, because it treats the `typename' as part of   a `typed_typespecs'.   It is possible that this same technique would allow the distinction   between `notype_initdecls' and `initdecls' to be eliminated.   But I am being cautious and not trying it.  */component_decl:	  typed_typespecs setspecs components		{ $$ = $3;		  current_declspecs = TREE_VALUE (declspec_stack);		  prefix_attributes = TREE_PURPOSE (declspec_stack);		  declspec_stack = TREE_CHAIN (declspec_stack);		  resume_momentary ($2); }	| typed_typespecs		{ if (pedantic)		    pedwarn ("ANSI C forbids member declarations with no members");		  shadow_tag($1);		  $$ = NULL_TREE; }	| nonempty_type_quals setspecs components		{ $$ = $3;		  current_declspecs = TREE_VALUE (declspec_stack);		  prefix_attributes = TREE_PURPOSE (declspec_stack);		  declspec_stack = TREE_CHAIN (declspec_stack);		  resume_momentary ($2); }	| nonempty_type_quals		{ if (pedantic)		    pedwarn ("ANSI C forbids member declarations with no members");		  shadow_tag($1);		  $$ = NULL_TREE; }	| error		{ $$ = NULL_TREE; }	| extension component_decl		{ $$ = $2;		  pedantic = $<itype>1; }	;components:	  component_declarator	| components ',' component_declarator		{ $$ = chainon ($1, $3); }	;component_declarator:	  save_filename save_lineno declarator maybe_attribute		{ $$ = grokfield ($1, $2, $3, current_declspecs, NULL_TREE);		  decl_attributes ($$, $4, prefix_attributes); }	| save_filename save_lineno	  declarator ':' expr_no_commas maybe_attribute		{ $$ = grokfield ($1, $2, $3, current_declspecs, $5);		  decl_attributes ($$, $6, prefix_attributes); }	| save_filename save_lineno ':' expr_no_commas maybe_attribute		{ $$ = grokfield ($1, $2, NULL_TREE, current_declspecs, $4);		  decl_attributes ($$, $5, prefix_attributes); }	;/* We chain the enumerators in reverse order.   They are put in forward order where enumlist is used.   (The order used to be significant, but no longer is so.   However, we still maintain the order, just to be clean.)  */enumlist:	  enumerator	| enumlist ',' enumerator		{ if ($1 == error_mark_node)		    $$ = $1;		  else		    $$ = chainon ($3, $1); }	| error		{ $$ = error_mark_node; }	;enumerator:	  identifier		{ $$ = build_enumerator ($1, NULL_TREE); }	| identifier '=' expr_no_commas		{ $$ = build_enumerator ($1, $3); }	;typename:	typed_typespecs absdcl		{ $$ = build_tree_list ($1, $2); }	| nonempty_type_quals absdcl		{ $$ = build_tree_list ($1, $2); }	;absdcl:   /* an absolute declarator */	/* empty */		{ $$ = NULL_TREE; }	| absdcl1	;nonempty_type_quals:	  TYPE_QUAL		{ $$ = tree_cons (NULL_TREE, $1, NULL_TREE); }	| nonempty_type_quals TYPE_QUAL		{ $$ = tree_cons (NULL_TREE, $2, $1); }	;type_quals:	  /* empty */		{ $$ = NULL_TREE; }	| type_quals TYPE_QUAL		{ $$ = tree_cons (NULL_TREE, $2, $1); }	;absdcl1:  /* a nonempty absolute declarator */	  '(' absdcl1 ')'		{ $$ = $2; }	  /* `(typedef)1' is `int'.  */	| '*' type_quals absdcl1  %prec UNARY		{ $$ = make_pointer_declarator ($2, $3); }	| '*' type_quals  %prec UNARY		{ $$ = make_pointer_declarator ($2, NULL_TREE); }	| absdcl1 '(' parmlist  %prec '.'		{ $$ = build_nt (CALL_EXPR, $1, $3, NULL_TREE); }	| absdcl1 '[' expr ']'  %prec '.'		{ $$ = build_nt (ARRAY_REF, $1, $3); }	| absdcl1 '[' ']'  %prec '.'		{ $$ = build_nt (ARRAY_REF, $1, NULL_TREE); }	| '(' parmlist  %prec '.'		{ $$ = build_nt (CALL_EXPR, NULL_TREE, $2, NULL_TREE); }	| '[' expr ']'  %prec '.'		{ $$ = build_nt (ARRAY_REF, NULL_TREE, $2); }	| '[' ']'  %prec '.'		{ $$ = build_nt (ARRAY_REF, NULL_TREE, NULL_TREE); }	/* ??? It appears we have to support attributes here, however	   using prefix_attributes is wrong.  */	| attributes setattrs absdcl1		{ $$ = $3; }	;/* at least one statement, the first of which parses without error.  *//* stmts is used only after decls, so an invalid first statement   is actually regarded as an invalid decl and part of the decls.  */stmts:	lineno_stmt_or_labels		{		  if (pedantic && $1)		    pedwarn ("ANSI C forbids label at end of compound statement");		}	;lineno_stmt_or_labels:	  lineno_stmt_or_label	| lineno_stmt_or_labels lineno_stmt_or_label		{ $$ = $2; }	| lineno_stmt_or_labels errstmt		{ $$ = 0; }	;xstmts:	/* empty */	| stmts	;errstmt:  error ';'	;pushlevel:  /* empty */		{ emit_line_note (input_filename, lineno);		  pushlevel (0);		  clear_last_expr ();		  push_momentary ();		  expand_start_bindings (0);		  if (objc_method_context)		    add_objc_decls ();		}	;/* Read zero or more forward-declarations for labels   that nested functions can jump to.  */maybe_label_decls:	  /* empty */	| label_decls		{ if (pedantic)		    pedwarn ("ANSI C forbids label declarations"); }	;label_decls:	  label_decl	| label_decls label_decl	;label_decl:	  LABEL identifiers_or_typenames ';'		{ tree link;		  for (link = $2; link; link = TREE_CHAIN (link))		    {		      tree label = shadow_label (TREE_VALUE (link));		      C_DECLARED_LABEL_FLAG (label) = 1;		      declare_nonlocal_label (label);		    }		}	;/* This is the body of a function definition.   It causes syntax errors to ignore to the next openbrace.  */compstmt_or_error:	  compstmt		{}	| error compstmt	;compstmt_start: '{' { compstmt_count++; }compstmt: compstmt_start '}'		{ $$ = convert (void_type_node, integer_zero_node); }	| compstmt_start pushlevel maybe_label_decls decls xstmts '}'		{ emit_line_note (input_filename, lineno);		  expand_end_bindings (getdecls (), 1, 0);		  $$ = poplevel (1, 1, 0);		  if (yychar == CONSTANT || yychar == STRING)		    pop_momentary_nofree ();		  else		    pop_momentary (); }	| compstmt_start pushlevel maybe_label_decls error '}'		{ emit_line_note (input_filename, lineno);		  expand_end_bindings (getdecls (), kept_level_p (), 0);		  $$ = poplevel (kept_level_p (), 0, 0);		  if (yychar == CONSTANT || yychar == STRING)		    pop_momentary_nofree ();		  else		    pop_momentary (); }	| compstmt_start pushlevel maybe_label_decls stmts '}'		{ emit_line_note (input_filename, lineno);		  expand_end_bindings (getdecls (), kept_level_p (), 0);		  $$ = poplevel (kept_level_p (), 0, 0);		  if (yychar == CONSTANT || yychar == STRING)		    pop_momentary_nofree ();		  else		    pop_momentary (); }	;/* Value is number of statements counted as of the closeparen.  */simple_if:	  if_prefix lineno_labeled_stmt/* Make sure c_expand_end_cond is run once   for each call to c_expand_start_cond.   Otherwise a crash is likely.  */	| if_prefix error	;if_prefix:	  IF '(' expr ')'		{ emit_line_note ($<filename>-1, $<lineno>0);		  c_expand_start_cond (truthvalue_conversion ($3), 0, 				       compstmt_count);		  $<itype>$ = stmt_count;		  if_stmt_file = $<filename>-1;		  if_stmt_line = $<lineno>0;		  position_after_white_space (); }	;/* This is a subroutine of stmt.   It is used twice, once for valid DO statements

⌨️ 快捷键说明

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