Skip to content

Conversation

@IwanKaramazow
Copy link

Fixes rescript-lang/syntax#473

The ecmascript spec states that both SingleEscapeCharacter and NonEscapeCharacter are valid escape sequences.
Previously escape sequences containing a NonEscapeCharacter, any regular char like a in\a, would throw the "Invalid escape code" error.
ReScript strings should have the same semantics as JS.

See webkit which implements the spec.

  • Safari:

image

  • Chrome:

image

Fixes rescript-lang/syntax#473

The [ecmascript spec](https://tc39.es/ecma262/#prod-CharacterEscapeSequence) states that both `SingleEscapeCharacter` and `NonEscapeCharacter` are valid escape sequences.
Previously escape sequences containing a `NonEscapeCharacter`, any regular char like `a` in`"\a"`, would throw the "Invalid escape code" error.
ReScript strings should have the same semantics as JS.
@IwanKaramazow IwanKaramazow requested a review from bobzhang May 24, 2022 05:10
@cristianoc cristianoc merged commit bf5a154 into master May 26, 2022
@cristianoc cristianoc deleted the iwan/transform-non-escape-sequence branch May 26, 2022 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bsc.exe on master complains about invalid escape codes in strings while 9.1.4 is fine

4 participants