FreeBSD/contrib/gcc/cp/parser.c
/* Parse Objective-C ivars.  */
Parse Objective-C ivars.
Parse Objective - C ivars .
static void
cp_parser_objc_class_ivars (cp_parser* parser)
{
  cp_token *token = cp_lexer_peek_token (parser->lexer);
  if (token->type != CPP_OPEN_BRACE)
    return;	
  cp_lexer_consume_token (parser->lexer);  
  token = cp_lexer_peek_token (parser->lexer);
  while (token->type != CPP_CLOSE_BRACE)
    {
      cp_decl_specifier_seq declspecs;
      int decl_class_or_enum_p;
      tree prefix_attributes;
      cp_parser_objc_visibility_spec (parser);
      if (cp_lexer_next_token_is (parser->lexer, CPP_CLOSE_BRACE))
	break;
      cp_parser_decl_specifier_seq (parser,
				    CP_PARSER_FLAGS_OPTIONAL,
				    &declspecs,
				    &decl_class_or_enum_p);
      prefix_attributes = declspecs.attributes;
      declspecs.attributes = NULL_TREE;
      while (cp_lexer_next_token_is_not (parser->lexer, CPP_SEMICOLON))
	{
	  tree width = NULL_TREE, attributes, first_attribute, decl;
	  cp_declarator *declarator = NULL;
	  int ctor_dtor_or_conv_p;
	  token = cp_lexer_peek_token (parser->lexer);
	  if (token->type == CPP_COLON)
	    goto eat_colon;
	  if (token->type == CPP_NAME
	      && (cp_lexer_peek_nth_token (parser->lexer, 2)->type
		  == CPP_COLON))
	    {
	      declarator = make_id_declarator (NULL_TREE,
					       cp_parser_identifier (parser),
					       sfk_none);
	     eat_colon:
	      cp_lexer_consume_token (parser->lexer);  
	      width
		= cp_parser_constant_expression (parser,
						 false,
						 NULL);
	    }
	  else
	    {
	      declarator
		= cp_parser_declarator (parser, CP_PARSER_DECLARATOR_NAMED,
					&ctor_dtor_or_conv_p,
					NULL,
					false);
	    }
	  attributes = cp_parser_attributes_opt (parser);
	  first_attribute = attributes;
	  attributes = chainon (prefix_attributes, attributes);
	  if (width)
	    {
	      decl = grokbitfield (declarator, &declspecs, width);
	      cplus_decl_attributes (&decl, attributes, 0);
	    }
	  else
	    decl = grokfield (declarator, &declspecs,
			      NULL_TREE, false,
			      NULL_TREE, attributes);
	  objc_add_instance_variable (decl);
	  while (attributes && TREE_CHAIN (attributes) != first_attribute)
	    attributes = TREE_CHAIN (attributes);
	  if (attributes)
	    TREE_CHAIN (attributes) = NULL_TREE;
	  token = cp_lexer_peek_token (parser->lexer);
	  if (token->type == CPP_COMMA)
	    {
	      cp_lexer_consume_token (parser->lexer);  
	      continue;
	    }
	  break;
	}
      cp_parser_consume_semicolon_at_end_of_statement (parser);
      token = cp_lexer_peek_token (parser->lexer);
    }
  cp_lexer_consume_token (parser->lexer);  
  if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))
    cp_lexer_consume_token (parser->lexer);
}
static void cp_parser_objc_class_ivars ( cp_parser * parser ) { cp_token * token = cp_lexer_peek_token ( parser -> lexer ) ; if ( token -> type != CPP_OPEN_BRACE ) return ; cp_lexer_consume_token ( parser -> lexer ) ; token = cp_lexer_peek_token ( parser -> lexer ) ; while ( token -> type != CPP_CLOSE_BRACE ) { cp_decl_specifier_seq declspecs ; int decl_class_or_enum_p ; tree prefix_attributes ; cp_parser_objc_visibility_spec ( parser ) ; if ( cp_lexer_next_token_is ( parser -> lexer , CPP_CLOSE_BRACE ) ) break ; cp_parser_decl_specifier_seq ( parser , CP_PARSER_FLAGS_OPTIONAL , & declspecs , & decl_class_or_enum_p ) ; prefix_attributes = declspecs . attributes ; declspecs . attributes = NULL_TREE ; while ( cp_lexer_next_token_is_not ( parser -> lexer , CPP_SEMICOLON ) ) { tree width = NULL_TREE , attributes , first_attribute , decl ; cp_declarator * declarator = NULL ; int ctor_dtor_or_conv_p ; token = cp_lexer_peek_token ( parser -> lexer ) ; if ( token -> type == CPP_COLON ) goto eat_colon ; if ( token -> type == CPP_NAME && ( cp_lexer_peek_nth_token ( parser -> lexer , 2 ) -> type == CPP_COLON ) ) { declarator = make_id_declarator ( NULL_TREE , cp_parser_identifier ( parser ) , sfk_none ) ; eat_colon : cp_lexer_consume_token ( parser -> lexer ) ; width = cp_parser_constant_expression ( parser , false , NULL ) ; } else { declarator = cp_parser_declarator ( parser , CP_PARSER_DECLARATOR_NAMED , & ctor_dtor_or_conv_p , NULL , false ) ; } attributes = cp_parser_attributes_opt ( parser ) ; first_attribute = attributes ; attributes = chainon ( prefix_attributes , attributes ) ; if ( width ) { decl = grokbitfield ( declarator , & declspecs , width ) ; cplus_decl_attributes ( & decl , attributes , 0 ) ; } else decl = grokfield ( declarator , & declspecs , NULL_TREE , false , NULL_TREE , attributes ) ; objc_add_instance_variable ( decl ) ; while ( attributes && TREE_CHAIN ( attributes ) != first_attribute ) attributes = TREE_CHAIN ( attributes ) ; if ( attributes ) TREE_CHAIN ( attributes ) = NULL_TREE ; token = cp_lexer_peek_token ( parser -> lexer ) ; if ( token -> type == CPP_COMMA ) { cp_lexer_consume_token ( parser -> lexer ) ; continue ; } break ; } cp_parser_consume_semicolon_at_end_of_statement ( parser ) ; token = cp_lexer_peek_token ( parser -> lexer ) ; } cp_lexer_consume_token ( parser -> lexer ) ; if ( cp_lexer_next_token_is ( parser -> lexer , CPP_SEMICOLON ) ) cp_lexer_consume_token ( parser -> lexer ) ; }
Parse Objective-C ivars.
Parse Objective - C ivars .
/* No ivars specified.  */ /* Eat '{'.  */ /* Keep going until we hit the `;' at the end of the
	 declaration.  */ /* Check for a (possibly unnamed) bitfield declaration.  */ /* Get the name of the bitfield.  */ /* Eat ':'.  */ /* Get the width of the bitfield.  */ /*allow_non_constant=*/ /* Parse the declarator.  */ /*parenthesized_p=*/ /*member_p=*/ /* Look for attributes that apply to the ivar.  */ /* Remember which attributes are prefix attributes and
	     which are not.  */ /* Combine the attributes.  */ /* Create the bitfield declaration.  */ /*flags=*/ /*init_const_expr_p=*/ /* Add the instance variable.  */ /* Reset PREFIX_ATTRIBUTES.  */ /* Eat ','.  */ /* Eat '}'.  */ /* For historical reasons, we accept an optional semicolon.  */