Ecma-355 pdf




















All external surfaces are perpendicular to each other. Group "C": Non-rectangular cardboard boxes. At least one of the outer faces of the main body is not rectangular. The height, or the vertical face, does not necessarily have to be perpendicular to the base. Group "D": Rectangular box without a longitudinal glue seam. At least one of the outer edges of the package the lateral surface or base does not necessarily have to be perpendicular to the base.

Group "E": Packaging that is in direct contact with the product or intended for group packaging. Group "F": Other folding boxes. This category consists of all models not clearly falling into one of the previous categories "A—E". Classification of group "F": 10 — Special model similar to group "A". Group "X": Auxiliary devices for all groups. Code structure The model code always starts with a capital letter indicating which group it belongs to.

The table provides an overview of the values that form the model code. GROUP 1st group 2 digits 2nd group 2 digits 3rd group 2 digits 4th group 2 digits Code "X" not necessary A Bottom closure system Top closure system Location of the bottom closure system.

User area. We like boxes! A UnicodeEscapeSequence cannot be used to put a character into an IdentifierName that would otherwise be illegal. All interpretations of identifiers within this specification are based upon their actual characters regardless of whether or not an escape sequence was used to contribute any particular characters. Two IdentifierName that are canonically equivalent according to the Unicode standard are not equal unless they are represented by the exact same sequence of code units in other words, conforming ECMAScript implementations are only required to do bitwise comparison on IdentifierName values.

The intent is that the incoming source text has been converted to normalised form C before it reaches the compiler. If portability is a concern, programmers should only employ identifier characters defined in Unicode 3. The definitions of the nonterminal UnicodeEscapeSequence is given in 7. A reserved word is an IdentifierName that cannot be used as an Identifier. The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions.

The following tokens are also considered to be FutureReservedWords when they occur within strict mode code see The occurrence of any of these tokens within strict mode code in any context where the occurrence of a FutureReservedWord would produce an error must also produce an equivalent error:.

The value of the null literal null is the sole value of the Null type, namely null. The value of the Boolean literal true is a value of the Boolean type, namely true. The value of the Boolean literal false is a value of the Boolean type, namely false. A numeric literal stands for a value of the Number type. This value is determined in two steps: first, a mathematical value MV is derived from the literal; second, this mathematical value is rounded as described below.

The MV of DecimalLiteral Once the exact MV for a numeric literal has been determined, it is then rounded to a value of the Number type. A digit is significant if it is not part of an ExponentPart and. A conforming implementation, when processing strict mode code see A string literal is zero or more characters enclosed in single or double quotes. Each character may be represented by an escape sequence. All characters may appear literally in a string literal except for the closing quote character, backslash, carriage return, line separator, paragraph separator, and line feed.

Any character may appear in the form of an escape sequence. The definition of the nonterminal HexDigit is given in 7. SourceCharacter is defined in clause 6. A string literal stands for a value of the String type. The String value SV of the literal is described in terms of character values CV contributed by the various parts of the string literal.

As part of this process, some characters within the string literal are interpreted as having a mathematical value MV , as described below or in 7. The SV of StringLiteral :: "" is the empty character sequence. The SV of StringLiteral :: '' is the empty character sequence. NOTE A line terminator character cannot appear in a string literal, except as part of a LineContinuation to produce the empty character sequence. A regular expression literal is an input element that is converted to a RegExp object see A RegExp object may also be created at runtime by new RegExp see The productions below describe the syntax for a regular expression literal and are used by the input element scanner to find the end of the regular expression literal.

The Strings of characters comprising the RegularExpressionBody and the RegularExpressionFlags are passed uninterpreted to the regular expression constructor, which interprets them according to its own, more stringent grammar.

An implementation may extend the regular expression constructor's grammar, but it must not extend the RegularExpressionBody and RegularExpressionFlags productions or the productions used by these productions. A regular expression literal evaluates to a value of the Object type that is an instance of the standard built-in constructor RegExp. This value is determined in two steps: first, the characters comprising the regular expression's RegularExpressionBody and RegularExpressionFlags production expansions are collected uninterpreted into two Strings Pattern and Flags, respectively.

