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

Empty curly Unicode escape is not an error #856

Open
RazrFalcon opened this issue Jun 4, 2022 · 3 comments
Open

Empty curly Unicode escape is not an error #856

RazrFalcon opened this issue Jun 4, 2022 · 3 comments

Comments

@RazrFalcon
Copy link

> ruby -v
ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]

> ruby -e 'puts "\\u{}"'


> ruby-parse -v
ruby-parse based on parser version 3.1.2.0

> ruby-parse --32 -E -e '"\\u{}"'
(fragment:0):1:2: fatal: invalid Unicode escape
(fragment:0):1: "\u{}"
(fragment:0):1:  ^~~~ 
@iliabylich
Copy link
Collaborator

Just like in #855 I can't reproduce your error:

$ ruby -v bin/ruby-parse --32 -E -e '"\\u{}"'
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19]
"\\u{}"
^~~~~~~ tSTRING "\\u{}"                         expr_end     [0 <= cond] [0 <= cmdarg]
"\\u{}"
       ^ false "$eof"                           expr_end     [0 <= cond] [0 <= cmdarg]
(str "\\u{}")

$ ruby -ve 'p "\\u{}"'
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19]
"\\u{}"

Please, try at least Ruby 2.7, older versions are not supported.

@iliabylich
Copy link
Collaborator

Similar to #855

I'm closing it, but feel free to reopen it if the error appears again for you with maintained Ruby versions (>= 2.7)

@iliabylich iliabylich reopened this Jun 4, 2022
@iliabylich
Copy link
Collaborator

This is a real bug, too:

$ /bin/cat test.rb
"\u{}"

$ ruby -v test.rb
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19]
test.rb:1: warning: possibly useless use of a literal in void context

$ bin/ruby-parse --32 test.rb
test.rb:1:2: fatal: invalid Unicode escape
test.rb:1: "\u{}"
test.rb:1:  ^~~~

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

No branches or pull requests

2 participants