diff options
Diffstat (limited to 'js/src/irregexp/RegExpParser.cpp')
-rw-r--r-- | js/src/irregexp/RegExpParser.cpp | 52 |
1 files changed, 4 insertions, 48 deletions
diff --git a/js/src/irregexp/RegExpParser.cpp b/js/src/irregexp/RegExpParser.cpp index 28abdb0b4..9ef9fe3e2 100644 --- a/js/src/irregexp/RegExpParser.cpp +++ b/js/src/irregexp/RegExpParser.cpp @@ -1384,7 +1384,7 @@ UnicodeEverythingAtom(LifoAlloc* alloc) { RegExpBuilder* builder = alloc->newInfallible<RegExpBuilder>(alloc); - // Everything except \x0a, \x0d, \u2028 and \u2029 + // everything except \x0a, \x0d, \u2028 and \u2029 CharacterRangeVector* ranges = alloc->newInfallible<CharacterRangeVector>(*alloc); ranges->append(CharacterRange::Range(0x0, 0x09)); @@ -1414,38 +1414,6 @@ UnicodeEverythingAtom(LifoAlloc* alloc) return builder->ToRegExp(); } -static inline RegExpTree* -UnicodeDotAllAtom(LifoAlloc* alloc) -{ - RegExpBuilder* builder = alloc->newInfallible<RegExpBuilder>(alloc); - - // Full range excluding surrogates because /s was specified - - CharacterRangeVector* ranges = alloc->newInfallible<CharacterRangeVector>(*alloc); - ranges->append(CharacterRange::Range(0x0, unicode::LeadSurrogateMin - 1)); - ranges->append(CharacterRange::Range(unicode::TrailSurrogateMax + 1, unicode::UTF16Max)); - builder->AddAtom(alloc->newInfallible<RegExpCharacterClass>(ranges, false)); - - builder->NewAlternative(); - - builder->AddAtom(RangeAtom(alloc, unicode::LeadSurrogateMin, unicode::LeadSurrogateMax)); - builder->AddAtom(NegativeLookahead(alloc, unicode::TrailSurrogateMin, - unicode::TrailSurrogateMax)); - - builder->NewAlternative(); - - builder->AddAssertion(alloc->newInfallible<RegExpAssertion>( - RegExpAssertion::NOT_AFTER_LEAD_SURROGATE)); - builder->AddAtom(RangeAtom(alloc, unicode::TrailSurrogateMin, unicode::TrailSurrogateMax)); - - builder->NewAlternative(); - - builder->AddAtom(RangeAtom(alloc, unicode::LeadSurrogateMin, unicode::LeadSurrogateMax)); - builder->AddAtom(RangeAtom(alloc, unicode::TrailSurrogateMin, unicode::TrailSurrogateMax)); - - return builder->ToRegExp(); -} - RegExpTree* UnicodeCharacterClassEscapeAtom(LifoAlloc* alloc, char16_t char_class, bool ignore_case) { @@ -1573,25 +1541,13 @@ RegExpParser<CharT>::ParseDisjunction() } case '.': { Advance(); - + // everything except \x0a, \x0d, \u2028 and \u2029 if (unicode_) { - if (dotall_) { - // Everything - builder->AddAtom(UnicodeDotAllAtom(alloc)); - } else { - // Everything except \x0a, \x0d, \u2028 and \u2029 - builder->AddAtom(UnicodeEverythingAtom(alloc)); - } + builder->AddAtom(UnicodeEverythingAtom(alloc)); break; } CharacterRangeVector* ranges = alloc->newInfallible<CharacterRangeVector>(*alloc); - if (dotall_) { - // Everything - CharacterRange::AddClassEscape(alloc, '*', ranges); - } else { - // Everything except \x0a, \x0d, \u2028 and \u2029 - CharacterRange::AddClassEscape(alloc, '.', ranges); - } + CharacterRange::AddClassEscape(alloc, '.', ranges); RegExpTree* atom = alloc->newInfallible<RegExpCharacterClass>(ranges, false); builder->AddAtom(atom); break; |