Boa: A string containing only a Unicode escape sequence causes an error

Created on 6 Oct 2020  路  1Comment  路  Source: boa-dev/boa

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 ".

bug good first issue Hacktoberfest lexer

Most helpful comment

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

>All comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

IovoslavIovchev picture IovoslavIovchev  路  4Comments

croraf picture croraf  路  4Comments

attliaLin picture attliaLin  路  3Comments

neeldug picture neeldug  路  3Comments

HalidOdat picture HalidOdat  路  3Comments