diff options
author | Nadrieril Feneanar | 2019-11-11 18:30:36 +0100 |
---|---|---|
committer | GitHub | 2019-11-11 18:30:36 +0100 |
commit | bbb089d219cb22751d7100fe6524063cbe2474dd (patch) | |
tree | 4c64231fd014215b962cb294d4672d6785326372 /dhall_syntax/src/printer.rs | |
parent | 84cd6f386d6f4c7952fbc1da87dcd754f26ee404 (diff) | |
parent | facd2c587d96510c5a808f19d37b40c1fc2d2618 (diff) |
Merge pull request #115 from Nadrieril/parse-selection-be-expr
Parse projection by expression
Diffstat (limited to '')
-rw-r--r-- | dhall_syntax/src/printer.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/dhall_syntax/src/printer.rs b/dhall_syntax/src/printer.rs index 19ec781..ce6ff97 100644 --- a/dhall_syntax/src/printer.rs +++ b/dhall_syntax/src/printer.rs @@ -66,6 +66,9 @@ impl<SE: Display + Clone, E: Display> Display for ExprF<SE, E> { write!(f, "{}.", e)?; fmt_list("{ ", ", ", " }", ls, f, Display::fmt)?; } + ProjectionByExpr(a, b) => { + write!(f, "{}.({})", a, b)?; + } Var(a) => a.fmt(f)?, Const(k) => k.fmt(f)?, Builtin(v) => v.fmt(f)?, @@ -159,7 +162,9 @@ impl<A: Display + Clone> RawExpr<A> { // Precedence is magically handled by the ordering of BinOps. ExprF::BinOp(op, _, _) if phase > PrintPhase::BinOp(*op) => true, ExprF::App(_, _) if phase > PrintPhase::App => true, - Field(_, _) | Projection(_, _) if phase > PrintPhase::Import => { + Field(_, _) | Projection(_, _) | ProjectionByExpr(_, _) + if phase > PrintPhase::Import => + { true } _ => false, @@ -196,6 +201,7 @@ impl<A: Display + Clone> RawExpr<A> { ), Field(a, b) => Field(a.phase(Primitive), b), Projection(e, ls) => Projection(e.phase(Primitive), ls), + ProjectionByExpr(a, b) => ProjectionByExpr(a.phase(Primitive), b), e => e, }; |