diff --git a/spec.html b/spec.html index a7eac67b82..c4b47bee53 100644 --- a/spec.html +++ b/spec.html @@ -12054,6 +12054,7 @@
The source
{ 1 2 } 3
is not a valid sentence in the ECMAScript grammar, even with the automatic semicolon insertion rules. In contrast, the source
@@ -12115,6 +12116,44 @@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.
ECMAScript programs can be written in a style with very few semicolons by relying on automatic semicolon insertion. As described above, semicolons are not inserted at every newline, and automatic semicolon insertion can depend on multiple tokens across line terminators.
+ +As new syntactic features are added to ECMAScript, additional grammar productions could be added that cause lines relying on automatic semicolon insertion preceding them to change grammar productions when parsed.
+ +The interesting cases of automatic semicolon insertion are places where a semicolon may or may not be inserted depending on preceding source text according to the rules above. These places are considered interesting if changes outside of an existing source text grammar production could change the grammar production of the existing source text depending on automatic semicolon insertion. The rest of this section describes a number of interesting cases of automatic semicolon insertion in this version of ECMAScript.
+In a |StatementList|, many |StatementListItem|s end in semicolons, which may be omitted using automatic semicolon insertion. As a consequence of the rules above, at the end of a line ending an expression, a semicolon is required if the following line begins with any of the following: +
(
). Without a semicolon, the two lines together are treated as a |CallExpression|.[
). Without a semicolon, the two lines together are treated as property access, rather than an |ArrayLiteral| or |ArrayAssignmentPattern|.`
). Without a semicolon, the two lines together are interpreted as a tagged Template (+
or -
. Without a semicolon, the two lines together are interpreted as a usage of the corresponding binary operator.ECMAScript contains grammar productions which include “[no |LineTerminator| here]”. These productions are sometimes a means to have optional operands in the grammar. Introducing a |LineTerminator| in these locations would change the grammar production of a source text by using the grammar production without the optional operand.
+ +The rest of this section describes a number of productions using “[no |LineTerminator| here]” in this version of ECMAScript.
+