v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
regexp-error.h
Go to the documentation of this file.
1// Copyright 2020 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_REGEXP_REGEXP_ERROR_H_
6#define V8_REGEXP_REGEXP_ERROR_H_
7
8#include "src/base/logging.h"
9#include "src/base/macros.h"
10
11namespace v8 {
12namespace internal {
13
14#define REGEXP_ERROR_MESSAGES(T) \
15 T(None, "") \
16 T(StackOverflow, "Maximum call stack size exceeded") \
17 T(AnalysisStackOverflow, "Stack overflow") \
18 T(TooLarge, "Regular expression too large") \
19 T(UnterminatedGroup, "Unterminated group") \
20 T(UnmatchedParen, "Unmatched ')'") \
21 T(EscapeAtEndOfPattern, "\\ at end of pattern") \
22 T(InvalidPropertyName, "Invalid property name") \
23 T(InvalidEscape, "Invalid escape") \
24 T(InvalidDecimalEscape, "Invalid decimal escape") \
25 T(InvalidUnicodeEscape, "Invalid Unicode escape") \
26 T(NothingToRepeat, "Nothing to repeat") \
27 T(LoneQuantifierBrackets, "Lone quantifier brackets") \
28 T(RangeOutOfOrder, "numbers out of order in {} quantifier") \
29 T(IncompleteQuantifier, "Incomplete quantifier") \
30 T(InvalidQuantifier, "Invalid quantifier") \
31 T(InvalidGroup, "Invalid group") \
32 T(MultipleFlagDashes, "Multiple dashes in flag group") \
33 T(NotLinear, "Cannot be executed in linear time") \
34 T(RepeatedFlag, "Repeated flag in flag group") \
35 T(InvalidFlagGroup, "Invalid flag group") \
36 T(TooManyCaptures, "Too many captures") \
37 T(InvalidCaptureGroupName, "Invalid capture group name") \
38 T(DuplicateCaptureGroupName, "Duplicate capture group name") \
39 T(InvalidNamedReference, "Invalid named reference") \
40 T(InvalidNamedCaptureReference, "Invalid named capture referenced") \
41 T(InvalidClassPropertyName, "Invalid property name in character class") \
42 T(InvalidCharacterClass, "Invalid character class") \
43 T(UnterminatedCharacterClass, "Unterminated character class") \
44 T(OutOfOrderCharacterClass, "Range out of order in character class") \
45 T(InvalidClassSetOperation, "Invalid set operation in character class") \
46 T(InvalidCharacterInClass, "Invalid character in character class") \
47 T(NegatedCharacterClassWithStrings, \
48 "Negated character class may contain strings")
49
50enum class RegExpError : uint32_t {
51#define TEMPLATE(NAME, STRING) k##NAME,
53#undef TEMPLATE
55};
56
58
59inline constexpr bool RegExpErrorIsStackOverflow(RegExpError error) {
60 return error == RegExpError::kStackOverflow ||
61 error == RegExpError::kAnalysisStackOverflow;
62}
63
64} // namespace internal
65} // namespace v8
66
67#endif // V8_REGEXP_REGEXP_ERROR_H_
constexpr bool RegExpErrorIsStackOverflow(RegExpError error)
const char * RegExpErrorString(RegExpError error)
#define REGEXP_ERROR_MESSAGES(T)
#define V8_EXPORT_PRIVATE
Definition macros.h:460