Index: src/regexp/regexp-parser.h |
diff --git a/src/regexp/regexp-parser.h b/src/regexp/regexp-parser.h |
index a3ef22d8b7ac8f83fe0dc777bfeb49010d780574..607e61a9379a6440acee6798b3d7fdf46e09ca5e 100644 |
--- a/src/regexp/regexp-parser.h |
+++ b/src/regexp/regexp-parser.h |
@@ -184,11 +184,18 @@ class RegExpParser BASE_EMBEDDED { |
// can be reparsed. |
bool ParseBackReferenceIndex(int* index_out); |
+ // The default behavior is to combine surrogate pairs in unicode mode and |
+ // don't combine them otherwise (a quantifier after a surrogate pair would |
+ // then apply only to the trailing surrogate). Forcing combination is required |
+ // when parsing capture names since they can always legally contain surrogate |
+ // pairs. |
+ enum class ScanMode { DEFAULT, FORCE_COMBINE_SURROGATE_PAIRS }; |
+ |
bool ParseClassProperty(ZoneList<CharacterRange>* result); |
CharacterRange ParseClassAtom(uc16* char_class); |
RegExpTree* ReportError(Vector<const char> message); |
- void Advance(); |
- void Advance(int dist); |
+ void Advance(ScanMode mode = ScanMode::DEFAULT); |
+ void Advance(int dist, ScanMode mode = ScanMode::DEFAULT); |
void Reset(int pos); |
// Reports whether the pattern might be used as a literal search string. |
@@ -305,7 +312,7 @@ class RegExpParser BASE_EMBEDDED { |
bool has_next() { return next_pos_ < in()->length(); } |
uc32 Next(); |
template <bool update_position> |
- uc32 ReadNext(); |
+ uc32 ReadNext(ScanMode mode); |
FlatStringReader* in() { return in_; } |
void ScanForCaptures(); |