ECMA-262 (12th Edition) ECMAScript 2021 Language Specification - page 39

 

  Главная      Manuals     ECMA-262 (12th Edition) ECMAScript 2021 Language Specification

 

Search            copyright infringement  

 

 

 

 

 

 

 

 

 

 

 

Content      ..     37      38      39      40     ..

 

 

 

ECMA-262 (12th Edition) ECMAScript 2021 Language Specification - page 39

 

 

NonDecimalIntegerLiteral

[+Sep]

NonDecimalIntegerLiteral

[+Sep]

 

BigIntLiteralSuffix

LegacyOctalIntegerLiteral

LegacyOctalIntegerLiteral

 

::

0

 

OctalDigit

LegacyOctalIntegerLiteral

 

OctalDigit

DecimalIntegerLiteral

 

::

0

NonZeroDigit
NonZeroDigit

 

NumericLiteralSeparator

opt

 

DecimalDigits

[+Sep]

NonOctalDecimalIntegerLiteral

NonOctalDecimalIntegerLiteral

 

::

0

 

NonOctalDigit

LegacyOctalLikeDecimalIntegerLiteral

 

NonOctalDigit

NonOctalDecimalIntegerLiteral

 

DecimalDigit

LegacyOctalLikeDecimalIntegerLiteral

 

::

0

 

OctalDigit

LegacyOctalLikeDecimalIntegerLiteral

 

OctalDigit

NonOctalDigit

 

::

 

one of

8

 

9

The MV of 

LegacyOctalIntegerLiteral

 

::

 

0

 

OctalDigit

 is the MV of 

OctalDigit

.

The MV of 

LegacyOctalIntegerLiteral

 

::

 

LegacyOctalIntegerLiteral

 

OctalDigit

 is (the MV of 

LegacyOctalIntegerLiteral

 times 8) plus the MV of 

OctalDigit

.

The MV of 

DecimalIntegerLiteral

 

::

 

NonOctalDecimalIntegerLiteral

 is the MV of 

NonOctalDecimalIntegerLiteral

.

The MV of 

NonOctalDecimalIntegerLiteral

 

::

 

0

 

NonOctalDigit

 is the MV of 

NonOctalDigit

.

The MV of 

NonOctalDecimalIntegerLiteral

 

::

 

LegacyOctalLikeDecimalIntegerLiteral

 

NonOctalDigit

 is (the MV of 

LegacyOctalLikeDecimalIntegerLiteral

 times 10) plus the MV of 

NonOctalDigit

.

The MV of 

NonOctalDecimalIntegerLiteral

 

::

 

NonOctalDecimalIntegerLiteral

 

DecimalDigit

 is (the MV of 

NonOctalDecimalIntegerLiteral

 times 10) plus the MV of 

DecimalDigit

.

The MV of 

LegacyOctalLikeDecimalIntegerLiteral

 

::

 

0

 

OctalDigit

 is the MV of 

OctalDigit

.

The MV of 

LegacyOctalLikeDecimalIntegerLiteral

 

::

 

LegacyOctalLikeDecimalIntegerLiteral

 

OctalDigit

 is (the MV

of 

LegacyOctalLikeDecimalIntegerLiteral

 times 10) plus the MV of 

OctalDigit

.

The MV of 

NonOctalDigit

 

::

 

8

 is 8.

The MV of 

NonOctalDigit

 

::

 

9

 is 9.

The syntax and semantics of 

12.8.4

 is extended as follows except that this extension is not allowed for 

strict mode

code

:

B.1.1.1  Static Semantics

B.1.2  String Literals

842

EscapeSequence

 

::

CharacterEscapeSequence
LegacyOctalEscapeSequence
NonOctalDecimalEscapeSequence
HexEscapeSequence
UnicodeEscapeSequence

LegacyOctalEscapeSequence

 

::

OctalDigit

 [lookahead 

 

OctalDigit

]

ZeroToThree

 

OctalDigit

 [lookahead 

 

OctalDigit

]

FourToSeven

 

OctalDigit

ZeroToThree

 

OctalDigit

 

OctalDigit

ZeroToThree

 

::

 

one of

0

 

1

 

2

 

3

FourToSeven

 

::

 

one of

4

 

5

 

6

 

7

NonOctalDecimalEscapeSequence

 

::

 

one of

8

 

9

This definition of 

EscapeSequence

 is not used in strict mode or when parsing 

TemplateCharacter

.

NOTE

The 

SV

 of 

EscapeSequence

 

::

 

LegacyOctalEscapeSequence

 is the String value consisting of the code unit whose

value is the MV of 

LegacyOctalEscapeSequence

.

The MV of 

LegacyOctalEscapeSequence

 

::

 

ZeroToThree

 

OctalDigit

 is (8 times the MV of 

ZeroToThree

) plus the

MV of 

OctalDigit

.

The MV of 

LegacyOctalEscapeSequence

 

::

 

FourToSeven

 

OctalDigit

 is (8 times the MV of 

FourToSeven

) plus the

MV of 

OctalDigit

.

The MV of 

