pub fn format_sheet(sheet: &Sheet, source: &str) -> StringExpand description
Pretty-prints sheet back to adam-lang source text — see the module doc for the printing
rules.
source is the text sheet was parsed from (or "" for a programmatically built Sheet);
it’s forwarded to [cel_parser::format_expr] for every embedded expression.
- Precondition:
sheethas no recorded syntax errors (sheet.errors.is_empty()) — a sheet with aSheetItem::Errorplaceholder cannot be printed back to valid source.
§Examples
use adam_lang::{AdamAstParser, attach_trivia, format_sheet};
let source = "sheet s { cell x: i32 = 1; }";
let mut sheet = AdamAstParser::new().parse_str(source).unwrap();
attach_trivia(source, &mut sheet);
assert_eq!(format_sheet(&sheet, source), "sheet s {\n cell x: i32 = 1;\n}\n");