whitequark / whitequark/parser
Escaped newlines in single-quoted heredocs
Open
Nobody has claimed this yet.
bug
- Dominant language
- Yacc
- Stars
- 1.6k
- Forks
- 205
- PR merge metrics
- No merged PRs in 30d
Description
In the following snippet:
<<~'FOO'
baz\\
qux
FOO
For Ruby you will get:
$ ruby --dump=insns test/tmp/test.rb
== disasm: #<ISeq:<main>@test/tmp/test.rb:1 (1,0)-(1,8)> (catch: false)
0000 putstring "baz\\\\\nqux\n" ( 1)[Li]
0002 leave
but for parser you get:
$ bin/ruby-parse test/tmp/test.rb
(dstr
(str "baz\\\n")
(str "qux\n"))
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the discrepancy with test/tmp/test.rb, comparing ruby --dump=insns with bin/ruby-parse for the single-quoted heredoc shown. Trace how each output represents the escaped newline, then make the parser agree with Ruby and verify both command outputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- compilers, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100