LegacyOctalEscapeSequence

 

::

 

ZeroToThree

 

OctalDigit

 

OctalDigit

 is (64 (that is, 8

2

) times the MV of 

ZeroToThree

) plus (8 times the MV of the first 

OctalDigit

) plus the MV of the second 

OctalDigit

.

The 

SV

 of 

NonOctalDecimalEscapeSequence

 

::

 

8

 is the String value consisting of the code unit 0x0038 (DIGIT

EIGHT).
The 

SV

 of 

NonOctalDecimalEscapeSequence

 

::

 

9

 is the String value consisting of the code unit 0x0039 (DIGIT

NINE).

It is possible for string literals to precede a 

Use Strict Directive

 that places the enclosing code in

strict mode

, and implementations must take care to not use this extended definition of 

EscapeSequence

 with such literals. For example, attempting to parse the following source text

must fail:

function

 

invalid

() { 

"\7"

"use strict"

; }

Syntax

B.1.2.1  Static Semantics

843

The MV of 

ZeroToThree

 

::

 

0

 is 0.

The MV of 

ZeroToThree

 

::

 

1

 is 1.

The MV of 

ZeroToThree

 

::

 

2

 is 2.

The MV of 

ZeroToThree

 

::

 

3

 is 3.

The MV of 

FourToSeven

 

::

 

4

 is 4.

The MV of 

FourToSeven

 

::

 

5

 is 5.

The MV of 

FourToSeven

 

::

 

6

 is 6.

The MV of 

FourToSeven

 

::

 

7

 is 7.

The syntax and semantics of 

12.4

 is extended as follows except that this extension is not allowed when parsing source

code using the 

goal symbol

 

Module

:

Comment

 

::

MultiLineComment
SingleLineComment
SingleLineHTMLOpenComment
SingleLineHTMLCloseComment
SingleLineDelimitedComment

MultiLineComment

 

::

/*

 

FirstCommentLine

opt

 

LineTerminator

 

MultiLineCommentChars

opt

 

*/

 

HTMLCloseComment

opt

FirstCommentLine

 

::

SingleLineDelimitedCommentChars

SingleLineHTMLOpenComment

 

::

<!--

 

SingleLineCommentChars

opt

SingleLineHTMLCloseComment

 

::

LineTerminatorSequence

 

HTMLCloseComment

SingleLineDelimitedComment

 

::

/*

 

SingleLineDelimitedCommentChars

opt

 

*/

HTMLCloseComment

 

::

WhiteSpaceSequence

opt

 

SingleLineDelimitedCommentSequence

opt

 

-->

 

SingleLineCommentChars

opt

SingleLineDelimitedCommentChars

 

::

SingleLineNotAsteriskChar

 

SingleLineDelimitedCommentChars

opt

*

 

SingleLinePostAsteriskCommentChars

opt

SingleLineNotAsteriskChar

 

::

SourceCharacter

 but not one of 

*

 or 

LineTerminator

SingleLinePostAsteriskCommentChars

 

::

B.1.3  HTML-like Comments

Syntax

844

SingleLineNotForwardSlashOrAsteriskChar

 

SingleLineDelimitedCommentChars

opt

*

 

SingleLinePostAsteriskCommentChars

opt

SingleLineNotForwardSlashOrAsteriskChar

 

::

SourceCharacter

 but not one of 

/

 or 

*

 or 

LineTerminator

WhiteSpaceSequence

 

::

WhiteSpace

 

WhiteSpaceSequence

opt

SingleLineDelimitedCommentSequence

 

::

SingleLineDelimitedComment

 

WhiteSpaceSequence

opt

 

SingleLineDelimitedCommentSequence

opt

Similar to a 

MultiLineComment

 that contains a line terminator code point, a 

SingleLineHTMLCloseComment

 is

considered to be a 

LineTerminator

 for purposes of parsing by the syntactic grammar.

The syntax of 

22.2.1

 is modified and extended as follows. These changes introduce ambiguities that are broken by the

ordering of grammar productions and by contextual information. When parsing using the following grammar, each
alternative is considered only if previous production alternatives do not match.

This alternative pattern grammar and semantics only changes the syntax and semantics of BMP patterns. The
following grammar extensions include productions parameterized with the [U] parameter. However, none of these
extensions change the syntax of Unicode patterns recognized when parsing with the [U] parameter present on the

goal symbol

.

Term

[U, N]

 

::

[+U]

Assertion

[+U, ?N]

[+U]

 

Atom

[+U, ?N]

 

Quantifier

[+U]

Atom

[+U, ?N]

[~U]

 

QuantifiableAssertion

[?N]

 

Quantifier

[~U]

Assertion

[~U, ?N]

[~U]

 

ExtendedAtom

[?N]

 

Quantifier

[~U]

ExtendedAtom

[?N]

Assertion

[U, N]

 

::

^

$

\

 

b

\

 

B

[+U]

 

(

 

?

 

=

 

Disjunction

[+U, ?N]

 

)

[+U]

 

(

 

?

 

!

 

Disjunction

[+U, ?N]

 

)

