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

📄 c-parse.in

📁 早期freebsd实现
💻 IN
📖 第 1 页 / 共 5 页
字号:
		{ $$ = $2;		  parmlist_tags_warning ();		  poplevel (0, 0, 0); }	;parmlist_or_identifiers_1:	  parmlist_1	| identifiers ')'		{ tree t;		  for (t = $1; t; t = TREE_CHAIN (t))		    if (TREE_VALUE (t) == NULL_TREE)		      error ("`...' in old-style identifier list");		  $$ = tree_cons (NULL_TREE, NULL_TREE, $1); }	;/* A nonempty list of identifiers.  */identifiers:	IDENTIFIER		{ $$ = build_tree_list (NULL_TREE, $1); }	| identifiers ',' IDENTIFIER		{ $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }	;/* A nonempty list of identifiers, including typenames.  */identifiers_or_typenames:	identifier		{ $$ = build_tree_list (NULL_TREE, $1); }	| identifiers_or_typenames ',' identifier		{ $$ = chainon ($1, build_tree_list (NULL_TREE, $3)); }	;ifobjc/* Objective-C productions.  */objcdef:	  classdef	| methoddef	| END		{		  if (objc_implementation_context)                    {		      finish_class (objc_implementation_context);		      objc_ivar_chain = NULL_TREE;		      objc_implementation_context = NULL_TREE;		    }		  else		    warning ("`@end' must appear in an implementation context");		}	;classdef:	  INTERFACE identifier '{'		{		  objc_interface_context = objc_ivar_context		    = start_class (INTERFACE_TYPE, $2, NULL_TREE);                  objc_public_flag = 0;		}	  ivar_decl_list '}'		{                  continue_class (objc_interface_context);		}	  methodprotolist	  END		{		  finish_class (objc_interface_context);		  objc_interface_context = NULL_TREE;		}	| INTERFACE identifier		{		  objc_interface_context		    = start_class (INTERFACE_TYPE, $2, NULL_TREE);                  continue_class (objc_interface_context);		}	  methodprotolist	  END		{		  finish_class (objc_interface_context);		  objc_interface_context = NULL_TREE;		}	| INTERFACE identifier ':' identifier '{'		{		  objc_interface_context = objc_ivar_context		    = start_class (INTERFACE_TYPE, $2, $4);                  objc_public_flag = 0;		}	  ivar_decl_list '}'		{                  continue_class (objc_interface_context);		}	  methodprotolist	  END		{		  finish_class (objc_interface_context);		  objc_interface_context = NULL_TREE;		}	| INTERFACE identifier ':' identifier		{		  objc_interface_context		    = start_class (INTERFACE_TYPE, $2, $4);                  continue_class (objc_interface_context);		}	  methodprotolist	  END		{		  finish_class (objc_interface_context);		  objc_interface_context = NULL_TREE;		}	| IMPLEMENTATION identifier '{'		{		  objc_implementation_context = objc_ivar_context		    = start_class (IMPLEMENTATION_TYPE, $2, NULL_TREE);                  objc_public_flag = 0;		}	  ivar_decl_list '}'		{                  objc_ivar_chain		    = continue_class (objc_implementation_context);		}	| IMPLEMENTATION identifier		{		  objc_implementation_context		    = start_class (IMPLEMENTATION_TYPE, $2, NULL_TREE);                  objc_ivar_chain		    = continue_class (objc_implementation_context);		}	| IMPLEMENTATION identifier ':' identifier '{'		{		  objc_implementation_context = objc_ivar_context		    = start_class (IMPLEMENTATION_TYPE, $2, $4);                  objc_public_flag = 0;		}	  ivar_decl_list '}'		{                  objc_ivar_chain		    = continue_class (objc_implementation_context);		}	| IMPLEMENTATION identifier ':' identifier		{		  objc_implementation_context		    = start_class (IMPLEMENTATION_TYPE, $2, $4);                  objc_ivar_chain		    = continue_class (objc_implementation_context);		}	| INTERFACE identifier '(' identifier ')'		{		  objc_interface_context		    = start_class (PROTOCOL_TYPE, $2, $4);                  continue_class (objc_interface_context);		}	  methodprotolist	  END		{		  finish_class (objc_interface_context);		  objc_interface_context = NULL_TREE;		}	| IMPLEMENTATION identifier '(' identifier ')'		{		  objc_implementation_context		    = start_class (CATEGORY_TYPE, $2, $4);                  objc_ivar_chain		    = continue_class (objc_implementation_context);		}	;ivar_decl_list:          ivar_decls PUBLIC { objc_public_flag = 1; } ivar_decls        | ivar_decls        ;ivar_decls:          /* empty */		{                  $$ = NULL_TREE;                }	| ivar_decls ivar_decl ';'	| ivar_decls ';'		{                  if (pedantic)		    warning ("extra semicolon in struct or union specified");                }	;/* 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.  */ivar_decl:	typed_typespecs setspecs ivars	        {                  $$ = $3;		  resume_momentary ($2);                }	| nonempty_type_quals setspecs ivars		{                  $$ = $3;		  resume_momentary ($2);                }	| error		{ $$ = NULL_TREE; }	;ivars:	  /* empty */		{ $$ = NULL_TREE; }	| ivar_declarator	| ivars ',' ivar_declarator	;ivar_declarator:	  declarator		{		  $$ = add_instance_variable (objc_ivar_context,					      objc_public_flag,					      $1, current_declspecs,					      NULL_TREE);                }	| declarator ':' expr_no_commas		{		  $$ = add_instance_variable (objc_ivar_context,					      objc_public_flag,					      $1, current_declspecs, $3);                }	| ':' expr_no_commas		{		  $$ = add_instance_variable (objc_ivar_context,					      objc_public_flag,					      NULL_TREE,					      current_declspecs, $2);                }	;methoddef:	  '+'		{		  if (objc_implementation_context)		    objc_inherit_code = CLASS_METHOD_DECL;                  else		    fatal ("method definition not in class context");		}	  methoddecl		{		  add_class_method (objc_implementation_context, $3);		  start_method_def ($3);		  objc_method_context = $3;		}	  optarglist		{		  continue_method_def ();		}	  compstmt_or_error		{		  finish_method_def ();		  objc_method_context = NULL_TREE;		}	| '-'		{		  if (objc_implementation_context)		    objc_inherit_code = INSTANCE_METHOD_DECL;                  else		    fatal ("method definition not in class context");		}	  methoddecl		{		  add_instance_method (objc_implementation_context, $3);		  start_method_def ($3);		  objc_method_context = $3;		}	  optarglist		{		  continue_method_def ();		}	  compstmt_or_error		{		  finish_method_def ();		  objc_method_context = NULL_TREE;		}	;/* the reason for the strange actions in this rule is so that notype_initdecls when reached via datadef can find a valid list of type and sc specs in $0. */methodprotolist:	  /* empty  */	| {$<ttype>$ = NULL_TREE; } methodprotolist2	;methodprotolist2:		 /* eliminates a shift/reduce conflict */	   methodproto	|  datadef	| methodprotolist2 methodproto	| methodprotolist2 {$<ttype>$ = NULL_TREE; } datadef	;semi_or_error:	  ';'	| error	;methodproto:	  '+'		{		  objc_inherit_code = CLASS_METHOD_DECL;		}	  methoddecl		{		  add_class_method (objc_interface_context, $3);		}	  semi_or_error	| '-'		{		  objc_inherit_code = INSTANCE_METHOD_DECL;		}	  methoddecl		{		  add_instance_method (objc_interface_context, $3);		}	  semi_or_error	;methoddecl:	  '(' typename ')' unaryselector		{		  $$ = build_method_decl (objc_inherit_code, $2, $4, NULL_TREE);		}	| unaryselector		{		  $$ = build_method_decl (objc_inherit_code, NULL_TREE, $1, NULL_TREE);		}	| '(' typename ')' keywordselector optparmlist		{		  $$ = build_method_decl (objc_inherit_code, $2, $4, $5);		}	| keywordselector optparmlist		{		  $$ = build_method_decl (objc_inherit_code, NULL_TREE, $1, $2);		}	;/* "optarglist" assumes that start_method_def has already been called...   if it is not, the "xdecls" will not be placed in the proper scope */optarglist:	  /* empty */	| ';' myxdecls	;/* to get around the following situation: "int foo (int a) int b; {}" that   is synthesized when parsing "- a:a b:b; id c; id d; { ... }" */myxdecls:	  /* empty */	| mydecls	;mydecls:	mydecl	| errstmt	| mydecls mydecl	| mydecl errstmt	;mydecl:	typed_declspecs setspecs myparms ';'		{ resume_momentary ($2); }	| typed_declspecs ';'		{ shadow_tag ($1); }	| declmods ';'		{ pedwarn ("empty declaration"); }	;myparms:	myparm		{ push_parm_decl ($1); }	| myparms ',' myparm		{ push_parm_decl ($3); }	;/* A single parameter declaration or parameter type name,   as found in a parmlist. DOES NOT ALLOW AN INITIALIZER OR ASMSPEC */myparm:	  parm_declarator		{ $$ = build_tree_list (current_declspecs, $1)	; }	| notype_declarator		{ $$ = build_tree_list (current_declspecs, $1)	; }	| absdcl		{ $$ = build_tree_list (current_declspecs, $1)	; }	;optparmlist:	  /* empty */		{	    	  $$ = NULL_TREE;		}	| ',' ELLIPSIS		{		  /* oh what a kludge! */		  $$ = (tree)1;		}	| ','		{		  pushlevel (0);		}	  parmlist_2		{	  	  /* returns a tree list node generated by get_parm_info */		  $$ = $3;		  poplevel (0, 0, 0);		}	;unaryselector:	  selector	;keywordselector:	  keyworddecl	| keywordselector keyworddecl		{		  $$ = chainon ($1, $2);		}	;selector:	  IDENTIFIER        | TYPENAME	| reservedwords	;reservedwords:	  ENUM { $$ = get_identifier (token_buffer); }	| STRUCT { $$ = get_identifier (token_buffer); }	| UNION { $$ = get_identifier (token_buffer); }	| IF { $$ = get_identifier (token_buffer); }	| ELSE { $$ = get_identifier (token_buffer); }	| WHILE { $$ = get_identifier (token_buffer); }	| DO { $$ = get_identifier (token_buffer); }	| FOR { $$ = get_identifier (token_buffer); }	| SWITCH { $$ = get_identifier (token_buffer); }	| CASE { $$ = get_identifier (token_buffer); }	| DEFAULT { $$ = get_identifier (token_buffer); }	| BREAK { $$ = get_identifier (token_buffer); }	| CONTINUE { $$ = get_identifier (token_buffer); }	| RETURN  { $$ = get_identifier (token_buffer); }	| GOTO { $$ = get_identifier (token_buffer); }	| ASM_KEYWORD { $$ = get_identifier (token_buffer); }      

⌨️ 快捷键说明

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