Skip to content

Commit

Permalink
Normative: Enable ASI when parsing from CreateDynamicFunction
Browse files Browse the repository at this point in the history
In addition to Script and Module, goal symbols for the grammar can also be FunctionBody, GeneratorBody, AsyncFunctionBody, and FormalParameters.
  • Loading branch information
anba authored and bterlson committed Feb 4, 2017
1 parent 88d8df7 commit a3b0507
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions spec.html
Expand Up @@ -10606,7 +10606,7 @@ <h1>Rules of Automatic Semicolon Insertion</h1>
<p>There are three basic rules of semicolon insertion:</p>
<ol>
<li>
<p>When, as a |Script| or |Module| is parsed from left to right, a token (called the <em>offending token</em>) is encountered that is not allowed by any production of the grammar, then a semicolon is automatically inserted before the offending token if one or more of the following conditions is true:</p>
<p>When, as the source text is parsed from left to right, a token (called the <em>offending token</em>) is encountered that is not allowed by any production of the grammar, then a semicolon is automatically inserted before the offending token if one or more of the following conditions is true:</p>
<ul>
<li>
The offending token is separated from the previous token by at least one |LineTerminator|.
Expand All @@ -10620,10 +10620,10 @@ <h1>Rules of Automatic Semicolon Insertion</h1>
</ul>
</li>
<li>
When, as the |Script| or |Module| is parsed from left to right, the end of the input stream of tokens is encountered and the parser is unable to parse the input token stream as a single complete ECMAScript |Script| or |Module|, then a semicolon is automatically inserted at the end of the input stream.
When, as the source text is parsed from left to right, the end of the input stream of tokens is encountered and the parser is unable to parse the input token stream as a single instance of the goal nonterminal, then a semicolon is automatically inserted at the end of the input stream.
</li>
<li>
When, as the |Script| or |Module| is parsed from left to right, a token is encountered that is allowed by some production of the grammar, but the production is a <em>restricted production</em> and the token would be the first token for a terminal or nonterminal immediately following the annotation &ldquo;[no |LineTerminator| here]&rdquo; within the restricted production (and therefore such a token is called a restricted token), and the restricted token is separated from the previous token by at least one |LineTerminator|, then a semicolon is automatically inserted before the restricted token.
When, as the source text is parsed from left to right, a token is encountered that is allowed by some production of the grammar, but the production is a <em>restricted production</em> and the token would be the first token for a terminal or nonterminal immediately following the annotation &ldquo;[no |LineTerminator| here]&rdquo; within the restricted production (and therefore such a token is called a restricted token), and the restricted token is separated from the previous token by at least one |LineTerminator|, then a semicolon is automatically inserted before the restricted token.
</li>
</ol>
<p>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 <emu-xref href="#sec-for-statement"></emu-xref>).</p>
Expand Down

0 comments on commit a3b0507

Please sign in to comment.