nsresult
nsSMILParserUtils::ParseValuesGeneric(const nsAString& aSpec,
                                      GenericValueParser& aParser)
{
  nsCharSeparatedTokenizer tokenizer(aSpec, ';');
  if (!tokenizer.hasMoreTokens()) { // Empty list
    return NS_ERROR_FAILURE;
  }

  while (tokenizer.hasMoreTokens()) {
    nsresult rv = aParser.Parse(tokenizer.nextToken());
    if (NS_FAILED(rv)) {
      return NS_ERROR_FAILURE;
    }
  }

  return NS_OK;
}
nsresult
nsSMILParserUtils::ParseValuesGeneric(const nsAString& aSpec,
                                      GenericValueParser& aParser)
{
  nsCharSeparatedTokenizer tokenizer(aSpec, ';');
  if (!tokenizer.hasMoreTokens()) { // Empty list
    return NS_ERROR_FAILURE;
  }

  while (tokenizer.hasMoreTokens()) {
    nsresult rv = aParser.Parse(tokenizer.nextToken());
    if (NS_FAILED(rv)) {
      return NS_ERROR_FAILURE;
    }
  }

  // Disallow ;-terminated values lists.
  if (tokenizer.lastTokenEndedWithSeparator()) {
    return NS_ERROR_FAILURE;
  }

  return NS_OK;
}