[~U]

QuantifiableAssertion

[?N]

(

 

?

 

<=

 

Disjunction

[?U, ?N]

 

)

B.1.4  Regular Expressions Patterns

Syntax

845

(

 

?

 

<!

 

Disjunction

[?U, ?N]

 

)

QuantifiableAssertion

[N]

 

::

(

 

?

 

=

 

Disjunction

[~U, ?N]

 

)

(

 

?

 

!

 

Disjunction

[~U, ?N]

 

)

ExtendedAtom

[N]

 

::

.

\

 

AtomEscape

[~U, ?N]

\

 [lookahead = 

c

]

CharacterClass

[~U]

(

 

Disjunction

[~U, ?N]

 

)

(

 

?

 

:

 

Disjunction

[~U, ?N]

 

)

InvalidBracedQuantifier
ExtendedPatternCharacter

InvalidBracedQuantifier

 

::

{

 

DecimalDigits

[~Sep]

 

}

{

 

DecimalDigits

[~Sep]

 

,

 

}

{

 

DecimalDigits

[~Sep]

 

,

 

DecimalDigits

[~Sep]

 

}

ExtendedPatternCharacter

 

::

SourceCharacter

 but not one of 

^

 

$

 

\

 

.

 

*

 

+

 

?

 

(

 

)

 

[

 

|

AtomEscape

[U, N]

 

::

[+U]

DecimalEscape

[~U]

 

DecimalEscape

 but only if the 

CapturingGroupNumber

 of 

DecimalEscape

 is 

 

NcapturingParens

CharacterClassEscape

[?U]

CharacterEscape

[?U, ?N]

[+N]

 

k

 

GroupName

[?U]

CharacterEscape

[U, N]

 

::

ControlEscape

c

 

ControlLetter

0

 [lookahead 

 

DecimalDigit

]

HexEscapeSequence
RegExpUnicodeEscapeSequence

[?U]

[~U]

LegacyOctalEscapeSequence

IdentityEscape

[?U, ?N]

IdentityEscape

[U, N]

 

::

[+U]

SyntaxCharacter

[+U]

/

[~U]

SourceCharacterIdentityEscape

[?N]

846

SourceCharacterIdentityEscape

[N]

 

::

[~N]

SourceCharacter

 but not 

c

[+N]

SourceCharacter

 but not one of 

c

 or 

k

ClassAtomNoDash

[U, N]

 

::

SourceCharacter

 but not one of 

\

 or 

]

 or 

-

\

 

ClassEscape

[?U, ?N]

\

 [lookahead = 

c

]

ClassEscape

[U, N]

 

::

b

[+U]

-

[~U]

 

c

 

ClassControlLetter

CharacterClassEscape

[?U]

CharacterEscape

[?U, ?N]

ClassControlLetter

 

::

DecimalDigit

_

NOTE

The semantics of 

22.2.1.1

 is extended as follows:

ExtendedAtom

 

::

 

InvalidBracedQuantifier

It is a Syntax Error if any source text matches this rule.

Additionally, the rules for the following productions are modified with the addition of the highlighted text:

NonemptyClassRanges

 

::

 

ClassAtom

 

-

 

ClassAtom

 

ClassRanges

It is a Syntax Error if 

IsCharacterClass

 of the first 

ClassAtom

 is 

true

 or 

IsCharacterClass

 of the second 

ClassAtom

is 

true

 and this production has a 

[U]

 parameter.

It is a Syntax Error if 

IsCharacterClass

 of the first 

ClassAtom

 is 

false

 and 

IsCharacterClass

 of the second 

ClassAtom

 is 

false

 and the 

CharacterValue

 of the first 

ClassAtom

 is larger than the 

CharacterValue

 of the second 

ClassAtom

.

NonemptyClassRangesNoDash

 

::

 

ClassAtomNoDash

 

-

 

ClassAtom

 

ClassRanges

It is a Syntax Error if 

IsCharacterClass

 of 

ClassAtomNoDash

 is 

true

 or 

IsCharacterClass

 of 

ClassAtom

 is 

true

 and

this production has a 

[U]

 parameter.

It is a Syntax Error if 

IsCharacterClass

 of 

ClassAtomNoDash

 is 

false

 and 

IsCharacterClass

 of 

ClassAtom

 is 

false

and the 

CharacterValue

 of 

ClassAtomNoDash

 is larger than the 

CharacterValue

 of 

ClassAtom

.

When the same left hand sides occurs with both [+U] and [~U] guards it is to control the
disambiguation priority.

B.1.4.1  Static Semantics: Early Errors

847

The semantics of 

22.2.1.3

 is extended as follows:

ClassAtomNoDash

 

::

 

\

 [lookahead = 

c

]

1.  Return 

false

.

The semantics of 

22.2.1.4

 is extended as follows:

ClassAtomNoDash

 

::

 

\

 [lookahead = 

c

]

1.  Return the code point value of U+005C (REVERSE SOLIDUS).

ClassEscape

 

::

 

c

 

ClassControlLetter

1.  Let 

