Parse deprecated interpolation syntax differently

This commit is contained in:
Richard Feldman 2024-01-06 17:41:03 -05:00
parent 7189104df8
commit 8ea38d3a04
No known key found for this signature in database
GPG key ID: F1F21AA5B1D9E43B
9 changed files with 51 additions and 15 deletions

View file

@ -974,7 +974,7 @@ fn to_str_report<'a>(
suggestion("An escaped quote: ", "\\\""),
suggestion("An escaped backslash: ", "\\\\"),
suggestion("A unicode code point: ", "\\u(00FF)"),
suggestion("An interpolated string: ", "\$(myVariable)"),
suggestion("An interpolated string: ", "$(myVariable)"),
])
.indent(4),
]);
@ -1021,7 +1021,7 @@ fn to_str_report<'a>(
alloc.region_with_subregion(lines.convert_region(surroundings), region),
alloc.concat([
alloc.reflow(r"You could change it to something like "),
alloc.parser_suggestion("\"The count is \$(count\\)\""),
alloc.parser_suggestion("\"The count is $(count)\""),
alloc.reflow("."),
]),
]);
@ -1099,7 +1099,7 @@ fn to_str_report<'a>(
alloc.stack([
alloc.concat([
alloc.reflow("I am part way through parsing this scalar literal (character literal), "),
alloc.reflow("but I encountered a string interpolation like \"\$(this)\", which is not "),
alloc.reflow("but I encountered a string interpolation like \"$(this)\", which is not "),
alloc.reflow("allowed in scalar literals."),
]),
alloc.region_with_subregion(lines.convert_region(surroundings), region),