Reformatting a string containing both single and double quotes breaks down #4838
Closed
2 tasks done
Labels
bug
Invalid compiler output or panic
What happened?
If you use
prqlc fmt
on a triple-quoted string, typically it strips the triple-quotes and gives back a string with escape sequences for things like newlines.formats to
let foo = "first\nsecond"
.If you also include a set of double quotes in the triple-quoted string, the formatting output quotes the string in single quotes.
formats to
let foo = 'first\nand "second" here'
But if you include both single and double quotes in the triple-quoted string, the formatting output goes off the rails, using two double quotes to quote the string:
formats to
let foo = ""first's\nand "second" here""
-- which is invalid PRQL.This is also not limited to triple-quoted string input -- if you try to format an escaped version of the string, you get the same output.
also formats to
let foo = ""first's\nand "second" here""
.Perhaps
prqlc fmt
should emit triple-quoted strings when both single and double quotes are in the string?PRQL input
SQL output
Expected SQL output
MVCE confirmation
Anything else?
No response
The text was updated successfully, but these errors were encountered: