-
Notifications
You must be signed in to change notification settings - Fork 174
Open
Description
I think this is like #2842, but with more line continuations:
description = <<~EOS
This line\
\
Another line.
Extra rationale.
EOSbin/prism ripper gives:
Ripper:
[:program,
[:stmts_add,
[:stmts_new],
[:assign,
[:var_field, [:@ident, "description", [1, 0]]],
[:string_literal,
[:string_add,
[:string_add,
[:string_add, [:string_add, [:string_add, [:string_content], [:@tstring_content, "This line\\\n", [2, 2]]], [:@tstring_content, " \\\n", [3, 0]]], [:@tstring_content, "Another line.\n", [4, 2]]],
[:@tstring_content, "\n", [5, 0]]],
[:@tstring_content, "Extra rationale.\n", [6, 2]]]]]]]
Prism:
[:program,
[:stmts_add,
[:stmts_new],
[:assign,
[:var_field, [:@ident, "description", [1, 0]]],
[:string_literal,
[:string_add,
[:string_add, [:string_add, [:string_add, [:string_content], [:@tstring_content, " This line\\\n", [2, 0]]], [:@tstring_content, "Another line.\n", [4, 2]]], [:@tstring_content, "\n", [5, 0]]],
[:@tstring_content, "Extra rationale.\n", [6, 2]]]]]]]
Output is not identical
The second line continuation is nowhere to be found in the prism output. I'm not sure how deeply you care about this, given that the ultimate output is unchanged, but it was a little surprising that the parse tree didn't really correspond to the source for this bit.
Found while debugging fables-tables/rubyfmt#772. (cc @reese)
Metadata
Metadata
Assignees
Labels
No labels