mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 04:08:19 +00:00
Parse deprecated interpolation syntax differently
This commit is contained in:
parent
08ab7996a0
commit
af8e9c7292
7 changed files with 47 additions and 11 deletions
|
@ -612,9 +612,20 @@ fn format_str_segment(seg: &StrSegment, buf: &mut Buf, indent: u16) {
|
|||
buf.push('\\');
|
||||
buf.push(escaped.to_parsed_char());
|
||||
}
|
||||
Interpolated(loc_expr) => {
|
||||
DeprecatedInterpolated(loc_expr) => {
|
||||
buf.push_str("\\(");
|
||||
// e.g. (name) in "Hi, \(name)!"
|
||||
// e.g. (name) in "Hi, $(name)!"
|
||||
loc_expr.value.format_with_options(
|
||||
buf,
|
||||
Parens::NotNeeded, // We already printed parens!
|
||||
Newlines::No, // Interpolations can never have newlines
|
||||
indent,
|
||||
);
|
||||
buf.push(')');
|
||||
}
|
||||
Interpolated(loc_expr) => {
|
||||
buf.push_str("$(");
|
||||
// e.g. (name) in "Hi, $(name)!"
|
||||
loc_expr.value.format_with_options(
|
||||
buf,
|
||||
Parens::NotNeeded, // We already printed parens!
|
||||
|
|
|
@ -656,6 +656,9 @@ impl<'a> RemoveSpaces<'a> for StrSegment<'a> {
|
|||
StrSegment::Unicode(t) => StrSegment::Unicode(t.remove_spaces(arena)),
|
||||
StrSegment::EscapedChar(c) => StrSegment::EscapedChar(c),
|
||||
StrSegment::Interpolated(t) => StrSegment::Interpolated(t.remove_spaces(arena)),
|
||||
StrSegment::DeprecatedInterpolated(t) => {
|
||||
StrSegment::DeprecatedInterpolated(t.remove_spaces(arena))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue