diff --git a/rendered_spec.html b/rendered_spec.html index 1bc39b21484..1d18a443ffa 100644 --- a/rendered_spec.html +++ b/rendered_spec.html @@ -47,7 +47,7 @@
-

Draft ECMA-262 / August 02, 2019

+

Draft ECMA-262 / August 04, 2019

ECMAScript® 2020 Language Specification

@@ -442,7 +442,7 @@

5.1.1Context-Free Grammars

5.1.2The Lexical and RegExp Grammars

A lexical grammar for ECMAScript is given in clause 11. This grammar has as its terminal symbols Unicode code points that conform to the rules for SourceCharacter defined in 10.1. It defines a set of productions, starting from the goal symbol InputElementDiv, InputElementTemplateTail, or InputElementRegExp, or InputElementRegExpOrTemplateTail, that describe how sequences of such code points are translated into a sequence of input elements.

-

Input elements other than white space and comments form the terminal symbols for the syntactic grammar for ECMAScript and are called ECMAScript tokens. These tokens are the reserved words, identifiers, literals, and punctuators of the ECMAScript language. Moreover, line terminators, although not considered to be tokens, also become part of the stream of input elements and guide the process of automatic semicolon insertion (11.9). Simple white space and single-line comments are discarded and do not appear in the stream of input elements for the syntactic grammar. A MultiLineComment (that is, a comment of the form /**/ regardless of whether it spans more than one line) is likewise simply discarded if it contains no line terminator; but if a MultiLineComment contains one or more line terminators, then it is replaced by a single line terminator, which becomes part of the stream of input elements for the syntactic grammar.

+

Input elements other than white space and comments form the terminal symbols for the syntactic grammar for ECMAScript and are called ECMAScript tokens. These tokens are the reserved words, identifiers, literals, and punctuators of the ECMAScript language. Moreover, line terminators, although not considered to be tokens, also become part of the stream of input elements and guide the process of automatic semicolon insertion (11.9). Simple white space and single-line comments are discarded and do not appear in the stream of input elements for the syntactic grammar. A MultiLineComment (that is, a comment of the form /**/ that spans more than one line) is replaced by a single line terminator, which becomes part of the stream of input elements for the syntactic grammar.

A RegExp grammar for ECMAScript is given in 21.2.1. This grammar also has as its terminal symbols the code points as defined by SourceCharacter. It defines a set of productions, starting from the goal symbol Pattern, that describe how sequences of code points are translated into regular expression patterns.

Productions of the lexical and RegExp grammars are distinguished by having two colons “::” as separating punctuation. The lexical and RegExp grammars share some productions.

@@ -11557,7 +11557,7 @@

Syntax

11.3Line Terminators

Like white space code points, line terminator code points are used to improve source text readability and to separate tokens (indivisible lexical units) from each other. However, unlike white space code points, line terminators have some influence over the behaviour of the syntactic grammar. In general, line terminators may occur between any two tokens, but there are a few places where they are forbidden by the syntactic grammar. Line terminators also affect the process of automatic semicolon insertion (11.9). A line terminator cannot occur within any token except a StringLiteral, Template, or TemplateSubstitutionTail. <LF> and <CR> line terminators cannot occur within a StringLiteral token except as part of a LineContinuation.

-

A line terminator can occur within a MultiLineComment but cannot occur within a SingleLineComment.

+

A line terminator must occur within a MultiLineComment but cannot occur within a SingleLineDelimitedComment or a SingleLineComment.

Line terminators are included in the set of white space code points that are matched by the \s class in regular expressions.

The ECMAScript line terminator code points are listed in Table 33.

Table 33: Line Terminator Code Points
@@ -11657,14 +11657,20 @@

Syntax

11.4Comments

Comments can be either single or multi-line. Multi-line comments cannot nest.

Because a single-line comment can contain any Unicode code point except a LineTerminator code point, and because of the general rule that a token is always as long as possible, a single-line comment always consists of all code points from the // marker to the end of the line. However, the LineTerminator at the end of the line is not considered to be part of the single-line comment; it is recognized separately by the lexical grammar and becomes part of the stream of input elements for the syntactic grammar. This point is very important, because it implies that the presence or absence of single-line comments does not affect the process of automatic semicolon insertion (see 11.9).

