diff options
Diffstat (limited to 'deps/v8/src/regexp/regexp-parser.cc')
-rw-r--r-- | deps/v8/src/regexp/regexp-parser.cc | 50 |
1 files changed, 20 insertions, 30 deletions
diff --git a/deps/v8/src/regexp/regexp-parser.cc b/deps/v8/src/regexp/regexp-parser.cc index ebc56650b1..c1d2c7d5cd 100644 --- a/deps/v8/src/regexp/regexp-parser.cc +++ b/deps/v8/src/regexp/regexp-parser.cc @@ -342,20 +342,15 @@ RegExpTree* RegExpParser::ParseDisjunction() { uc32 p = Next(); Advance(2); if (unicode()) { - if (FLAG_harmony_regexp_property) { - ZoneList<CharacterRange>* ranges = - new (zone()) ZoneList<CharacterRange>(2, zone()); - if (!ParsePropertyClass(ranges, p == 'P')) { - return ReportError(CStrVector("Invalid property name")); - } - RegExpCharacterClass* cc = new (zone()) - RegExpCharacterClass(zone(), ranges, builder->flags()); - builder->AddCharacterClass(cc); - } else { - // With /u, no identity escapes except for syntax characters - // are allowed. Otherwise, all identity escapes are allowed. - return ReportError(CStrVector("Invalid escape")); + ZoneList<CharacterRange>* ranges = + new (zone()) ZoneList<CharacterRange>(2, zone()); + if (!ParsePropertyClass(ranges, p == 'P')) { + return ReportError(CStrVector("Invalid property name")); } + RegExpCharacterClass* cc = new (zone()) + RegExpCharacterClass(zone(), ranges, builder->flags()); + builder->AddCharacterClass(cc); + } else { builder->AddCharacter(p); } @@ -477,18 +472,17 @@ RegExpTree* RegExpParser::ParseDisjunction() { builder->AddCharacter('u'); } else { // With /u, invalid escapes are not treated as identity escapes. - return ReportError(CStrVector("Invalid unicode escape")); + return ReportError(CStrVector("Invalid Unicode escape")); } break; } case 'k': // Either an identity escape or a named back-reference. The two // interpretations are mutually exclusive: '\k' is interpreted as - // an identity escape for non-unicode patterns without named + // an identity escape for non-Unicode patterns without named // capture groups, and as the beginning of a named back-reference // in all other cases. - if (FLAG_harmony_regexp_named_captures && - (unicode() || HasNamedCaptures())) { + if (unicode() || HasNamedCaptures()) { Advance(2); ParseNamedBackReference(builder, state CHECK_FAILED); break; @@ -678,13 +672,10 @@ RegExpParser::RegExpParserState* RegExpParser::ParseOpenParenthesis( subexpr_type = NEGATIVE_LOOKAROUND; break; } - if (FLAG_harmony_regexp_named_captures) { - is_named_capture = true; - has_named_captures_ = true; - Advance(); - break; - } - V8_FALLTHROUGH; + is_named_capture = true; + has_named_captures_ = true; + Advance(); + break; default: ReportError(CStrVector("Invalid group")); return nullptr; @@ -765,7 +756,6 @@ void RegExpParser::ScanForCaptures() { // * or a named capture '(?<'. // // Of these, only named captures are capturing groups. - if (!FLAG_harmony_regexp_named_captures) break; Advance(); if (current() != '<') break; @@ -830,8 +820,6 @@ static void push_code_unit(ZoneVector<uc16>* v, uint32_t code_unit) { } const ZoneVector<uc16>* RegExpParser::ParseCaptureGroupName() { - DCHECK(FLAG_harmony_regexp_named_captures); - ZoneVector<uc16>* name = new (zone()->New(sizeof(ZoneVector<uc16>))) ZoneVector<uc16>(zone()); @@ -879,7 +867,6 @@ const ZoneVector<uc16>* RegExpParser::ParseCaptureGroupName() { bool RegExpParser::CreateNamedCaptureAtIndex(const ZoneVector<uc16>* name, int index) { - DCHECK(FLAG_harmony_regexp_named_captures); DCHECK(0 < index && index <= captures_started_); DCHECK_NOT_NULL(name); @@ -1304,6 +1291,9 @@ bool IsSupportedBinaryProperty(UProperty property) { case UCHAR_EMOJI_MODIFIER_BASE: case UCHAR_EMOJI_MODIFIER: case UCHAR_EMOJI_PRESENTATION: +#if U_ICU_VERSION_MAJOR_NUM >= 62 + case UCHAR_EXTENDED_PICTOGRAPHIC: +#endif case UCHAR_EXTENDER: case UCHAR_GRAPHEME_BASE: case UCHAR_GRAPHEME_EXTEND: @@ -1598,7 +1588,7 @@ void RegExpParser::ParseClassEscape(ZoneList<CharacterRange>* ranges, return; case 'p': case 'P': - if (FLAG_harmony_regexp_property && unicode()) { + if (unicode()) { bool negate = Next() == 'P'; Advance(2); if (!ParsePropertyClass(ranges, negate)) { @@ -1700,7 +1690,7 @@ bool RegExpParser::ParseRegExp(Isolate* isolate, Zone* zone, DCHECK(tree != nullptr); DCHECK(result->error.is_null()); if (FLAG_trace_regexp_parser) { - OFStream os(stdout); + StdoutStream os; tree->Print(os, zone); os << "\n"; } |