// aMessage must take 1 parameter (for the string representation of the // unexpected token) void nsCSSScanner::ReportUnexpectedToken(nsCSSToken& tok, const char *aMessage) { ENSURE_STRINGBUNDLE; nsAutoString tokenString; tok.AppendToString(tokenString); const PRUnichar *params[] = { tokenString.get() }; ReportUnexpectedParams(aMessage, params, NS_ARRAY_LENGTH(params)); }
void ErrorReporter::ReportUnexpected(const char *aMessage, const nsCSSToken &aToken) { if (!ShouldReportErrors()) return; nsAutoString tokenString; aToken.AppendToString(tokenString); const PRUnichar *params[1] = { tokenString.get() }; nsAutoString str; sStringBundle->FormatStringFromName(NS_ConvertASCIItoUTF16(aMessage).get(), params, ArrayLength(params), getter_Copies(str)); AddToError(str); }
// aParams's first entry must be null, and we'll fill in the token void nsCSSScanner::ReportUnexpectedTokenParams(nsCSSToken& tok, const char* aMessage, const PRUnichar **aParams, PRUint32 aParamsLength) { NS_PRECONDITION(aParamsLength > 1, "use the non-params version"); NS_PRECONDITION(aParams[0] == nsnull, "first param should be empty"); ENSURE_STRINGBUNDLE; nsAutoString tokenString; tok.AppendToString(tokenString); aParams[0] = tokenString.get(); ReportUnexpectedParams(aMessage, aParams, aParamsLength); }