Title: [258976] trunk
Revision
258976
Author
shvaikal...@gmail.com
Date
2020-03-25 04:11:47 -0700 (Wed, 25 Mar 2020)

Log Message

\b escapes inside character classes should be valid in Unicode patterns
https://bugs.webkit.org/show_bug.cgi?id=209528

Reviewed by Darin Adler.

JSTests:

* test262/expectations.yaml: Mark 2 test cases as passing.

Source/_javascript_Core:

This change removes isIdentityEscapeAnError('b') check, allowing \b escapes
inside character classes in Unicode patterns match U+0008 (BACKSPACE) characters,
aligning JSC with V8 and SpiderMonkey.

Grammar: https://tc39.es/ecma262/#prod-ClassEscape
('b' comes before CharacterEscape :: IdentityEscape)

* yarr/YarrParser.h:
(JSC::Yarr::Parser::parseEscape):

LayoutTests:

* js/regexp-unicode-expected.txt:
* js/script-tests/regexp-unicode.js:

Modified Paths

Diff

Modified: trunk/JSTests/ChangeLog (258975 => 258976)


--- trunk/JSTests/ChangeLog	2020-03-25 10:19:09 UTC (rev 258975)
+++ trunk/JSTests/ChangeLog	2020-03-25 11:11:47 UTC (rev 258976)
@@ -1,3 +1,12 @@
+2020-03-25  Alexey Shvayka  <shvaikal...@gmail.com>
+
+        \b escapes inside character classes should be valid in Unicode patterns
+        https://bugs.webkit.org/show_bug.cgi?id=209528
+
+        Reviewed by Darin Adler.
+
+        * test262/expectations.yaml: Mark 2 test cases as passing.
+
 2020-03-24  Tadeu Zagallo  <tzaga...@apple.com>
 
         LLIntGenerator must link switch jumps to otherwise redundant labels

Modified: trunk/JSTests/test262/expectations.yaml (258975 => 258976)


--- trunk/JSTests/test262/expectations.yaml	2020-03-25 10:19:09 UTC (rev 258975)
+++ trunk/JSTests/test262/expectations.yaml	2020-03-25 11:11:47 UTC (rev 258976)
@@ -1711,9 +1711,6 @@
 test/built-ins/RegExp/quantifier-integer-limit.js:
   default: 'SyntaxError: Invalid regular _expression_: number too large in {} quantifier'
   strict mode: 'SyntaxError: Invalid regular _expression_: number too large in {} quantifier'
-test/built-ins/RegExp/unicode_character_class_backspace_escape.js:
-  default: 'SyntaxError: Invalid regular _expression_: invalid escaped character for Unicode pattern'
-  strict mode: 'SyntaxError: Invalid regular _expression_: invalid escaped character for Unicode pattern'
 test/built-ins/RegExp/unicode_restricted_identity_escape_alpha.js:
   default: "Test262Error: IdentityEscape in AtomEscape: 'k' Expected a SyntaxError to be thrown but no exception was thrown at all"
   strict mode: "Test262Error: IdentityEscape in AtomEscape: 'k' Expected a SyntaxError to be thrown but no exception was thrown at all"

Modified: trunk/LayoutTests/ChangeLog (258975 => 258976)


--- trunk/LayoutTests/ChangeLog	2020-03-25 10:19:09 UTC (rev 258975)
+++ trunk/LayoutTests/ChangeLog	2020-03-25 11:11:47 UTC (rev 258976)
@@ -1,3 +1,13 @@
+2020-03-25  Alexey Shvayka  <shvaikal...@gmail.com>
+
+        \b escapes inside character classes should be valid in Unicode patterns
+        https://bugs.webkit.org/show_bug.cgi?id=209528
+
+        Reviewed by Darin Adler.
+
+        * js/regexp-unicode-expected.txt:
+        * js/script-tests/regexp-unicode.js:
+
 2020-03-24  Zalan Bujtas  <za...@apple.com>
 
         [MultiColumn] Infinite recursion in RenderBlockFlow::relayoutToAvoidWidows

Modified: trunk/LayoutTests/js/regexp-unicode-expected.txt (258975 => 258976)