ch

 be the code point matched by 

ClassControlLetter

.

2.  Let 

i

 be 

ch

's code point value.

3.  Return the remainder of dividing 

i

 by 32.

CharacterEscape

 

::

 

LegacyOctalEscapeSequence

1.  Return the MV of 

LegacyOctalEscapeSequence

 (see 

B.1.2

).

The semantics of 

22.2.2

 is extended as follows:

Within 

22.2.2.5

 reference to “  

Atom

 

::

 

(

 

GroupSpecifier

 

Disjunction

 

)

 ” are to be interpreted as meaning “  

Atom

 

::

 

(

GroupSpecifier

 

Disjunction

 

)

 ” or “  

ExtendedAtom

 

::

 

(

 

Disjunction

 

)

 ”.

Term (

22.2.2.5

) includes the following additional evaluation rules:

The production 

Term

 

::

 

QuantifiableAssertion

 

Quantifier

 evaluates the same as the production 

Term

 

::

 

Atom

Quantifier

 but with 

QuantifiableAssertion

 substituted for 

Atom

.

The production 

Term

 

::

 

ExtendedAtom

 

Quantifier

 evaluates the same as the production 

Term

 

::

 

Atom

 

Quantifier

 but

with 

ExtendedAtom

 substituted for 

Atom

.

The production 

Term

 

::

 

ExtendedAtom

 evaluates the same as the production 

Term

 

::

 

Atom

 but with 

ExtendedAtom

substituted for 

Atom

.

Assertion (

22.2.2.6

) includes the following additional evaluation rule:

The production 

Assertion

 

::

 

QuantifiableAssertion

 evaluates as follows:

1.  Evaluate 

QuantifiableAssertion

 to obtain a Matcher 

m

.

2.  Return 

m

.

Assertion (

22.2.2.6

) evaluation rules for the 

Assertion

 

::

 

(

 

?

 

=

 

Disjunction

 

)

 and 

Assertion

 

::

 

(

 

?

 

!

 

Disjunction

 

)

productions are also used for the 

QuantifiableAssertion

 productions, but with 

QuantifiableAssertion

 substituted for 

Assertion

.

B.1.4.2  Static Semantics: IsCharacterClass

B.1.4.3  Static Semantics: CharacterValue

B.1.4.4  Pattern Semantics

848

Atom (

22.2.2.8

) evaluation rules for the 

Atom

 productions except for 

Atom

 

::

 

PatternCharacter

 are also used for the 

ExtendedAtom

 productions, but with 

ExtendedAtom

 substituted for 

Atom

. The following evaluation rules, with

parameter 

direction

, are also added:

The production 

ExtendedAtom

 

::

 

\

 [lookahead = 

c

]  evaluates as follows:

1.  Let 

A

 be the CharSet containing the single character 

\\

 U+005C (REVERSE SOLIDUS).

2.  Return ! 

CharacterSetMatcher

(

A

false

direction

).

The production 

ExtendedAtom

 

::

 

ExtendedPatternCharacter

 evaluates as follows:

1.  Let 

ch

 be the character represented by 

ExtendedPatternCharacter

.

2.  Let 

A

 be a one-element CharSet containing the character 

ch

.

3.  Return ! 

CharacterSetMatcher

(

A

false

direction

).

CharacterEscape (

22.2.2.10

) includes the following additional evaluation rule:

The production 

CharacterEscape

 

::

 

LegacyOctalEscapeSequence

 evaluates as follows:

1.  Let 

cv

 be the 

CharacterValue

 of this 

CharacterEscape

.

2.  Return the character whose character value is 

cv

.

NonemptyClassRanges (

22.2.2.15

) modifies the following evaluation rule:

The production 

NonemptyClassRanges

 

::

 

ClassAtom

 

-

 

ClassAtom

 

ClassRanges

 evaluates as follows:

1.  Evaluate the first 

ClassAtom

 to obtain a CharSet 

A

.

2.  Evaluate the second 

ClassAtom

 to obtain a CharSet 

B

.

3.  Evaluate 

ClassRanges

 to obtain a CharSet 

C

.

4.  Let 

D

 be ! 

CharacterRangeOrUnion

(

A

B

).

5.  Return the union of 

D

 and 

C

.

NonemptyClassRangesNoDash (

22.2.2.16

) modifies the following evaluation rule:

The production 

NonemptyClassRangesNoDash

 

::

 

ClassAtomNoDash

 

-

 

ClassAtom

 

ClassRanges

 evaluates as follows:

1.  Evaluate 

ClassAtomNoDash

 to obtain a CharSet 

A

.

2.  Evaluate 

ClassAtom

 to obtain a CharSet 

B

.

3.  Evaluate 

ClassRanges

 to obtain a CharSet 

C

.

4.  Let 

D

 be ! 

CharacterRangeOrUnion

(

A

B

).

5.  Return the union of 

D

 and 

C

.

ClassEscape (

22.2.2.19

) includes the following additional evaluation rule:

The production 

ClassEscape

 

::

 

c

 

ClassControlLetter

 evaluates as follows:

