summaryrefslogtreecommitdiff
path: root/src/syntax/pretty.rs
diff options
context:
space:
mode:
authorMartin <mhaug@live.de>2021-12-22 20:37:34 +0100
committerGitHub <noreply@github.com>2021-12-22 20:37:34 +0100
commitf6c7a8292dc1ab0560408fca9d74505e9d7cf13a (patch)
treebadd3076f6146cec34c55764600df5124c408521 /src/syntax/pretty.rs
parent738ff7e1f573bef678932b313be9969a17af8d22 (diff)
parent438255519e88bb790480306b9a9b452aaf054519 (diff)
Merge pull request #51 from typst/set-rules
Set rules
Diffstat (limited to 'src/syntax/pretty.rs')
-rw-r--r--src/syntax/pretty.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/syntax/pretty.rs b/src/syntax/pretty.rs
index c453fb56..62ecb8cd 100644
--- a/src/syntax/pretty.rs
+++ b/src/syntax/pretty.rs
@@ -225,6 +225,7 @@ impl Pretty for Expr {
Self::Closure(v) => v.pretty(p),
Self::With(v) => v.pretty(p),
Self::Let(v) => v.pretty(p),
+ Self::Set(v) => v.pretty(p),
Self::If(v) => v.pretty(p),
Self::While(v) => v.pretty(p),
Self::For(v) => v.pretty(p),
@@ -444,6 +445,16 @@ impl Pretty for LetExpr {
}
}
+impl Pretty for SetExpr {
+ fn pretty(&self, p: &mut Printer) {
+ p.push_str("set ");
+ self.class().pretty(p);
+ p.push_str("(");
+ self.args().pretty(p);
+ p.push(')');
+ }
+}
+
impl Pretty for IfExpr {
fn pretty(&self, p: &mut Printer) {
p.push_str("if ");
@@ -639,6 +650,7 @@ mod tests {
// Control flow.
roundtrip("#let x = 1 + 2");
roundtrip("#let f(x) = y");
+ roundtrip("#set text(size: 12pt)");
roundtrip("#if x [y] else [z]");
roundtrip("#if x {} else if y {} else {}");
roundtrip("#while x {y}");