diff options
author | Nadrieril | 2020-04-06 22:11:54 +0100 |
---|---|---|
committer | Nadrieril | 2020-04-06 22:11:54 +0100 |
commit | fff4c46e09d4edf25eba737f4d71bfdb1dbf4a82 (patch) | |
tree | 30f48f45ba0201859193510c65edfd3634764090 /dhall/src/syntax/text | |
parent | cd3b11cc8bd7c4397071d1d3b4b9020b7d5ff2ad (diff) |
Extract operation-related code to a new module
Diffstat (limited to 'dhall/src/syntax/text')
-rw-r--r-- | dhall/src/syntax/text/parser.rs | 2 | ||||
-rw-r--r-- | dhall/src/syntax/text/printer.rs | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/dhall/src/syntax/text/parser.rs b/dhall/src/syntax/text/parser.rs index ab9bc24..8d76225 100644 --- a/dhall/src/syntax/text/parser.rs +++ b/dhall/src/syntax/text/parser.rs @@ -7,10 +7,10 @@ use std::rc::Rc; use pest_consume::{match_nodes, Parser}; +use crate::operations::OpKind::*; use crate::syntax::map::{DupTreeMap, DupTreeSet}; use crate::syntax::ExprKind::*; use crate::syntax::NumKind::*; -use crate::syntax::OpKind::*; use crate::syntax::{ Double, Expr, FilePath, FilePrefix, Hash, ImportMode, ImportTarget, Integer, InterpolatedText, InterpolatedTextContents, Label, NaiveDouble, diff --git a/dhall/src/syntax/text/printer.rs b/dhall/src/syntax/text/printer.rs index d655489..a85f435 100644 --- a/dhall/src/syntax/text/printer.rs +++ b/dhall/src/syntax/text/printer.rs @@ -1,3 +1,4 @@ +use crate::operations::OpKind; use crate::syntax::*; use itertools::Itertools; use std::fmt::{self, Display}; @@ -37,8 +38,8 @@ impl<'a> PhasedExpr<'a> { impl UnspannedExpr { // Annotate subexpressions with the appropriate phase, defaulting to Base fn annotate_with_phases(&self) -> ExprKind<PhasedExpr<'_>> { - use crate::syntax::ExprKind::*; - use crate::syntax::OpKind::*; + use ExprKind::*; + use OpKind::*; use PrintPhase::*; let with_base = self.map_ref(|e| PhasedExpr(e, Base)); match with_base { @@ -89,8 +90,8 @@ impl UnspannedExpr { f: &mut fmt::Formatter, phase: PrintPhase, ) -> Result<(), fmt::Error> { - use crate::syntax::ExprKind::*; - use crate::syntax::OpKind::*; + use ExprKind::*; + use OpKind::*; let needs_paren = match self { Lam(_, _, _) @@ -212,7 +213,7 @@ impl<SE: Display + Clone> Display for ExprKind<SE> { /// Generic instance that delegates to subexpressions impl<SE: Display + Clone> Display for OpKind<SE> { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { - use crate::syntax::OpKind::*; + use OpKind::*; match self { App(a, b) => { write!(f, "{} {}", a, b)?; |