Then each time the literal is evaluated, a new object is created as if by the expression new RegExp Pattern, Flags where RegExp is the standard built-in constructor with that name. The newly constructed object becomes the value of the RegularExpressionLiteral.

If the call to new RegExp would generate an error as specified in Certain ECMAScript statements empty statement, variable statement, expression statement, do - while statement, continue statement, break statement, return statement, and throw statement must be terminated with semicolons. Such semicolons may always appear explicitly in the source text.

For convenience, however, such semicolons may be omitted from the source text in certain situations. These situations are described by saying that semicolons are automatically inserted into the source code token stream in those situations.

However, there is an additional overriding condition on the preceding rules: a semicolon is never inserted automatically if the semicolon would then be parsed as an empty statement or if that semicolon would become one of the two semicolons in the header of a for statement see When a continue , break , return , or throw token is encountered and a LineTerminator is encountered before the next token, a semicolon is automatically inserted after the continue , break , return , or throw token.

An Expression in a return or throw statement should start on the same line as the return or throw token. An Identifier in a break or continue statement should be on the same line as the break or continue token. In contrast, the source. Automatic semicolon insertion never inserts one of the two semicolons in the header of a for statement. In the circumstance that an assignment statement must begin with a left parenthesis, it is a good idea for the programmer to provide an explicit semicolon at the end of the preceding statement rather than to rely on automatic semicolon insertion.

Algorithms within this specification manipulate values each of which has an associated type. The possible value types are exactly those defined in this clause. Specification type values are specification artefacts that do not necessarily correspond to any specific entity within an ECMAScript implementation.

Specification type values may be used to describe intermediate results of ECMAScript expression evaluation but such values cannot be stored as properties of objects or values of ECMAScript language variables.

The Undefined type has exactly one value, called undefined. Any variable that has not been assigned a value has the value undefined. The Boolean type represents a logical entity having two values, called true and false. The String type is generally used to represent textual data in a running ECMAScript program, in which case each element in the String is treated as a code unit value see Clause 6.

Each element is regarded as occupying a position within the sequence. These positions are indexed with nonnegative integers. The first element if any is at position 0, the next element if any at position 1, and so on. The length of a String is the number of elements i. The empty String has length zero and therefore contains no elements.

When a String contains actual textual data, each element is considered to be a single UTF code unit. Whether or not this is the actual storage format of a String, the characters within a String are numbered by their initial code unit element position as though they were represented using UTF All operations on Strings except as otherwise stated treat them as sequences of undifferentiated bit unsigned integers; they do not ensure the resulting String is in normalised form, nor do they ensure language-sensitive results.

NOTE The rationale behind this design was to keep the implementation of Strings as simple and high-performing as possible. The intent is that textual data coming into the execution environment from outside e. Usually this would occur at the same time incoming text is converted from its original character encoding to Unicode and would impose no additional overhead. Since it is recommended that ECMAScript source code be in Normalised Form C, string literals are guaranteed to be normalised if source text is guaranteed to be normalised , as long as they do not contain any Unicode escape sequences.

Note that the NaN value is produced by the program expression NaN. In some implementations, external code might be able to detect a difference between various Not-a-Number values, but such behaviour is implementation-dependent; to ECMAScript code, all NaN values are indistinguishable from each other.

There are two other special values, called positive Infinity and negative Infinity. Half of these are positive numbers and half are negative numbers; for every finite positive Number value there is a corresponding negative value having the same magnitude.

Note that there is both a positive zero and a negative zero. A finite number has an odd significand if it is nonzero and the integer m used to express it in one of the two forms shown above is odd. Otherwise, it has an even significand. Choose the member of this set that is closest in value to x. The result is the Number value for x.

These operators accept any value of the Number type but first convert each such value to one of 2 32 integer values. See the descriptions of the ToInt32 and ToUint32 operators in 9. An Object is a collection of properties. Each property is either a named data property, a named accessor property, or an internal property:. A named accessor property associates a name with one or two accessor functions, and a set of Boolean attributes. The accessor functions are used to store or retrieve an ECMAScript language value that is associated with the property.

