summaryrefslogtreecommitdiff
path: root/dhall_core/src/core.rs
diff options
context:
space:
mode:
authorNadrieril2019-03-24 01:06:40 +0100
committerNadrieril2019-03-24 01:06:40 +0100
commit7d30b044a2c8c2cef8143b9e0ac763024c50026c (patch)
treecf6aa5f9af31edf77ac49a27083f53af2b6d2a30 /dhall_core/src/core.rs
parent062fc44a93a18ee432e51db852290ab5849f4dd9 (diff)
Refactor printer
Avoids stupid stack overflows when adding variants, gets precedences right, and updates to latest grammar changes
Diffstat (limited to '')
-rw-r--r--dhall_core/src/core.rs32
1 files changed, 17 insertions, 15 deletions
diff --git a/dhall_core/src/core.rs b/dhall_core/src/core.rs
index 502a9bc..0ea8c83 100644
--- a/dhall_core/src/core.rs
+++ b/dhall_core/src/core.rs
@@ -102,32 +102,34 @@ pub enum Const {
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct V(pub Label, pub usize);
-#[derive(Debug, Copy, Clone, PartialEq, Eq)]
+// Definition order must match precedence order for
+// pretty-printing to work correctly
+#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub enum BinOp {
- /// x && y`
- BoolAnd,
+ /// x ? y
+ ImportAlt,
/// x || y`
BoolOr,
- /// x == y`
- BoolEQ,
- /// x != y`
- BoolNE,
/// x + y`
NaturalPlus,
- /// x * y`
- NaturalTimes,
/// x ++ y`
TextAppend,
+ /// x # y
+ ListAppend,
+ /// x && y`
+ BoolAnd,
/// x ∧ y`
Combine,
- /// x //\\ y
- CombineTypes,
- /// x ? y
- ImportAlt,
/// x // y
Prefer,
- /// x # y
- ListAppend,
+ /// x //\\ y
+ CombineTypes,
+ /// x * y`
+ NaturalTimes,
+ /// x == y`
+ BoolEQ,
+ /// x != y`
+ BoolNE,
}
/// Built-ins