Skip to content

Commit

Permalink
Normative: Make B.1.2 "String Literals" normative.
Browse files Browse the repository at this point in the history
(Part of Annex B reform, see PR #1595.)

This one was trickier than B.1.1

B.1.2's extension isn't simply to add a production to the grammar
(AKA add another right-hand-side to an existing production).
Instead it *replaces* a production/alternative with something more general.

So, when it comes to strict mode disallowing the general syntax,
we can't simply say that the general production
is a Syntax Error in strict mode,
because strict mode still has to allow the restricted syntax.

Instead, we say that if we're in strict mode code (or a TemplateLiteral),
an instance of the new production is a Syntax Error
*unless* it's an instance of the restricted syntax.
To express the latter condition,
we use the cover grammar machinery.
(It could be done in other ways, but I think this is clearest.)
  • Loading branch information
jmdyck committed Aug 4, 2019
1 parent ccecfaa commit 70bed41
Show file tree
Hide file tree
Showing 2 changed files with 253 additions and 206 deletions.
Loading

0 comments on commit 70bed41

Please sign in to comment.