tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

line-continuation-double.js (1480B)


      1 // Copyright (C) 2018 Richard Gibson. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-literals-string-literals
      6 description: >
      7  Line terminators may occur within string literals as part of a |LineContinuation|
      8  to produce the empty code points sequence.
      9 info: |
     10  11.8.4 String Literals
     11 
     12  StringLiteral ::
     13    `"` DoubleStringCharacters? `"`
     14    `'` SingleStringCharacters? `'`
     15 
     16  DoubleStringCharacters ::
     17    DoubleStringCharacter DoubleStringCharacters?
     18 
     19  DoubleStringCharacter ::
     20    SourceCharacter but not one of `"` or `\` or LineTerminator
     21    <LS>
     22    <PS>
     23    `\` EscapeSequence
     24    LineContinuation
     25 
     26  LineContinuation ::
     27    `\` LineTerminatorSequence
     28 
     29  11.3 Line Terminators
     30 
     31  LineTerminatorSequence ::
     32    <LF>
     33    <CR> [lookahead != <LF>]
     34    <LS>
     35    <PS>
     36    <CR> <LF>
     37 
     38  11.8.4.2 Static Semantics: SV
     39 
     40  The SV of DoubleStringCharacter :: LineContinuation is the empty code unit sequence.
     41 ---*/
     42 
     43 // LineTerminatorSequence :: <LF>
     44 assert.sameValue("\
     45 ", "");
     46 
     47 // LineTerminatorSequence :: <CR> [lookahead ≠ <LF>]
     48 assert.sameValue("\", "");
     49 
     50 // LineTerminatorSequence :: <LS>
     51 // <LS> is U+2028 LINE SEPARATOR; UTF8(0x2028) = 0xE2 0x80 0xA8
     52 assert.sameValue("\", "");
     53 
     54 // LineTerminatorSequence :: <PS>
     55 // <PS> is U+2029 PARAGRAPH SEPARATOR; UTF8(0x2029) = 0xE2 0x80 0xA9
     56 assert.sameValue("\", "");
     57 
     58 // LineTerminatorSequence :: <CR> <LF>
     59 assert.sameValue("\
     60 ", "");
     61 
     62 reportCompare(0, 0);