Internal properties exist purely for specification purposes. There are two kinds of access for named non-internal properties: get and put , corresponding to retrieval and assignment, respectively. Attributes are used in this specification to define and explain the state of named properties.

A named data property associates a name with the attributes listed in Table 5. If the value of an attribute is not explicitly specified by this specification for a named property, the default value defined in Table 7 is used. This specification uses various internal properties to define the semantics of object values.

They are defined by this specification purely for expository purposes. An implementation of ECMAScript must behave as if it produced and operated upon internal properties in the manner described here.

The names of internal properties are enclosed in double square brackets [[ ]]. When an algorithm uses an internal property of an object and the object does not implement the indicated internal property, a TypeError exception is thrown. The Table 8 summarises the internal properties used by this specification that are applicable to all ECMAScript objects.

The Table 9 summarises the internal properties used by this specification that are only applicable to some ECMAScript objects. Host objects may support these internal properties with any implementation-dependent behaviour as long as it is consistent with the specific host object restrictions stated in this document. The type names refer to the types defined in Clause 8 augmented by the following additional names.

If a parameter name is the same as a type name then the name describes the type of the parameter. Every object including host objects must implement all of the internal properties listed in Table 8.

However, the [[DefaultValue]] internal method may, for some objects, simply throw a TypeError exception. All objects have an internal property called [[Prototype]].

The value of this property is either null or an object and is used for implementing inheritance. Whether or not a native object can have a host object as its [[Prototype]] depends on the implementation.

Every [[Prototype]] chain must have finite length that is, starting from any object, recursively accessing the [[Prototype]] internal property must eventually lead to a null value. Named data properties of the [[Prototype]] object are inherited are visible as properties of the child object for the purposes of get access, but not for put access. Named accessor properties are inherited for both get access and put access.

Every ECMAScript object has a Boolean-valued [[Extensible]] internal property that controls whether or not named properties may be added to the object. If the value of the [[Extensible]] internal property is false then additional named properties may not be added to the object.

In addition, if [[Extensible]] is false the value of the [[Class]] and [[Prototype]] internal properties of the object may not be modified. Once the value of an [[Extensible]] internal property has been set to false it may not be subsequently changed to true.

Implementation specific extensions that modify [[Class]], [[Prototype]] or [[Extensible]] must not violate the invariants defined in the preceding paragraph. The value of the [[Class]] internal property is defined by this specification for every kind of built-in object. The value of a [[Class]] internal property is used internally to distinguish different kinds of objects. Note that this specification does not provide any means for a program to access that value except through Object.

Unless otherwise specified, the common internal methods of native ECMAScript objects behave as described in 8. Array objects have a slightly different implementation of the [[DefineOwnProperty]] internal method see Arguments objects Function objects Host objects may implement these internal methods in any manner unless specified otherwise; for example, one possibility is that [[Get]] and [[Put]] for a particular host object indeed fetch and store property values but [[HasProperty]] always generates false.

However, if any specified manipulation of a host object's internal properties is not supported by an implementation, that manipulation must throw a TypeError exception when attempted. The [[GetOwnProperty]] internal method of a host object must conform to the following invariants for each property of the host object:.

If a property is described as a data property and it may return different values over time, then either or both of the [[Writable]] and [[Configurable]] attributes must be true even if no mechanism to change the value is exposed via the other internal methods. If a property is described as a data property and its [[Writable]] and [[Configurable]] are both false , then the SameValue according to 9. If the attributes other than [[Writable]] may change over time or if the property might disappear, then the [[Configurable]] attribute must be true.

If the [[Writable]] attribute may change from false to true , then the [[Configurable]] attribute must be true. The [[DefineOwnProperty]] internal method of a host object must not permit the addition of a new property to a host object if the [[Extensible]] internal property of that host object has been observed by ECMAScript code to be false.

If the [[Extensible]] internal property of that host object has been observed by ECMAScript code to be false then it must not subsequently become true.

The Reference type is used to explain the behaviour of such operators as delete , typeof , and the assignment operators. For example, the left-hand operand of an assignment is expected to produce a reference. The behaviour of assignment could, instead, be explained entirely in terms of a case analysis on the syntactic form of the left-hand operand of an assignment operator, but for one difficulty: function calls are permitted to return references.

This possibility is admitted purely for the sake of host objects. No built-in ECMAScript function defined by this specification returns a reference and there is no provision for a user-defined function to return a reference. Another reason not to use a syntactic case analysis is that it would be lengthy and awkward, affecting many parts of the specification.

A Reference is a resolved name binding. A Reference consists of three components, the base value, the referenced name and the Boolean valued strict reference flag. The base value is either undefined , an Object, a Boolean, a String, a Number, or an environment record A base value of undefined indicates that the reference could not be resolved to a binding.

The referenced name is a String. The following abstract operations are used in this specification to access the components of references:. IsPropertyReference V. Returns true if either the base value is an object or HasPrimitiveBase V is true ; otherwise returns false.

IsUnresolvableReference V. Returns true if the base value is undefined and false otherwise. The following [[Get]] internal method is used by GetValue when V is a property reference with a primitive base value.

It is called using base as its this value and with property P as its argument. The following steps are taken:. NOTE The object that may be created in step 1 is not accessible outside of the above method.

An implementation might choose to avoid the actual creation of the object. The only situation where such an actual property access that uses this internal method can have visible effect is when it invokes an accessor function. The following [[Put]] internal method is used by PutValue when V is a property reference with a primitive base value. It is called using base as its this value and with property P , value W , and Boolean flag Throw as arguments.

An implementation might choose to avoid the actual creation of that transient object. The only situations where such an actual property assignment that uses this internal method can have visible effect are when it either invokes an accessor function or is in violation of a Throw predicated error check. When Throw is true any property assignment that would create a new property on the transient object throws an error. The List type is used to explain the evaluation of argument lists see Values of the List type are simply ordered sequences of values.

These sequences may be of any length. The Completion type is used to explain the behaviour of statements break , continue , return and throw that perform nonlocal transfers of control.

Values of the Completion type are triples of the form type , value , target , where type is one of normal , break , continue , return , or throw , value is any ECMAScript language value or empty , and target is any ECMAScript identifier or empty. If cv is a completion value then cv.

The Property Descriptor type is used to explain the manipulation and reification of named property attributes. In addition, any field may be present or absent. Property Descriptor values may be further classified as data property descriptors and accessor property descriptors based upon the existence or use of certain fields.

A data property descriptor is one that includes any fields named either [[Value]] or [[Writable]]. An accessor property descriptor is one that includes any fields named either [[Get]] or [[Set]].

Any property descriptor may have fields named [[Enumerable]] and [[Configurable]]. A Property Descriptor value may not be both a data property descriptor and an accessor property descriptor; however, it may be neither.

A generic property descriptor is a Property Descriptor value that is neither a data property descriptor nor an accessor property descriptor. A fully populated property descriptor is one that is either an accessor property descriptor or a data property descriptor and that has all of the fields that correspond to the property attributes defined in either 8.

For notational convenience within this specification, an object literal-like syntax can be used to define a property descriptor value. Field name order is not significant. Any fields that are not explicitly listed are considered to be absent. In specification text and algorithms, dot notation may be used to refer to a specific field of a Property Descriptor.

For example, if D is a property descriptor then D. The Property Identifier type is used to associate a property name with a Property Descriptor. Values of the Property Identifier type are pairs of the form name, descriptor , where name is a String and descriptor is a Property Descriptor value.

The following abstract operations are used in this specification to operate upon Property Descriptor values:. When the abstract operation IsAccessorDescriptor is called with property descriptor Desc , the following steps are taken:. When the abstract operation IsDataDescriptor is called with property descriptor Desc , the following steps are taken:.

When the abstract operation IsGenericDescriptor is called with property descriptor Desc , the following steps are taken:. When the abstract operation FromPropertyDescriptor is called with property descriptor Desc , the following steps are taken:.

The following algorithm assumes that Desc is a fully populated Property Descriptor , such as that returned from [[GetOwnProperty]] see 8. When the abstract operation ToPropertyDescriptor is called with object Obj , the following steps are taken:. The Lexical Environment and Environment Record types are used to explain the behaviour of name resolution in nested functions and blocks.

These types and the operations upon them are defined in Clause When the [[GetOwnProperty]] internal method of O is called with property name P , the following steps are taken:. However, if O is a String object it has a more elaborate [[GetOwnProperty]] internal method defined in When the [[GetProperty]] internal method of O is called with property name P , the following steps are taken:.

When the [[Get]] internal method of O is called with property name P , the following steps are taken:. When the [[CanPut]] internal method of O is called with property name P , the following steps are taken:. Host objects may define additional constraints upon [[Put]] operations. If possible, host objects should not allow [[Put]] operations in situations where this definition of [[CanPut]] returns false.

When the [[Put]] internal method of O is called with property P , value V , and Boolean flag Throw , the following steps are taken:. When the [[HasProperty]] internal method of O is called with property name P , the following steps are taken:. When the [[Delete]] internal method of O is called with property name P and the Boolean flag Throw , the following steps are taken:.

When the [[DefaultValue]] internal method of O is called with hint String, the following steps are taken:. When the [[DefaultValue]] internal method of O is called with hint Number, the following steps are taken:. When the [[DefaultValue]] internal method of O is called with no hint, then it behaves as if the hint were Number, unless O is a Date object see The above specification of [[DefaultValue]] for native objects can return only primitive values.

If a host object implements its own [[DefaultValue]] internal method, it must ensure that its [[DefaultValue]] internal method can return only primitive values.

The algorithm contains steps that test various fields of the Property Descriptor Desc for specific values. The fields that are tested in this manner need not actually exist in Desc. If a field is absent then its value is considered to be false. When the [[DefineOwnProperty]] internal method of O is called with property name P , property descriptor Desc , and Boolean flag Throw , the following steps are taken:.

However, if O is an Array object, it has a more elaborate [[DefineOwnProperty]] internal method defined in NOTE Step This even permits changing the [[Value]] of a property whose [[Writable]] attribute is false. This is allowed because a true [[Configurable]] attribute would permit an equivalent sequence of calls where [[Writable]] is first set to true , a new [[Value]] is set, and then [[Writable]] is set to false.

To clarify the semantics of certain constructs it is useful to define a set of conversion abstract operations. These abstract operations are not a part of the language; they are defined here to aid the specification of the semantics of the language.

The conversion abstract operations are polymorphic; that is, they can accept a value of any ECMAScript language type, but not of specification types. The abstract operation ToPrimitive takes an input argument and an optional argument PreferredType. The abstract operation ToPrimitive converts its input argument to a non-Object type.

If an object is capable of converting to more than one primitive type, it may use the optional hint PreferredType to favour that type. Conversion occurs according to Table The abstract operation ToBoolean converts its argument to a value of type Boolean according to Table The abstract operation ToNumber converts its argument to a value of type Number according to Table ToNumber applied to Strings applies the following grammar to the input String.

Some differences should be noted between the syntax of a StringNumericLiteral and a NumericLiteral see 7. A StringNumericLiteral that is decimal may have any number of leading 0 digits. The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal see 7.

This value is determined in two steps: first, a mathematical value MV is derived from the String numeric literal; second, this mathematical value is rounded as described below. Once the exact MV for a String numeric literal has been determined, it is then rounded to a value of the Number type.

Otherwise, the rounded value must be the Number value for the MV in the sense defined in 8. The abstract operation ToInteger converts its argument to an integral numeric value. This abstract operation functions as follows:. The ToInt32 abstract operation is idempotent: if applied to a result that it produced, the second application leaves that value unchanged.

This abstraction operation functions as follows:. The ToUint32 abstract operation is idempotent: if applied to a result that it produced, the second application leaves that value unchanged. The abstract operation ToString converts its argument to a value of type String according to Table If the argument is false , then the result is "false".

