FreeBSD/contrib/gcc/cp/parser.c
/* An error message is produced if the next token is not '>'.
   All further tokens are skipped until the desired token is
   found or '{', '}', ';' or an unbalanced ')' or ']'.  */
An error message is produced if the next token is not '>'.
An error message is produced if the next token is not ' > ' .
static void
cp_parser_skip_to_end_of_template_parameter_list (cp_parser* parser)
{
  unsigned level = 0;
  unsigned nesting_depth = 0;
  if (cp_parser_require (parser, CPP_GREATER, "%<>%>"))
    return;
  while (true)
    {
      switch (cp_lexer_peek_token (parser->lexer)->type)
	{
	case CPP_LESS:
	  if (!nesting_depth)
	    ++level;
	  break;
	case CPP_GREATER:
	  if (!nesting_depth && level-- == 0)
	    {
	      cp_lexer_consume_token (parser->lexer);
	      return;
	    }
	  break;
	case CPP_OPEN_PAREN:
	case CPP_OPEN_SQUARE:
	  ++nesting_depth;
	  break;
	case CPP_CLOSE_PAREN:
	case CPP_CLOSE_SQUARE:
	  if (nesting_depth-- == 0)
	    return;
	  break;
	case CPP_EOF:
	case CPP_PRAGMA_EOL:
	case CPP_SEMICOLON:
	case CPP_OPEN_BRACE:
	case CPP_CLOSE_BRACE:
	  return;
	default:
	  break;
	}
      cp_lexer_consume_token (parser->lexer);
    }
}
static void cp_parser_skip_to_end_of_template_parameter_list ( cp_parser * parser ) { unsigned level = 0 ; unsigned nesting_depth = 0 ; if ( cp_parser_require ( parser , CPP_GREATER , " " ) ) return ; while ( true ) { switch ( cp_lexer_peek_token ( parser -> lexer ) -> type ) { case CPP_LESS : if ( ! nesting_depth ) ++ level ; break ; case CPP_GREATER : if ( ! nesting_depth && level -- == 0 ) { cp_lexer_consume_token ( parser -> lexer ) ; return ; } break ; case CPP_OPEN_PAREN : case CPP_OPEN_SQUARE : ++ nesting_depth ; break ; case CPP_CLOSE_PAREN : case CPP_CLOSE_SQUARE : if ( nesting_depth -- == 0 ) return ; break ; case CPP_EOF : case CPP_PRAGMA_EOL : case CPP_SEMICOLON : case CPP_OPEN_BRACE : case CPP_CLOSE_BRACE : return ; default : break ; } cp_lexer_consume_token ( parser -> lexer ) ; } }
An error message is produced if the next token is not '>'.
An error message is produced if the next token is not ' > ' .
/* Current level of '< ... >'.  */ /* Ignore '<' and '>' nested inside '( ... )' or '[ ... ]'.  */ /* Are we ready, yet?  If not, issue error message.  */ /* Skip tokens until the desired token is found.  */ /* Peek at the next token.  */ /* We've reached the token we want, consume it and stop.  */ /* The '>' was probably forgotten, don't look further.  */ /* Consume this token.  */