Skip to content

Commit

Permalink
Editorial: Standardize more terminology re code units.
Browse files Browse the repository at this point in the history
(Get rid of the phrase "code unit value" in algorithms.)

the code unit value of the string element at index _p_ within _str_
the code unit value of the element at index _p_ within _str_
the code unit value at index _p_ within _str_
->
the numeric value of the code unit at index _p_ within _str_

the numeric code unit value of _code_unit_
the code unit value of _code_unit_
_code_unit_'s code unit value
->
the numeric value of _code_unit_

the code unit value that is _i_
the code unit with code unit value _i_
->
the code unit whose value is _i_

_code_unit_ has a code unit value less than _i_
->
_code_unit_ has a numeric value less than _i_
  • Loading branch information
jmdyck committed Aug 19, 2017
1 parent 3484815 commit bfecd4f
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -4248,8 +4248,8 @@ <h1>Abstract Relational Comparison</h1>
1. If _py_ is a prefix of _px_, return *false*. (A String value _p_ is a prefix of String value _q_ if _q_ can be the string-concatenation of _p_ and some other String _r_. Note that any String is a prefix of itself, because _r_ may be the empty String.)
1. If _px_ is a prefix of _py_, return *true*.
1. Let _k_ be the smallest nonnegative integer such that the code unit at index _k_ within _px_ is different from the code unit at index _k_ within _py_. (There must be such a _k_, for neither String is a prefix of the other.)
1. Let _m_ be the integer that is the code unit value at index _k_ within _px_.
1. Let _n_ be the integer that is the code unit value at index _k_ within _py_.
1. Let _m_ be the integer that is the numeric value of the code unit at index _k_ within _px_.
1. Let _n_ be the integer that is the numeric value of the code unit at index _k_ within _py_.
1. If _m_ &lt; _n_, return *true*. Otherwise, return *false*.
1. Else,
1. Let _nx_ be ? ToNumber(_px_). Because _px_ and _py_ are primitive values evaluation order is not important.
Expand Down Expand Up @@ -10445,13 +10445,13 @@ <h1>Static Semantics: SV</h1>
The SV of <emu-grammar>NonEscapeCharacter :: SourceCharacter but not one of EscapeCharacter or LineTerminator</emu-grammar> is the UTF16Encoding of the code point value of |SourceCharacter|.
</li>
<li>
The SV of <emu-grammar>HexEscapeSequence :: `x` HexDigit HexDigit</emu-grammar> is the code unit value that is (16 times the MV of the first |HexDigit|) plus the MV of the second |HexDigit|.
The SV of <emu-grammar>HexEscapeSequence :: `x` HexDigit HexDigit</emu-grammar> is the code unit whose value is (16 times the MV of the first |HexDigit|) plus the MV of the second |HexDigit|.
</li>
<li>
The SV of <emu-grammar>UnicodeEscapeSequence :: `u` Hex4Digits</emu-grammar> is the SV of |Hex4Digits|.
</li>
<li>
The SV of <emu-grammar>Hex4Digits :: HexDigit HexDigit HexDigit HexDigit</emu-grammar> is the code unit value that is (0x1000 times the MV of the first |HexDigit|) plus (0x100 times the MV of the second |HexDigit|) plus (0x10 times the MV of the third |HexDigit|) plus the MV of the fourth |HexDigit|.
The SV of <emu-grammar>Hex4Digits :: HexDigit HexDigit HexDigit HexDigit</emu-grammar> is the code unit whose value is (0x1000 times the MV of the first |HexDigit|) plus (0x100 times the MV of the second |HexDigit|) plus (0x10 times the MV of the third |HexDigit|) plus the MV of the fourth |HexDigit|.
</li>
<li>
The SV of <emu-grammar>UnicodeEscapeSequence :: `u{` CodePoint `}`</emu-grammar> is the UTF16Encoding of the MV of |CodePoint|.
Expand Down Expand Up @@ -23468,13 +23468,13 @@ <h1>Runtime Semantics: Encode ( _string_, _unescapedSet_ )</h1>
1. Let _S_ be the String value containing only the code unit _C_.
1. Set _R_ to the string-concatenation of the previous value of _R_ and _S_.
1. Else _C_ is not in _unescapedSet_,
1. If the code unit value of _C_ is not less than 0xDC00 and not greater than 0xDFFF, throw a *URIError* exception.
1. If the code unit value of _C_ is less than 0xD800 or greater than 0xDBFF, then
1. If the numeric value of _C_ is not less than 0xDC00 and not greater than 0xDFFF, throw a *URIError* exception.
1. If the numeric value of _C_ is less than 0xD800 or greater than 0xDBFF, then
1. Let _V_ be the code point with the same numeric value as code unit _C_.
1. Else,
1. Increase _k_ by 1.
1. If _k_ equals _strLen_, throw a *URIError* exception.
1. Let _kChar_ be the code unit value of the code unit at index _k_ within _string_.
1. Let _kChar_ be the numeric value of the code unit at index _k_ within _string_.
1. If _kChar_ is less than 0xDC00 or greater than 0xDFFF, throw a *URIError* exception.
1. Let _V_ be UTF16Decode(_C_, _kChar_).
1. Let _Octets_ be the array of octets resulting by applying the UTF-8 transformation to _V_, and let _L_ be the array size.
Expand Down Expand Up @@ -23508,7 +23508,7 @@ <h1>Runtime Semantics: Decode ( _string_, _reservedSet_ )</h1>
1. Let _B_ be the 8-bit value represented by the two hexadecimal digits at index (_k_ + 1) and (_k_ + 2).
1. Increment _k_ by 2.
1. If the most significant bit in _B_ is 0, then
1. Let _C_ be the code unit with code unit value _B_.
1. Let _C_ be the code unit whose value is _B_.
1. If _C_ is not in _reservedSet_, then
1. Let _S_ be the String value containing only the code unit _C_.
1. Else _C_ is in _reservedSet_,
Expand Down Expand Up @@ -28149,7 +28149,7 @@ <h1>String.prototype.charAt ( _pos_ )</h1>
<emu-clause id="sec-string.prototype.charcodeat">
<h1>String.prototype.charCodeAt ( _pos_ )</h1>
<emu-note>
<p>Returns a Number (a nonnegative integer less than 2<sup>16</sup>) that is the code unit value of the string element at index _pos_ within the String resulting from converting this object to a String. If there is no element at that index, the result is *NaN*.</p>
<p>Returns a Number (a nonnegative integer less than 2<sup>16</sup>) that is the numeric value of the code unit at index _pos_ within the String resulting from converting this object to a String. If there is no element at that index, the result is *NaN*.</p>
</emu-note>
<p>When the `charCodeAt` method is called with one argument _pos_, the following steps are taken:</p>
<emu-alg>
Expand All @@ -28158,7 +28158,7 @@ <h1>String.prototype.charCodeAt ( _pos_ )</h1>
1. Let _position_ be ? ToInteger(_pos_).
1. Let _size_ be the length of _S_.
1. If _position_ &lt; 0 or _position_ &ge; _size_, return *NaN*.
1. Return a value of Number type, whose value is the code unit value of the element at index _position_ within the String _S_.
1. Return a value of Number type, whose value is the numeric value of the code unit at index _position_ within the String _S_.
</emu-alg>
<emu-note>
<p>The `charCodeAt` function is intentionally generic; it does not require that its *this* value be a String object. Therefore it can be transferred to other kinds of objects for use as a method.</p>
Expand All @@ -28178,9 +28178,9 @@ <h1>String.prototype.codePointAt ( _pos_ )</h1>
1. Let _position_ be ? ToInteger(_pos_).
1. Let _size_ be the length of _S_.
1. If _position_ &lt; 0 or _position_ &ge; _size_, return *undefined*.
1. Let _first_ be the code unit value of the element at index _position_ within the String _S_.
1. Let _first_ be the numeric value of the code unit at index _position_ within the String _S_.
1. If _first_ &lt; 0xD800 or _first_ &gt; 0xDBFF or _position_+1 = _size_, return _first_.
1. Let _second_ be the code unit value of the element at index _position_+1 within the String _S_.
1. Let _second_ be the numeric value of the code unit at index _position_+1 within the String _S_.
1. If _second_ &lt; 0xDC00 or _second_ &gt; 0xDFFF, return _first_.
1. Return UTF16Decode(_first_, _second_).
</emu-alg>
Expand Down Expand Up @@ -28925,10 +28925,10 @@ <h1>%StringIteratorPrototype%.next ( )</h1>
1. If _position_ &ge; _len_, then
1. Set _O_.[[IteratedString]] to *undefined*.
1. Return CreateIterResultObject(*undefined*, *true*).
1. Let _first_ be the code unit value at index _position_ within _s_.
1. Let _first_ be the numeric value of the code unit at index _position_ within _s_.
1. If _first_ &lt; 0xD800 or _first_ &gt; 0xDBFF or _position_+1 = _len_, let _resultString_ be the String value consisting of the single code unit _first_.
1. Else,
1. Let _second_ be the code unit value at index _position_+1 within the String _S_.
1. Let _second_ be the numeric value of the code unit at index _position_+1 within the String _S_.
1. If _second_ &lt; 0xDC00 or _second_ &gt; 0xDFFF, let _resultString_ be the String value consisting of the single code unit _first_.
1. Else, let _resultString_ be the string-concatenation of the code unit _first_ and the code unit _second_.
1. Let _resultSize_ be the number of code units in _resultString_.
Expand Down Expand Up @@ -29810,7 +29810,7 @@ <h1>Runtime Semantics: Canonicalize ( _ch_ )</h1>
1. Assert: _u_ is a String value.
1. If _u_ does not consist of a single code unit, return _ch_.
1. Let _cu_ be _u_'s single code unit element.
1. If _ch_'s code unit value &ge; 128 and _cu_'s code unit value &lt; 128, return _ch_.
1. If the numeric value of _ch_ &ge; 128 and the numeric value of _cu_ &lt; 128, return _ch_.
1. Return _cu_.
</emu-alg>
<emu-note>
Expand Down Expand Up @@ -30502,9 +30502,9 @@ <h1>AdvanceStringIndex ( _S_, _index_, _unicode_ )</h1>
1. If _unicode_ is *false*, return _index_+1.
1. Let _length_ be the number of code units in _S_.
1. If _index_+1 &ge; _length_, return _index_+1.
1. Let _first_ be the code unit value at index _index_ within _S_.
1. Let _first_ be the numeric value of the code unit at index _index_ within _S_.
1. If _first_ &lt; 0xD800 or _first_ &gt; 0xDBFF, return _index_+1.
1. Let _second_ be the code unit value at index _index_+1 within _S_.
1. Let _second_ be the numeric value of the code unit at index _index_+1 within _S_.
1. If _second_ &lt; 0xDC00 or _second_ &gt; 0xDFFF, return _index_+1.
1. Return _index_+2.
</emu-alg>
Expand Down Expand Up @@ -35940,10 +35940,10 @@ <h1>Runtime Semantics: QuoteJSONString ( _value_ )</h1>
</tbody>
</table>
1. Set _product_ to the string-concatenation of _product_ and _abbrev_.
1. Else if _C_ has a code unit value less than 0x0020 (SPACE), then
1. Else if _C_ has a numeric value less than 0x0020 (SPACE), then
1. Set _product_ to the string-concatenation of _product_ and the code unit 0x005C (REVERSE SOLIDUS).
1. Set _product_ to the string-concatenation of _product_ and `"u"`.
1. Let _hex_ be the string result of converting the numeric code unit value of _C_ to a String of four lowercase hexadecimal digits.
1. Let _hex_ be the string result of converting the numeric value of _C_ to a String of four lowercase hexadecimal digits.
1. Set _product_ to the string-concatenation of _product_ and _hex_.
1. Else,
1. Set _product_ to the string-concatenation of _product_ and _C_.
Expand Down

0 comments on commit bfecd4f

Please sign in to comment.