FreeBSD/contrib/gcc/cp/parser.c
/* Return a pointer to the Nth token in the token stream.  If N is 1,
   then this is precisely equivalent to cp_lexer_peek_token (except
   that it is not inline).  One would like to disallow that case, but
   there is one case (cp_parser_nth_token_starts_template_id) where
   the caller passes a variable for N and it might be 1.  */
Return a pointer to the Nth token in the token stream.  If N is 1,
then this is precisely equivalent to cp_lexer_peek_token (except
that it is not inline).  One would like to disallow that case, but
there is one case (cp_parser_nth_token_starts_template_id) where
the caller passes a variable for N and it might be 1.
Return a pointer to the Nth token in the token stream . If N is 1 then this is precisely equivalent to cp_lexer_peek_token ( except that it is not inline ) . One would like to disallow that case but there is one case ( cp_parser_nth_token_starts_template_id ) where the caller passes a variable for N and it might be 1 .
static cp_token *
cp_lexer_peek_nth_token (cp_lexer* lexer, size_t n)
{
  cp_token *token;
  gcc_assert (n > 0);
  if (cp_lexer_debugging_p (lexer))
    fprintf (cp_lexer_debug_stream,
	     "cp_lexer: peeking ahead %ld at token: ", (long)n);
  --n;
  token = lexer->next_token;
  gcc_assert (!n || token != &eof_token);
  while (n != 0)
    {
      ++token;
      if (token == lexer->last_token)
	{
	  token = (cp_token *)&eof_token;
	  break;
	}
      if (token->type != CPP_PURGED)
	--n;
    }
  if (cp_lexer_debugging_p (lexer))
    {
      cp_lexer_print_token (cp_lexer_debug_stream, token);
      putc ('\n', cp_lexer_debug_stream);
    }
  return token;
}
static cp_token * cp_lexer_peek_nth_token ( cp_lexer * lexer , size_t n ) { cp_token * token ; gcc_assert ( n > 0 ) ; if ( cp_lexer_debugging_p ( lexer ) ) fprintf ( cp_lexer_debug_stream , " " , ( long ) n ) ; -- n ; token = lexer -> next_token ; gcc_assert ( ! n || token != & eof_token ) ; while ( n != 0 ) { ++ token ; if ( token == lexer -> last_token ) { token = ( cp_token * ) & eof_token ; break ; } if ( token -> type != CPP_PURGED ) -- n ; } if ( cp_lexer_debugging_p ( lexer ) ) { cp_lexer_print_token ( cp_lexer_debug_stream , token ) ; putc ( ' \n ' , cp_lexer_debug_stream ) ; } return token ; }
Return a pointer to the Nth token in the token stream.
Return a pointer to the Nth token in the token stream .
/* N is 1-based, not zero-based.  */