summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2023-10-11 13:58:00 -0400
committerKevin Newton <kddnewton@gmail.com>2023-10-13 15:31:30 -0400
commitd0614b5254d1767cdffdd32f13897dc10facc6a2 (patch)
tree8d56dd7cfe9a5700da2e447da3fb6cf466001184 /test
parentad46fc093b1344b4129ef5199060402e9270b652 (diff)
[ruby/prism] Split up lines in tilde heredocs
https://github.com/ruby/prism/commit/21fad0c2ce
Diffstat (limited to 'test')
-rw-r--r--test/prism/snapshots/dos_endings.txt20
-rw-r--r--test/prism/snapshots/heredocs_nested.txt14
-rw-r--r--test/prism/snapshots/heredocs_with_ignored_newlines.txt56
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_squiggly.txt26
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_squiggly_blank_line_plus_interpolation.txt4
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_squiggly_blank_lines.txt26
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_squiggly_interp.txt26
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_squiggly_tabs.txt20
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_squiggly_tabs_extra.txt20
-rw-r--r--test/prism/snapshots/seattlerb/heredoc_squiggly_visually_blank_lines.txt26
-rw-r--r--test/prism/snapshots/tilde_heredocs.txt262
-rw-r--r--test/prism/snapshots/unparser/corpus/semantic/dstr.txt42
-rw-r--r--test/prism/snapshots/whitequark/dedenting_heredoc.txt204
-rw-r--r--test/prism/snapshots/whitequark/dedenting_interpolating_heredoc_fake_line_continuation.txt20
-rw-r--r--test/prism/snapshots/whitequark/dedenting_non_interpolating_heredoc_line_continuation.txt20
-rw-r--r--test/prism/snapshots/whitequark/parser_bug_640.txt2
-rw-r--r--test/prism/snapshots/whitequark/ruby_bug_11989.txt2
-rw-r--r--test/prism/snapshots/whitequark/slash_newline_in_heredocs.txt20
-rw-r--r--test/prism/unescape_test.rb54
19 files changed, 655 insertions, 209 deletions
diff --git a/test/prism/snapshots/dos_endings.txt b/test/prism/snapshots/dos_endings.txt
index d01c5a7ac9..7e553ed932 100644
--- a/test/prism/snapshots/dos_endings.txt
+++ b/test/prism/snapshots/dos_endings.txt
@@ -72,12 +72,22 @@
│ │ └── arguments: (length: 1)
│ │ └── @ CallNode (location: (17,8)-(17,19))
│ │ ├── receiver:
- │ │ │ @ StringNode (location: (17,8)-(17,14))
- │ │ │ ├── flags: ∅
+ │ │ │ @ InterpolatedStringNode (location: (17,8)-(17,14))
│ │ │ ├── opening_loc: (17,8)-(17,14) = "<<~EOF"
- │ │ │ ├── content_loc: (18,0)-(19,0) = "\r\n baz\r\n"
- │ │ │ ├── closing_loc: (20,0)-(20,0) = " EOF\r\n"
- │ │ │ └── unescaped: "\nbaz\r\n"
+ │ │ │ ├── parts: (length: 2)
+ │ │ │ │ ├── @ StringNode (location: (18,0)-(18,0))
+ │ │ │ │ │ ├── flags: ∅
+ │ │ │ │ │ ├── opening_loc: ∅
+ │ │ │ │ │ ├── content_loc: (18,0)-(18,0) = "\r\n"
+ │ │ │ │ │ ├── closing_loc: ∅
+ │ │ │ │ │ └── unescaped: "\n"
+ │ │ │ │ └── @ StringNode (location: (19,0)-(19,0))
+ │ │ │ │ ├── flags: ∅
+ │ │ │ │ ├── opening_loc: ∅
+ │ │ │ │ ├── content_loc: (19,0)-(19,0) = " baz\r\n"
+ │ │ │ │ ├── closing_loc: ∅
+ │ │ │ │ └── unescaped: "baz\r\n"
+ │ │ │ └── closing_loc: (20,0)-(20,0) = " EOF\r\n"
│ │ ├── call_operator_loc: (17,14)-(17,15) = "."
│ │ ├── message_loc: (17,15)-(17,19) = "chop"
│ │ ├── opening_loc: ∅
diff --git a/test/prism/snapshots/heredocs_nested.txt b/test/prism/snapshots/heredocs_nested.txt
index 8680dd2346..0e76652072 100644
--- a/test/prism/snapshots/heredocs_nested.txt
+++ b/test/prism/snapshots/heredocs_nested.txt
@@ -5,7 +5,7 @@
└── body: (length: 1)
└── @ InterpolatedStringNode (location: (1,0)-(1,7))
├── opening_loc: (1,0)-(1,7) = "<<~RUBY"
- ├── parts: (length: 3)
+ ├── parts: (length: 4)
│ ├── @ StringNode (location: (2,0)-(2,0))
│ │ ├── flags: ∅
│ │ ├── opening_loc: ∅
@@ -24,10 +24,16 @@
│ │ │ ├── closing_loc: (6,0)-(6,0) = "RUBY\n"
│ │ │ └── unescaped: " hello\n"
│ │ └── closing_loc: (7,0)-(7,1) = "}"
- │ └── @ StringNode (location: (7,1)-(8,0))
+ │ ├── @ StringNode (location: (7,1)-(7,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (7,1)-(7,0) = "\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "\n"
+ │ └── @ StringNode (location: (8,0)-(8,0))
│ ├── flags: ∅
│ ├── opening_loc: ∅
- │ ├── content_loc: (7,1)-(8,0) = "\npost\n"
+ │ ├── content_loc: (8,0)-(8,0) = "post\n"
│ ├── closing_loc: ∅
- │ └── unescaped: "\npost\n"
+ │ └── unescaped: "post\n"
└── closing_loc: (9,0)-(9,0) = "RUBY\n"
diff --git a/test/prism/snapshots/heredocs_with_ignored_newlines.txt b/test/prism/snapshots/heredocs_with_ignored_newlines.txt
index 280a01f879..361c8687aa 100644
--- a/test/prism/snapshots/heredocs_with_ignored_newlines.txt
+++ b/test/prism/snapshots/heredocs_with_ignored_newlines.txt
@@ -9,9 +9,55 @@
│ ├── content_loc: (2,0)-(1,0) = ""
│ ├── closing_loc: (2,0)-(2,0) = "HERE\n"
│ └── unescaped: ""
- └── @ StringNode (location: (4,0)-(4,8))
- ├── flags: ∅
+ └── @ InterpolatedStringNode (location: (4,0)-(4,8))
├── opening_loc: (4,0)-(4,8) = "<<~THERE"
- ├── content_loc: (5,0)-(13,0) = " way over\n <<HERE\n not here\n HERE\n\n <<~BUT\\\n but\n BUT\n there\n"
- ├── closing_loc: (14,0)-(14,0) = "THERE\n"
- └── unescaped: "way over\n<<HERE\n not here\nHERE\n\n<<~BUT but\nBUT\n there\n"
+ ├── parts: (length: 8)
+ │ ├── @ StringNode (location: (5,0)-(5,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (5,0)-(5,0) = " way over\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "way over\n"
+ │ ├── @ StringNode (location: (6,0)-(6,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (6,0)-(6,0) = " <<HERE\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "<<HERE\n"
+ │ ├── @ StringNode (location: (7,0)-(7,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (7,0)-(7,0) = " not here\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: " not here\n"
+ │ ├── @ StringNode (location: (8,0)-(8,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (8,0)-(8,0) = " HERE\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "HERE\n"
+ │ ├── @ StringNode (location: (9,0)-(9,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (9,0)-(9,0) = "\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "\n"
+ │ ├── @ StringNode (location: (10,0)-(11,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (10,0)-(11,0) = " <<~BUT\\\n but\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "<<~BUT but\n"
+ │ ├── @ StringNode (location: (12,0)-(12,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (12,0)-(12,0) = " BUT\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "BUT\n"
+ │ └── @ StringNode (location: (13,0)-(13,0))
+ │ ├── flags: ∅
+ │ ├── opening_loc: ∅
+ │ ├── content_loc: (13,0)-(13,0) = " there\n"
+ │ ├── closing_loc: ∅
+ │ └── unescaped: " there\n"
+ └── closing_loc: (14,0)-(14,0) = "THERE\n"
diff --git a/test/prism/snapshots/seattlerb/heredoc_squiggly.txt b/test/prism/snapshots/seattlerb/heredoc_squiggly.txt
index bc5273e9ac..207da6b038 100644
--- a/test/prism/snapshots/seattlerb/heredoc_squiggly.txt
+++ b/test/prism/snapshots/seattlerb/heredoc_squiggly.txt
@@ -8,10 +8,26 @@
├── depth: 0
├── name_loc: (1,0)-(1,1) = "a"
├── value:
- │ @ StringNode (location: (1,4)-(1,12))
- │ ├── flags: ∅
+ │ @ InterpolatedStringNode (location: (1,4)-(1,12))
│ ├── opening_loc: (1,4)-(1,12) = "<<~\"EOF\""
- │ ├── content_loc: (2,0)-(4,0) = " x\n y\n z\n"
- │ ├── closing_loc: (5,0)-(5,0) = " EOF\n"
- │ └── unescaped: "x\ny\nz\n"
+ │ ├── parts: (length: 3)
+ │ │ ├── @ StringNode (location: (2,0)-(2,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (2,0)-(2,0) = " x\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "x\n"
+ │ │ ├── @ StringNode (location: (3,0)-(3,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (3,0)-(3,0) = " y\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "y\n"
+ │ │ └── @ StringNode (location: (4,0)-(4,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (4,0)-(4,0) = " z\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "z\n"
+ │ └── closing_loc: (5,0)-(5,0) = " EOF\n"
└── operator_loc: (1,2)-(1,3) = "="
diff --git a/test/prism/snapshots/seattlerb/heredoc_squiggly_blank_line_plus_interpolation.txt b/test/prism/snapshots/seattlerb/heredoc_squiggly_blank_line_plus_interpolation.txt
index eeaa6e73d6..43703cbe04 100644
--- a/test/prism/snapshots/seattlerb/heredoc_squiggly_blank_line_plus_interpolation.txt
+++ b/test/prism/snapshots/seattlerb/heredoc_squiggly_blank_line_plus_interpolation.txt
@@ -21,10 +21,10 @@
│ │ │ @ InterpolatedStringNode (location: (1,8)-(1,14))
│ │ │ ├── opening_loc: (1,8)-(1,14) = "<<~EOF"
│ │ │ ├── parts: (length: 3)
- │ │ │ │ ├── @ StringNode (location: (2,0)-(3,4))
+ │ │ │ │ ├── @ StringNode (location: (2,0)-(2,0))
│ │ │ │ │ ├── flags: ∅
│ │ │ │ │ ├── opening_loc: ∅
- │ │ │ │ │ ├── content_loc: (2,0)-(3,4) = "\n "
+ │ │ │ │ │ ├── content_loc: (2,0)-(2,0) = "\n"
│ │ │ │ │ ├── closing_loc: ∅
│ │ │ │ │ └── unescaped: "\n"
│ │ │ │ ├── @ EmbeddedStatementsNode (location: (3,4)-(3,10))
diff --git a/test/prism/snapshots/seattlerb/heredoc_squiggly_blank_lines.txt b/test/prism/snapshots/seattlerb/heredoc_squiggly_blank_lines.txt
index 8adeee53bf..a9abc3f40a 100644
--- a/test/prism/snapshots/seattlerb/heredoc_squiggly_blank_lines.txt
+++ b/test/prism/snapshots/seattlerb/heredoc_squiggly_blank_lines.txt
@@ -8,10 +8,26 @@
├── depth: 0
├── name_loc: (1,0)-(1,1) = "a"
├── value:
- │ @ StringNode (location: (1,4)-(1,10))
- │ ├── flags: ∅
+ │ @ InterpolatedStringNode (location: (1,4)-(1,10))
│ ├── opening_loc: (1,4)-(1,10) = "<<~EOF"
- │ ├── content_loc: (2,0)-(4,0) = " x\n\n z\n"
- │ ├── closing_loc: (5,0)-(5,0) = "EOF\n"
- │ └── unescaped: "x\n\nz\n"
+ │ ├── parts: (length: 3)
+ │ │ ├── @ StringNode (location: (2,0)-(2,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (2,0)-(2,0) = " x\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "x\n"
+ │ │ ├── @ StringNode (location: (3,0)-(3,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (3,0)-(3,0) = "\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "\n"
+ │ │ └── @ StringNode (location: (4,0)-(4,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (4,0)-(4,0) = " z\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "z\n"
+ │ └── closing_loc: (5,0)-(5,0) = "EOF\n"
└── operator_loc: (1,2)-(1,3) = "="
diff --git a/test/prism/snapshots/seattlerb/heredoc_squiggly_interp.txt b/test/prism/snapshots/seattlerb/heredoc_squiggly_interp.txt
index 620b29591c..122a6ad05f 100644
--- a/test/prism/snapshots/seattlerb/heredoc_squiggly_interp.txt
+++ b/test/prism/snapshots/seattlerb/heredoc_squiggly_interp.txt
@@ -10,13 +10,19 @@
├── value:
│ @ InterpolatedStringNode (location: (1,4)-(1,10))
│ ├── opening_loc: (1,4)-(1,10) = "<<~EOF"
- │ ├── parts: (length: 3)
- │ │ ├── @ StringNode (location: (2,0)-(3,3))
+ │ ├── parts: (length: 5)
+ │ │ ├── @ StringNode (location: (2,0)-(2,0))
│ │ │ ├── flags: ∅
│ │ │ ├── opening_loc: ∅
- │ │ │ ├── content_loc: (2,0)-(3,3) = " w\n x"
+ │ │ │ ├── content_loc: (2,0)-(2,0) = " w\n"
│ │ │ ├── closing_loc: ∅
- │ │ │ └── unescaped: " w\nx"
+ │ │ │ └── unescaped: " w\n"
+ │ │ ├── @ StringNode (location: (3,0)-(3,3))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (3,0)-(3,3) = " x"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "x"
│ │ ├── @ EmbeddedStatementsNode (location: (3,3)-(3,8))
│ │ │ ├── opening_loc: (3,3)-(3,5) = "\#{"
│ │ │ ├── statements:
@@ -25,11 +31,17 @@
│ │ │ │ └── @ IntegerNode (location: (3,5)-(3,7))
│ │ │ │ └── flags: decimal
│ │ │ └── closing_loc: (3,7)-(3,8) = "}"
- │ │ └── @ StringNode (location: (3,8)-(4,0))
+ │ │ ├── @ StringNode (location: (3,8)-(3,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (3,8)-(3,0) = " y\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: " y\n"
+ │ │ └── @ StringNode (location: (4,0)-(4,0))
│ │ ├── flags: ∅
│ │ ├── opening_loc: ∅
- │ │ ├── content_loc: (3,8)-(4,0) = " y\n z\n"
+ │ │ ├── content_loc: (4,0)-(4,0) = " z\n"
│ │ ├── closing_loc: ∅
- │ │ └── unescaped: " y\n z\n"
+ │ │ └── unescaped: " z\n"
│ └── closing_loc: (5,0)-(5,0) = " EOF\n"
└── operator_loc: (1,2)-(1,3) = "="
diff --git a/test/prism/snapshots/seattlerb/heredoc_squiggly_tabs.txt b/test/prism/snapshots/seattlerb/heredoc_squiggly_tabs.txt
index f876ffa456..dc7ec36a9e 100644
--- a/test/prism/snapshots/seattlerb/heredoc_squiggly_tabs.txt
+++ b/test/prism/snapshots/seattlerb/heredoc_squiggly_tabs.txt
@@ -8,10 +8,20 @@
├── depth: 0
├── name_loc: (1,0)-(1,1) = "a"
├── value:
- │ @ StringNode (location: (1,4)-(1,12))
- │ ├── flags: ∅
+ │ @ InterpolatedStringNode (location: (1,4)-(1,12))
│ ├── opening_loc: (1,4)-(1,12) = "<<~\"EOF\""
- │ ├── content_loc: (2,0)-(3,0) = " blah blah\n\t blah blah\n"
- │ ├── closing_loc: (4,0)-(4,0) = " EOF\n"
- │ └── unescaped: "blah blah\n blah blah\n"
+ │ ├── parts: (length: 2)
+ │ │ ├── @ StringNode (location: (2,0)-(2,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (2,0)-(2,0) = " blah blah\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "blah blah\n"
+ │ │ └── @ StringNode (location: (3,0)-(3,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (3,0)-(3,0) = "\t blah blah\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: " blah blah\n"
+ │ └── closing_loc: (4,0)-(4,0) = " EOF\n"
└── operator_loc: (1,2)-(1,3) = "="
diff --git a/test/prism/snapshots/seattlerb/heredoc_squiggly_tabs_extra.txt b/test/prism/snapshots/seattlerb/heredoc_squiggly_tabs_extra.txt
index 32a8b64ce4..9d0962371d 100644
--- a/test/prism/snapshots/seattlerb/heredoc_squiggly_tabs_extra.txt
+++ b/test/prism/snapshots/seattlerb/heredoc_squiggly_tabs_extra.txt
@@ -8,10 +8,20 @@
├── depth: 0
├── name_loc: (1,0)-(1,1) = "a"
├── value:
- │ @ StringNode (location: (1,4)-(1,12))
- │ ├── flags: ∅
+ │ @ InterpolatedStringNode (location: (1,4)-(1,12))
│ ├── opening_loc: (1,4)-(1,12) = "<<~\"EOF\""
- │ ├── content_loc: (2,0)-(3,0) = " blah blah\n \tblah blah\n"
- │ ├── closing_loc: (4,0)-(4,0) = " EOF\n"
- │ └── unescaped: "blah blah\n\tblah blah\n"
+ │ ├── parts: (length: 2)
+ │ │ ├── @ StringNode (location: (2,0)-(2,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (2,0)-(2,0) = " blah blah\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "blah blah\n"
+ │ │ └── @ StringNode (location: (3,0)-(3,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (3,0)-(3,0) = " \tblah blah\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "\tblah blah\n"
+ │ └── closing_loc: (4,0)-(4,0) = " EOF\n"
└── operator_loc: (1,2)-(1,3) = "="
diff --git a/test/prism/snapshots/seattlerb/heredoc_squiggly_visually_blank_lines.txt b/test/prism/snapshots/seattlerb/heredoc_squiggly_visually_blank_lines.txt
index edf33da732..1d93f974eb 100644
--- a/test/prism/snapshots/seattlerb/heredoc_squiggly_visually_blank_lines.txt
+++ b/test/prism/snapshots/seattlerb/heredoc_squiggly_visually_blank_lines.txt
@@ -8,10 +8,26 @@
├── depth: 0
├── name_loc: (1,0)-(1,1) = "a"
├── value:
- │ @ StringNode (location: (1,4)-(1,10))
- │ ├── flags: ∅
+ │ @ InterpolatedStringNode (location: (1,4)-(1,10))
│ ├── opening_loc: (1,4)-(1,10) = "<<~EOF"
- │ ├── content_loc: (2,0)-(4,0) = " x\n \n z\n"
- │ ├── closing_loc: (5,0)-(5,0) = "EOF\n"
- │ └── unescaped: "x\n\nz\n"
+ │ ├── parts: (length: 3)
+ │ │ ├── @ StringNode (location: (2,0)-(2,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (2,0)-(2,0) = " x\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "x\n"
+ │ │ ├── @ StringNode (location: (3,0)-(3,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (3,0)-(3,0) = " \n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "\n"
+ │ │ └── @ StringNode (location: (4,0)-(4,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (4,0)-(4,0) = " z\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "z\n"
+ │ └── closing_loc: (5,0)-(5,0) = "EOF\n"
└── operator_loc: (1,2)-(1,3) = "="
diff --git a/test/prism/snapshots/tilde_heredocs.txt b/test/prism/snapshots/tilde_heredocs.txt
index b0b060255c..3d3335776d 100644
--- a/test/prism/snapshots/tilde_heredocs.txt
+++ b/test/prism/snapshots/tilde_heredocs.txt
@@ -9,12 +9,28 @@
│ ├── content_loc: (2,0)-(2,0) = " a\n"
│ ├── closing_loc: (3,0)-(3,0) = "EOF\n"
│ └── unescaped: "a\n"
- ├── @ StringNode (location: (5,0)-(5,6))
- │ ├── flags: ∅
+ ├── @ InterpolatedStringNode (location: (5,0)-(5,6))
│ ├── opening_loc: (5,0)-(5,6) = "<<~EOF"
- │ ├── content_loc: (6,0)-(8,0) = "\ta\n b\n\t\tc\n"
- │ ├── closing_loc: (9,0)-(9,0) = "EOF\n"
- │ └── unescaped: "\ta\nb\n\t\tc\n"
+ │ ├── parts: (length: 3)
+ │ │ ├── @ StringNode (location: (6,0)-(6,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (6,0)-(6,0) = "\ta\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "\ta\n"
+ │ │ ├── @ StringNode (location: (7,0)-(7,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (7,0)-(7,0) = " b\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "b\n"
+ │ │ └── @ StringNode (location: (8,0)-(8,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (8,0)-(8,0) = "\t\tc\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "\t\tc\n"
+ │ └── closing_loc: (9,0)-(9,0) = "EOF\n"
├── @ InterpolatedStringNode (location: (11,0)-(11,6))
│ ├── opening_loc: (11,0)-(11,6) = "<<~EOF"
│ ├── parts: (length: 2)
@@ -60,10 +76,10 @@
├── @ InterpolatedStringNode (location: (19,0)-(19,6))
│ ├── opening_loc: (19,0)-(19,6) = "<<~EOF"
│ ├── parts: (length: 3)
- │ │ ├── @ StringNode (location: (20,0)-(21,1))
+ │ │ ├── @ StringNode (location: (20,0)-(20,0))
│ │ │ ├── flags: ∅
│ │ │ ├── opening_loc: ∅
- │ │ │ ├── content_loc: (20,0)-(21,1) = " a\n "
+ │ │ │ ├── content_loc: (20,0)-(20,0) = " a\n"
│ │ │ ├── closing_loc: ∅
│ │ │ └── unescaped: " a\n"
│ │ ├── @ EmbeddedStatementsNode (location: (21,1)-(21,5))
@@ -84,10 +100,10 @@
├── @ InterpolatedStringNode (location: (24,0)-(24,6))
│ ├── opening_loc: (24,0)-(24,6) = "<<~EOF"
│ ├── parts: (length: 3)
- │ │ ├── @ StringNode (location: (25,0)-(26,2))
+ │ │ ├── @ StringNode (location: (25,0)-(25,0))
│ │ │ ├── flags: ∅
│ │ │ ├── opening_loc: ∅
- │ │ │ ├── content_loc: (25,0)-(26,2) = " a\n "
+ │ │ │ ├── content_loc: (25,0)-(25,0) = " a\n"
│ │ │ ├── closing_loc: ∅
│ │ │ └── unescaped: "a\n"
│ │ ├── @ EmbeddedStatementsNode (location: (26,2)-(26,6))
@@ -105,73 +121,193 @@
│ │ ├── closing_loc: ∅
│ │ └── unescaped: "\n"
│ └── closing_loc: (27,0)-(27,0) = "EOF\n"
- ├── @ StringNode (location: (29,0)-(29,6))
- │ ├── flags: ∅
+ ├── @ InterpolatedStringNode (location: (29,0)-(29,6))
│ ├── opening_loc: (29,0)-(29,6) = "<<~EOF"
- │ ├── content_loc: (30,0)-(31,0) = " a\n b\n"
- │ ├── closing_loc: (32,0)-(32,0) = "EOF\n"
- │ └── unescaped: "a\nb\n"
- ├── @ StringNode (location: (34,0)-(34,6))
- │ ├── flags: ∅
+ │ ├── parts: (length: 2)
+ │ │ ├── @ StringNode (location: (30,0)-(30,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (30,0)-(30,0) = " a\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "a\n"
+ │ │ └── @ StringNode (location: (31,0)-(31,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (31,0)-(31,0) = " b\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "b\n"
+ │ └── closing_loc: (32,0)-(32,0) = "EOF\n"
+ ├── @ InterpolatedStringNode (location: (34,0)-(34,6))
│ ├── opening_loc: (34,0)-(34,6) = "<<~EOF"
- │ ├── content_loc: (35,0)-(36,0) = " a\n b\n"
- │ ├── closing_loc: (37,0)-(37,0) = "EOF\n"
- │ └── unescaped: "a\n b\n"
- ├── @ StringNode (location: (39,0)-(39,6))
- │ ├── flags: ∅
+ │ ├── parts: (length: 2)
+ │ │ ├── @ StringNode (location: (35,0)-(35,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (35,0)-(35,0) = " a\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "a\n"
+ │ │ └── @ StringNode (location: (36,0)-(36,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (36,0)-(36,0) = " b\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: " b\n"
+ │ └── closing_loc: (37,0)-(37,0) = "EOF\n"
+ ├── @ InterpolatedStringNode (location: (39,0)-(39,6))
│ ├── opening_loc: (39,0)-(39,6) = "<<~EOF"
- │ ├── content_loc: (40,0)-(41,0) = "\t\t\ta\n\t\tb\n"
- │ ├── closing_loc: (42,0)-(42,0) = "EOF\n"
- │ └── unescaped: "\ta\nb\n"
+ │ ├── parts: (length: 2)
+ │ │ ├── @ StringNode (location: (40,0)-(40,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (40,0)-(40,0) = "\t\t\ta\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "\ta\n"
+ │ │ └── @ StringNode (location: (41,0)-(41,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (41,0)-(41,0) = "\t\tb\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "b\n"
+ │ └── closing_loc: (42,0)-(42,0) = "EOF\n"
├── @ StringNode (location: (44,0)-(44,8))
│ ├── flags: ∅
│ ├── opening_loc: (44,0)-(44,8) = "<<~'EOF'"
│ ├── content_loc: (45,0)-(45,0) = " a \#{1}\n"
│ ├── closing_loc: (46,0)-(46,0) = "EOF\n"
│ └── unescaped: "a \#{1}\n"
- ├── @ StringNode (location: (48,0)-(48,6))
- │ ├── flags: ∅
+ ├── @ InterpolatedStringNode (location: (48,0)-(48,6))
│ ├── opening_loc: (48,0)-(48,6) = "<<~EOF"
- │ ├── content_loc: (49,0)-(50,0) = "\ta\n\t b\n"
- │ ├── closing_loc: (51,0)-(51,0) = "EOF\n"
- │ └── unescaped: "a\n b\n"
- ├── @ StringNode (location: (53,0)-(53,6))
- │ ├── flags: ∅
+ │ ├── parts: (length: 2)
+ │ │ ├── @ StringNode (location: (49,0)-(49,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (49,0)-(49,0) = "\ta\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "a\n"
+ │ │ └── @ StringNode (location: (50,0)-(50,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (50,0)-(50,0) = "\t b\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: " b\n"
+ │ └── closing_loc: (51,0)-(51,0) = "EOF\n"
+ ├── @ InterpolatedStringNode (location: (53,0)-(53,6))
│ ├── opening_loc: (53,0)-(53,6) = "<<~EOF"
- │ ├── content_loc: (54,0)-(55,0) = "\t a\n\tb\n"
- │ ├── closing_loc: (56,0)-(56,0) = "EOF\n"
- │ └── unescaped: " a\nb\n"
- ├── @ StringNode (location: (58,0)-(58,6))
- │ ├── flags: ∅
+ │ ├── parts: (length: 2)
+ │ │ ├── @ StringNode (location: (54,0)-(54,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (54,0)-(54,0) = "\t a\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: " a\n"
+ │ │ └── @ StringNode (location: (55,0)-(55,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (55,0)-(55,0) = "\tb\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "b\n"
+ │ └── closing_loc: (56,0)-(56,0) = "EOF\n"
+ ├── @ InterpolatedStringNode (location: (58,0)-(58,6))
│ ├── opening_loc: (58,0)-(58,6) = "<<~EOF"
- │ ├── content_loc: (59,0)-(60,0) = " \ta\n b\n"
- │ ├── closing_loc: (61,0)-(61,0) = "EOF\n"
- │ └── unescaped: "a\nb\n"
- ├── @ StringNode (location: (63,0)-(63,6))
- │ ├── flags: ∅
+ │ ├── parts: (length: 2)
+ │ │ ├── @ StringNode (location: (59,0)-(59,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (59,0)-(59,0) = " \ta\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "a\n"
+ │ │ └── @ StringNode (location: (60,0)-(60,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (60,0)-(60,0) = " b\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "b\n"
+ │ └── closing_loc: (61,0)-(61,0) = "EOF\n"
+ ├── @ InterpolatedStringNode (location: (63,0)-(63,6))
│ ├── opening_loc: (63,0)-(63,6) = "<<~EOF"
- │ ├── content_loc: (64,0)-(66,0) = " a\n\n b\n"
- │ ├── closing_loc: (67,0)-(67,0) = "EOF\n"
- │ └── unescaped: "a\n\nb\n"
- ├── @ StringNode (location: (69,0)-(69,6))
- │ ├── flags: ∅
+ │ ├── parts: (length: 3)
+ │ │ ├── @ StringNode (location: (64,0)-(64,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (64,0)-(64,0) = " a\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "a\n"
+ │ │ ├── @ StringNode (location: (65,0)-(65,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (65,0)-(65,0) = "\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "\n"
+ │ │ └── @ StringNode (location: (66,0)-(66,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (66,0)-(66,0) = " b\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "b\n"
+ │ └── closing_loc: (67,0)-(67,0) = "EOF\n"
+ ├── @ InterpolatedStringNode (location: (69,0)-(69,6))
│ ├── opening_loc: (69,0)-(69,6) = "<<~EOF"
- │ ├── content_loc: (70,0)-(72,0) = " a\n\n b\n"
- │ ├── closing_loc: (73,0)-(73,0) = "EOF\n"
- │ └── unescaped: "a\n\nb\n"
- ├── @ StringNode (location: (75,0)-(75,6))
- │ ├── flags: ∅
+ │ ├── parts: (length: 3)
+ │ │ ├── @ StringNode (location: (70,0)-(70,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (70,0)-(70,0) = " a\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "a\n"
+ │ │ ├── @ StringNode (location: (71,0)-(71,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (71,0)-(71,0) = "\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "\n"
+ │ │ └── @ StringNode (location: (72,0)-(72,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (72,0)-(72,0) = " b\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "b\n"
+ │ └── closing_loc: (73,0)-(73,0) = "EOF\n"
+ ├── @ InterpolatedStringNode (location: (75,0)-(75,6))
│ ├── opening_loc: (75,0)-(75,6) = "<<~EOF"
- │ ├── content_loc: (76,0)-(80,0) = " a\n\n\n\n b\n"
- │ ├── closing_loc: (81,0)-(81,0) = "EOF\n"
- │ └── unescaped: "a\n\n\n\nb\n"
+ │ ├── parts: (length: 5)
+ │ │ ├── @ StringNode (location: (76,0)-(76,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (76,0)-(76,0) = " a\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "a\n"
+ │ │ ├── @ StringNode (location: (77,0)-(77,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (77,0)-(77,0) = "\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "\n"
+ │ │ ├── @ StringNode (location: (78,0)-(78,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (78,0)-(78,0) = "\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "\n"
+ │ │ ├── @ StringNode (location: (79,0)-(79,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (79,0)-(79,0) = "\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "\n"
+ │ │ └── @ StringNode (location: (80,0)-(80,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (80,0)-(80,0) = " b\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "b\n"
+ │ └── closing_loc: (81,0)-(81,0) = "EOF\n"
├── @ InterpolatedStringNode (location: (83,0)-(83,6))
│ ├── opening_loc: (83,0)-(83,6) = "<<~EOF"
│ ├── parts: (length: 3)
- │ │ ├── @ StringNode (location: (84,0)-(85,2))
+ │ │ ├── @ StringNode (location: (84,0)-(84,0))
│ │ │ ├── flags: ∅
│ │ │ ├── opening_loc: ∅
- │ │ │ ├── content_loc: (84,0)-(85,2) = "\n "
+ │ │ │ ├── content_loc: (84,0)-(84,0) = "\n"
│ │ │ ├── closing_loc: ∅
│ │ │ └── unescaped: "\n"
│ │ ├── @ EmbeddedStatementsNode (location: (85,2)-(85,6))
@@ -191,7 +327,7 @@
│ └── closing_loc: (86,0)-(86,0) = " EOF\n"
└── @ InterpolatedStringNode (location: (88,0)-(88,6))
├── opening_loc: (88,0)-(88,6) = "<<~EOT"
- ├── parts: (length: 2)
+ ├── parts: (length: 3)
│ ├── @ EmbeddedStatementsNode (location: (89,2)-(89,6))
│ │ ├── opening_loc: (89,2)-(89,4) = "\#{"
│ │ ├── statements:
@@ -200,10 +336,16 @@
│ │ │ └── @ IntegerNode (location: (89,4)-(89,5))
│ │ │ └── flags: decimal
│ │ └── closing_loc: (89,5)-(89,6) = "}"
- │ └── @ StringNode (location: (89,6)-(90,0))
+ │ ├── @ StringNode (location: (89,6)-(89,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (89,6)-(89,0) = "\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "\n"
+ │ └── @ StringNode (location: (90,0)-(90,0))
│ ├── flags: ∅
│ ├── opening_loc: ∅
- │ ├── content_loc: (89,6)-(90,0) = "\n\tb\n"
+ │ ├── content_loc: (90,0)-(90,0) = "\tb\n"
│ ├── closing_loc: ∅
- │ └── unescaped: "\n\tb\n"
+ │ └── unescaped: "\tb\n"
└── closing_loc: (91,0)-(91,0) = "EOT\n"
diff --git a/test/prism/snapshots/unparser/corpus/semantic/dstr.txt b/test/prism/snapshots/unparser/corpus/semantic/dstr.txt
index 126886f3e0..f52663c5a1 100644
--- a/test/prism/snapshots/unparser/corpus/semantic/dstr.txt
+++ b/test/prism/snapshots/unparser/corpus/semantic/dstr.txt
@@ -62,10 +62,10 @@
├── @ InterpolatedStringNode (location: (26,0)-(26,6))
│ ├── opening_loc: (26,0)-(26,6) = "<<~DOC"
│ ├── parts: (length: 3)
- │ │ ├── @ StringNode (location: (27,0)-(28,2))
+ │ │ ├── @ StringNode (location: (27,0)-(27,0))
│ │ │ ├── flags: ∅
│ │ │ ├── opening_loc: ∅
- │ │ │ ├── content_loc: (27,0)-(28,2) = " a\n "
+ │ │ │ ├── content_loc: (27,0)-(27,0) = " a\n"
│ │ │ ├── closing_loc: ∅
│ │ │ └── unescaped: "a\n"
│ │ ├── @ EmbeddedStatementsNode (location: (28,2)-(28,5))
@@ -81,30 +81,46 @@
│ └── closing_loc: (29,0)-(29,0) = "DOC\n"
├── @ InterpolatedStringNode (location: (31,0)-(31,6))
│ ├── opening_loc: (31,0)-(31,6) = "<<~DOC"
- │ ├── parts: (length: 3)
- │ │ ├── @ StringNode (location: (32,0)-(33,2))
+ │ ├── parts: (length: 4)
+ │ │ ├── @ StringNode (location: (32,0)-(32,0))
│ │ │ ├── flags: ∅
│ │ │ ├── opening_loc: ∅
- │ │ │ ├── content_loc: (32,0)-(33,2) = " a\n "
+ │ │ │ ├── content_loc: (32,0)-(32,0) = " a\n"
│ │ │ ├── closing_loc: ∅
│ │ │ └── unescaped: "a\n"
│ │ ├── @ EmbeddedStatementsNode (location: (33,2)-(33,5))
│ │ │ ├── opening_loc: (33,2)-(33,4) = "\#{"
│ │ │ ├── statements: ∅
│ │ │ └── closing_loc: (33,4)-(33,5) = "}"
- │ │ └── @ StringNode (location: (33,5)-(34,0))
+ │ │ ├── @ StringNode (location: (33,5)-(33,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (33,5)-(33,0) = "\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "\n"
+ │ │ └── @ StringNode (location: (34,0)-(34,0))
│ │ ├── flags: ∅
│ │ ├── opening_loc: ∅
- │ │ ├── content_loc: (33,5)-(34,0) = "\n b\n"
+ │ │ ├── content_loc: (34,0)-(34,0) = " b\n"
│ │ ├── closing_loc: ∅
- │ │ └── unescaped: "\nb\n"
+ │ │ └── unescaped: "b\n"
│ └── closing_loc: (35,0)-(35,0) = "DOC\n"
- ├── @ StringNode (location: (37,0)-(37,6))
- │ ├── flags: ∅
+ ├── @ InterpolatedStringNode (location: (37,0)-(37,6))
│ ├── opening_loc: (37,0)-(37,6) = "<<~DOC"
- │ ├── content_loc: (38,0)-(39,0) = " a\n b\n"
- │ ├── closing_loc: (40,0)-(40,0) = "DOC\n"
- │ └── unescaped: "a\n b\n"
+ │ ├── parts: (length: 2)
+ │ │ ├── @ StringNode (location: (38,0)-(38,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (38,0)-(38,0) = " a\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "a\n"
+ │ │ └── @ StringNode (location: (39,0)-(39,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (39,0)-(39,0) = " b\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: " b\n"
+ │ └── closing_loc: (40,0)-(40,0) = "DOC\n"
├── @ StringNode (location: (42,0)-(42,7))
│ ├── flags: ∅
│ ├── opening_loc: (42,0)-(42,7) = "<<'DOC'"
diff --git a/test/prism/snapshots/whitequark/dedenting_heredoc.txt b/test/prism/snapshots/whitequark/dedenting_heredoc.txt
index 891eba567f..6155f22fd2 100644
--- a/test/prism/snapshots/whitequark/dedenting_heredoc.txt
+++ b/test/prism/snapshots/whitequark/dedenting_heredoc.txt
@@ -14,10 +14,10 @@
│ │ └── @ InterpolatedStringNode (location: (1,2)-(1,8))
│ │ ├── opening_loc: (1,2)-(1,8) = "<<~\"E\""
│ │ ├── parts: (length: 3)
- │ │ │ ├── @ StringNode (location: (2,0)-(3,2))
+ │ │ │ ├── @ StringNode (location: (2,0)-(2,0))
│ │ │ │ ├── flags: ∅
│ │ │ │ ├── opening_loc: ∅
- │ │ │ │ ├── content_loc: (2,0)-(3,2) = " x\n "
+ │ │ │ │ ├── content_loc: (2,0)-(2,0) = " x\n"
│ │ │ │ ├── closing_loc: ∅
│ │ │ │ └── unescaped: " x\n"
│ │ │ ├── @ EmbeddedStatementsNode (location: (3,2)-(3,10))
@@ -54,10 +54,10 @@
│ │ └── @ InterpolatedStringNode (location: (6,2)-(6,8))
│ │ ├── opening_loc: (6,2)-(6,8) = "<<~\"E\""
│ │ ├── parts: (length: 3)
- │ │ │ ├── @ StringNode (location: (7,0)-(8,2))
+ │ │ │ ├── @ StringNode (location: (7,0)-(7,0))
│ │ │ │ ├── flags: ∅
│ │ │ │ ├── opening_loc: ∅
- │ │ │ │ ├── content_loc: (7,0)-(8,2) = " x\n "
+ │ │ │ │ ├── content_loc: (7,0)-(7,0) = " x\n"
│ │ │ │ ├── closing_loc: ∅
│ │ │ │ └── unescaped: " x\n"
│ │ │ ├── @ EmbeddedStatementsNode (location: (8,2)-(8,8))
@@ -95,12 +95,22 @@
│ ├── arguments:
│ │ @ ArgumentsNode (location: (11,2)-(11,6))
│ │ └── arguments: (length: 1)
- │ │ └── @ StringNode (location: (11,2)-(11,6))
- │ │ ├── flags: ∅
+ │ │ └── @ InterpolatedStringNode (location: (11,2)-(11,6))
│ │ ├── opening_loc: (11,2)-(11,6) = "<<~E"
- │ │ ├── content_loc: (12,0)-(13,0) = "\tx\n y\n"
- │ │ ├── closing_loc: (14,0)-(14,0) = "E\n"
- │ │ └── unescaped: "x\ny\n"
+ │ │ ├── parts: (length: 2)
+ │ │ │ ├── @ StringNode (location: (12,0)-(12,0))
+ │ │ │ │ ├── flags: ∅
+ │ │ │ │ ├── opening_loc: ∅
+ │ │ │ │ ├── content_loc: (12,0)-(12,0) = "\tx\n"
+ │ │ │ │ ├── closing_loc: ∅
+ │ │ │ │ └── unescaped: "x\n"
+ │ │ │ └── @ StringNode (location: (13,0)-(13,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (13,0)-(13,0) = " y\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "y\n"
+ │ │ └── closing_loc: (14,0)-(14,0) = "E\n"
│ ├── closing_loc: ∅
│ ├── block: ∅
│ ├── flags: ∅
@@ -113,12 +123,22 @@
│ ├── arguments:
│ │ @ ArgumentsNode (location: (16,2)-(16,6))
│ │ └── arguments: (length: 1)
- │ │ └── @ StringNode (location: (16,2)-(16,6))
- │ │ ├── flags: ∅
+ │ │ └── @ InterpolatedStringNode (location: (16,2)-(16,6))
│ │ ├── opening_loc: (16,2)-(16,6) = "<<~E"
- │ │ ├── content_loc: (17,0)-(18,0) = "\tx\n y\n"
- │ │ ├── closing_loc: (19,0)-(19,0) = "E\n"
- │ │ └── unescaped: "\tx\ny\n"
+ │ │ ├── parts: (length: 2)
+ │ │ │ ├── @ StringNode (location: (17,0)-(17,0))
+ │ │ │ │ ├── flags: ∅
+ │ │ │ │ ├── opening_loc: ∅
+ │ │ │ │ ├── content_loc: (17,0)-(17,0) = "\tx\n"
+ │ │ │ │ ├── closing_loc: ∅
+ │ │ │ │ └── unescaped: "\tx\n"
+ │ │ │ └── @ StringNode (location: (18,0)-(18,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (18,0)-(18,0) = " y\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "y\n"
+ │ │ └── closing_loc: (19,0)-(19,0) = "E\n"
│ ├── closing_loc: ∅
│ ├── block: ∅
│ ├── flags: ∅
@@ -131,12 +151,22 @@
│ ├── arguments:
│ │ @ ArgumentsNode (location: (21,2)-(21,6))
│ │ └── arguments: (length: 1)
- │ │ └── @ StringNode (location: (21,2)-(21,6))
- │ │ ├── flags: ∅
+ │ │ └── @ InterpolatedStringNode (location: (21,2)-(21,6))
│ │ ├── opening_loc: (21,2)-(21,6) = "<<~E"
- │ │ ├── content_loc: (22,0)-(23,0) = " \tx\n y\n"
- │ │ ├── closing_loc: (24,0)-(24,0) = "E\n"
- │ │ └── unescaped: "x\ny\n"
+ │ │ ├── parts: (length: 2)
+ │ │ │ ├── @ StringNode (location: (22,0)-(22,0))
+ │ │ │ │ ├── flags: ∅
+ │ │ │ │ ├── opening_loc: ∅
+ │ │ │ │ ├── content_loc: (22,0)-(22,0) = " \tx\n"
+ │ │ │ │ ├── closing_loc: ∅
+ │ │ │ │ └── unescaped: "x\n"
+ │ │ │ └── @ StringNode (location: (23,0)-(23,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (23,0)-(23,0) = " y\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "y\n"
+ │ │ └── closing_loc: (24,0)-(24,0) = "E\n"
│ ├── closing_loc: ∅
│ ├── block: ∅
│ ├── flags: ∅
@@ -149,12 +179,22 @@
│ ├── arguments:
│ │ @ ArgumentsNode (location: (26,2)-(26,6))
│ │ └── arguments: (length: 1)
- │ │ └── @ StringNode (location: (26,2)-(26,6))
- │ │ ├── flags: ∅
+ │ │ └── @ InterpolatedStringNode (location: (26,2)-(26,6))
│ │ ├── opening_loc: (26,2)-(26,6) = "<<~E"
- │ │ ├── content_loc: (27,0)-(28,0) = " \tx\n\ty\n"
- │ │ ├── closing_loc: (29,0)-(29,0) = "E\n"
- │ │ └── unescaped: "\tx\ny\n"
+ │ │ ├── parts: (length: 2)
+ │ │ │ ├── @ StringNode (location: (27,0)-(27,0))
+ │ │ │ │ ├── flags: ∅
+ │ │ │ │ ├── opening_loc: ∅
+ │ │ │ │ ├── content_loc: (27,0)-(27,0) = " \tx\n"
+ │ │ │ │ ├── closing_loc: ∅
+ │ │ │ │ └── unescaped: "\tx\n"
+ │ │ │ └── @ StringNode (location: (28,0)-(28,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (28,0)-(28,0) = "\ty\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "y\n"
+ │ │ └── closing_loc: (29,0)-(29,0) = "E\n"
│ ├── closing_loc: ∅
│ ├── block: ∅
│ ├── flags: ∅
@@ -167,12 +207,22 @@
│ ├── arguments:
│ │ @ ArgumentsNode (location: (31,2)-(31,6))
│ │ └── arguments: (length: 1)
- │ │ └── @ StringNode (location: (31,2)-(31,6))
- │ │ ├── flags: ∅
+ │ │ └── @ InterpolatedStringNode (location: (31,2)-(31,6))
│ │ ├── opening_loc: (31,2)-(31,6) = "<<~E"
- │ │ ├── content_loc: (32,0)-(33,0) = " x\n \\\ty\n"
- │ │ ├── closing_loc: (34,0)-(34,0) = "E\n"
- │ │ └── unescaped: " x\n\ty\n"
+ │ │ ├── parts: (length: 2)
+ │ │ │ ├── @ StringNode (location: (32,0)-(32,0))
+ │ │ │ │ ├── flags: ∅
+ │ │ │ │ ├── opening_loc: ∅
+ │ │ │ │ ├── content_loc: (32,0)-(32,0) = " x\n"
+ │ │ │ │ ├── closing_loc: ∅
+ │ │ │ │ └── unescaped: " x\n"
+ │ │ │ └── @ StringNode (location: (33,0)-(33,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (33,0)-(33,0) = " \\\ty\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "\ty\n"
+ │ │ └── closing_loc: (34,0)-(34,0) = "E\n"
│ ├── closing_loc: ∅
│ ├── block: ∅
│ ├── flags: ∅
@@ -185,12 +235,22 @@
│ ├── arguments:
│ │ @ ArgumentsNode (location: (36,2)-(36,6))
│ │ └── arguments: (length: 1)
- │ │ └── @ StringNode (location: (36,2)-(36,6))
- │ │ ├── flags: ∅
+ │ │ └── @ InterpolatedStringNode (location: (36,2)-(36,6))
│ │ ├── opening_loc: (36,2)-(36,6) = "<<~E"
- │ │ ├── content_loc: (37,0)-(38,0) = " x\n \\ y\n"
- │ │ ├── closing_loc: (39,0)-(39,0) = "E\n"
- │ │ └── unescaped: " x\n y\n"
+ │ │ ├── parts: (length: 2)
+ │ │ │ ├── @ StringNode (location: (37,0)-(37,0))
+ │ │ │ │ ├── flags: ∅
+ │ │ │ │ ├── opening_loc: ∅
+ │ │ │ │ ├── content_loc: (37,0)-(37,0) = " x\n"
+ │ │ │ │ ├── closing_loc: ∅
+ │ │ │ │ └── unescaped: " x\n"
+ │ │ │ └── @ StringNode (location: (38,0)-(38,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (38,0)-(38,0) = " \\ y\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: " y\n"
+ │ │ └── closing_loc: (39,0)-(39,0) = "E\n"
│ ├── closing_loc: ∅
│ ├── block: ∅
│ ├── flags: ∅
@@ -221,12 +281,28 @@
│ ├── arguments:
│ │ @ ArgumentsNode (location: (44,2)-(44,6))
│ │ └── arguments: (length: 1)
- │ │ └── @ StringNode (location: (44,2)-(44,6))
- │ │ ├── flags: ∅
+ │ │ └── @ InterpolatedStringNode (location: (44,2)-(44,6))
│ │ ├── opening_loc: (44,2)-(44,6) = "<<~E"
- │ │ ├── content_loc: (45,0)-(47,0) = " x\n\ny\n"
- │ │ ├── closing_loc: (48,0)-(48,0) = "E\n"
- │ │ └── unescaped: " x\n\ny\n"
+ │ │ ├── parts: (length: 3)
+ │ │ │ ├── @ StringNode (location: (45,0)-(45,0))
+ │ │ │ │ ├── flags: ∅
+ │ │ │ │ ├── opening_loc: ∅
+ │ │ │ │ ├── content_loc: (45,0)-(45,0) = " x\n"
+ │ │ │ │ ├── closing_loc: ∅
+ │ │ │ │ └── unescaped: " x\n"
+ │ │ │ ├── @ StringNode (location: (46,0)-(46,0))
+ │ │ │ │ ├── flags: ∅
+ │ │ │ │ ├── opening_loc: ∅
+ │ │ │ │ ├── content_loc: (46,0)-(46,0) = "\n"
+ │ │ │ │ ├── closing_loc: ∅
+ │ │ │ │ └── unescaped: "\n"
+ │ │ │ └── @ StringNode (location: (47,0)-(47,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (47,0)-(47,0) = "y\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "y\n"
+ │ │ └── closing_loc: (48,0)-(48,0) = "E\n"
│ ├── closing_loc: ∅
│ ├── block: ∅
│ ├── flags: ∅
@@ -239,12 +315,28 @@
│ ├── arguments:
│ │ @ ArgumentsNode (location: (50,2)-(50,6))
│ │ └── arguments: (length: 1)
- │ │ └── @ StringNode (location: (50,2)-(50,6))
- │ │ ├── flags: ∅
+ │ │ └── @ InterpolatedStringNode (location: (50,2)-(50,6))
│ │ ├── opening_loc: (50,2)-(50,6) = "<<~E"
- │ │ ├── content_loc: (51,0)-(53,0) = " x\n \n y\n"
- │ │ ├── closing_loc: (54,0)-(54,0) = "E\n"
- │ │ └── unescaped: "x\n \ny\n"
+ │ │ ├── parts: (length: 3)
+ │ │ │ ├── @ StringNode (location: (51,0)-(51,0))
+ │ │ │ │ ├── flags: ∅
+ │ │ │ │ ├── opening_loc: ∅
+ │ │ │ │ ├── content_loc: (51,0)-(51,0) = " x\n"
+ │ │ │ │ ├── closing_loc: ∅
+ │ │ │ │ └── unescaped: "x\n"
+ │ │ │ ├── @ StringNode (location: (52,0)-(52,0))
+ │ │ │ │ ├── flags: ∅
+ │ │ │ │ ├── opening_loc: ∅
+ │ │ │ │ ├── content_loc: (52,0)-(52,0) = " \n"
+ │ │ │ │ ├── closing_loc: ∅
+ │ │ │ │ └── unescaped: " \n"
+ │ │ │ └── @ StringNode (location: (53,0)-(53,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (53,0)-(53,0) = " y\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "y\n"
+ │ │ └── closing_loc: (54,0)-(54,0) = "E\n"
│ ├── closing_loc: ∅
│ ├── block: ∅
│ ├── flags: ∅
@@ -257,12 +349,22 @@
│ ├── arguments:
│ │ @ ArgumentsNode (location: (56,2)-(56,6))
│ │ └── arguments: (length: 1)
- │ │ └── @ StringNode (location: (56,2)-(56,6))
- │ │ ├── flags: ∅
+ │ │ └── @ InterpolatedStringNode (location: (56,2)-(56,6))
│ │ ├── opening_loc: (56,2)-(56,6) = "<<~E"
- │ │ ├── content_loc: (57,0)-(58,0) = " x\n y\n"
- │ │ ├── closing_loc: (59,0)-(59,0) = "E\n"
- │ │ └── unescaped: "x\n y\n"
+ │ │ ├── parts: (length: 2)
+ │ │ │ ├── @ StringNode (location: (57,0)-(57,0))
+ │ │ │ │ ├── flags: ∅
+ │ │ │ │ ├── opening_loc: ∅
+ │ │ │ │ ├── content_loc: (57,0)-(57,0) = " x\n"
+ │ │ │ │ ├── closing_loc: ∅
+ │ │ │ │ └── unescaped: "x\n"
+ │ │ │ └── @ StringNode (location: (58,0)-(58,0))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (58,0)-(58,0) = " y\n"
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: " y\n"
+ │ │ └── closing_loc: (59,0)-(59,0) = "E\n"
│ ├── closing_loc: ∅
│ ├── block: ∅
│ ├── flags: ∅
@@ -332,10 +434,10 @@
│ └── @ InterpolatedXStringNode (location: (72,2)-(72,8))
│ ├── opening_loc: (72,2)-(72,8) = "<<~`E`"
│ ├── parts: (length: 3)
- │ │ ├── @ StringNode (location: (73,0)-(74,2))
+ │ │ ├── @ StringNode (location: (73,0)-(73,0))
│ │ │ ├── flags: ∅
│ │ │ ├── opening_loc: ∅
- │ │ │ ├── content_loc: (73,0)-(74,2) = " x\n "
+ │ │ │ ├── content_loc: (73,0)-(73,0) = " x\n"
│ │ │ ├── closing_loc: ∅
│ │ │ └── unescaped: " x\n"
│ │ ├── @ EmbeddedStatementsNode (location: (74,2)-(74,8))
diff --git a/test/prism/snapshots/whitequark/dedenting_interpolating_heredoc_fake_line_continuation.txt b/test/prism/snapshots/whitequark/dedenting_interpolating_heredoc_fake_line_continuation.txt
index ac083f3edc..aa9b58063c 100644
--- a/test/prism/snapshots/whitequark/dedenting_interpolating_heredoc_fake_line_continuation.txt
+++ b/test/prism/snapshots/whitequark/dedenting_interpolating_heredoc_fake_line_continuation.txt
@@ -3,9 +3,19 @@
└── statements:
@ StatementsNode (location: (1,0)-(1,8))
└── body: (length: 1)
- └── @ StringNode (location: (1,0)-(1,8))
- ├── flags: ∅
+ └── @ InterpolatedStringNode (location: (1,0)-(1,8))
├── opening_loc: (1,0)-(1,8) = "<<~'FOO'"
- ├── content_loc: (2,0)-(3,0) = " baz\\\\\n qux\n"
- ├── closing_loc: (4,0)-(4,0) = "FOO\n"
- └── unescaped: "baz\\\nqux\n"
+ ├── parts: (length: 2)
+ │ ├── @ StringNode (location: (2,0)-(2,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (2,0)-(2,0) = " baz\\\\\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "baz\\\\\n"
+ │ └── @ StringNode (location: (3,0)-(3,0))
+ │ ├── flags: ∅
+ │ ├── opening_loc: ∅
+ │ ├── content_loc: (3,0)-(3,0) = " qux\n"
+ │ ├── closing_loc: ∅
+ │ └── unescaped: "qux\n"
+ └── closing_loc: (4,0)-(4,0) = "FOO\n"
diff --git a/test/prism/snapshots/whitequark/dedenting_non_interpolating_heredoc_line_continuation.txt b/test/prism/snapshots/whitequark/dedenting_non_interpolating_heredoc_line_continuation.txt
index 6d123a3387..5f2502dac8 100644
--- a/test/prism/snapshots/whitequark/dedenting_non_interpolating_heredoc_line_continuation.txt
+++ b/test/prism/snapshots/whitequark/dedenting_non_interpolating_heredoc_line_continuation.txt
@@ -3,9 +3,19 @@
└── statements:
@ StatementsNode (location: (1,0)-(1,8))
└── body: (length: 1)
- └── @ StringNode (location: (1,0)-(1,8))
- ├── flags: ∅
+ └── @ InterpolatedStringNode (location: (1,0)-(1,8))
├── opening_loc: (1,0)-(1,8) = "<<~'FOO'"
- ├── content_loc: (2,0)-(3,0) = " baz\\\n qux\n"
- ├── closing_loc: (4,0)-(4,0) = "FOO\n"
- └── unescaped: "baz\\\nqux\n"
+ ├── parts: (length: 2)
+ │ ├── @ StringNode (location: (2,0)-(2,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (2,0)-(2,0) = " baz\\\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "baz\\\n"
+ │ └── @ StringNode (location: (3,0)-(3,0))
+ │ ├── flags: ∅
+ │ ├── opening_loc: ∅
+ │ ├── content_loc: (3,0)-(3,0) = " qux\n"
+ │ ├── closing_loc: ∅
+ │ └── unescaped: "qux\n"
+ └── closing_loc: (4,0)-(4,0) = "FOO\n"
diff --git a/test/prism/snapshots/whitequark/parser_bug_640.txt b/test/prism/snapshots/whitequark/parser_bug_640.txt
index 3ddfb52d98..1363dabe3b 100644
--- a/test/prism/snapshots/whitequark/parser_bug_640.txt
+++ b/test/prism/snapshots/whitequark/parser_bug_640.txt
@@ -8,4 +8,4 @@
├── opening_loc: (1,0)-(1,6) = "<<~FOO"
├── content_loc: (2,0)-(3,0) = " baz\\\n qux\n"
├── closing_loc: (4,0)-(4,0) = "FOO\n"
- └── unescaped: "bazqux\n"
+ └── unescaped: "baz qux\n"
diff --git a/test/prism/snapshots/whitequark/ruby_bug_11989.txt b/test/prism/snapshots/whitequark/ruby_bug_11989.txt
index 27ec4058af..2d56025693 100644
--- a/test/prism/snapshots/whitequark/ruby_bug_11989.txt
+++ b/test/prism/snapshots/whitequark/ruby_bug_11989.txt
@@ -16,7 +16,7 @@
│ ├── opening_loc: (1,2)-(1,8) = "<<~\"E\""
│ ├── content_loc: (2,0)-(2,0) = " x\\n y\n"
│ ├── closing_loc: (3,0)-(3,0) = "E\n"
- │ └── unescaped: "x\n y\n"
+ │ └── unescaped: "x\n y\n"
├── closing_loc: ∅
├── block: ∅
├── flags: ∅
diff --git a/test/prism/snapshots/whitequark/slash_newline_in_heredocs.txt b/test/prism/snapshots/whitequark/slash_newline_in_heredocs.txt
index 2a63c8cb0b..f7a249946a 100644
--- a/test/prism/snapshots/whitequark/slash_newline_in_heredocs.txt
+++ b/test/prism/snapshots/whitequark/slash_newline_in_heredocs.txt
@@ -9,9 +9,19 @@
│ ├── content_loc: (2,0)-(4,0) = " 1 \\\n 2\n 3\n"
│ ├── closing_loc: (5,0)-(5,0) = "E\n"
│ └── unescaped: " 1 2\n 3\n"
- └── @ StringNode (location: (8,0)-(8,4))
- ├── flags: ∅
+ └── @ InterpolatedStringNode (location: (8,0)-(8,4))
├── opening_loc: (8,0)-(8,4) = "<<~E"
- ├── content_loc: (9,0)-(11,0) = " 1 \\\n 2\n 3\n"
- ├── closing_loc: (12,0)-(12,0) = "E\n"
- └── unescaped: "1 2\n3\n"
+ ├── parts: (length: 2)
+ │ ├── @ StringNode (location: (9,0)-(10,0))
+ │ │ ├── flags: ∅
+ │ │ ├── opening_loc: ∅
+ │ │ ├── content_loc: (9,0)-(10,0) = " 1 \\\n 2\n"
+ │ │ ├── closing_loc: ∅
+ │ │ └── unescaped: "1 2\n"
+ │ └── @ StringNode (location: (11,0)-(11,0))
+ │ ├── flags: ∅
+ │ ├── opening_loc: ∅
+ │ ├── content_loc: (11,0)-(11,0) = " 3\n"
+ │ ├── closing_loc: ∅
+ │ └── unescaped: "3\n"
+ └── closing_loc: (12,0)-(12,0) = "E\n"
diff --git a/test/prism/unescape_test.rb b/test/prism/unescape_test.rb
index de4d1bf1b9..2e7e9fcd3e 100644
--- a/test/prism/unescape_test.rb
+++ b/test/prism/unescape_test.rb
@@ -67,6 +67,20 @@ module Prism
def prism_result(escape) = prism(escape, &:unescaped)
end
+ class Heredoc < Base
+ def ruby_result(escape) = ruby(escape, &:itself)
+ def prism_result(escape)
+ prism(escape) do |node|
+ case node.type
+ when :interpolated_string_node, :interpolated_x_string_node
+ node.parts.flat_map(&:unescaped).join
+ else
+ node.unescaped
+ end
+ end
+ end
+ end
+
class RegExp < Base
def ruby_result(escape) = ruby(escape, &:source)
def prism_result(escape) = prism(escape, &:unescaped)
@@ -94,30 +108,30 @@ module Prism
escapes = [*ascii, *ascii8, *newlines, *octal, *hex2, *hex4, *hex6, *ctrls]
contexts = [
- [Context::String.new("?", ""), escapes],
- [Context::String.new("'", "'"), escapes],
- [Context::String.new("\"", "\""), escapes],
- [Context::String.new("%q[", "]"), escapes],
- [Context::String.new("%Q[", "]"), escapes],
- [Context::String.new("%[", "]"), escapes],
- [Context::String.new("`", "`"), escapes],
- [Context::String.new("%x[", "]"), escapes],
- [Context::String.new("<<H\n", "\nH"), escapes],
- [Context::String.new("<<'H'\n", "\nH"), escapes],
- [Context::String.new("<<\"H\"\n", "\nH"), escapes],
- [Context::String.new("<<`H`\n", "\nH"), escapes],
+ [Context::String.new("?", ""), escapes],
+ [Context::String.new("'", "'"), escapes],
+ [Context::String.new("\"", "\""), escapes],
+ [Context::String.new("%q[", "]"), escapes],
+ [Context::String.new("%Q[", "]"), escapes],
+ [Context::String.new("%[", "]"), escapes],
+ [Context::String.new("`", "`"), escapes],
+ [Context::String.new("%x[", "]"), escapes],
+ [Context::String.new("<<H\n", "\nH"), escapes],
+ [Context::String.new("<<'H'\n", "\nH"), escapes],
+ [Context::String.new("<<\"H\"\n", "\nH"), escapes],
+ [Context::String.new("<<`H`\n", "\nH"), escapes],
[Context::String.new("<<-H\n", "\nH"), escapes],
[Context::String.new("<<-'H'\n", "\nH"), escapes],
[Context::String.new("<<-\"H\"\n", "\nH"), escapes],
[Context::String.new("<<-`H`\n", "\nH"), escapes],
- # [Context::String.new("<<~H\n", "\nH"), escapes],
- # [Context::String.new("<<~'H'\n", "\nH"), escapes],
- # [Context::String.new("<<~\"H\"\n", "\nH"), escapes],
- # [Context::String.new("<<~`H`\n", "\nH"), escapes],
- [Context::List.new("%w[", "]"), escapes],
- [Context::List.new("%W[", "]"), escapes],
- [Context::List.new("%i[", "]"), escapes],
- [Context::List.new("%I[", "]"), escapes],
+ [Context::Heredoc.new("<<~H\n", "\nH"), escapes],
+ [Context::Heredoc.new("<<~'H'\n", "\nH"), escapes],
+ [Context::Heredoc.new("<<~\"H\"\n", "\nH"), escapes],
+ [Context::Heredoc.new("<<~`H`\n", "\nH"), escapes],
+ [Context::List.new("%w[", "]"), escapes],
+ [Context::List.new("%W[", "]"), escapes],
+ [Context::List.new("%i[", "]"), escapes],
+ [Context::List.new("%I[", "]"), escapes],
# [Context::Symbol.new("%s[", "]"), escapes],
# [Context::Symbol.new(":'", "'"), escapes],
# [Context::Symbol.new(":\"", "\""), escapes],