Skip to content
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

A string containing only a Unicode escape sequence causes an error #808

Closed
dapper-gh opened this issue Oct 6, 2020 · 1 comment · Fixed by #826
Closed

A string containing only a Unicode escape sequence causes an error #808

dapper-gh opened this issue Oct 6, 2020 · 1 comment · Fixed by #826
Assignees
Labels
bug Something isn't working good first issue Good for newcomers Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com lexer Issues surrounding the lexer
Milestone

Comments

@dapper-gh
Copy link

Describe the bug
If a string is composed only of a Unicode escape sequence (e.g. "\uABCD"), then an error occurs instead of producing a string.

To Reproduce

"\u00A7"

(that's the code for the section sign. It's not important, as the bug applies to any escape sequence)

Expected behavior
The string is valid, and is not supposed to throw an error. The syntax for string literals can be found here.

Build environment (please complete the following information):

  • OS: Windows 10
  • Version: Version 1909 (OS Build 18363.1082)
  • Target triple: x86_64-pc-windows-msvc
  • Rustc version: rustc 1.46.0 (04488afe3 2020-08-24)

Additional context
Spec: https://tc39.es/ecma262/#sec-literals-string-literals
MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar

As far as I can tell, the bug is caused by an issue in syntax/lexer/string.rs where once a Unicode escape sequence is detected, it skips checking for " and believes the string has finished without a ".

@dapper-gh dapper-gh added the bug Something isn't working label Oct 6, 2020
@Razican Razican added the lexer Issues surrounding the lexer label Oct 6, 2020
@Razican Razican added this to the v0.11.0 milestone Oct 6, 2020
@Razican Razican added good first issue Good for newcomers Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com labels Oct 6, 2020
@jevancc
Copy link
Contributor

jevancc commented Oct 6, 2020

Hi @Razican , I would like to work on this issue. Could you please assign it to me? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers Hacktoberfest Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com lexer Issues surrounding the lexer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants