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

 

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

 

Search            copyright infringement  

 

 

 

 

 

 

 

 

 

 

 

Content      ..     5      6      7      8     ..

 

 

 

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

 

 

QMark

QMark

Radical

Radical

Radical

Radical

Regional_Indicator

Regional_Indicator

Regional_Indicator

Regional_Indicator

RI

RI

Sentence_Terminal

Sentence_Terminal

Sentence_Terminal

Sentence_Terminal

STerm

STerm

Soft_Dotted

Soft_Dotted

Soft_Dotted

Soft_Dotted

SD

SD

Terminal_Punctuation

Terminal_Punctuation

Terminal_Punctuation

Terminal_Punctuation

Term

Term

Unified_Ideograph

Unified_Ideograph

Unified_Ideograph

Unified_Ideograph

UIdeo

UIdeo

Uppercase

Uppercase

Uppercase

Uppercase

Upper

Upper

Variation_Selector

Variation_Selector

Variation_Selector

Variation_Selector

VS

VS

White_Space

White_Space

White_Space

White_Space

space

space

XID_Continue

XID_Continue

XID_Continue

XID_Continue

XIDC

XIDC

XID_Start

XID_Start

XID_Start

XID_Start

XIDS

XIDS

The abstract operation UnicodeMatchPropertyValue takes arguments 

p

 (a 

List

 of Unicode code points) and 

v

 (a 

List

 of

Unicode code points). It performs the following steps when called:

1. 

Assert

p

 is a 

List

 of Unicode code points that is identical to a 

List

 of Unicode code points that is a canonical,

unaliased Unicode 

property name

 listed in the “Canonical 

property name

” column of 

Table 56

.

2. 

Assert

v

 is a 

List

 of Unicode code points that is identical to a 

List

 of Unicode code points that is a property

value or property value alias for Unicode property 

p

 listed in the “Property value and aliases” column of 

Table

58

 or 

Table 59

.

3.  Let 

value

 be the canonical property value of 

v

 as given in the “Canonical property value” column of the

corresponding row.

4.  Return the 

List

 of Unicode code points of 

value

.

Implementations must support the Unicode property value names and aliases listed in 

Table 58

 and 

Table 59

. To

ensure interoperability, implementations must not support any other property value names or aliases.

22.2.2.8.4  UnicodeMatchPropertyValue ( 

p

v

 )

600

NOTE 1

NOTE 2

Table 58: Value aliases and canonical values for the Unicode property 

General_Category

General_Category

Property value and aliases

Canonical property value

Cased_Letter

Cased_Letter

Cased_Letter

Cased_Letter

LC

LC

Close_Punctuation

Close_Punctuation

Close_Punctuation

Close_Punctuation

Pe

Pe

Connector_Punctuation

Connector_Punctuation

Connector_Punctuation

Connector_Punctuation

Pc

Pc

Control

Control

Control

Control

Cc

Cc

cntrl

cntrl

Currency_Symbol

Currency_Symbol

Currency_Symbol

Currency_Symbol

Sc

Sc

Dash_Punctuation

Dash_Punctuation

Dash_Punctuation

Dash_Punctuation

Pd

Pd

Decimal_Number

Decimal_Number

Decimal_Number

Decimal_Number

Nd

Nd

digit

digit

Enclosing_Mark

Enclosing_Mark

Enclosing_Mark

Enclosing_Mark

Me

Me

Final_Punctuation

Final_Punctuation

Final_Punctuation

Final_Punctuation

Pf

Pf

Format

Format

Format

Format

Cf

Cf

Initial_Punctuation

Initial_Punctuation

Initial_Punctuation

Initial_Punctuation

Pi

Pi

Letter

Letter

Letter

Letter

LL

Letter_Number

Letter_Number

Letter_Number

Letter_Number

Nl

Nl

For example, 

Xpeo

Xpeo

 and 

Old_Persian

Old_Persian

 are valid 

Script_Extensions

Script_Extensions

 values, but 

xpeo

xpeo

and 

Old Persian

Old Persian

 aren't.

This algorithm differs from 