-

Comments behave like white space and are discarded except that, if a MultiLineComment contains a line terminator code point, then the entire comment is considered to be a LineTerminator for purposes of parsing by the syntactic grammar.

+

Comments behave like white space and are discarded except that a MultiLineComment or a SingleLineHTMLCloseComment is considered to be a LineTerminator for purposes of parsing by the syntactic grammar.

Syntax

Comment::MultiLineComment SingleLineComment + SingleLineHTMLOpenComment + SingleLineHTMLCloseComment + SingleLineDelimitedComment - MultiLineComment::/*MultiLineCommentCharsopt*/ + MultiLineComment::/*FirstCommentLineoptLineTerminatorMultiLineCommentCharsopt*/HTMLCloseCommentopt + + + FirstCommentLine::SingleLineDelimitedCommentChars MultiLineCommentChars::MultiLineNotAsteriskCharMultiLineCommentCharsopt @@ -11683,12 +11689,57 @@

Syntax

SingleLineComment:://SingleLineCommentCharsopt + + SingleLineHTMLOpenComment::<!--SingleLineCommentCharsopt + + + SingleLineHTMLCloseComment::LineTerminatorSequenceHTMLCloseComment + + + HTMLCloseComment::WhiteSpaceSequenceoptSingleLineDelimitedCommentSequenceopt-->SingleLineCommentCharsopt + + + SingleLineDelimitedCommentSequence::SingleLineDelimitedCommentWhiteSpaceSequenceoptSingleLineDelimitedCommentSequenceopt + + + WhiteSpaceSequence::WhiteSpaceWhiteSpaceSequenceopt + SingleLineCommentChars::SingleLineCommentCharSingleLineCommentCharsopt SingleLineCommentChar::SourceCharacterbut not LineTerminator + + + SingleLineDelimitedComment::/*SingleLineDelimitedCommentCharsopt*/ + + + SingleLineDelimitedCommentChars::SingleLineNotAsteriskCharSingleLineDelimitedCommentCharsopt + *SingleLinePostAsteriskCommentCharsopt + + + SingleLineNotAsteriskChar::SourceCharacterbut not one of * or LineTerminator + + + SingleLinePostAsteriskCommentChars::SingleLineNotForwardSlashOrAsteriskCharSingleLineDelimitedCommentCharsopt + *SingleLinePostAsteriskCommentCharsopt + + + SingleLineNotForwardSlashOrAsteriskChar::SourceCharacterbut not one of / or * or LineTerminator
+ + +

11.4.1Static Semantics: Early Errors

+ + SingleLineHTMLOpenComment::<!--SingleLineCommentCharsopt + + + HTMLCloseComment::WhiteSpaceSequenceoptSingleLineDelimitedCommentSequenceopt-->SingleLineCommentCharsopt + +
    +
  • It is a Syntax Error if a Module contains the source code matching this production.
  • +
+
@@ -48265,9 +48316,15 @@

A.1Lexical Grammar

Comment::MultiLineComment SingleLineComment + SingleLineHTMLOpenComment + SingleLineHTMLCloseComment + SingleLineDelimitedComment - MultiLineComment::/*MultiLineCommentCharsopt*/ + MultiLineComment::/*FirstCommentLineoptLineTerminatorMultiLineCommentCharsopt*/HTMLCloseCommentopt + + + FirstCommentLine::SingleLineDelimitedCommentChars MultiLineCommentChars::MultiLineNotAsteriskCharMultiLineCommentCharsopt @@ -48285,12 +48342,44 @@

A.1Lexical Grammar

SingleLineComment:://SingleLineCommentCharsopt + + + SingleLineHTMLOpenComment::<!--SingleLineCommentCharsopt + + + SingleLineHTMLCloseComment::LineTerminatorSequenceHTMLCloseComment + + + HTMLCloseComment::WhiteSpaceSequenceoptSingleLineDelimitedCommentSequenceopt-->SingleLineCommentCharsopt + + + SingleLineDelimitedCommentSequence::SingleLineDelimitedCommentWhiteSpaceSequenceoptSingleLineDelimitedCommentSequenceopt + + + WhiteSpaceSequence::WhiteSpaceWhiteSpaceSequenceopt SingleLineCommentChars::SingleLineCommentCharSingleLineCommentCharsopt SingleLineCommentChar::SourceCharacterbut not LineTerminator + + + SingleLineDelimitedComment::/*SingleLineDelimitedCommentCharsopt*/ + + + SingleLineDelimitedCommentChars::SingleLineNotAsteriskCharSingleLineDelimitedCommentCharsopt + *SingleLinePostAsteriskCommentCharsopt + + + SingleLineNotAsteriskChar::SourceCharacterbut not one of * or LineTerminator + + + SingleLinePostAsteriskCommentChars::SingleLineNotForwardSlashOrAsteriskCharSingleLineDelimitedCommentCharsopt + *SingleLinePostAsteriskCommentCharsopt + + + SingleLineNotForwardSlashOrAsteriskChar::SourceCharacterbut not one of / or * or LineTerminator CommonToken::IdentifierName @@ -49723,54 +49812,7 @@

B.1.2String Literals

B.1.3HTML-like Comments

-

The syntax and semantics of 11.4 is extended as follows except that this extension is not allowed when parsing source code using the goal symbol Module:

-

Syntax

- - Comment::MultiLineComment - SingleLineComment - SingleLineHTMLOpenComment - SingleLineHTMLCloseComment - SingleLineDelimitedComment - - - MultiLineComment::/*FirstCommentLineoptLineTerminatorMultiLineCommentCharsopt*/HTMLCloseCommentopt - - - FirstCommentLine::SingleLineDelimitedCommentChars - - - SingleLineHTMLOpenComment::<!--SingleLineCommentCharsopt - - - SingleLineHTMLCloseComment::LineTerminatorSequenceHTMLCloseComment - - - SingleLineDelimitedComment::/*SingleLineDelimitedCommentCharsopt*/ - - - HTMLCloseComment::WhiteSpaceSequenceoptSingleLineDelimitedCommentSequenceopt-->SingleLineCommentCharsopt - - - SingleLineDelimitedCommentChars::SingleLineNotAsteriskCharSingleLineDelimitedCommentCharsopt - *SingleLinePostAsteriskCommentCharsopt - - - SingleLineNotAsteriskChar::SourceCharacterbut not one of * or LineTerminator - - - SingleLinePostAsteriskCommentChars::SingleLineNotForwardSlashOrAsteriskCharSingleLineDelimitedCommentCharsopt - *SingleLinePostAsteriskCommentCharsopt - - - SingleLineNotForwardSlashOrAsteriskChar::SourceCharacterbut not one of / or * or LineTerminator - - - WhiteSpaceSequence::WhiteSpaceWhiteSpaceSequenceopt - - - SingleLineDelimitedCommentSequence::SingleLineDelimitedCommentWhiteSpaceSequenceoptSingleLineDelimitedCommentSequenceopt - -

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 HTML-like comment syntax used to be normative optional outside Modules.

diff --git a/spec.html b/spec.html index e47582e665e..cf855056800 100644 --- a/spec.html +++ b/spec.html @@ -438,7 +438,7 @@

Context-Free Grammars

The Lexical and RegExp Grammars

A lexical grammar for ECMAScript is given in clause . This grammar has as its terminal symbols Unicode code points that conform to the rules for |SourceCharacter| defined in . It defines a set of productions, starting from the goal symbol |InputElementDiv|, |InputElementTemplateTail|, or |InputElementRegExp|, or |InputElementRegExpOrTemplateTail|, that describe how sequences of such code points are translated into a sequence of input elements.

-