--- trunk/LayoutTests/js/regexp-unicode-expected.txt	2020-03-25 10:19:09 UTC (rev 258975)
+++ trunk/LayoutTests/js/regexp-unicode-expected.txt	2020-03-25 11:11:47 UTC (rev 258976)
@@ -187,7 +187,6 @@
 PASS r = new RegExp("\\-", "u") threw exception SyntaxError: Invalid regular _expression_: invalid escaped character for Unicode pattern.
 PASS r = new RegExp("\\a", "u") threw exception SyntaxError: Invalid regular _expression_: invalid escaped character for Unicode pattern.
 PASS r = new RegExp("[\\a]", "u") threw exception SyntaxError: Invalid regular _expression_: invalid escaped character for Unicode pattern.
-PASS r = new RegExp("[\\b]", "u") threw exception SyntaxError: Invalid regular _expression_: invalid escaped character for Unicode pattern.
 PASS r = new RegExp("[\\B]", "u") threw exception SyntaxError: Invalid regular _expression_: invalid escaped character for Unicode pattern.
 PASS r = new RegExp("\\x", "u") threw exception SyntaxError: Invalid regular _expression_: invalid escaped character for Unicode pattern.
 PASS r = new RegExp("[\\x]", "u") threw exception SyntaxError: Invalid regular _expression_: invalid escaped character for Unicode pattern.

Modified: trunk/LayoutTests/js/script-tests/regexp-unicode.js (258975 => 258976)


--- trunk/LayoutTests/js/script-tests/regexp-unicode.js	2020-03-25 10:19:09 UTC (rev 258975)
+++ trunk/LayoutTests/js/script-tests/regexp-unicode.js	2020-03-25 11:11:47 UTC (rev 258976)
@@ -247,7 +247,6 @@
 shouldThrowInvalidEscape("\\\\-");
 shouldThrowInvalidEscape("\\\\a");
 shouldThrowInvalidEscape("[\\\\a]");
-shouldThrowInvalidEscape("[\\\\b]");
 shouldThrowInvalidEscape("[\\\\B]");
 shouldThrowInvalidEscape("\\\\x");
 shouldThrowInvalidEscape("[\\\\x]");

Modified: trunk/Source/_javascript_Core/ChangeLog (258975 => 258976)


--- trunk/Source/_javascript_Core/ChangeLog	2020-03-25 10:19:09 UTC (rev 258975)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-03-25 11:11:47 UTC (rev 258976)
@@ -1,3 +1,20 @@
+2020-03-25  Alexey Shvayka  <shvaikal...@gmail.com>
+
+        \b escapes inside character classes should be valid in Unicode patterns
+        https://bugs.webkit.org/show_bug.cgi?id=209528
+
+        Reviewed by Darin Adler.
+
+        This change removes isIdentityEscapeAnError('b') check, allowing \b escapes
+        inside character classes in Unicode patterns match U+0008 (BACKSPACE) characters,
+        aligning JSC with V8 and SpiderMonkey.
+
+        Grammar: https://tc39.es/ecma262/#prod-ClassEscape
+        ('b' comes before CharacterEscape :: IdentityEscape)
+
+        * yarr/YarrParser.h:
+        (JSC::Yarr::Parser::parseEscape):
+
 2020-03-24  Ross Kirsling  <ross.kirsl...@sony.com>
 
         Introduce @tryGetByIdWithWellKnownSymbol instead of repurposing @tryGetById itself

Modified: trunk/Source/_javascript_Core/yarr/YarrParser.h (258975 => 258976)


--- trunk/Source/_javascript_Core/yarr/YarrParser.h	2020-03-25 10:19:09 UTC (rev 258975)
+++ trunk/Source/_javascript_Core/yarr/YarrParser.h	2020-03-25 11:11:47 UTC (rev 258976)
@@ -275,12 +275,9 @@
         // Assertions
         case 'b':
             consume();
-            if (inCharacterClass) {
-                if (isIdentityEscapeAnError('b'))
-                    break;
-
+            if (inCharacterClass)
                 delegate.atomPatternCharacter('\b');
-            } else {
+            else {
                 delegate.assertionWordBoundary(false);
                 return false;
             }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to