e443b89f23
Includes support for modifier spans and duplicate named capture groups. Drops the flow graph implementation to ease maintenance. TEST=corelib/regexp Bug: https://github.com/dart-lang/sdk/issues/56573 Bug: https://github.com/dart-lang/sdk/issues/61337 Bug: https://github.com/dart-lang/sdk/issues/62349 Bug: https://github.com/dart-lang/sdk/issues/62708 Change-Id: I05640ba945a4fa5476e7ad463738f4f39d842c14 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/480121 Reviewed-by: Lasse Nielsen <lrn@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
66 lines
3.5 KiB
C++
66 lines
3.5 KiB
C++
// Copyright 2020 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef V8_REGEXP_REGEXP_ERROR_H_
|
|
#define V8_REGEXP_REGEXP_ERROR_H_
|
|
|
|
#include "vm/globals.h"
|
|
|
|
namespace dart {
|
|
|
|
#define REGEXP_ERROR_MESSAGES(T) \
|
|
T(None, "") \
|
|
T(StackOverflow, "Maximum call stack size exceeded") \
|
|
T(AnalysisStackOverflow, "Stack overflow") \
|
|
T(TooLarge, "Regular expression too large") \
|
|
T(UnterminatedGroup, "Unterminated group") \
|
|
T(UnmatchedParen, "Unmatched ')'") \
|
|
T(EscapeAtEndOfPattern, "\\ at end of pattern") \
|
|
T(InvalidPropertyName, "Invalid property name") \
|
|
T(InvalidEscape, "Invalid escape") \
|
|
T(InvalidDecimalEscape, "Invalid decimal escape") \
|
|
T(InvalidUnicodeEscape, "Invalid Unicode escape") \
|
|
T(NothingToRepeat, "Nothing to repeat") \
|
|
T(LoneQuantifierBrackets, "Lone quantifier brackets") \
|
|
T(RangeOutOfOrder, "numbers out of order in {} quantifier") \
|
|
T(IncompleteQuantifier, "Incomplete quantifier") \
|
|
T(InvalidQuantifier, "Invalid quantifier") \
|
|
T(InvalidGroup, "Invalid group") \
|
|
T(MultipleFlagDashes, "Multiple dashes in flag group") \
|
|
T(NotLinear, "Cannot be executed in linear time") \
|
|
T(RepeatedFlag, "Repeated flag in flag group") \
|
|
T(InvalidFlagGroup, "Invalid flag group") \
|
|
T(TooManyCaptures, "Too many captures") \
|
|
T(InvalidCaptureGroupName, "Invalid capture group name") \
|
|
T(DuplicateCaptureGroupName, "Duplicate capture group name") \
|
|
T(InvalidNamedReference, "Invalid named reference") \
|
|
T(InvalidNamedCaptureReference, "Invalid named capture referenced") \
|
|
T(InvalidClassPropertyName, "Invalid property name in character class") \
|
|
T(InvalidCharacterClass, "Invalid character class") \
|
|
T(UnterminatedCharacterClass, "Unterminated character class") \
|
|
T(OutOfOrderCharacterClass, "Range out of order in character class") \
|
|
T(InvalidClassSetOperation, "Invalid set operation in character class") \
|
|
T(InvalidCharacterInClass, "Invalid character in character class") \
|
|
T(NegatedCharacterClassWithStrings, \
|
|
"Negated character class may contain strings") \
|
|
T(UnsupportedBytecode, "Unsupported Bytecode")
|
|
|
|
enum class RegExpError : uint32_t {
|
|
#define TEMPLATE(NAME, STRING) k##NAME,
|
|
REGEXP_ERROR_MESSAGES(TEMPLATE)
|
|
#undef TEMPLATE
|
|
NumErrors
|
|
};
|
|
|
|
const char* RegExpErrorString(RegExpError error);
|
|
|
|
inline constexpr bool RegExpErrorIsStackOverflow(RegExpError error) {
|
|
return error == RegExpError::kStackOverflow ||
|
|
error == RegExpError::kAnalysisStackOverflow;
|
|
}
|
|
|
|
} // namespace dart
|
|
|
|
#endif // V8_REGEXP_REGEXP_ERROR_H_
|