Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3145,6 +3145,7 @@ nodes:
- EmbeddedStatementsNode
- EmbeddedVariableNode
- InterpolatedStringNode # `"a" "#{b}"`
- on error: XStringNode # `<<`FOO` "bar"
- name: closing_loc
type: location?
newline: parts
Expand Down
10 changes: 10 additions & 0 deletions src/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -5328,6 +5328,12 @@ pm_interpolated_string_node_append(pm_interpolated_string_node_t *node, pm_node_
// should clear the mutability flags.
CLEAR_FLAGS(node);
break;
case PM_X_STRING_NODE:
case PM_INTERPOLATED_X_STRING_NODE:
// If this is an x string, then this is a syntax error. But we want
// to handle it here so that we don't fail the assertion.
CLEAR_FLAGS(node);
break;
default:
assert(false && "unexpected node type");
break;
Expand Down Expand Up @@ -16828,6 +16834,10 @@ parse_strings(pm_parser_t *parser, pm_node_t *current, bool accepts_label, uint1
// If we haven't already created our container for concatenation,
// we'll do that now.
if (!concating) {
if (!PM_NODE_TYPE_P(current, PM_STRING_NODE) && !PM_NODE_TYPE_P(current, PM_INTERPOLATED_STRING_NODE)) {
pm_parser_err_node(parser, current, PM_ERR_STRING_CONCATENATION);
}

concating = true;
pm_token_t bounds = not_provided(parser);

Expand Down
5 changes: 5 additions & 0 deletions test/prism/errors/xstring_concat.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<<`EOC` "bar"
^~~~~~~ expected a string for concatenation
echo foo
EOC

Loading