the matching rules for symbolic values listed in UAX44

: case, 

white

space

, U+002D (HYPHEN-MINUS), and U+005F (LOW LINE) are not ignored, and the 

Is

Is

 prefix

is not supported.

601

Line_Separator

Line_Separator

Line_Separator

Line_Separator

Zl

Zl

Lowercase_Letter

Lowercase_Letter

Lowercase_Letter

Lowercase_Letter

Ll

Ll

Mark

Mark

Mark

Mark

MM

Combining_Mark

Combining_Mark

Math_Symbol

Math_Symbol

Math_Symbol

Math_Symbol

Sm

Sm

Modifier_Letter

Modifier_Letter

Modifier_Letter

Modifier_Letter

Lm

Lm

Modifier_Symbol

Modifier_Symbol

Modifier_Symbol

Modifier_Symbol

Sk

Sk

Nonspacing_Mark

Nonspacing_Mark

Nonspacing_Mark

Nonspacing_Mark

Mn

Mn

Number

Number

Number

Number

NN

Open_Punctuation

Open_Punctuation

Open_Punctuation

Open_Punctuation

Ps

Ps

Other

Other

Other

Other

CC

Other_Letter

Other_Letter

Other_Letter

Other_Letter

Lo

Lo

Other_Number

Other_Number

Other_Number

Other_Number

No

No

Other_Punctuation

Other_Punctuation

Other_Punctuation

Other_Punctuation

Po

Po

Other_Symbol

Other_Symbol

Other_Symbol

Other_Symbol

So

So

Paragraph_Separator

Paragraph_Separator

Paragraph_Separator

Paragraph_Separator

Zp

Zp

Private_Use

Private_Use

Private_Use

Private_Use

Co

Co

Punctuation

Punctuation

Punctuation

Punctuation

PP

punct

punct

602

unregistration of cleanup operations performed when target objects are garbage collected; separators for numeric
literals (

1_000

1_000

); and 

Array.prototype.sort

Array.prototype.sort

 was made stable.

Dozens of individuals representing many organizations have made very significant contributions within Ecma TC39
to the development of this edition and to the prior editions. In addition, a vibrant community has emerged supporting
TC39's ECMAScript efforts. This community has reviewed numerous drafts, filed thousands of bug reports,
performed implementation experiments, contributed test suites, and educated the world-wide developer community
about ECMAScript. Unfortunately, it is impossible to identify and acknowledge every person and organization who
has contributed to this effort.

Allen Wirfs-Brock

ECMA-262, Project Editor, 6

th

 Edition

Brian Terlson

ECMA-262, Project Editor, 7

th

 through 10

th

 Editions

Jordan Harband

ECMA-262, Project Editor, 10

th

 through 12

th

 Editions

This Standard defines the ECMAScript 2021 general-purpose programming language.

A conforming implementation of ECMAScript must provide and support all the types, values, objects, properties,
functions, and program syntax and semantics described in this specification.

A conforming implementation of ECMAScript must interpret source text input in conformance with the latest version
of the Unicode Standard and ISO/IEC 10646.

A conforming implementation of ECMAScript that provides an application programming interface (API) that
supports programs that need to adapt to the linguistic and cultural conventions used by different human languages
and countries must implement the interface defined by the most recent edition of ECMA-402 that is compatible with
this specification.

A conforming implementation of ECMAScript may provide additional types, values, objects, properties, and functions
beyond those described in this specification. In particular, a conforming implementation of ECMAScript may provide
properties not described in this specification, and values for those properties, for objects that are described in this
specification.

A conforming implementation of ECMAScript may support program and regular expression syntax not described in
this specification. In particular, a conforming implementation of ECMAScript may support program syntax that
makes use of any “future reserved words” noted in subclause 

12.6.2

 of this specification.

A conforming implementation of ECMAScript must not implement any extension that is listed as a Forbidden
Extension in subclause 

17.1

.

1  Scope

2  Conformance

46

A conforming implementation of ECMAScript must not redefine any facilities that are not 

implementation-defined

,

implementation-approximated

, or 

host-defined

.

A conforming implementation of ECMAScript may choose to implement or not implement 

Normative Optional

subclauses. If any Normative Optional behaviour is implemented, all of the behaviour in the containing Normative
Optional clause must be implemented. A Normative Optional clause is denoted in this specification with the words
"Normative Optional" in a coloured box, as shown below.

NORMATIVE OPTIONAL

Example clause contents.

The following referenced documents are indispensable for the application of this document. For dated references, only
the edition cited applies. For undated references, the latest edition of the referenced document (including any
amendments) applies.

ISO/IEC 10646 

Information Technology — Universal Multiple-Octet Coded Character Set (UCS) plus Amendment 1:2005,

Amendment 2:2006, Amendment 3:2008, and Amendment 4:2008

, plus additional amendments and corrigenda, or

successor

ECMA-402, 

ECMAScript 2015 Internationalization API Specification

https://ecma-international.org/publications/standards/Ecma-402.htm

ECMA-404, 

The JSON Data Interchange Format

https://ecma-international.org/publications/standards/Ecma-404.htm

This section contains a non-normative overview of the ECMAScript language.

ECMAScript is an object-oriented programming language for performing computations and manipulating
computational objects within a 

host environment

. ECMAScript as defined here is not intended to be computationally

self-sufficient; indeed, there are no provisions in this specification for input of external data or output of computed
results. Instead, it is expected that the computational environment of an ECMAScript program will provide not only
the objects and other facilities described in this specification but also certain environment-specific objects, whose
description and behaviour are beyond the scope of this specification except to indicate that they may provide certain
properties that can be accessed and certain functions that can be called from an ECMAScript program.

ECMAScript was originally designed to be used as a scripting language, but has become widely used as a general-
purpose programming language. A 

scripting language

 is a programming language that is used to manipulate,

customize, and automate the facilities of an existing system. In such systems, useful functionality is already available

2.1  Example Clause Heading

3  Normative References

4  Overview

47

through a user interface, and the scripting language is a mechanism for exposing that functionality to program
control. In this way, the existing system is said to provide a 

host environment

 of objects and facilities, which completes

the capabilities of the scripting language. A scripting language is intended for use by both professional and non-
professional programmers.

ECMAScript was originally designed to be a 

Web scripting language

, providing a mechanism to enliven Web pages in

browsers and to perform server computation as part of a Web-based client-server architecture. ECMAScript is now
used to provide core scripting capabilities for a variety of 

host

 environments. Therefore the core language is specified

in this document apart from any particular 

host environment

.

ECMAScript usage has moved beyond simple scripting and it is now used for the full spectrum of programming tasks
in many different environments and scales. As the usage of ECMAScript has expanded, so have the features and
facilities it provides. ECMAScript is now a fully featured general-purpose programming language.

A web browser provides an ECMAScript 

host environment

 for client-side computation including, for instance, objects

that represent windows, menus, pop-ups, dialog boxes, text areas, anchors, frames, history, cookies, and
input/output. Further, the 

host environment

 provides a means to attach scripting code to events such as change of

focus, page and image loading, unloading, error and abort, selection, form submission, and mouse actions. Scripting
code appears within the HTML and the displayed page is a combination of user interface elements and fixed and
computed text and images. The scripting code is reactive to user interaction, and there is no need for a main program.

A web server provides a different 

host environment

 for server-side computation including objects representing

requests, clients, and files; and mechanisms to lock and share data. By using browser-side and server-side scripting
together, it is possible to distribute computation between the client and server while providing a customized user
interface for a Web-based application.

Each Web browser and server that supports ECMAScript supplies its own 

host environment

, completing the

ECMAScript execution environment.

To aid integrating ECMAScript into 

host

 environments, this specification defers the definition of certain facilities (e.g.,

abstract operations

), either in whole or in part, to a source outside of this specification. Editorially, this specification

distinguishes the following kinds of deferrals.

An 

implementation

 is an external source that further defines facilities enumerated in Annex 

D

 or those that are marked

as 

implementation-defined

 or 

implementation-approximated

