Skip to content

Commit e3e2b1e

Browse files
committed
Fix label interpolated string
1 parent c2dfb8e commit e3e2b1e

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3306,6 +3306,9 @@ nodes:
33063306
- EmbeddedVariableNode
33073307
- InterpolatedStringNode # `"a" "#{b}"`
33083308
- on error: XStringNode # `<<`FOO` "bar"
3309+
- on error: InterpolatedXStringNode
3310+
- on error: SymbolNode
3311+
- on error: InterpolatedSymbolNode
33093312
- name: closing_loc
33103313
type: location?
33113314
newline: parts

src/prism.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5344,8 +5344,10 @@ pm_interpolated_string_node_append(pm_interpolated_string_node_t *node, pm_node_
53445344
break;
53455345
case PM_X_STRING_NODE:
53465346
case PM_INTERPOLATED_X_STRING_NODE:
5347-
// If this is an x string, then this is a syntax error. But we want
5348-
// to handle it here so that we don't fail the assertion.
5347+
case PM_SYMBOL_NODE:
5348+
case PM_INTERPOLATED_SYMBOL_NODE:
5349+
// These will only happen in error cases. But we want to handle it
5350+
// here so that we don't fail the assertion.
53495351
CLEAR_FLAGS(node);
53505352
break;
53515353
default:
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
case in el""Q
2+
^~~~ expected a predicate for a case matching statement
3+
^ expected a delimiter after the patterns of an `in` clause
4+
^ unexpected constant, expecting end-of-input
5+
!"""#{in el"":Q
6+
^~ unexpected 'in', assuming it is closing the parent 'in' clause
7+
^ expected a `}` to close the embedded expression
8+
^~ cannot parse the string part
9+
^~ cannot parse the string part
10+
^ cannot parse the string part
11+
^~~~~~~~~~~ unexpected label
12+
^~~~~~~~~~~ expected a string for concatenation
13+
^ expected an `end` to close the `case` statement
14+

0 commit comments

Comments
 (0)