Pretty print programs partially
This commit is contained in:
parent
1b364061e4
commit
200b653e61
3 changed files with 28 additions and 17 deletions
23
src/pretty/program.rs
Normal file
23
src/pretty/program.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
use pretty::RcDoc;
|
||||
|
||||
use crate::ast::Program;
|
||||
|
||||
impl Program {
|
||||
pub fn to_doc(&self) -> RcDoc {
|
||||
match self {
|
||||
Program::Expr {
|
||||
s0,
|
||||
expr,
|
||||
s1,
|
||||
span: _,
|
||||
} => RcDoc::nil(),
|
||||
Program::Module {
|
||||
s0,
|
||||
s1,
|
||||
elems,
|
||||
s2,
|
||||
span: _,
|
||||
} => RcDoc::text("module"),
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue