The below excerpts refer to ECMAScript 2017.
11.8.4 String Literals, Note 1
A string literal is zero or more Unicode code points enclosed in single or double quotes. Unicode code points may also be represented by an escape sequence. .... Any code points may appear in the form of an escape sequence.
11.8.4 String Literals, Syntax
Nonterminal symbol EscapeSequence has the following lexical grammar production:
EscapeSequence :: CharacterEscapeSequence 0 [lookahead ∉ DecimalDigit] HexEscapeSequence UnicodeEscapeSequence Nonterminal symbol CharacterEscapeSequence has the following lexical grammar production:
CharacterEscapeSequence :: SingleEscapeCharacter NonEscapeCharacter 11.8.4.3 Static Semantics: SV
Contains descriptions such as:
The SV of DoubleStringCharacter :: \ EscapeSequence is the SV of the EscapeSequence
Questions
- What is meant by
escape sequencein Note 1? Trying to understand what an escape sequence actually does, rather than just the lexical grammar for it - Why does
CharacterEscapeSequenceincludeNonEscapeCharacter? - The descriptions in 11.8.4.3 Static Semantics: SV do not seem to follow the normal ECMAScript convention for lexical grammar productions. What is meant by those descriptions?
- Added question: Does Note 1 state that code points can be within quotes or alternatively after an escape sequence (such as backslash)? Is that what is meant by
Any code points may appear in the form of an escape sequence?