Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- dedenter.rb: Fix squiggly heredoc line continuation handling (#819)
Firstly, this fixes an issue with non-interpolating squiggly heredocs, where line continuation characters should be ignored. Two things were broken: - The line continuation backslash would be removed, as well as the subsequent carriage return - The subsequent line would not be dedented. For example, the following source: ```ruby <<~'END' foo \ bar END ``` Would be parsed as follows: ``` (dstr (str "foo ") (str " bar\n")) ``` With the change, the result is: ``` (dstr (str "foo \\\n") (str "bar\n")) ``` This also fixes an issue with interpolating squiggly heredocs, where an escaped backslash followed by a newline would be interpreted as a line continuation. This is issue #789. In that case, the following source: ```ruby <<~END foo \\ bar END ``` Would (again) be parsed as follows: ``` (dstr (str "foo ") (str " bar\n")) ``` With the change, the result is: ``` (dstr (str "foo \\\n") (str "bar\n")) ```
- Loading branch information