FreeBSD/contrib/gcc/c-parser.c
/* Read in and lex a single token, storing it in *TOKEN.  */
Read in and lex a single token, storing it in *TOKEN.
Read in and lex a single token storing it in * TOKEN .
static void
c_lex_one_token (c_token *token, c_parser *parser)
{
  timevar_push (TV_LEX);
  token->type = c_lex_with_flags (&token->value, &token->location, NULL);
  token->id_kind = C_ID_NONE;
  token->keyword = RID_MAX;
  token->pragma_kind = PRAGMA_NONE;
  token->in_system_header = in_system_header;
  switch (token->type)
    {
    case CPP_NAME:
      {
	tree decl;
	int objc_force_identifier = objc_need_raw_identifier;
	OBJC_NEED_RAW_IDENTIFIER (0);
	if (C_IS_RESERVED_WORD (token->value))
	  {
	    enum rid rid_code = C_RID_CODE (token->value);
	    if (c_dialect_objc ())
	      {
		if (!OBJC_IS_AT_KEYWORD (rid_code)
		    && (!OBJC_IS_PQ_KEYWORD (rid_code) || objc_pq_context))
		  {
		    token->value = ridpointers[(int) rid_code];
		    token->type = CPP_KEYWORD;
		    token->keyword = rid_code;
		    break;
		  }
		else if (objc_foreach_context && rid_code == RID_IN)
		  {
		    c_token *tk = c_parser_peek_2nd_token (parser);
		    if (tk->type == CPP_NAME
			|| tk->type == CPP_OPEN_PAREN
			|| tk->type == CPP_MULT
			|| tk->type == CPP_PLUS
			|| tk->type == CPP_PLUS_PLUS
			|| tk->type == CPP_MINUS
			|| tk->type == CPP_MINUS_MINUS
			|| tk->type == CPP_OPEN_SQUARE)
		      {
			token->type = CPP_KEYWORD;
			token->keyword = rid_code;
			break;
		      }
		  }
	      }
	    else
	      {
		token->value = ridpointers[(int) rid_code];
		token->type = CPP_KEYWORD;
		token->keyword = rid_code;
		break;
	      }
	  }
	decl = lookup_name (token->value);
	if (decl)
	  {
	    if (TREE_CODE (decl) == TYPE_DECL)
	      {
		token->id_kind = C_ID_TYPENAME;
		break;
	      }
	  }
	else if (c_dialect_objc ())
	  {
	    tree objc_interface_decl = objc_is_class_name (token->value);
	    if (objc_interface_decl
		&& (global_bindings_p ()
		    || (!objc_force_identifier && !decl)))
	      {
		token->value = objc_interface_decl;
		token->id_kind = C_ID_CLASSNAME;
		break;
	      }
	  }
        token->id_kind = C_ID_ID;
      }
      break;
    case CPP_AT_NAME:
      token->type = CPP_KEYWORD;
      token->keyword = C_RID_CODE (token->value);
      break;
    case CPP_COLON:
    case CPP_COMMA:
    case CPP_CLOSE_PAREN:
    case CPP_SEMICOLON:
      OBJC_NEED_RAW_IDENTIFIER (0);
      break;
    case CPP_PRAGMA:
      token->pragma_kind = TREE_INT_CST_LOW (token->value);
      token->value = NULL;
      break;
    default:
      break;
    }
  timevar_pop (TV_LEX);
}
static void c_lex_one_token ( c_token * token , c_parser * parser ) { timevar_push ( TV_LEX ) ; token -> type = c_lex_with_flags ( & token -> value , & token -> location , NULL ) ; token -> id_kind = C_ID_NONE ; token -> keyword = RID_MAX ; token -> pragma_kind = PRAGMA_NONE ; token -> in_system_header = in_system_header ; switch ( token -> type ) { case CPP_NAME : { tree decl ; int objc_force_identifier = objc_need_raw_identifier ; OBJC_NEED_RAW_IDENTIFIER ( 0 ) ; if ( C_IS_RESERVED_WORD ( token -> value ) ) { enum rid rid_code = C_RID_CODE ( token -> value ) ; if ( c_dialect_objc ( ) ) { if ( ! OBJC_IS_AT_KEYWORD ( rid_code ) && ( ! OBJC_IS_PQ_KEYWORD ( rid_code ) || objc_pq_context ) ) { token -> value = ridpointers [ ( int ) rid_code ] ; token -> type = CPP_KEYWORD ; token -> keyword = rid_code ; break ; } else if ( objc_foreach_context && rid_code == RID_IN ) { c_token * tk = c_parser_peek_2nd_token ( parser ) ; if ( tk -> type == CPP_NAME || tk -> type == CPP_OPEN_PAREN || tk -> type == CPP_MULT || tk -> type == CPP_PLUS || tk -> type == CPP_PLUS_PLUS || tk -> type == CPP_MINUS || tk -> type == CPP_MINUS_MINUS || tk -> type == CPP_OPEN_SQUARE ) { token -> type = CPP_KEYWORD ; token -> keyword = rid_code ; break ; } } } else { token -> value = ridpointers [ ( int ) rid_code ] ; token -> type = CPP_KEYWORD ; token -> keyword = rid_code ; break ; } } decl = lookup_name ( token -> value ) ; if ( decl ) { if ( TREE_CODE ( decl ) == TYPE_DECL ) { token -> id_kind = C_ID_TYPENAME ; break ; } } else if ( c_dialect_objc ( ) ) { tree objc_interface_decl = objc_is_class_name ( token -> value ) ; if ( objc_interface_decl && ( global_bindings_p ( ) || ( ! objc_force_identifier && ! decl ) ) ) { token -> value = objc_interface_decl ; token -> id_kind = C_ID_CLASSNAME ; break ; } } token -> id_kind = C_ID_ID ; } break ; case CPP_AT_NAME : token -> type = CPP_KEYWORD ; token -> keyword = C_RID_CODE ( token -> value ) ; break ; case CPP_COLON : case CPP_COMMA : case CPP_CLOSE_PAREN : case CPP_SEMICOLON : OBJC_NEED_RAW_IDENTIFIER ( 0 ) ; break ; case CPP_PRAGMA : token -> pragma_kind = TREE_INT_CST_LOW ( token -> value ) ; token -> value = NULL ; break ; default : break ; } timevar_pop ( TV_LEX ) ; }
Read in and lex a single token, storing it in *TOKEN.
Read in and lex a single token storing it in * TOKEN .
/* Return the canonical spelling for this keyword.  */ /* APPLE LOCAL begin radar 4708210 (for_objc_collection in 4.2) */ /* This is dangerous, we assume we don't need 3 input tokens look ahead.  */ /* APPLE LOCAL radar 4529200 (in 4.2 af) */ /* APPLE LOCAL end radar 4708210 (for_objc_collection in 4.2) */ /* Return the canonical spelling for this keyword.  */ /* Objective-C class names are in the same namespace as
	       variables and typedefs, and hence are shadowed by local
	       declarations.  */ /* This only happens in Objective-C; it must be a keyword.  */ /* These tokens may affect the interpretation of any identifiers
	 following, if doing Objective-C.  */ /* We smuggled the cpp_token->u.pragma value in an INTEGER_CST.  */