Pretty print program elements

This commit is contained in:
Joscha 2022-11-20 21:10:19 +01:00
parent 200b653e61
commit 23796e53a9
3 changed files with 48 additions and 2 deletions

View file

@ -10,14 +10,21 @@ impl Program {
expr,
s1,
span: _,
} => RcDoc::nil(),
} => RcDoc::text("<expr>"),
Program::Module {
s0,
s1,
elems,
s2,
span: _,
} => RcDoc::text("module"),
} => RcDoc::text("module")
.append(RcDoc::line())
.append(RcDoc::line())
.append(elems.to_doc(
|e| RcDoc::text("<elem>"),
|(s0, s1)| RcDoc::text(",").append(RcDoc::line()),
|s| RcDoc::text(","),
)),
}
}
}