summaryrefslogtreecommitdiff
path: root/src/pretty.rs
diff options
context:
space:
mode:
authorMartin Haug <mhaug@live.de>2021-05-29 12:25:10 +0200
committerLaurenz <laurmaedje@gmail.com>2021-05-31 22:33:40 +0200
commit9f77f09aacd1fb0fd6138a6d16ed2755f6bfae3f (patch)
treeeba4a1609f178b3f2e6838ca9ee3c013e420621f /src/pretty.rs
parent0bfee5b7772338fd39bbf708d3e31ea7bcec859b (diff)
Parse import and include expressions
Co-Authored-By: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'src/pretty.rs')
-rw-r--r--src/pretty.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/pretty.rs b/src/pretty.rs
index bf475bf6..397bbc38 100644
--- a/src/pretty.rs
+++ b/src/pretty.rs
@@ -229,6 +229,8 @@ impl Pretty for Expr {
Self::If(v) => v.pretty(p),
Self::While(v) => v.pretty(p),
Self::For(v) => v.pretty(p),
+ Self::Import(v) => v.pretty(p),
+ Self::Include(v) => v.pretty(p),
}
}
}
@@ -434,6 +436,31 @@ impl Pretty for ForPattern {
}
}
+impl Pretty for ImportExpr {
+ fn pretty(&self, p: &mut Printer) {
+ p.push_str("import ");
+ self.path.pretty(p);
+ p.push_str(" using ");
+ self.imports.pretty(p);
+ }
+}
+
+impl Pretty for Imports {
+ fn pretty(&self, p: &mut Printer) {
+ match self {
+ Self::Wildcard => p.push('*'),
+ Self::Idents(idents) => p.join(idents, ", ", |item, p| item.pretty(p)),
+ }
+ }
+}
+
+impl Pretty for IncludeExpr {
+ fn pretty(&self, p: &mut Printer) {
+ p.push_str("include ");
+ self.path.pretty(p);
+ }
+}
+
impl Pretty for Ident {
fn pretty(&self, p: &mut Printer) {
p.push_str(self.as_str());