Input elements other than white space and comments form the terminal symbols for the syntactic grammar for ECMAScript and are called ECMAScript tokens. These tokens are the reserved words, identifiers, literals, and punctuators of the ECMAScript language. Moreover, line terminators, although not considered to be tokens, also become part of the stream of input elements and guide the process of automatic semicolon insertion (). Simple white space and single-line comments are discarded and do not appear in the stream of input elements for the syntactic grammar. A |MultiLineComment| (that is, a comment of the form `/*`…`*/` regardless of whether it spans more than one line) is likewise simply discarded if it contains no line terminator; but if a |MultiLineComment| contains one or more line terminators, then it is replaced by a single line terminator, which becomes part of the stream of input elements for the syntactic grammar.

+

Input elements other than white space and comments form the terminal symbols for the syntactic grammar for ECMAScript and are called ECMAScript tokens. These tokens are the reserved words, identifiers, literals, and punctuators of the ECMAScript language. Moreover, line terminators, although not considered to be tokens, also become part of the stream of input elements and guide the process of automatic semicolon insertion (). Simple white space and single-line comments are discarded and do not appear in the stream of input elements for the syntactic grammar. A |MultiLineComment| (that is, a comment of the form `/*`…`*/` that spans more than one line) is replaced by a single line terminator, which becomes part of the stream of input elements for the syntactic grammar.

A RegExp grammar for ECMAScript is given in . This grammar also has as its terminal symbols the code points as defined by |SourceCharacter|. It defines a set of productions, starting from the goal symbol |Pattern|, that describe how sequences of code points are translated into regular expression patterns.

Productions of the lexical and RegExp grammars are distinguished by having two colons “::” as separating punctuation. The lexical and RegExp grammars share some productions.

@@ -9718,7 +9718,7 @@

Syntax

Line Terminators

Like white space code points, line terminator code points are used to improve source text readability and to separate tokens (indivisible lexical units) from each other. However, unlike white space code points, line terminators have some influence over the behaviour of the syntactic grammar. In general, line terminators may occur between any two tokens, but there are a few places where they are forbidden by the syntactic grammar. Line terminators also affect the process of automatic semicolon insertion (). A line terminator cannot occur within any token except a |StringLiteral|, |Template|, or |TemplateSubstitutionTail|. <LF> and <CR> line terminators cannot occur within a |StringLiteral| token except as part of a |LineContinuation|.

-

A line terminator can occur within a |MultiLineComment| but cannot occur within a |SingleLineComment|.

+

A line terminator must occur within a |MultiLineComment| but cannot occur within a |SingleLineDelimitedComment| or a |SingleLineComment|.

Line terminators are included in the set of white space code points that are matched by the `\\s` class in regular expressions.

The ECMAScript line terminator code points are listed in .

@@ -9804,15 +9804,21 @@

Syntax

Comments

Comments can be either single or multi-line. Multi-line comments cannot nest.

Because a single-line comment can contain any Unicode code point except a |LineTerminator| code point, and because of the general rule that a token is always as long as possible, a single-line comment always consists of all code points from the `//` marker to the end of the line. However, the |LineTerminator| at the end of the line is not considered to be part of the single-line comment; it is recognized separately by the lexical grammar and becomes part of the stream of input elements for the syntactic grammar. This point is very important, because it implies that the presence or absence of single-line comments does not affect the process of automatic semicolon insertion (see ).

-

Comments behave like white space and are discarded except that, if a |MultiLineComment| contains a line terminator code point, then the entire comment is considered to be a |LineTerminator| for purposes of parsing by the syntactic grammar.

+

Comments behave like white space and are discarded except that a |MultiLineComment| or a |SingleLineHTMLCloseComment| is considered to be a |LineTerminator| for purposes of parsing by the syntactic grammar.

Syntax

Comment :: MultiLineComment SingleLineComment + SingleLineHTMLOpenComment + SingleLineHTMLCloseComment + SingleLineDelimitedComment MultiLineComment :: - `/*` MultiLineCommentChars? `*/` + `/*` FirstCommentLine? LineTerminator MultiLineCommentChars? `*/` HTMLCloseComment? + + FirstCommentLine :: + SingleLineDelimitedCommentChars MultiLineCommentChars :: MultiLineNotAsteriskChar MultiLineCommentChars? @@ -9831,12 +9837,58 @@

