Skip to content

Transform "NonEscapeCharacter" in Ast_utf8_string correct. #5391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2022

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
3 participants