1.  Let 

cv

 be the 

CharacterValue

 of this 

ClassEscape

.

2.  Let 

c

 be the character whose character value is 

cv

.

3.  Return the CharSet containing the single character 

c

.

ClassAtomNoDash (

22.2.2.18

) includes the following additional evaluation rule:

The production 

ClassAtomNoDash

 

::

 

\

 [lookahead = 

c

]  evaluates as follows:

849

1.  Return the CharSet containing the single character 

\\

 U+005C (REVERSE SOLIDUS).

NOTE

The abstract operation CharacterRangeOrUnion takes arguments 

A

 (a CharSet) and 

B

 (a CharSet). It performs the

following steps when called:

1.  If 

Unicode

 is 

false

, then

a.  If 

A

 does not contain exactly one character or 

B

 does not contain exactly one character, then

i.  Let 

C

 be the CharSet containing the single character 

--

 U+002D (HYPHEN-MINUS).

ii.  Return the union of CharSets 

A

B

 and 

C

.

2.  Return ! 

CharacterRange

(

A

B

).

When the ECMAScript 

host

 is a web browser the following additional properties of the standard built-in objects are

defined.

The entries in 

Table 82

 are added to 

Table 8

.

Table 82: Additional Well-known Intrinsic Objects

Intrinsic Name Global Name ECMAScript Language Association

%escape%

escape

escape

The 

escape

escape

 function (

B.2.1.1

)

%unescape%

unescape

unescape

The 

unescape

unescape

 function (

B.2.1.2

)

The 

escape

escape

 function is a property of the 

global object

. It computes a new version of a String value in which certain

code units have been replaced by a hexadecimal escape sequence.

For those code units being replaced whose value is 

0x00FF

0x00FF

 or less, a two-digit escape sequence of the form 

%%

xx

xx

 is

used. For those characters being replaced whose code unit value is greater than 

0x00FF

0x00FF

, a four-digit escape sequence

of the form 

%u

%u

xxxx

xxxx

 is used.

The 

escape

escape

 function is the 

%escape%

 intrinsic object. When the 

escape

escape

 function is called with one argument

string

, the following steps are taken:

1.  Set 

string

 to ? 

ToString

(

string

).

2.  Let 

length

 be the number of code units in 

string

.

3.  Let 

R

 be the empty String.

This production can only be reached from the sequence 

\c

\c

 within a character class where it is

not followed by an acceptable control character.

B.1.4.4.1  CharacterRangeOrUnion ( 

A

B

 )

B.2  Additional Built-in Properties

B.2.1  Additional Properties of the Global Object

B.2.1.1  escape ( 

string

 )

850

4.  Let 

k

 be 0.

5.  Repeat, while 

k

 < 

length

,

a.  Let 

char

 be the code unit (represented as a 16-bit unsigned 

integer

) at index 

k

 within 

string

.

b.  If 

char

 is one of the code units in

"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./"

, then

i.  Let 

S

 be the String value containing the single code unit 

char

.

c.  Else if 

char

 

 256, then

i.  Let 

n

 be the numeric value of 

char

.

ii.  Let 

S

 be the 

string-concatenation

 of:

"%u"

the String representation of 

n

, formatted as a four-digit uppercase hexadecimal number,

padded to the left with zeroes if necessary

d.  Else,

i. 

Assert

char

 < 256.

ii.  Let 

n

 be the numeric value of 

char

.

iii.  Let 

S

 be the 

string-concatenation

 of:

"%"

the String representation of 

n

, formatted as a two-digit uppercase hexadecimal number,

padded to the left with a zero if necessary

e.  Set 

R

 to the 

string-concatenation

 of 

R

 and 

S

.

f.  Set 

k

 to 

k

 + 1.

6.  Return 

R

.

NOTE

The 

unescape

unescape

 function is a property of the 

global object

. It computes a new version of a String value in which each

escape sequence of the sort that might be introduced by the 

escape

escape

 function is replaced with the code unit that it

represents.

The 

unescape

unescape

 function is the 

%unescape%

 intrinsic object. When the 

unescape

unescape

 function is called with one

argument 

string

, the following steps are taken:

1.  Set 

string

 to ? 

ToString

(

string

).

2.  Let 

length

 be the number of code units in 

string

.

3.  Let 

R

 be the empty String.

4.  Let 

k

 be 0.

5.  Repeat, while 

k

 

 

length

,

a.  Let 

c

 be the code unit at index 

k

 within 

string

.

b.  If 

c

 is the code unit 0x0025 (PERCENT SIGN), then

i.  Let 

hexEscape

 be the empty String.

ii.  Let 

skip

 be 0.

iii.  If 

k

 

 

length

 - 6 and the code unit at index 

k

 + 1 within 

string

 is the code unit 0x0075 (LATIN

SMALL LETTER U), then

1.  Set 

hexEscape

 to the 

substring

 of 

string

 from 

k

 + 2 to 

k

 + 6.

