Skip to content

Commit

Permalink
[Normative] Add RegExp dotAll mode (s flag)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasbynens authored and bterlson committed Dec 8, 2017
1 parent fee2b8e commit 1429e31
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -29495,6 +29495,9 @@ <h1>Notation</h1>
<li>
_NcapturingParens_ is the total number of left-capturing parentheses (i.e. the total number of <emu-grammar>Atom :: `(` Disjunction `)`</emu-grammar> Parse Nodes) in the pattern. A left-capturing parenthesis is any `(` pattern character that is matched by the `(` terminal of the <emu-grammar>Atom :: `(` Disjunction `)`</emu-grammar> production.
</li>
<li>
_DotAll_ is *true* if the RegExp object's [[OriginalFlags]] internal slot contains `"s"` and otherwise is *false*.
</li>
<li>
_IgnoreCase_ is *true* if the RegExp object's [[OriginalFlags]] internal slot contains `"i"` and otherwise is *false*.
</li>
Expand Down Expand Up @@ -30069,7 +30072,9 @@ <h1>Atom</h1>
</emu-alg>
<p>The production <emu-grammar>Atom :: `.`</emu-grammar> evaluates as follows:</p>
<emu-alg>
1. Let _A_ be the set of all characters except |LineTerminator|.
1. If _DotAll_ is *true*, then
1. Let _A_ be the set of all characters.
1. Otherwise, let _A_ be the set of all characters except |LineTerminator|.
1. Call CharacterSetMatcher(_A_, *false*) and return its Matcher result.
</emu-alg>
<p>The production <emu-grammar>Atom :: `\` AtomEscape</emu-grammar> evaluates as follows:</p>
Expand Down Expand Up @@ -30478,7 +30483,7 @@ <h1>Runtime Semantics: RegExpInitialize ( _obj_, _pattern_, _flags_ )</h1>
1. Else, let _P_ be ? ToString(_pattern_).
1. If _flags_ is *undefined*, let _F_ be the empty String.
1. Else, let _F_ be ? ToString(_flags_).
1. If _F_ contains any code unit other than `"g"`, `"i"`, `"m"`, `"u"`, or `"y"` or if it contains the same code unit more than once, throw a *SyntaxError* exception.
1. If _F_ contains any code unit other than `"g"`, `"i"`, `"m"`, `"s"`, `"u"`, or `"y"` or if it contains the same code unit more than once, throw a *SyntaxError* exception.
1. If _F_ contains `"u"`, let _BMP_ be *false*; else let _BMP_ be *true*.
1. If _BMP_ is *true*, then
1. Parse _P_ using the grammars in <emu-xref href="#sec-patterns"></emu-xref> and interpreting each of its 16-bit elements as a Unicode BMP code point. UTF-16 decoding is not applied to the elements. The goal symbol for the parse is |Pattern[~U]|. Throw a *SyntaxError* exception if _P_ did not conform to the grammar, if any elements of _P_ were not matched by the parse, or if any Early Error conditions exist.
Expand Down Expand Up @@ -30670,6 +30675,21 @@ <h1>AdvanceStringIndex ( _S_, _index_, _unicode_ )</h1>
</emu-clause>
</emu-clause>

<emu-clause id="sec-get-regexp.prototype.dotAll">
<h1>get RegExp.prototype.dotAll</h1>
<p>`RegExp.prototype.dotAll` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:</p>
<emu-alg>
1. Let _R_ be the *this* value.
1. If Type(_R_) is not Object, throw a *TypeError* exception.
1. If _R_ does not have an [[OriginalFlags]] internal slot, then
1. If SameValue(_R_, %RegExpPrototype%) is *true*, return *undefined*.
1. Otherwise, throw a *TypeError* exception.
1. Let _flags_ be _R_.[[OriginalFlags]].
1. If _flags_ contains the code unit 0x0073 (LATIN SMALL LETTER S), return *true*.
1. Return *false*.
</emu-alg>
</emu-clause>

<!-- es6num="21.2.5.3" -->
<emu-clause id="sec-get-regexp.prototype.flags">
<h1>get RegExp.prototype.flags</h1>
Expand All @@ -30684,6 +30704,8 @@ <h1>get RegExp.prototype.flags</h1>
1. If _ignoreCase_ is *true*, append the code unit 0x0069 (LATIN SMALL LETTER I) as the last code unit of _result_.
1. Let _multiline_ be ToBoolean(? Get(_R_, `"multiline"`)).
1. If _multiline_ is *true*, append the code unit 0x006D (LATIN SMALL LETTER M) as the last code unit of _result_.
1. Let _dotAll_ be ToBoolean(? Get(_R_, `"dotAll"`)).
1. If _dotAll_ is *true*, append the code unit 0x0073 (LATIN SMALL LETTER S) as the last code unit of _result_.
1. Let _unicode_ be ToBoolean(? Get(_R_, `"unicode"`)).
1. If _unicode_ is *true*, append the code unit 0x0075 (LATIN SMALL LETTER U) as the last code unit of _result_.
1. Let _sticky_ be ToBoolean(? Get(_R_, `"sticky"`)).
Expand Down

0 comments on commit 1429e31

Please sign in to comment.