@@ -2,7 +2,7 @@
22//!
33//! This step knows the shape of the language: indentation, continuation
44//! lines of attribute lists, verbatim bodies (of `@raw`, `@style`, `@head`,
5−//! `@script` and `@markdown`), multi-line strings, and the directives whose
5+//! `@script` and `@markdown`), and the directives whose
66//! structure spans several lines (`@if` / `@else` chains, `@each` with an
77//! `@else`, function definitions). It reads no files and substitutes no
88//! variables; `parser.rs` evaluates the tree.
@@ -230,19 +230,6 @@ fn sibling(lines: &[Line], pos: usize, indent: usize) -> Option<(usize, &str)> {
230230 }
231231}
232232
233−/// For `@let name """…` (or `@let name = """…`) without the closing `"""`
234−/// on the same line, the text after the opening quotes.
235−fn opens_multiline_string(line: &str) -> Option<&str> {
236− let (_, value) = line.strip_prefix("@let ")?.trim_start().split_once(' ')?;
237− let value = value.trim_start();
238− let value = value.strip_prefix('=').map_or(value, str::trim_start);
239− let open = value.strip_prefix("\"\"\"")?;
240− if open.len() >= 3 && open.ends_with("\"\"\"") {
241− return None;
242− }
243− Some(open)
244−}
245−
246233pub(crate) fn preprocess(input: &str) -> Vec<Line> {
247234 let raw_lines: Vec<&str> = input.lines().collect();
248235 let mut lines = Vec::new();
@@ -311,60 +298,6 @@ pub(crate) fn preprocess(input: &str) -> Vec<Line> {
311298 continue;
312299 }
313300
314− // The removed `@raw """…"""` form: its content is kept whole (and
315− // not evaluated) so the evaluator can point at the indented form.
316− if let Some(after_open) = trimmed.strip_prefix("@raw \"\"\"") {
317− let mut content = vec![after_open.trim_end_matches("\"\"\"")];
318− let first_line_num = i + 1;
319− if !(after_open.len() >= 3 && after_open.ends_with("\"\"\"")) {
320− i += 1;
321− while i < raw_lines.len() && raw_lines[i].trim() != "\"\"\"" {
322− content.push(raw_lines[i]);
323− i += 1;
324− }
325− }
326− i += 1;
327− lines.push(Line {
328− indent,
329− content: LineContent::Normal("@raw \"\"\"".to_string()),
330− line_num: first_line_num,
331− });
332− lines.push(Line {
333− indent: indent + 1,
334− content: LineContent::Raw(content.join("\n")),
335− line_num: first_line_num,
336− });
337− continue;
338− }
339−
340− // `@let name """` opens a multi-line string running to a `"""` line;
341− // it becomes one line holding the whole value.
342− if let Some(open) = opens_multiline_string(trimmed) {
343− let mut value: Vec<&str> = Vec::new();
344− if !open.is_empty() {
345− value.push(open);
346− }
347− let first_line_num = i + 1;
348− i += 1;
349− while i < raw_lines.len() {
350− let next = raw_lines[i].trim();
351− i += 1;
352− if next == "\"\"\"" {
353− break;
354− }
355− if !next.is_empty() {
356− value.push(next);
357− }
358− }
359− let head = &trimmed[..trimmed.len() - open.len()];
360− lines.push(Line {
361− indent,
362− content: LineContent::Normal(format!("{}{}\"\"\"", head, value.join("\n"))),
363− line_num: first_line_num,
364− });
365− continue;
366− }
367−
368301 // Join continuation lines for multi-line attribute brackets
369302 let first_line_num = i + 1;
370303 let mut full = trimmed.to_string();
@@ -478,11 +411,4 @@ mod tests {
478411 assert_eq!(text, ":root {\n --brand: red;\n}");
479412 assert_eq!(kinds(&tree), ["line", "line"]);
480413 }
481−
482− #[test]
483− fn multiline_strings_become_one_line() {
484− let tree = parse("@let msg \"\"\"\n Hello\n there\n\"\"\"\n@text $msg\n");
485− assert_eq!(kinds(&tree), ["line", "line"]);
486− assert_eq!(tree[0].source(), "@let msg \"\"\"Hello\nthere\"\"\"");
487− }
488414}