The encoding is partly based on the encoding described in RFC 1738, but the entire encoding
specified in this standard is described above without regard to the contents of RFC 1738. This
encoding does not reflect changes to RFC 1738 made by RFC 3986.

B.2.1.2  unescape ( 

string

 )

851

2.  Set 

skip

 to 5.

iv.  Else if 

k

 

 

length

 - 3, then

1.  Set 

hexEscape

 to the 

substring

 of 

string

 from 

k

 + 1 to 

k

 + 3.

2.  Set 

skip

 to 2.

v.  If 

hexEscape

 can be interpreted as an expansion of 

HexDigits

[~Sep]

, then

1.  Let 

hexIntegerLiteral

 be the 

string-concatenation

 of 

"0x"

 and 

hexEscape

.

2.  Let 

n

 be ! 

ToNumber

(

hexIntegerLiteral

).

3.  Set 

c

 to the code unit whose value is 

(

n

).

4.  Set 

k

 to 

k

 + 

skip

.

c.  Set 

R

 to the 

string-concatenation

 of 

R

 and 

c

.

d.  Set 

k

 to 

k

 + 1.

6.  Return 

R

.

Object.prototype.__proto__

Object.prototype.__proto__

 is an 

accessor property

 with attributes { [[Enumerable]]: 

false

,

[[Configurable]]: 

true

 }. The [[Get]] and [[Set]] attributes are defined as follows:

The value of the [[Get]] attribute is a built-in function that requires no arguments. It performs the following steps
when called:

1.  Let 

O

 be ? 

ToObject

(

this

 value).

2.  Return ? 

O

.[[GetPrototypeOf]]().

The value of the [[Set]] attribute is a built-in function that takes an argument 

proto

. It performs the following steps

when called:

1.  Let 

O

 be ? 

RequireObjectCoercible

(

this

 value).

2.  If 

Type

(

proto

) is neither Object nor Null, return 

undefined

.

3.  If 

Type

(

O

) is not Object, return 

undefined

.

4.  Let 

status

 be ? 

O

.[[SetPrototypeOf]](

proto

).

5.  If 

status

 is 

false

, throw a 

TypeError

 exception.

6.  Return 

undefined

.

When the 

__defineGetter__

__defineGetter__

 method is called with arguments 

P

 and 

getter

, the following steps are taken:

1.  Let 

O

 be ? 

ToObject

(

this

 value).

2.  If 

IsCallable

(

getter

) is 

false

, throw a 

TypeError

 exception.

3.  Let 

desc

 be PropertyDescriptor { [[Get]]: 

getter

, [[Enumerable]]: 

true

, [[Configurable]]: 

true

 }.

4.  Let 

key

 be ? 

ToPropertyKey

(

P

).

5.  Perform ? 

DefinePropertyOrThrow

(

O

key

desc

).

B.2.2  Additional Properties of the Object.prototype Object

B.2.2.1  Object.prototype.__proto__

B.2.2.1.1  get Object.prototype.__proto__

B.2.2.1.2  set Object.prototype.__proto__

B.2.2.2  Object.prototype.__defineGetter__ ( 

P

getter

 )

852

6.  Return 

undefined

.

When the 

__defineSetter__

__defineSetter__

 method is called with arguments 

P

 and 

setter

, the following steps are taken:

1.  Let 

O

 be ? 

ToObject

(

this

 value).

2.  If 

IsCallable

(

setter

) is 

false

, throw a 

TypeError

 exception.

3.  Let 

desc

 be PropertyDescriptor { [[Set]]: 

setter

, [[Enumerable]]: 

true

, [[Configurable]]: 

true

 }.

4.  Let 

key

 be ? 

ToPropertyKey

(

P

).

5.  Perform ? 

DefinePropertyOrThrow

(

O

key

desc

).

6.  Return 

undefined

.

When the 

__lookupGetter__

__lookupGetter__

 method is called with argument 

P

, the following steps are taken:

1.  Let 

O

 be ? 

ToObject

(

this

 value).

2.  Let 

key

 be ? 

ToPropertyKey

(

P

).

3.  Repeat,

a.  Let 

desc

 be ? 

O

.[[GetOwnProperty]](

key

).

b.  If 

desc

 is not 

undefined

, then

i.  If 

IsAccessorDescriptor

(

desc

) is 

true

, return 

desc

.[[Get]].

ii.  Return 

undefined

.

c.  Set 

O

 to ? 

O

.[[GetPrototypeOf]]().

d.  If 

O

 is 

null

, return 

undefined

.

When the 

__lookupSetter__

__lookupSetter__

 method is called with argument 

P

, the following steps are taken:

1.  Let 

O

 be ? 

ToObject

(

this

 value).

2.  Let 

key

 be ? 

ToPropertyKey

(

P

).

3.  Repeat,

a.  Let 

desc

 be ? 

O

.[[GetOwnProperty]](

key

).

b.  If 

desc

 is not 

undefined

, then

i.  If 

IsAccessorDescriptor

(

desc

) is 

true

, return 

desc

.[[Set]].

ii.  Return 

undefined

.

c.  Set 

O

 to ? 

O

.[[GetPrototypeOf]]().

d.  If 

O

 is 

null

, return 

undefined

.

The 

substr

substr

 method takes two arguments, 

start

 and 

length

, and returns a substring of the result of converting the

this

 value to a String, starting from index 

start

 and running for 

length

 code units (or through the end of the String if

length

 is 

undefined

). If 

start

 is negative, it is treated as 

sourceLength

 + 

start

 where 

sourceLength

 is the length of the

B.2.2.3  Object.prototype.__defineSetter__ ( 

P

setter

 )

B.2.2.4  Object.prototype.__lookupGetter__ ( 

P

 )

B.2.2.5  Object.prototype.__lookupSetter__ ( 

P

 )

B.2.3  Additional Properties of the String.prototype Object

B.2.3.1  String.prototype.substr ( 

start

length

 )

853

String. The result is a String value, not a String object. The following steps are taken:

1.  Let 

O

 be ? 

RequireObjectCoercible

(

this

 value).

2.  Let 

S

 be ? 

ToString

(

O

).

3.  Let 

size

 be the length of 

S

.

4.  Let 

intStart

 be ? 

ToIntegerOrInfinity

(

start

).

5.  If 

intStart

 is -

, set 

intStart

 to 0.

6.  Else if 

intStart

 < 0, set 

intStart

 to 

max

(

size

 + 

intStart

, 0).

7.  If 

length

 is 

undefined

, let 

intLength

 be 

size

; otherwise let 

intLength

 be ? 

ToIntegerOrInfinity

(

length

).

8.  If 

intStart

 is +

intLength

 

 0, or 

intLength

 is +

, return the empty String.

9.  Let 

intEnd

 be 

min

(

intStart

 + 

intLength

size

).

10.  If 

intStart

 

 

intEnd

, return the empty String.

11.  Return the 

substring

 of 

S

 from 

intStart

 to 

intEnd

.

NOTE

When the 

anchor

anchor

 method is called with argument 

name

, the following steps are taken:

1.  Let 

S

 be the 

this

 value.

2.  Return ? 

CreateHTML

(

S

"a"

"name"

name

).

The abstract operation CreateHTML takes arguments 

string

tag

 (a String), 

attribute

 (a String), and 

value

. It performs

the following steps when called:

1.  Let 

str

 be ? 

RequireObjectCoercible

(

string

).

2.  Let 

S

 be ? 

ToString

(

str

).

3.  Let 

p1

 be the 

string-concatenation

 of 

"<"

 and 

tag

.

4.  If 

attribute

 is not the empty String, then

a.  Let 

V

 be ? 

ToString

(

value

).

b.  Let 

escapedV

 be the String value that is the same as 

V

 except that each occurrence of the code unit 0x0022

(QUOTATION MARK) in 

V

 has been replaced with the six code unit sequence 

"&quot;"

.

c.  Set 

p1

 to the 

string-concatenation

 of:

p1

the code unit 0x0020 (SPACE)

attribute

the code unit 0x003D (EQUALS SIGN)
the code unit 0x0022 (QUOTATION MARK)

escapedV

the code unit 0x0022 (QUOTATION MARK)

5.  Let 

p2

 be the 

string-concatenation

 of 

p1

 and 

">"

.

6.  Let 

p3

 be the 

string-concatenation

 of 

p2

 and 

S

.

7.  Let 

p4

 be the 

string-concatenation

 of 

p3

"</"

tag

, and 

">"

.

8.  Return 

p4

.

The 

substr

substr

 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.

B.2.3.2  String.prototype.anchor ( 

name

 )

B.2.3.2.1  CreateHTML ( 

string

tag

attribute

value

 )

854

When the 

big

big

 method is called with no arguments, the following steps are taken:

1.  Let 

S

 be the 

this

 value.

2.  Return ? 

CreateHTML

(

S

"big"

""

""

).

When the 

blink

blink

 method is called with no arguments, the following steps are taken:

1.  Let 

S

 be the 

this

 value.

2.  Return ? 

CreateHTML

(

S

"blink"

""

""

).

When the 

bold

bold

 method is called with no arguments, the following steps are taken:

1.  Let 

S

 be the 

this

 value.

2.  Return ? 

CreateHTML

(

S

"b"

""

""

).

When the 

fixed

fixed

 method is called with no arguments, the following steps are taken:

1.  Let 

S

 be the 

this

 value.

2.  Return ? 

CreateHTML

(

S

"tt"

""

""

).

When the 

fontcolor

fontcolor

 method is called with argument 

color

, the following steps are taken:

1.  Let 

S

 be the 

this

 value.

2.  Return ? 

CreateHTML

(

S

"font"

"color"

color

).

When the 

fontsize

fontsize

 method is called with argument 

size

, the following steps are taken:

1.  Let 

S

 be the 

this

 value.

2.  Return ? 

CreateHTML

(

S

"font"

"size"

size

).

When the 

italics

italics

 method is called with no arguments, the following steps are taken:

1.  Let 

S

 be the 

this

 value.

2.  Return ? 

CreateHTML

