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

EOF characters should be allowed as heredoc delimiter #809

Open
pocke opened this issue Jul 10, 2021 · 1 comment
Open

EOF characters should be allowed as heredoc delimiter #809

pocke opened this issue Jul 10, 2021 · 1 comment
Labels

Comments

@pocke
Copy link
Collaborator

pocke commented Jul 10, 2021

Problem

^D, ^Z, and \0 should be allowed as heredoc delimiter if it is surrounded with quotes, but isn't.

For example:

# test.rb
puts <<~RUBY
  <<~'\0'
  \0
RUBY
$ ruby test.rb | ruby -c
Syntax OK
$ ruby test.rb | ruby-parse /dev/stdin 
/dev/stdin:1:1: fatal: unterminated string meets end of file
/dev/stdin:1: <<~'
@pocke pocke added the bug label Jul 10, 2021
@pocke
Copy link
Collaborator Author

pocke commented Jul 10, 2021

By the way, I found other bugs during grep c_any in lexer.rl.
Both of the following are accepted by CRuby, but ruby-parse raises an error unexpectedly.

  • /^D/
  • ?^D

Note that ^D means 0x04.

Maybe there are other bugs related to c_any char class in lexer.rl but didn't investigate it deeply.

ref: #808

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant