From 29c5b851281da753ea0ae204afbd3f9010b466bc Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Sun, 27 Aug 2023 16:40:18 -0400 Subject: [ruby/yarp] fix: %i list spanning a heredoc The fix here is similar to what we did in a previous commit for %w, to accept two consecutive string tokens without a separator. https://github.com/ruby/yarp/commit/f869fbdbe5 --- test/yarp/fixtures/spanning_heredoc.txt | 6 ++++++ test/yarp/snapshots/spanning_heredoc.txt | 27 +++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/yarp/fixtures/spanning_heredoc.txt b/test/yarp/fixtures/spanning_heredoc.txt index a81731a181..c1852e377a 100644 --- a/test/yarp/fixtures/spanning_heredoc.txt +++ b/test/yarp/fixtures/spanning_heredoc.txt @@ -36,3 +36,9 @@ pp <<-A, %W[l\ k A l] + +# ripper can't parse this successfully, though ruby runs it correctly +pp <<-A, %i[n\ +m +A +n] diff --git a/test/yarp/snapshots/spanning_heredoc.txt b/test/yarp/snapshots/spanning_heredoc.txt index a0f58a97bf..3d223e5e4d 100644 --- a/test/yarp/snapshots/spanning_heredoc.txt +++ b/test/yarp/snapshots/spanning_heredoc.txt @@ -1,6 +1,6 @@ -ProgramNode(164...709)( +ProgramNode(164...802)( [], - StatementsNode(164...709)( + StatementsNode(164...802)( [CallNode(164...192)( nil, nil, @@ -160,6 +160,29 @@ ProgramNode(164...709)( nil, 0, "pp" + ), + CallNode(781...802)( + nil, + nil, + (781...783), + nil, + ArgumentsNode(784...802)( + [InterpolatedStringNode(784...788)( + (784...788), + [StringNode(796...798)(nil, (796...798), nil, "m\n")], + (798...800) + ), + ArrayNode(790...802)( + [SymbolNode(793...796)(nil, (793...796), nil, "n\\\n"), + SymbolNode(800...801)(nil, (800...801), nil, "n")], + (790...793), + (801...802) + )] + ), + nil, + nil, + 0, + "pp" )] ) ) -- cgit v1.2.3