From 99984665bca78ae46e8dce46707d048508bda485 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sat, 26 Sep 2015 13:58:09 -0700 Subject: [PATCH 01/14] Add `Symbol.matchAll` --- index.html | 112 ++++++++++++++++++++++++++++++++++++++++++++--------- spec.emu | 29 ++++++++++++++ spec.md | 34 ++++++++++++++++ 3 files changed, 156 insertions(+), 19 deletions(-) diff --git a/index.html b/index.html index 1b2de54..cb73dbf 100644 --- a/index.html +++ b/index.html @@ -73,6 +73,37 @@ "location": "", "referencingIds": ["_ref_0", "_ref_1", "_ref_3"], "key": "The %RegExpStringIteratorPrototype% Object" + }, { + "type": "clause", + "id": "Symbol.matchAll", + "aoid": null, + "title": "Symbol.matchAll", + "titleHTML": "Symbol.matchAll", + "number": "4", + "namespace": "", + "location": "", + "referencingIds": [], + "key": "Symbol.matchAll" + }, { + "type": "table", + "id": "table-2", + "number": 1, + "caption": "Table 1: Well-known Symbols", + "referencingIds": ["_ref_4"], + "namespace": "", + "location": "", + "key": "Table 1: Well-known Symbols" + }, { + "type": "clause", + "id": "sec-well-known-symbols", + "aoid": null, + "title": "Well-Known Symbols", + "titleHTML": "Well-Known Symbols", + "number": "5", + "namespace": "", + "location": "", + "referencingIds": [], + "key": "Well-Known Symbols" }, { "type": "clause", "id": "sec-copyright-and-software-license", @@ -2125,6 +2156,8 @@
  • 3.3 Properties of RegExp String Iterator Instances
  • +
  • 4 Symbol.matchAll
  • +
  • 5 Well-Known Symbols
  • A Copyright & Software License
  • @@ -2141,31 +2174,31 @@

    1String.prototype.matchAll ( regexp )
    1. Let O be ? - RequireObjectCoercible( + RequireObjectCoercible( this value).
    2. Let isRegExp be ? - IsRegExp(regexp).
    3. + IsRegExp(regexp).
    4. If isRegExp is not true, throw a TypeError exception.
    5. Let S be ? - ToString( + ToString( O).
    6. Let flags be ? - ToString(? - Get(regexp, + ToString(? + Get(regexp, "flags")).
    7. If flags does not contain the character "g", let flags be the String concatenation of the String "g" and flags.
    8. Let rx be ? - RegExpCreate(regexp, flags).
    9. + RegExpCreate(regexp, flags).
    10. Let lastIndex be ? - ToLength(? - Get(regexp, + ToLength(? + Get(regexp, "lastIndex")).
    11. Perform ? - Set(rx, + Set(rx, "lastIndex", lastIndex, true).
    12. Return ? CreateRegExpStringIterator(rx, S) @@ -2184,20 +2217,20 @@

      2CreateRegExpStringIterator ( R,
      1. Assert: - Type(string) is String.
      2. + Type(string) is String.
      3. If ? - IsRegExp(R) is not + IsRegExp(R) is not true, throw a TypeError exception.
      4. Let global be ? - ToBoolean(? - Get(R, + ToBoolean(? + Get(R, "global"));
      5. If global is not true, throw a TypeError exception.
      6. Let iterator be - ObjectCreate( + ObjectCreate( %RegExpStringIteratorPrototype%, « [[IteratingRegExp]], [[IteratedString]] »).
      7. Set iterator.[[IteratingRegExp]] to R.
      8. Set iterator.[[IteratedString]] to S.
      9. @@ -2220,7 +2253,7 @@

        3.1%RegExpStringIteratorPrototype%.next ( )

      10. Let O be the this value.
      11. If - Type(O) is not Object, throw a + Type(O) is not Object, throw a TypeError exception.
      12. If O does not have all of the internal slots of a RegExp String Iterator Object Instance (see 3.3), throw a @@ -2228,12 +2261,12 @@

        3.1%RegExpStringIteratorPrototype%.next ( )

      13. Let R be O.[[IteratingRegExp]].
      14. Let S be O.[[IteratedString]].
      15. Let match be ? - RegExpExec(R, S).
      16. + RegExpExec(R, S).
      17. If match is null, then
        1. Return ! - CreateIterResultObject( + CreateIterResultObject( null, true).
        @@ -2241,7 +2274,7 @@

        3.1%RegExpStringIteratorPrototype%.next ( )

      18. Else,
        1. Return ! - CreateIterResultObject(match, + CreateIterResultObject(match, false).
        @@ -2275,7 +2308,7 @@

        3.3Properties of RegExp String Iterator Instance [[IteratingRegExp]] The regular expression used for iteration. - IsRegExp([[IteratingRegExp]]) is always + IsRegExp([[IteratingRegExp]]) is always true. @@ -2287,6 +2320,47 @@

        3.3Properties of RegExp String Iterator Instance + + +

        4Symbol.matchAll

        +

        The initial value of + Symbol.matchAll is the well-known symbol @@matchAll ( + Table 1).

        +

        This property has the attributes { [[Writable]]: + false, [[Enumerable]]: + false, [[Configurable]]: + false }.

        +
        + + +

        5Well-Known Symbols

        +

        no change

        + +
        +
        Table 1: Well-known Symbols
        + + + + + + + + + + + + + + + + + + + +
        Specification Name[[Description]]Value and Purpose
        insert after @@match
        @@matchAll"Symbol.matchAll"A regular expression method that returns an iterator, that yields matches of the regular expression against a string. Called by the String.prototype.matchAll method.
        insert before @@replace
        +
        +
        +

        ACopyright & Software License

        diff --git a/spec.emu b/spec.emu index ad94487..b48d193 100644 --- a/spec.emu +++ b/spec.emu @@ -92,3 +92,32 @@ contributors: Jordan Harband + + +

        Symbol.matchAll

        +

        The initial value of *Symbol.matchAll* is the well-known symbol @@matchAll ().

        +

        This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *false* }.

        +
        + + +

        Well-Known Symbols

        +

        no change

        + + + + + + + + + + + + + + + + +
        Specification Name[[Description]]Value and Purpose
        insert after @@match
        @@matchAll`"Symbol.matchAll"`A regular expression method that returns an iterator, that yields matches of the regular expression against a string. Called by the `String.prototype.matchAll` method.
        insert before @@replace
        +
        +
        diff --git a/spec.md b/spec.md index 9cf012b..3218e43 100644 --- a/spec.md +++ b/spec.md @@ -75,6 +75,40 @@ RegExp String Iterator instances are ordinary objects that inherit properties fr +# Symbol.matchAll + +The initial value of *Symbol.matchAll* is the well-known symbol @@matchAll + +This property has the attributes { [[Writable]]: **false**, [[Enumerable]]: **false**, [[Configurable]]: **false** }. + +# Well-Known Symbols + +
        +
        Table 1: Well-known Symbols
        + + + + + + + + + + + + + + + + + + + + + +
        Specification Name[[Description]]Value and Purpose
        insert after @@match
        @@matchAll"Symbol.matchAll"A regular expression method that returns an iterator, that yields matches of the regular expression against a string. Called by the String.prototype.matchAll method.
        insert before @@replace
        +
        + [to-boolean]: https://tc39.github.io/ecma262/#sec-toboolean [to-length]: https://tc39.github.io/ecma262/#sec-tolength [to-string]: https://tc39.github.io/ecma262/#sec-tostring From 4a94a621318d4cf9332239ec5b9169979999b52c Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 17 Nov 2015 02:06:36 -0800 Subject: [PATCH 02/14] =?UTF-8?q?Add=20`RegExp#[Symbol.matchAll]`,=20remov?= =?UTF-8?q?e=20=E2=80=9Cglobal=E2=80=9D=20restriction,=20and=20properly=20?= =?UTF-8?q?support=20subclassing.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 345 +++++++++++++++++++++++------------------------------ spec.emu | 77 ++++++++---- spec.md | 58 ++++----- 3 files changed, 231 insertions(+), 249 deletions(-) diff --git a/index.html b/index.html index cb73dbf..f732303 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,7 @@