(

S

"i"

""

""

).

B.2.3.3  String.prototype.big ( )

B.2.3.4  String.prototype.blink ( )

B.2.3.5  String.prototype.bold ( )

B.2.3.6  String.prototype.fixed ( )

B.2.3.7  String.prototype.fontcolor ( 

color

 )

B.2.3.8  String.prototype.fontsize ( 

size

 )

B.2.3.9  String.prototype.italics ( )

B.2.3.10  String.prototype.link ( 

url

 )

855

When the 

link

link

 method is called with argument 

url

, the following steps are taken:

1.  Let 

S

 be the 

this

 value.

2.  Return ? 

CreateHTML

(

S

"a"

"href"

url

).

When the 

small

small

 method is called with no arguments, the following steps are taken:

1.  Let 

S

 be the 

this

 value.

2.  Return ? 

CreateHTML

(

S

"small"

""

""

).

When the 

strike

strike

 method is called with no arguments, the following steps are taken:

1.  Let 

S

 be the 

this

 value.

2.  Return ? 

CreateHTML

(

S

"strike"

""

""

).

When the 

sub

sub

 method is called with no arguments, the following steps are taken:

1.  Let 

S

 be the 

this

 value.

2.  Return ? 

CreateHTML

(

S

"sub"

""

""

).

When the 

sup

sup

 method is called with no arguments, the following steps are taken:

1.  Let 

S

 be the 

this

 value.

2.  Return ? 

CreateHTML

(

S

"sup"

""

""

).

NOTE

The initial value of the 

"trimLeft"

 property is the same 

function object

 as the initial value of the

String.prototype.trimStart

String.prototype.trimStart

 property.

NOTE

The property 

"trimStart"

 is preferred. The 

"trimLeft"

 property is provided principally for

compatibility with old code. It is recommended that the 

"trimStart"

 property be used in new

ECMAScript code.

The property 

"trimEnd"

 is preferred. The 

"trimRight"

 property is provided principally for

compatibility with old code. It is recommended that the 

"trimEnd"

 property be used in new

ECMAScript code.

B.2.3.11  String.prototype.small ( )

B.2.3.12  String.prototype.strike ( )

B.2.3.13  String.prototype.sub ( )

B.2.3.14  String.prototype.sup ( )

B.2.3.15  String.prototype.trimLeft ( )

B.2.3.16  String.prototype.trimRight ( )

856

The initial value of the 

"trimRight"

 property is the same 

function object

 as the initial value of the

String.prototype.trimEnd

String.prototype.trimEnd

 property.

NOTE

When the 

getYear

getYear

 method is called with no arguments, the following steps are taken:

1.  Let 

t

 be ? 

thisTimeValue

(

this

 value).

2.  If 

t

 is 

NaN

, return 

NaN

.

3.  Return 

YearFromTime

(

LocalTime

(

t

)) - 

1900

𝔽

.

NOTE

When the 

setYear

setYear

 method is called with one argument 

year

, the following steps are taken:

1.  Let 

t

 be ? 

thisTimeValue

(

this

 value).

2.  If 

t

 is 

NaN

, set 

t

 to 

+0

𝔽

; otherwise, set 

t

 to 

LocalTime

(

t

).

3.  Let 

y

 be ? 

ToNumber

(

year

).

4.  If 

y

 is 

NaN

, then

a.  Set the [[DateValue]] internal slot of 

this Date object

 to 

NaN

.

b.  Return 

NaN

.

5.  Let 

yi

 be ! 

ToIntegerOrInfinity

(

y

).

6.  If 0 

 

yi

 

 99, let 

yyyy

 be 

1900

𝔽

(

yi

).

7.  Else, let 

yyyy

 be 

y

.

8.  Let 

d

 be 

MakeDay

(

yyyy

MonthFromTime

(

t

), 

DateFromTime

(

t

)).

9.  Let 

date

 be 

UTC

(

MakeDate

(

d

TimeWithinDay

(

t

))).

10.  Set the [[DateValue]] internal slot of 

this Date object

 to 

TimeClip

(

date

).

11.  Return the value of the [[DateValue]] internal slot of 

this Date object

.

NOTE

The 

function object

 that is the initial value of 

Date.prototype.toGMTString

Date.prototype.toGMTString

 is the same 

function object

 that

is the initial value of 

Date.prototype.toUTCString

Date.prototype.toUTCString

.

The 

getFullYear

getFullYear

 method is preferred for nearly all purposes, because it avoids the “year

2000 problem.”

The 

setFullYear

setFullYear

 method is preferred for nearly all purposes, because it avoids the “year

2000 problem.”

The 

toUTCString

toUTCString

 method is preferred. The 

toGMTString

toGMTString

 method is provided principally

for compatibility with old code.

B.2.4  Additional Properties of the Date.prototype Object

B.2.4.1  Date.prototype.getYear ( )

B.2.4.2  Date.prototype.setYear ( 

year

 )

B.2.4.3  Date.prototype.toGMTString ( )

857

 

 

 

 

 

 

 

Content      ..     37      38      39      40     ..