Skip to content

Commit

Permalink
Editorial: Split 'Patterns' clause into two clauses
Browse files Browse the repository at this point in the history
... namely
    Syntax for Patterns
and
    Static Semantics for Patterns

And for consistency, rename
    Pattern Semantics
to
    Runtime Semantics for Patterns

... so that clause-headers more precisely convey what content is where.
  • Loading branch information
jmdyck committed Jul 24, 2021
1 parent f321fe0 commit 9ff6edb
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -33135,8 +33135,8 @@ <h1>RegExp (Regular Expression) Objects</h1>
</emu-note>

<emu-clause id="sec-patterns">
<h1>Patterns</h1>
<p>The RegExp constructor applies the following grammar to the input pattern String. An error occurs if the grammar cannot interpret the String as an expansion of |Pattern|.</p>
<h1>Syntax for Patterns</h1>
<p>The `RegExp` constructor applies the following grammar to the input pattern String. An error occurs if the grammar cannot interpret the String as an expansion of |Pattern|.</p>
<h2>Syntax</h2>
<emu-grammar type="definition">
Pattern[U, N] ::
Expand Down Expand Up @@ -33340,6 +33340,10 @@ <h2>Syntax</h2>
CharacterClassEscape[?U]
CharacterEscape[?U]
</emu-grammar>
</emu-clause>

<emu-clause id="sec-static-semantics-for-patterns">
<h1>Static Semantics for Patterns</h1>

<emu-note>
<p>A number of productions in this section are given alternative definitions in section <emu-xref href="#sec-regular-expressions-patterns"></emu-xref>.</p>
Expand Down Expand Up @@ -33697,10 +33701,7 @@ <h1>Static Semantics: CapturingGroupName</h1>
</emu-clause>

<emu-clause id="sec-pattern-semantics">
<h1>Pattern Semantics</h1>
<emu-note>
<p>This section is amended in <emu-xref href="#sec-regular-expression-patterns-semantics"></emu-xref>.</p>
</emu-note>
<h1>Runtime Semantics for Patterns</h1>
<p>A regular expression pattern is converted into an Abstract Closure using the process described below. An implementation is encouraged to use more efficient algorithms than the ones listed below, as long as the results are the same. The Abstract Closure is used as the value of a RegExp object's [[RegExpMatcher]] internal slot.</p>
<p>A |Pattern| is either a BMP pattern or a Unicode pattern depending upon whether or not its associated flags contain a `u`. A BMP pattern matches against a String interpreted as consisting of a sequence of 16-bit values that are Unicode code points in the range of the Basic Multilingual Plane. A Unicode pattern matches against a String interpreted as consisting of Unicode code points encoded using UTF-16. In the context of describing the behaviour of a BMP pattern &ldquo;character&rdquo; means a single 16-bit Unicode BMP code point. In the context of describing the behaviour of a Unicode pattern &ldquo;character&rdquo; means a UTF-16 encoded code point (<emu-xref href="#sec-ecmascript-language-types-string-type"></emu-xref>). In either context, &ldquo;character value&rdquo; means the numeric value of the corresponding non-encoded code point.</p>
<p>The syntax and semantics of |Pattern| is defined as if the source code for the |Pattern| was a List of |SourceCharacter| values where each |SourceCharacter| corresponds to a Unicode code point. If a BMP pattern contains a non-BMP |SourceCharacter| the entire pattern is encoded using UTF-16 and the individual code units of that encoding are used as the elements of the List.</p>
Expand Down

0 comments on commit 9ff6edb

Please sign in to comment.