FreeBSD/contrib/gcc/cp/parser.c
/* This function parses a @property declaration inside an objective class
   or its implementation. */
This function parses a @property declaration inside an objective class
or its implementation.
This function parses a @property declaration inside an objective class or its implementation .
static void 
objc_cp_parser_at_property (cp_parser *parser)
{
  cp_token *token;
  objc_set_property_attr (0, NULL_TREE);
  cp_lexer_consume_token (parser->lexer);
  token = cp_lexer_peek_token (parser->lexer);
  if (token->type == CPP_OPEN_PAREN)
    {
      cp_lexer_consume_token (parser->lexer);
      while (token->type != CPP_CLOSE_PAREN && token->type != CPP_EOF)
	{
	   tree node;
	   node = cp_parser_identifier (parser);
	   if (node == ridpointers [(int) RID_READONLY])
	    {
	      objc_set_property_attr (1, NULL_TREE);
	    }	
	  else if (node == ridpointers [(int) RID_GETTER]
		   || node == ridpointers [(int) RID_SETTER])
	    {
	      token = cp_lexer_consume_token (parser->lexer);
	      if (token->type == CPP_EQ)
		{
		  tree attr_ident = cp_parser_objc_selector (parser);
		  int num;
		  if (node == ridpointers [(int) RID_GETTER])
		    num = 2;
		  else
		    {
		      num = 3;
		      if (cp_lexer_next_token_is (parser->lexer, CPP_COLON))
			  cp_lexer_consume_token (parser->lexer);
		    }
		  objc_set_property_attr (num, attr_ident);
		}
	      else
		{
		  error ("getter/setter attribute must be followed by '='");
		  break;
		}
	    }
	  else if (node == ridpointers [(int) RID_NONATOMIC])
	    {
	      objc_set_property_attr (13, NULL_TREE);
	    }
	  else
	    {
	      error ("unknown property attribute");
	      break;
	    }
	  if (cp_lexer_next_token_is_not (parser->lexer, CPP_COMMA)
	      && cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_PAREN)
	      && cp_lexer_next_token_is_not (parser->lexer, CPP_EOF))
	    warning (0, "property attributes must be separated by a comma");
	  if (cp_lexer_next_token_is (parser->lexer, CPP_COMMA))
	    cp_lexer_consume_token (parser->lexer);
	  token = cp_lexer_peek_token (parser->lexer);	  
	}
	if (token->type != CPP_CLOSE_PAREN)
	  {
	    error ("syntax error in @property's attribute declaration");
	  }
	cp_lexer_consume_token (parser->lexer);
    }
    objc_cp_parse_property_decl (parser);
}
static void objc_cp_parser_at_property ( cp_parser * parser ) { cp_token * token ; objc_set_property_attr ( 0 , NULL_TREE ) ; cp_lexer_consume_token ( parser -> lexer ) ; token = cp_lexer_peek_token ( parser -> lexer ) ; if ( token -> type == CPP_OPEN_PAREN ) { cp_lexer_consume_token ( parser -> lexer ) ; while ( token -> type != CPP_CLOSE_PAREN && token -> type != CPP_EOF ) { tree node ; node = cp_parser_identifier ( parser ) ; if ( node == ridpointers [ ( int ) RID_READONLY ] ) { objc_set_property_attr ( 1 , NULL_TREE ) ; } else if ( node == ridpointers [ ( int ) RID_GETTER ] || node == ridpointers [ ( int ) RID_SETTER ] ) { token = cp_lexer_consume_token ( parser -> lexer ) ; if ( token -> type == CPP_EQ ) { tree attr_ident = cp_parser_objc_selector ( parser ) ; int num ; if ( node == ridpointers [ ( int ) RID_GETTER ] ) num = 2 ; else { num = 3 ; if ( cp_lexer_next_token_is ( parser -> lexer , CPP_COLON ) ) cp_lexer_consume_token ( parser -> lexer ) ; } objc_set_property_attr ( num , attr_ident ) ; } else { error ( " " ) ; break ; } } else if ( node == ridpointers [ ( int ) RID_NONATOMIC ] ) { objc_set_property_attr ( 13 , NULL_TREE ) ; } else { error ( " " ) ; break ; } if ( cp_lexer_next_token_is_not ( parser -> lexer , CPP_COMMA ) && cp_lexer_next_token_is_not ( parser -> lexer , CPP_CLOSE_PAREN ) && cp_lexer_next_token_is_not ( parser -> lexer , CPP_EOF ) ) warning ( 0 , " " ) ; if ( cp_lexer_next_token_is ( parser -> lexer , CPP_COMMA ) ) cp_lexer_consume_token ( parser -> lexer ) ; token = cp_lexer_peek_token ( parser -> lexer ) ; } if ( token -> type != CPP_CLOSE_PAREN ) { error ( " " ) ; } cp_lexer_consume_token ( parser -> lexer ) ; } objc_cp_parse_property_decl ( parser ) ; }
This function parses a @property declaration inside an objective class
or its implementation.
This function parses a @property declaration inside an objective class or its implementation .
/* Consume @property */ /* property has attribute list. */ /* Consume '(' */ /* Do the readyonly thing. */ /* Do the getter/setter attribute. */ /* APPLE LOCAL radar 4675792 */ /* Consume the ':' which must always follow the setter name. */ /* APPLE LOCAL begin radar 4947014 - objc atomic property */ /* APPLE LOCAL end radar 4947014 - objc atomic property */ /* APPLE LOCAL begin radar 6302949 */ /* APPLE LOCAL end radar 6302949 */ /* Consume ')' */