. In informal use, an implementation refers to a concrete

artefact, such as a particular web browser.

An 

implementation-defined

 facility is one that defers its definition to an external source without further qualification.

This specification does not make any recommendations for particular behaviours, and conforming implementations
are free to choose any behaviour within the constraints put forth by this specification.

An 

implementation-approximated

 facility is one that defers its definition to an external source while recommending an

ideal behaviour. While conforming implementations are free to choose any behaviour within the constraints put forth
by this specification, they are encouraged to strive to approximate the ideal. Some mathematical operations, such as

4.1  Web Scripting

4.2  Hosts and Implementations

48

Math.exp

Math.exp

, ar

implementation-approximated

.

host

 is an external source that further defines facilities listed in Annex 

D

 but does not further define other

implementation-defined

 or 

implementation-approximated

 facilities. In informal use, a 

host

 refers to the set of all

implementations, such as the set of all web browsers, that interface with this specification in the same way via Annex

D

. A 

host

 is often an external specification, such as WHATWG HTML (

https://html.spec.whatwg.org/

). In other

words, facilities that are 

host-defined

 are often further defined in external specifications.

host hook

 is an abstract operation that is defined in whole or in part by an external source. All 

host

 hooks must be

listed in Annex 

D

.

host-defined

 facility is one that defers its definition to an external source without further qualification and is listed in

Annex 

D

. Implementations that are not hosts may also provide definitions for 

host-defined

 facilities.

host environment

 is a particular choice of definition for all 

host-defined

 facilities. A 

host environment

 typically

includes objects or functions which allow obtaining input and providing output as 

host-defined

 properties of the

global object

.

This specification follows the editorial convention of always using the most specific term. For example, if a facility is

host-defined

, it should not be referred to as 

implementation-defined

.

Both hosts and implementations may interface with this specification via the language types, specification types,

abstract operations

, grammar productions, intrinsic objects, and intrinsic symbols defined herein.

The following is an informal overview of ECMAScript—not all parts of the language are described. This overview is
not part of the standard proper.

ECMAScript is object-based: basic language and 

host

 facilities are provided by objects, and an ECMAScript program

is a cluster of communicating objects. In ECMAScript, an 

object

 is a collection of zero or more 

properties

 each with

attributes

 that determine how each property can be used—for example, when the Writable attribute for a property is

set to 

false

, any attempt by executed ECMAScript code to assign a different value to the property fails. Properties are

containers that hold other objects, 

primitive values

, or 

functions

. A primitive value is a member of one of the following

built-in types: 

Undefined

Null

Boolean

Number

BigInt

String

, and 

Symbol;

 an object is a member of the built-in

type 

Object

; and a function is a callable object. A function that is associated with an object via a property is called a

method

.

ECMAScript defines a collection of 

built-in objects

 that round out the definition of ECMAScript entities. These built-in

objects include the 

global object

; objects that are fundamental to the 

runtime semantics

 of the language including

Object

Object

Function

Function

Boolean

Boolean

Symbol

Symbol

, and various 

Error

Error

 objects; objects that represent and manipulate

numeric values including 

Math

Math

Number

Number

, and 

Date

Date

; the text processing objects 

String

String

 and 

RegExp

RegExp

; objects that

are indexed collections of values including 

Array

Array

 and nine different kinds of Typed Arrays whose elements all have

a specific numeric data representation; keyed collections including 

Map

Map

 and 

Set

Set

 objects; objects supporting

structured data including the 

JSON

JSON

 object, 

ArrayBuffer

ArrayBuffer

SharedArrayBuffer

SharedArrayBuffer

, and 

DataView

DataView

; objects

supporting control abstractions including generator functions and 

Promise

Promise

 objects; and reflection objects including

Proxy

Proxy

 and 

Reflect

Reflect

.

ECMAScript also defines a set of built-in 

operators

. ECMAScript operators include various unary operations,

multiplicative operators, additive operators, bitwise shift operators, relational operators, equality operators, binary

4.3  ECMAScript Overview

49

 

 

 

 

 

 

 

Content      ..     5      6      7      8     ..