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
3 changes: 3 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3306,6 +3306,9 @@ nodes:
- EmbeddedVariableNode
- InterpolatedStringNode # `"a" "#{b}"`
- on error: XStringNode # `<<`FOO` "bar"
- on error: InterpolatedXStringNode
- on error: SymbolNode
- on error: InterpolatedSymbolNode
- name: closing_loc
type: location?
newline: parts
Expand Down
6 changes: 4 additions & 2 deletions src/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -5344,8 +5344,10 @@ pm_interpolated_string_node_append(pm_interpolated_string_node_t *node, pm_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.
case PM_SYMBOL_NODE:
case PM_INTERPOLATED_SYMBOL_NODE:
// These will only happen in error cases. But we want to handle it
// here so that we don't fail the assertion.
CLEAR_FLAGS(node);
break;
default:
Expand Down
14 changes: 14 additions & 0 deletions test/prism/errors/label_in_interpolated_string.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
case in el""Q
^~~~ expected a predicate for a case matching statement
^ expected a delimiter after the patterns of an `in` clause
^ unexpected constant, expecting end-of-input
!"""#{in el"":Q
^~ unexpected 'in', assuming it is closing the parent 'in' clause
^ expected a `}` to close the embedded expression
^~ cannot parse the string part
^~ cannot parse the string part
^ cannot parse the string part
^~~~~~~~~~~ unexpected label
^~~~~~~~~~~ expected a string for concatenation
^ expected an `end` to close the `case` statement