1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:18:11 +00:00
serenity/Libraries/LibJS
Linus Groh 4fb96afafc LibJS: Support LegacyOctalEscapeSequence in string literals
https://tc39.es/ecma262/#sec-additional-syntax-string-literals

The syntax and semantics of 11.8.4 is extended as follows except that
this extension is not allowed for strict mode code:

Syntax

    EscapeSequence::
        CharacterEscapeSequence
        LegacyOctalEscapeSequence
        NonOctalDecimalEscapeSequence
        HexEscapeSequence
        UnicodeEscapeSequence

    LegacyOctalEscapeSequence::
        OctalDigit [lookahead ∉ OctalDigit]
        ZeroToThree OctalDigit [lookahead ∉ OctalDigit]
        FourToSeven OctalDigit
        ZeroToThree OctalDigit OctalDigit

    ZeroToThree :: one of
        0 1 2 3

    FourToSeven :: one of
        4 5 6 7

    NonOctalDecimalEscapeSequence :: one of
        8 9

This definition of EscapeSequence is not used in strict mode or when
parsing TemplateCharacter.

Note

It is possible for string literals to precede a Use Strict Directive
that places the enclosing code in strict mode, and implementations must
take care to not use this extended definition of EscapeSequence with
such literals. For example, attempting to parse the following source
text must fail:

function invalid() { "\7"; "use strict"; }
2020-10-24 16:34:01 +02:00
..
Heap Everywhere: Add missing <AK/TemporaryChange.h> includes 2020-10-15 23:49:53 +02:00
Runtime LibJS: Give VM a cache of single-ASCII-character PrimitiveString 2020-10-22 17:48:12 +02:00
Tests LibJS: Support LegacyOctalEscapeSequence in string literals 2020-10-24 16:34:01 +02:00
AST.cpp LibJS: Check for exception after executing (do)while test expression 2020-10-23 19:06:57 +02:00
AST.h LibJS: Distinguish between statement and declaration 2020-10-23 19:13:06 +02:00
CMakeLists.txt LibJS: Split Heap into per-cell-size allocators 2020-10-06 18:50:47 +02:00
Console.cpp LibJS: Move Console from Interpreter to GlobalObject 2020-09-29 21:15:06 +02:00
Console.h LibJS: Move Console from Interpreter to GlobalObject 2020-09-29 21:15:06 +02:00
Forward.h LibJS: Split Heap into per-cell-size allocators 2020-10-06 18:50:47 +02:00
Interpreter.cpp LibJS: Cache commonly used FlyStrings in the VM 2020-10-13 23:57:45 +02:00
Interpreter.h LibJS: Remove some unused Interpreter member functions 2020-10-04 23:10:07 +02:00
Lexer.cpp LibJS: Support all line terminators (LF, CR, LS, PS) 2020-10-22 10:06:30 +02:00
Lexer.h LibJS: Support all line terminators (LF, CR, LS, PS) 2020-10-22 10:06:30 +02:00
MarkupGenerator.cpp LibJS: Unify syntax highlighting 2020-10-04 23:41:31 +02:00
MarkupGenerator.h Meta: Add a script check the presence of "#pragma once" in header files 2020-05-29 07:59:45 +02:00
Parser.cpp LibJS: Support LegacyOctalEscapeSequence in string literals 2020-10-24 16:34:01 +02:00
Parser.h LibJS: Support LegacyOctalEscapeSequence in string literals 2020-10-24 16:34:01 +02:00
Token.cpp LibJS: Support LegacyOctalEscapeSequence in string literals 2020-10-24 16:34:01 +02:00
Token.h LibJS: Support LegacyOctalEscapeSequence in string literals 2020-10-24 16:34:01 +02:00