Validates Unicode group name.
function validateUnicodeGroupName(name, state) {
  const isUnicodeName = uRe.test(name) || ucpRe.test(name);
  const isUnicodeState = (state === 'u' || state === 'xu' || state === 'u_class');

  if (isUnicodeName && !isUnicodeState) {
    throw new SyntaxError(`invalid group Unicode name "${name}", use \`u\` flag.`);
  }
}