The abstract operation ToString converts a Number m to String format as follows:. NOTE 1 The following observations may be useful as guidelines for implementations, but are not part of the normative requirements of this Standard:. The least significant digit of s is not always uniquely determined by the requirements listed in step 5.

NOTE 2 For implementations that provide more accurate conversions than required by the rules above, it is recommended that the following alternative version of step 5 be used as a guideline:. If there are two such possible values of s , choose the one that is even. Note that k is the number of digits in the decimal representation of s and that s is not divisible by Gay for binary-to-decimal conversion of floating-point numbers:.

Gay, David M. Numerical Analysis, Manuscript November 30, The abstract operation ToObject converts its argument to a value of type Object according to Table The abstract operation CheckObjectCoercible throws an error if its argument is a value that cannot be converted to an Object using ToObject. It is defined by Table Such a comparison is performed as follows:. The global code of a particular Program does not include any source text that is parsed as part of a FunctionBody.

Eval code is the source text supplied to the built-in eval function. The eval code for a particular invocation of eval is the global code portion of that Program. Function code is source text that is parsed as part of a FunctionBody.

The function code of a particular FunctionBody does not include any source text that is parsed as part of a nested FunctionBody. Function code also denotes the source text supplied when using the built-in Function object as a constructor. More precisely, the last parameter provided to the Function constructor is converted to a String and treated as the FunctionBody.

If more than one parameter is provided to the Function constructor, all parameters except the last one are converted to Strings and concatenated together, separated by commas. The function code for a particular instantiation of a Function does not include any source text that is parsed as part of a nested FunctionBody.

When processed using strict mode the three types of ECMAScript code are referred to as strict global code, strict eval code, and strict function code. Code is interpreted as strict mode code in the following situations:.

Global code is strict global code if it begins with a Directive Prologue that contains a Use Strict Directive see Eval code is strict eval code if it begins with a Directive Prologue that contains a Use Strict Directive or if the call to eval is a direct call see Function code that is part of a FunctionDeclaration , FunctionExpression , or accessor PropertyAssignment is strict function code if its FunctionDeclaration , FunctionExpression , or PropertyAssignment is contained in strict mode code or if the function code begins with a Directive Prologue that contains a Use Strict Directive.

Function code that is supplied as the last argument to the built-in Function constructor is strict function code if the last argument is a String that when processed as a FunctionBody begins with a Directive Prologue that contains a Use Strict Directive. A Lexical Environment is a specification type used to define the association of Identifiers to specific variables and functions based upon the lexical nesting structure of ECMAScript code.

A Lexical Environment consists of an Environment Record and a possibly null reference to an outer Lexical Environment. An Environment Record records the identifier bindings that are created within the scope of its associated Lexical Environment. The outer environment reference is used to model the logical nesting of Lexical Environment values. The outer reference of a inner Lexical Environment is a reference to the Lexical Environment that logically surrounds the inner Lexical Environment.

An outer Lexical Environment may, of course, have its own outer Lexical Environment. A Lexical Environment may serve as the outer environment for multiple inner Lexical Environments. For example, if a FunctionDeclaration contains two nested FunctionDeclarations then the Lexical Environments of each of the nested functions will have as their outer Lexical Environment the Lexical Environment of the current execution of the surrounding function.

Lexical Environments and Environment Record values are purely specification mechanisms and need not correspond to any specific artefact of an ECMAScript implementation. There are two kinds of Environment Record values used in this specification: declarative environment records and object environment records. Object environment records are used to define the effect of ECMAScript elements such as Program and WithStatement that associate identifier bindings with the properties of some object.

For specification purposes Environment Record values can be thought of as existing in a simple object-oriented hierarchy where Environment Record is an abstract class with two concrete subclasses, declarative environment record and object environment record. The abstract class includes the abstract specification methods defined in Table These abstract methods have distinct concrete algorithms for each of the concrete subclasses. A declarative environment record binds the set of identifiers defined by the declarations contained within its scope.

This Standard consists of the following parts:. Category Software engineering and interfaces. Technical Committee TC



0コメント

  • 1000 / 1000