Parse error when using the squiggly heredoc
Closed this issue · 10 comments
debride gives a parsing error when encountering this block:
def credentials
query = <<~END
SELECT e.*
FROM empresa;
END
end
Parse Error parsing invoice_downloader.rb. Skipping.
invoice_downloader.rb:51 :: parse error on value "<<" (tLSHFT)
This is most likely due to seattlerb/ruby_parser#218. That issue has been fixed on master, so this problem should go away with the next release of ruby_parser.
Thanks, you are right.
@NicolasWebDev A new version of ruby_parser was released yesterday. Did that fix your issue?
With the following code
puts <<~END
chien
chat
poulet
END
, I now have the error
+ ~/tmp/test_debride$ debride test.rb
Parse Error parsing test.rb. Skipping.
test.rb:1 :: parse error on value ["END", 1] (klEND)
These methods MIGHT not be called:
+ ~/tmp/test_debride$ cat Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
debride (1.8.0)
path_expander (~> 1.0)
ruby_parser (~> 3.6)
sexp_processor (~> 4.5)
path_expander (1.0.2)
ruby_parser (3.10.0)
sexp_processor (~> 4.9)
sexp_processor (4.10.0)
PLATFORMS
ruby
DEPENDENCIES
debride
BUNDLED WITH
1.15.1
Hi, I don't see that error message with a newly installed debride. Do you get different output when you run this command?
pete@rhombus:~/projects/test_debride2$ gem list debride ruby_parser sexp_processor
*** LOCAL GEMS ***
debride (1.8.0)
*** LOCAL GEMS ***
ruby_parser (3.10.0)
*** LOCAL GEMS ***
sexp_processor (4.10.0)
What version of ruby are you using?
+ ~/tmp/test_debride$ gem list debride ruby_parser sexp_processor
*** LOCAL GEMS ***
debride (1.8.0)
*** LOCAL GEMS ***
ruby_parser (3.10.0, 3.9.0)
*** LOCAL GEMS ***
sexp_processor (4.10.0, 4.9.0)
I am running debride with bundle exec, with the Gemfile.lock above, so it should use ruby_parser 3.10.0 and sexp_processor 4.10.0, isn't it? I am managing my gems/ruby versions with rbenv.
I am using ruby 2.4.1.
This is legit and I can reproduce it in ruby_parser. :(
Fixed. It was my fault and dumb. Still need better test structure to prevent regressions.
released
Thanks @zenspider.