FreeBSD/contrib/gcc/cp/parser.c
/* Parse a class-or-namespace-name.

   class-or-namespace-name:
     class-name
     namespace-name

   TYPENAME_KEYWORD_P is TRUE iff the `typename' keyword is in effect.
   TEMPLATE_KEYWORD_P is TRUE iff the `template' keyword is in effect.
   CHECK_DEPENDENCY_P is FALSE iff dependent names should be looked up.
   TYPE_P is TRUE iff the next name should be taken as a class-name,
   even the same name is declared to be another entity in the same
   scope.

   Returns the class (TYPE_DECL) or namespace (NAMESPACE_DECL)
   specified by the class-or-namespace-name.  If neither is found the
   ERROR_MARK_NODE is returned.  */
Parse a class-or-namespace-name.

TYPENAME_KEYWORD_P is TRUE iff the `typename' keyword is in effect.
TEMPLATE_KEYWORD_P is TRUE iff the `template' keyword is in effect.
CHECK_DEPENDENCY_P is FALSE iff dependent names should be looked up.
TYPE_P is TRUE iff the next name should be taken as a class-name,
even the same name is declared to be another entity in the same
scope.

Returns the class (TYPE_DECL) or namespace (NAMESPACE_DECL)
specified by the class-or-namespace-name.  If neither is found the
ERROR_MARK_NODE is returned.
Parse a class - or - namespace - name . TYPENAME_KEYWORD_P is TRUE iff the ` typename ' keyword is in effect . TEMPLATE_KEYWORD_P is TRUE iff the ` template ' keyword is in effect . CHECK_DEPENDENCY_P is FALSE iff dependent names should be looked up . TYPE_P is TRUE iff the next name should be taken as a class - name even the same name is declared to be another entity in the same scope . Returns the class ( TYPE_DECL ) or namespace ( NAMESPACE_DECL ) specified by the class - or - namespace - name . If neither is found the ERROR_MARK_NODE is returned .
static tree
cp_parser_class_or_namespace_name (cp_parser *parser,
				   bool typename_keyword_p,
				   bool template_keyword_p,
				   bool check_dependency_p,
				   bool type_p,
				   bool is_declaration)
{
  tree saved_scope;
  tree saved_qualifying_scope;
  tree saved_object_scope;
  tree scope;
  bool only_class_p;
  saved_scope = parser->scope;
  saved_qualifying_scope = parser->qualifying_scope;
  saved_object_scope = parser->object_scope;
  only_class_p = template_keyword_p || (saved_scope && TYPE_P (saved_scope));
  if (!only_class_p)
    cp_parser_parse_tentatively (parser);
  scope = cp_parser_class_name (parser,
				typename_keyword_p,
				template_keyword_p,
				type_p ? class_type : none_type,
				check_dependency_p,
				false,
				is_declaration);
  if (!only_class_p && !cp_parser_parse_definitely (parser))
    {
      parser->scope = saved_scope;
      parser->qualifying_scope = saved_qualifying_scope;
      parser->object_scope = saved_object_scope;
      if (cp_lexer_next_token_is_not (parser->lexer, CPP_NAME)
	  || cp_lexer_peek_nth_token (parser->lexer, 2)->type != CPP_SCOPE)
	return error_mark_node;
      scope = cp_parser_namespace_name (parser);
    }
  return scope;
}
static tree cp_parser_class_or_namespace_name ( cp_parser * parser , bool typename_keyword_p , bool template_keyword_p , bool check_dependency_p , bool type_p , bool is_declaration ) { tree saved_scope ; tree saved_qualifying_scope ; tree saved_object_scope ; tree scope ; bool only_class_p ; saved_scope = parser -> scope ; saved_qualifying_scope = parser -> qualifying_scope ; saved_object_scope = parser -> object_scope ; only_class_p = template_keyword_p || ( saved_scope && TYPE_P ( saved_scope ) ) ; if ( ! only_class_p ) cp_parser_parse_tentatively ( parser ) ; scope = cp_parser_class_name ( parser , typename_keyword_p , template_keyword_p , type_p ? class_type : none_type , check_dependency_p , false , is_declaration ) ; if ( ! only_class_p && ! cp_parser_parse_definitely ( parser ) ) { parser -> scope = saved_scope ; parser -> qualifying_scope = saved_qualifying_scope ; parser -> object_scope = saved_object_scope ; if ( cp_lexer_next_token_is_not ( parser -> lexer , CPP_NAME ) || cp_lexer_peek_nth_token ( parser -> lexer , 2 ) -> type != CPP_SCOPE ) return error_mark_node ; scope = cp_parser_namespace_name ( parser ) ; } return scope ; }
Parse a class-or-namespace-name.
Parse a class - or - namespace - name .
/* Before we try to parse the class-name, we must save away the
     current PARSER->SCOPE since cp_parser_class_name will destroy
     it.  */ /* Try for a class-name first.  If the SAVED_SCOPE is a type, then
     there is no need to look for a namespace-name.  */ /*class_head_p=*/ /* If that didn't work, try for a namespace-name.  */ /* Restore the saved scope.  */ /* If we are not looking at an identifier followed by the scope
	 resolution operator, then this is not part of a
	 nested-name-specifier.  (Note that this function is only used
	 to parse the components of a nested-name-specifier.)  */