diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-11-18 13:34:18 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-11-18 13:34:18 +0100 |
commit | bd529c60c67af685de029e2408da3d2bc6980291 (patch) | |
tree | 4410771482d5ac6239a9952cb5d15a06cd294ff0 /js/src/irregexp/RegExpParser.cpp | |
parent | f31b04a303607cd82757e7c4f60bb536658c8a30 (diff) | |
download | UXP-bd529c60c67af685de029e2408da3d2bc6980291.tar UXP-bd529c60c67af685de029e2408da3d2bc6980291.tar.gz UXP-bd529c60c67af685de029e2408da3d2bc6980291.tar.lz UXP-bd529c60c67af685de029e2408da3d2bc6980291.tar.xz UXP-bd529c60c67af685de029e2408da3d2bc6980291.zip |
Revert "Issue #1284 - Implement /s (dotAll) for regular expressions."
This reverts commit f31b04a303607cd82757e7c4f60bb536658c8a30.
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; |