forked from tc39/ecma262
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normative: Make B.1.2 "String Literals" normative.
(Part of Annex B reform, see PR tc39#1595.) B.1.2 makes 2 changes to the EscapeSequence production: (1) It adds the rhs `NonOctalDecimalEscapeSequence`. (2) It replaces the rhs: `0` [lookahead <! DecimalDigit] with: LegacyOctalEscapeSequence where the latter nonterminal generates `0` among lots of other things. We want to continue to disallow such syntax in strict mode, but the mechanism to do so must change. Formerly, the spec would say that in such contexts, it's forbidden to extend the syntax in this way. But since (with this PR), this is no longer an extension, we instead use early error rules to say that in such contexts, occurrences of the 'new' parts of the syntax are Syntax Errors. For change 1, making it a Syntax Error is fairly straightforward. But for change 2, we can't simply say that LegacyOctalEscapeSequence 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, an instance of LegacyOctalEscapeSequence 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
Showing
1 changed file
with
106 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters