11cb0ef41Sopenharmony_ci// Copyright 2020 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#include "src/regexp/regexp-error.h"
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_cinamespace v8 {
81cb0ef41Sopenharmony_cinamespace internal {
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ciconst char* const kRegExpErrorStrings[] = {
111cb0ef41Sopenharmony_ci#define TEMPLATE(NAME, STRING) STRING,
121cb0ef41Sopenharmony_ci    REGEXP_ERROR_MESSAGES(TEMPLATE)
131cb0ef41Sopenharmony_ci#undef TEMPLATE
141cb0ef41Sopenharmony_ci};
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ciconst char* RegExpErrorString(RegExpError error) {
171cb0ef41Sopenharmony_ci  DCHECK_LT(error, RegExpError::NumErrors);
181cb0ef41Sopenharmony_ci  return kRegExpErrorStrings[static_cast<int>(error)];
191cb0ef41Sopenharmony_ci}
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_ci}  // namespace internal
221cb0ef41Sopenharmony_ci}  // namespace v8
23