From 56d2da9b98f762cfc049d807b6f7b045db86b5f3 Mon Sep 17 00:00:00 2001 From: Priit Haamer Date: Mon, 13 Oct 2025 18:42:54 +0300 Subject: [PATCH 1/2] fix: s-string escaping Fixes s-strings terminating when they contain double quote. --- prqlc/prqlc-parser/src/lexer/mod.rs | 4 +- prqlc/prqlc-parser/src/lexer/test.rs | 9 ++ prqlc/prqlc/src/codegen/ast.rs | 11 +- .../queries/sstring_escaped_quotes.prql | 12 ++ ...ries__compile__sstring_escaped_quotes.snap | 23 ++++ ...s__compileall__sstring_escaped_quotes.snap | 58 +++++++++ ...debug_lineage__sstring_escaped_quotes.snap | 121 ++++++++++++++++++ ..._queries__fmt__sstring_escaped_quotes.snap | 15 +++ ..._queries__lex__sstring_escaped_quotes.snap | 45 +++++++ ...ries__results__sstring_escaped_quotes.snap | 7 + 10 files changed, 301 insertions(+), 4 deletions(-) create mode 100644 prqlc/prqlc/tests/integration/queries/sstring_escaped_quotes.prql create mode 100644 prqlc/prqlc/tests/integration/snapshots/integration__queries__compile__sstring_escaped_quotes.snap create mode 100644 prqlc/prqlc/tests/integration/snapshots/integration__queries__compileall__sstring_escaped_quotes.snap create mode 100644 prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__sstring_escaped_quotes.snap create mode 100644 prqlc/prqlc/tests/integration/snapshots/integration__queries__fmt__sstring_escaped_quotes.snap create mode 100644 prqlc/prqlc/tests/integration/snapshots/integration__queries__lex__sstring_escaped_quotes.snap create mode 100644 prqlc/prqlc/tests/integration/snapshots/integration__queries__results__sstring_escaped_quotes.snap diff --git a/prqlc/prqlc-parser/src/lexer/mod.rs b/prqlc/prqlc-parser/src/lexer/mod.rs index b59753d8ceaa..9acc5c2700e1 100644 --- a/prqlc/prqlc-parser/src/lexer/mod.rs +++ b/prqlc/prqlc-parser/src/lexer/mod.rs @@ -222,7 +222,7 @@ fn param<'a>() -> impl Parser<'a, ParserInput<'a>, TokenKind, ParserError<'a>> { fn interpolation<'a>() -> impl Parser<'a, ParserInput<'a>, TokenKind, ParserError<'a>> { // For s-strings and f-strings, use the same multi-quote string parser - // No escaping for interpolated strings + // Enable escaping so that `\"` in the source becomes a literal `"` in the string // // NOTE: Known limitation in error reporting for unclosed interpolated strings: // When an f-string or s-string is unclosed (e.g., `f"{}`), the error is reported at the @@ -231,7 +231,7 @@ fn interpolation<'a>() -> impl Parser<'a, ParserInput<'a>, TokenKind, ParserErro // modifies error spans during error recovery, and there's no way to prevent this from // custom parsers. one_of("sf") - .then(quoted_string(false)) + .then(quoted_string(true)) .map(|(c, s)| TokenKind::Interpolation(c, s)) } diff --git a/prqlc/prqlc-parser/src/lexer/test.rs b/prqlc/prqlc-parser/src/lexer/test.rs index 6eb69616536f..59d909257dee 100644 --- a/prqlc/prqlc-parser/src/lexer/test.rs +++ b/prqlc/prqlc-parser/src/lexer/test.rs @@ -178,6 +178,15 @@ fn interpolated_strings() { ], ) "#); + + // Test s-string with escaped quotes (issue #5494 regression) + assert_debug_snapshot!(test_interpolation_tokens(r#"s"SELECT \"col1 foo\"""#), @r#" + Tokens( + [ + 0..22: Interpolation('s', "SELECT \"col1 foo\""), + ], + ) + "#); } #[test] diff --git a/prqlc/prqlc/src/codegen/ast.rs b/prqlc/prqlc/src/codegen/ast.rs index fee2eed058c9..48829e180f86 100644 --- a/prqlc/prqlc/src/codegen/ast.rs +++ b/prqlc/prqlc/src/codegen/ast.rs @@ -479,8 +479,15 @@ fn display_interpolation( r += "\""; for part in parts { match &part { - // We use double braces to escape braces - pr::InterpolateItem::String(s) => r += s.replace('{', "{{").replace('}', "}}").as_str(), + // We use double braces to escape braces and backslash-quote to escape quotes + pr::InterpolateItem::String(s) => { + r += s + .replace('\\', "\\\\") + .replace('"', "\\\"") + .replace('{', "{{") + .replace('}', "}}") + .as_str() + } pr::InterpolateItem::Expr { expr, .. } => { r += "{"; r += &expr.write(opt.clone())?; diff --git a/prqlc/prqlc/tests/integration/queries/sstring_escaped_quotes.prql b/prqlc/prqlc/tests/integration/queries/sstring_escaped_quotes.prql new file mode 100644 index 000000000000..5a2c2b0fb8fc --- /dev/null +++ b/prqlc/prqlc/tests/integration/queries/sstring_escaped_quotes.prql @@ -0,0 +1,12 @@ +# Test s-strings with escaped quotes (regression test for issue #5494) +let outputs_sql = ( + from s" + select 'a' as \"col1 foo\", 'b' as \"col2#bar\" + " +) + +from outputs_sql +select { + `col1 foo` = outputs_sql.`col1 foo`, + `col2#bar` = outputs_sql.`col2#bar` +} diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__compile__sstring_escaped_quotes.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__compile__sstring_escaped_quotes.snap new file mode 100644 index 000000000000..a60ad21b777d --- /dev/null +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__compile__sstring_escaped_quotes.snap @@ -0,0 +1,23 @@ +--- +source: prqlc/prqlc/tests/integration/queries.rs +expression: "# Test s-strings with escaped quotes (regression test for issue #5494)\nlet outputs_sql = (\n from s\"\n select 'a' as \\\"col1 foo\\\", 'b' as \\\"col2#bar\\\"\n \"\n)\n\nfrom outputs_sql\nselect {\n `col1 foo` = outputs_sql.`col1 foo`,\n `col2#bar` = outputs_sql.`col2#bar`\n}\n" +input_file: prqlc/prqlc/tests/integration/queries/sstring_escaped_quotes.prql +snapshot_kind: text +--- +WITH table_0 AS ( + SELECT + 'a' as "col1 foo", + 'b' as "col2#bar" +), +outputs_sql AS ( + SELECT + "col1 foo", + "col2#bar" + FROM + table_0 +) +SELECT + "col1 foo", + "col2#bar" +FROM + outputs_sql diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__compileall__sstring_escaped_quotes.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__compileall__sstring_escaped_quotes.snap new file mode 100644 index 000000000000..e782073a44b2 --- /dev/null +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__compileall__sstring_escaped_quotes.snap @@ -0,0 +1,58 @@ +--- +source: prqlc/prqlc/tests/integration/queries.rs +expression: "# Test s-strings with escaped quotes (regression test for issue #5494)\nlet outputs_sql = (\n from s\"\n select 'a' as \\\"col1 foo\\\", 'b' as \\\"col2#bar\\\"\n \"\n)\n\nfrom outputs_sql\nselect {\n `col1 foo` = outputs_sql.`col1 foo`,\n `col2#bar` = outputs_sql.`col2#bar`\n}\n" +input_file: prqlc/prqlc/tests/integration/queries/sstring_escaped_quotes.prql +snapshot_kind: text +--- +--- generic ++++ clickhouse +@@ -1,17 +1,17 @@ + WITH table_0 AS ( + SELECT + 'a' as "col1 foo", + 'b' as "col2#bar" + ), + outputs_sql AS ( + SELECT +- "col1 foo", +- "col2#bar" ++ `col1 foo`, ++ `col2#bar` + FROM + table_0 + ) + SELECT +- "col1 foo", +- "col2#bar" ++ `col1 foo`, ++ `col2#bar` + FROM + outputs_sql + + + + +--- generic ++++ mysql +@@ -1,17 +1,17 @@ + WITH table_0 AS ( + SELECT + 'a' as "col1 foo", + 'b' as "col2#bar" + ), + outputs_sql AS ( + SELECT +- "col1 foo", +- "col2#bar" ++ `col1 foo`, ++ `col2#bar` + FROM + table_0 + ) + SELECT +- "col1 foo", +- "col2#bar" ++ `col1 foo`, ++ `col2#bar` + FROM + outputs_sql diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__sstring_escaped_quotes.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__sstring_escaped_quotes.snap new file mode 100644 index 000000000000..982e6d102d23 --- /dev/null +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__sstring_escaped_quotes.snap @@ -0,0 +1,121 @@ +--- +source: prqlc/prqlc/tests/integration/queries.rs +expression: "# Test s-strings with escaped quotes (regression test for issue #5494)\nlet outputs_sql = (\n from s\"\n select 'a' as \\\"col1 foo\\\", 'b' as \\\"col2#bar\\\"\n \"\n)\n\nfrom outputs_sql\nselect {\n `col1 foo` = outputs_sql.`col1 foo`,\n `col2#bar` = outputs_sql.`col2#bar`\n}\n" +input_file: prqlc/prqlc/tests/integration/queries/sstring_escaped_quotes.prql +snapshot_kind: text +--- +frames: +- - 1:177-264 + - columns: + - !Single + name: + - col1 foo + target_id: 122 + target_name: null + - !Single + name: + - col2#bar + target_id: 123 + target_name: null + inputs: + - id: 120 + name: outputs_sql + table: + - outputs_sql +nodes: +- id: 120 + kind: Ident + span: 1:160-176 + ident: !Ident + - outputs_sql + parent: 125 +- id: 122 + kind: Ident + span: 1:201-223 + alias: col1 foo + ident: !Ident + - this + - outputs_sql + - col1 foo + targets: + - 120 + parent: 124 +- id: 123 + kind: Ident + span: 1:240-262 + alias: col2#bar + ident: !Ident + - this + - outputs_sql + - col2#bar + targets: + - 120 + parent: 124 +- id: 124 + kind: Tuple + span: 1:184-264 + children: + - 122 + - 123 + parent: 125 +- id: 125 + kind: 'TransformCall: Select' + span: 1:177-264 + children: + - 120 + - 124 +ast: + name: Project + stmts: + - VarDef: + kind: Let + name: outputs_sql + value: + FuncCall: + name: + Ident: + - from + span: 1:93-97 + args: + - SString: + - !String "\n select 'a' as \"col1 foo\", 'b' as \"col2#bar\"\n " + span: 1:98-156 + span: 1:89-158 + span: 1:0-158 + - VarDef: + kind: Main + name: main + value: + Pipeline: + exprs: + - FuncCall: + name: + Ident: + - from + span: 1:160-164 + args: + - Ident: + - outputs_sql + span: 1:165-176 + span: 1:160-176 + - FuncCall: + name: + Ident: + - select + span: 1:177-183 + args: + - Tuple: + - Ident: + - outputs_sql + - col1 foo + span: 1:201-223 + alias: col1 foo + - Ident: + - outputs_sql + - col2#bar + span: 1:240-262 + alias: col2#bar + span: 1:184-264 + span: 1:177-264 + span: 1:160-264 + span: 1:158-264 diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__fmt__sstring_escaped_quotes.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__fmt__sstring_escaped_quotes.snap new file mode 100644 index 000000000000..bd1cfd2eddf7 --- /dev/null +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__fmt__sstring_escaped_quotes.snap @@ -0,0 +1,15 @@ +--- +source: prqlc/prqlc/tests/integration/queries.rs +expression: "# Test s-strings with escaped quotes (regression test for issue #5494)\nlet outputs_sql = (\n from s\"\n select 'a' as \\\"col1 foo\\\", 'b' as \\\"col2#bar\\\"\n \"\n)\n\nfrom outputs_sql\nselect {\n `col1 foo` = outputs_sql.`col1 foo`,\n `col2#bar` = outputs_sql.`col2#bar`\n}\n" +input_file: prqlc/prqlc/tests/integration/queries/sstring_escaped_quotes.prql +snapshot_kind: text +--- +let outputs_sql = from s" + select 'a' as \"col1 foo\", 'b' as \"col2#bar\" + " + +from outputs_sql +select { + `col1 foo` = outputs_sql.`col1 foo`, + `col2#bar` = outputs_sql.`col2#bar`, +} diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__lex__sstring_escaped_quotes.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__lex__sstring_escaped_quotes.snap new file mode 100644 index 000000000000..27e6c8094de5 --- /dev/null +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__lex__sstring_escaped_quotes.snap @@ -0,0 +1,45 @@ +--- +source: prqlc/prqlc/tests/integration/queries.rs +expression: tokens +input_file: prqlc/prqlc/tests/integration/queries/sstring_escaped_quotes.prql +snapshot_kind: text +--- +Tokens( + [ + 0..0: Start, + 0..70: Comment(" Test s-strings with escaped quotes (regression test for issue #5494)"), + 70..71: NewLine, + 71..74: Keyword("let"), + 75..86: Ident("outputs_sql"), + 87..88: Control('='), + 89..90: Control('('), + 90..91: NewLine, + 93..97: Ident("from"), + 98..156: Interpolation('s', "\n select 'a' as \"col1 foo\", 'b' as \"col2#bar\"\n "), + 156..157: NewLine, + 157..158: Control(')'), + 158..159: NewLine, + 159..160: NewLine, + 160..164: Ident("from"), + 165..176: Ident("outputs_sql"), + 176..177: NewLine, + 177..183: Ident("select"), + 184..185: Control('{'), + 185..186: NewLine, + 188..198: Ident("col1 foo"), + 199..200: Control('='), + 201..212: Ident("outputs_sql"), + 212..213: Control('.'), + 213..223: Ident("col1 foo"), + 223..224: Control(','), + 224..225: NewLine, + 227..237: Ident("col2#bar"), + 238..239: Control('='), + 240..251: Ident("outputs_sql"), + 251..252: Control('.'), + 252..262: Ident("col2#bar"), + 262..263: NewLine, + 263..264: Control('}'), + 264..265: NewLine, + ], +) diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__results__sstring_escaped_quotes.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__results__sstring_escaped_quotes.snap new file mode 100644 index 000000000000..a1d57eacf6dd --- /dev/null +++ b/prqlc/prqlc/tests/integration/snapshots/integration__queries__results__sstring_escaped_quotes.snap @@ -0,0 +1,7 @@ +--- +source: prqlc/prqlc/tests/integration/queries.rs +expression: "# Test s-strings with escaped quotes (regression test for issue #5494)\nlet outputs_sql = (\n from s\"\n select 'a' as \\\"col1 foo\\\", 'b' as \\\"col2#bar\\\"\n \"\n)\n\nfrom outputs_sql\nselect {\n `col1 foo` = outputs_sql.`col1 foo`,\n `col2#bar` = outputs_sql.`col2#bar`\n}\n" +input_file: prqlc/prqlc/tests/integration/queries/sstring_escaped_quotes.prql +snapshot_kind: text +--- +a,b From 61b2d228f76720154b697af479590a481ad91b7f Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Mon, 13 Oct 2025 12:31:07 -0700 Subject: [PATCH 2/2] refactor: replace integration test with inline test for s-string escaping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the comprehensive integration test with a focused inline test that verifies escaped quotes in s-strings round-trip correctly through parse and format. The lexer already has coverage for tokenization of escaped quotes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- prqlc/prqlc/src/codegen/ast.rs | 6 + .../queries/sstring_escaped_quotes.prql | 12 -- ...ries__compile__sstring_escaped_quotes.snap | 23 ---- ...s__compileall__sstring_escaped_quotes.snap | 58 --------- ...debug_lineage__sstring_escaped_quotes.snap | 121 ------------------ ..._queries__fmt__sstring_escaped_quotes.snap | 15 --- ..._queries__lex__sstring_escaped_quotes.snap | 45 ------- ...ries__results__sstring_escaped_quotes.snap | 7 - 8 files changed, 6 insertions(+), 281 deletions(-) delete mode 100644 prqlc/prqlc/tests/integration/queries/sstring_escaped_quotes.prql delete mode 100644 prqlc/prqlc/tests/integration/snapshots/integration__queries__compile__sstring_escaped_quotes.snap delete mode 100644 prqlc/prqlc/tests/integration/snapshots/integration__queries__compileall__sstring_escaped_quotes.snap delete mode 100644 prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__sstring_escaped_quotes.snap delete mode 100644 prqlc/prqlc/tests/integration/snapshots/integration__queries__fmt__sstring_escaped_quotes.snap delete mode 100644 prqlc/prqlc/tests/integration/snapshots/integration__queries__lex__sstring_escaped_quotes.snap delete mode 100644 prqlc/prqlc/tests/integration/snapshots/integration__queries__results__sstring_escaped_quotes.snap diff --git a/prqlc/prqlc/src/codegen/ast.rs b/prqlc/prqlc/src/codegen/ast.rs index 48829e180f86..64aea84c8f6e 100644 --- a/prqlc/prqlc/src/codegen/ast.rs +++ b/prqlc/prqlc/src/codegen/ast.rs @@ -585,6 +585,12 @@ mod test { ); } + #[test] + fn test_sstring_escaped_quotes() { + // Test that escaped quotes in s-strings round-trip correctly (issue #5496) + assert_is_formatted(r#"from s"SELECT \"col1 foo\"""#); + } + #[test] fn test_unary() { assert_is_formatted(r#"sort {-duration}"#); diff --git a/prqlc/prqlc/tests/integration/queries/sstring_escaped_quotes.prql b/prqlc/prqlc/tests/integration/queries/sstring_escaped_quotes.prql deleted file mode 100644 index 5a2c2b0fb8fc..000000000000 --- a/prqlc/prqlc/tests/integration/queries/sstring_escaped_quotes.prql +++ /dev/null @@ -1,12 +0,0 @@ -# Test s-strings with escaped quotes (regression test for issue #5494) -let outputs_sql = ( - from s" - select 'a' as \"col1 foo\", 'b' as \"col2#bar\" - " -) - -from outputs_sql -select { - `col1 foo` = outputs_sql.`col1 foo`, - `col2#bar` = outputs_sql.`col2#bar` -} diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__compile__sstring_escaped_quotes.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__compile__sstring_escaped_quotes.snap deleted file mode 100644 index a60ad21b777d..000000000000 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__compile__sstring_escaped_quotes.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: prqlc/prqlc/tests/integration/queries.rs -expression: "# Test s-strings with escaped quotes (regression test for issue #5494)\nlet outputs_sql = (\n from s\"\n select 'a' as \\\"col1 foo\\\", 'b' as \\\"col2#bar\\\"\n \"\n)\n\nfrom outputs_sql\nselect {\n `col1 foo` = outputs_sql.`col1 foo`,\n `col2#bar` = outputs_sql.`col2#bar`\n}\n" -input_file: prqlc/prqlc/tests/integration/queries/sstring_escaped_quotes.prql -snapshot_kind: text ---- -WITH table_0 AS ( - SELECT - 'a' as "col1 foo", - 'b' as "col2#bar" -), -outputs_sql AS ( - SELECT - "col1 foo", - "col2#bar" - FROM - table_0 -) -SELECT - "col1 foo", - "col2#bar" -FROM - outputs_sql diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__compileall__sstring_escaped_quotes.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__compileall__sstring_escaped_quotes.snap deleted file mode 100644 index e782073a44b2..000000000000 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__compileall__sstring_escaped_quotes.snap +++ /dev/null @@ -1,58 +0,0 @@ ---- -source: prqlc/prqlc/tests/integration/queries.rs -expression: "# Test s-strings with escaped quotes (regression test for issue #5494)\nlet outputs_sql = (\n from s\"\n select 'a' as \\\"col1 foo\\\", 'b' as \\\"col2#bar\\\"\n \"\n)\n\nfrom outputs_sql\nselect {\n `col1 foo` = outputs_sql.`col1 foo`,\n `col2#bar` = outputs_sql.`col2#bar`\n}\n" -input_file: prqlc/prqlc/tests/integration/queries/sstring_escaped_quotes.prql -snapshot_kind: text ---- ---- generic -+++ clickhouse -@@ -1,17 +1,17 @@ - WITH table_0 AS ( - SELECT - 'a' as "col1 foo", - 'b' as "col2#bar" - ), - outputs_sql AS ( - SELECT -- "col1 foo", -- "col2#bar" -+ `col1 foo`, -+ `col2#bar` - FROM - table_0 - ) - SELECT -- "col1 foo", -- "col2#bar" -+ `col1 foo`, -+ `col2#bar` - FROM - outputs_sql - - - - ---- generic -+++ mysql -@@ -1,17 +1,17 @@ - WITH table_0 AS ( - SELECT - 'a' as "col1 foo", - 'b' as "col2#bar" - ), - outputs_sql AS ( - SELECT -- "col1 foo", -- "col2#bar" -+ `col1 foo`, -+ `col2#bar` - FROM - table_0 - ) - SELECT -- "col1 foo", -- "col2#bar" -+ `col1 foo`, -+ `col2#bar` - FROM - outputs_sql diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__sstring_escaped_quotes.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__sstring_escaped_quotes.snap deleted file mode 100644 index 982e6d102d23..000000000000 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__debug_lineage__sstring_escaped_quotes.snap +++ /dev/null @@ -1,121 +0,0 @@ ---- -source: prqlc/prqlc/tests/integration/queries.rs -expression: "# Test s-strings with escaped quotes (regression test for issue #5494)\nlet outputs_sql = (\n from s\"\n select 'a' as \\\"col1 foo\\\", 'b' as \\\"col2#bar\\\"\n \"\n)\n\nfrom outputs_sql\nselect {\n `col1 foo` = outputs_sql.`col1 foo`,\n `col2#bar` = outputs_sql.`col2#bar`\n}\n" -input_file: prqlc/prqlc/tests/integration/queries/sstring_escaped_quotes.prql -snapshot_kind: text ---- -frames: -- - 1:177-264 - - columns: - - !Single - name: - - col1 foo - target_id: 122 - target_name: null - - !Single - name: - - col2#bar - target_id: 123 - target_name: null - inputs: - - id: 120 - name: outputs_sql - table: - - outputs_sql -nodes: -- id: 120 - kind: Ident - span: 1:160-176 - ident: !Ident - - outputs_sql - parent: 125 -- id: 122 - kind: Ident - span: 1:201-223 - alias: col1 foo - ident: !Ident - - this - - outputs_sql - - col1 foo - targets: - - 120 - parent: 124 -- id: 123 - kind: Ident - span: 1:240-262 - alias: col2#bar - ident: !Ident - - this - - outputs_sql - - col2#bar - targets: - - 120 - parent: 124 -- id: 124 - kind: Tuple - span: 1:184-264 - children: - - 122 - - 123 - parent: 125 -- id: 125 - kind: 'TransformCall: Select' - span: 1:177-264 - children: - - 120 - - 124 -ast: - name: Project - stmts: - - VarDef: - kind: Let - name: outputs_sql - value: - FuncCall: - name: - Ident: - - from - span: 1:93-97 - args: - - SString: - - !String "\n select 'a' as \"col1 foo\", 'b' as \"col2#bar\"\n " - span: 1:98-156 - span: 1:89-158 - span: 1:0-158 - - VarDef: - kind: Main - name: main - value: - Pipeline: - exprs: - - FuncCall: - name: - Ident: - - from - span: 1:160-164 - args: - - Ident: - - outputs_sql - span: 1:165-176 - span: 1:160-176 - - FuncCall: - name: - Ident: - - select - span: 1:177-183 - args: - - Tuple: - - Ident: - - outputs_sql - - col1 foo - span: 1:201-223 - alias: col1 foo - - Ident: - - outputs_sql - - col2#bar - span: 1:240-262 - alias: col2#bar - span: 1:184-264 - span: 1:177-264 - span: 1:160-264 - span: 1:158-264 diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__fmt__sstring_escaped_quotes.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__fmt__sstring_escaped_quotes.snap deleted file mode 100644 index bd1cfd2eddf7..000000000000 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__fmt__sstring_escaped_quotes.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: prqlc/prqlc/tests/integration/queries.rs -expression: "# Test s-strings with escaped quotes (regression test for issue #5494)\nlet outputs_sql = (\n from s\"\n select 'a' as \\\"col1 foo\\\", 'b' as \\\"col2#bar\\\"\n \"\n)\n\nfrom outputs_sql\nselect {\n `col1 foo` = outputs_sql.`col1 foo`,\n `col2#bar` = outputs_sql.`col2#bar`\n}\n" -input_file: prqlc/prqlc/tests/integration/queries/sstring_escaped_quotes.prql -snapshot_kind: text ---- -let outputs_sql = from s" - select 'a' as \"col1 foo\", 'b' as \"col2#bar\" - " - -from outputs_sql -select { - `col1 foo` = outputs_sql.`col1 foo`, - `col2#bar` = outputs_sql.`col2#bar`, -} diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__lex__sstring_escaped_quotes.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__lex__sstring_escaped_quotes.snap deleted file mode 100644 index 27e6c8094de5..000000000000 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__lex__sstring_escaped_quotes.snap +++ /dev/null @@ -1,45 +0,0 @@ ---- -source: prqlc/prqlc/tests/integration/queries.rs -expression: tokens -input_file: prqlc/prqlc/tests/integration/queries/sstring_escaped_quotes.prql -snapshot_kind: text ---- -Tokens( - [ - 0..0: Start, - 0..70: Comment(" Test s-strings with escaped quotes (regression test for issue #5494)"), - 70..71: NewLine, - 71..74: Keyword("let"), - 75..86: Ident("outputs_sql"), - 87..88: Control('='), - 89..90: Control('('), - 90..91: NewLine, - 93..97: Ident("from"), - 98..156: Interpolation('s', "\n select 'a' as \"col1 foo\", 'b' as \"col2#bar\"\n "), - 156..157: NewLine, - 157..158: Control(')'), - 158..159: NewLine, - 159..160: NewLine, - 160..164: Ident("from"), - 165..176: Ident("outputs_sql"), - 176..177: NewLine, - 177..183: Ident("select"), - 184..185: Control('{'), - 185..186: NewLine, - 188..198: Ident("col1 foo"), - 199..200: Control('='), - 201..212: Ident("outputs_sql"), - 212..213: Control('.'), - 213..223: Ident("col1 foo"), - 223..224: Control(','), - 224..225: NewLine, - 227..237: Ident("col2#bar"), - 238..239: Control('='), - 240..251: Ident("outputs_sql"), - 251..252: Control('.'), - 252..262: Ident("col2#bar"), - 262..263: NewLine, - 263..264: Control('}'), - 264..265: NewLine, - ], -) diff --git a/prqlc/prqlc/tests/integration/snapshots/integration__queries__results__sstring_escaped_quotes.snap b/prqlc/prqlc/tests/integration/snapshots/integration__queries__results__sstring_escaped_quotes.snap deleted file mode 100644 index a1d57eacf6dd..000000000000 --- a/prqlc/prqlc/tests/integration/snapshots/integration__queries__results__sstring_escaped_quotes.snap +++ /dev/null @@ -1,7 +0,0 @@ ---- -source: prqlc/prqlc/tests/integration/queries.rs -expression: "# Test s-strings with escaped quotes (regression test for issue #5494)\nlet outputs_sql = (\n from s\"\n select 'a' as \\\"col1 foo\\\", 'b' as \\\"col2#bar\\\"\n \"\n)\n\nfrom outputs_sql\nselect {\n `col1 foo` = outputs_sql.`col1 foo`,\n `col2#bar` = outputs_sql.`col2#bar`\n}\n" -input_file: prqlc/prqlc/tests/integration/queries/sstring_escaped_quotes.prql -snapshot_kind: text ---- -a,b