Syntax

SingleLineComment :: `//` SingleLineCommentChars? + SingleLineHTMLOpenComment :: + `<!--` SingleLineCommentChars? + + SingleLineHTMLCloseComment :: + LineTerminatorSequence HTMLCloseComment + + HTMLCloseComment :: + WhiteSpaceSequence? SingleLineDelimitedCommentSequence? `-->` SingleLineCommentChars? + + SingleLineDelimitedCommentSequence :: + SingleLineDelimitedComment WhiteSpaceSequence? SingleLineDelimitedCommentSequence? + + WhiteSpaceSequence :: + WhiteSpace WhiteSpaceSequence? + SingleLineCommentChars :: SingleLineCommentChar SingleLineCommentChars? SingleLineCommentChar :: SourceCharacter but not LineTerminator + + SingleLineDelimitedComment :: + `/*` SingleLineDelimitedCommentChars? `*/` + + SingleLineDelimitedCommentChars :: + SingleLineNotAsteriskChar SingleLineDelimitedCommentChars? + `*` SingleLinePostAsteriskCommentChars? + + SingleLineNotAsteriskChar :: + SourceCharacter but not one of `*` or LineTerminator + + SingleLinePostAsteriskCommentChars :: + SingleLineNotForwardSlashOrAsteriskChar SingleLineDelimitedCommentChars? + `*` SingleLinePostAsteriskCommentChars? + + SingleLineNotForwardSlashOrAsteriskChar :: + SourceCharacter but not one of `/` or `*` or LineTerminator
+ + +

Static Semantics: Early Errors

+ + SingleLineHTMLOpenComment :: + `<!--` SingleLineCommentChars? + + HTMLCloseComment :: + WhiteSpaceSequence? SingleLineDelimitedCommentSequence? `-->` SingleLineCommentChars? + +
    +
  • It is a Syntax Error if a |Module| contains the source code matching this production.
  • +
+
@@ -39871,13 +39923,24 @@

Lexical Grammar

+ + + + + + + + + + + @@ -40274,55 +40337,7 @@

String Literals

HTML-like Comments

-

The syntax and semantics of is extended as follows except that this extension is not allowed when parsing source code using the goal symbol |Module|:

-

Syntax

- - Comment :: - MultiLineComment - SingleLineComment - SingleLineHTMLOpenComment - SingleLineHTMLCloseComment - SingleLineDelimitedComment - - MultiLineComment :: - `/*` FirstCommentLine? LineTerminator MultiLineCommentChars? `*/` HTMLCloseComment? - - FirstCommentLine :: - SingleLineDelimitedCommentChars - - SingleLineHTMLOpenComment :: - `<!--` SingleLineCommentChars? - - SingleLineHTMLCloseComment :: - LineTerminatorSequence HTMLCloseComment - - SingleLineDelimitedComment :: - `/*` SingleLineDelimitedCommentChars? `*/` - - HTMLCloseComment :: - WhiteSpaceSequence? SingleLineDelimitedCommentSequence? `-->` SingleLineCommentChars? - - SingleLineDelimitedCommentChars :: - SingleLineNotAsteriskChar SingleLineDelimitedCommentChars? - `*` SingleLinePostAsteriskCommentChars? - - SingleLineNotAsteriskChar :: - SourceCharacter but not one of `*` or LineTerminator - - SingleLinePostAsteriskCommentChars :: - SingleLineNotForwardSlashOrAsteriskChar SingleLineDelimitedCommentChars? - `*` SingleLinePostAsteriskCommentChars? - - SingleLineNotForwardSlashOrAsteriskChar :: - SourceCharacter but not one of `/` or `*` or LineTerminator - - WhiteSpaceSequence :: - WhiteSpace WhiteSpaceSequence? - - SingleLineDelimitedCommentSequence :: - SingleLineDelimitedComment WhiteSpaceSequence? SingleLineDelimitedCommentSequence? - -

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 HTML-like comment syntax used to be normative optional outside |Module|s.