diff --git a/grammar.js b/grammar.js index 1907a3a3..60d0dd52 100644 --- a/grammar.js +++ b/grammar.js @@ -1560,7 +1560,7 @@ module.exports = grammar({ seq('\\', choice( /[^xu]/, /u[0-9a-fA-F]{4}/, - /u\{[0-9a-fA-F]+\}/, + /u\{[0-9a-fA-F_]+\}/, /x[0-9a-fA-F]{2}/, )), /[^\\']/, @@ -1573,7 +1573,7 @@ module.exports = grammar({ choice( /[^xu]/, /u[0-9a-fA-F]{4}/, - /u\{[0-9a-fA-F]+\}/, + /u\{[0-9a-fA-F_]+\}/, /x[0-9a-fA-F]{2}/, ), )), diff --git a/test/corpus/literals.txt b/test/corpus/literals.txt index f6fa74de..be9f890b 100644 --- a/test/corpus/literals.txt +++ b/test/corpus/literals.txt @@ -81,6 +81,7 @@ b"foo\nbar"; "/* foo bar */ foo bar"; "foo\x42\x43bar"; "foo \x42 \x43 bar"; +"\u{10__FFFF}"; -------------------------------------------------------------------------------- @@ -123,7 +124,10 @@ b"foo\nbar"; (escape_sequence) (string_content) (escape_sequence) - (string_content)))) + (string_content))) + (expression_statement + (string_literal + (escape_sequence)))) ================================================================================ Raw string literals @@ -198,6 +202,7 @@ b'x'; '\t'; '\xff'; '\\'; +'\u{10__FFFF}'; -------------------------------------------------------------------------------- @@ -214,6 +219,8 @@ b'x'; (char_literal)) (expression_statement (char_literal)) + (expression_statement + (char_literal)) (expression_statement (char_literal)))