summaryrefslogtreecommitdiff
path: root/dhall_syntax/src
diff options
context:
space:
mode:
authorNadrieril2019-08-04 11:11:37 +0200
committerNadrieril2019-08-06 21:40:24 +0200
commit711164a7a24ab832006b72cac162e78cf434861a (patch)
treecdb2097aa25e20c2953cd5d0192ce66274def33b /dhall_syntax/src
parentcc03ada4e713f145f2eb1bbf0f131a4c5746cf74 (diff)
Remove old-style optional literals
Diffstat (limited to 'dhall_syntax/src')
-rw-r--r--dhall_syntax/src/core/expr.rs4
-rw-r--r--dhall_syntax/src/core/visitor.rs4
-rw-r--r--dhall_syntax/src/parser.rs18
-rw-r--r--dhall_syntax/src/printer.rs8
4 files changed, 3 insertions, 31 deletions
diff --git a/dhall_syntax/src/core/expr.rs b/dhall_syntax/src/core/expr.rs
index da9465d..df2dc97 100644
--- a/dhall_syntax/src/core/expr.rs
+++ b/dhall_syntax/src/core/expr.rs
@@ -194,10 +194,6 @@ pub enum ExprF<SubExpr, Embed> {
EmptyListLit(SubExpr),
/// `[x, y, z]`
NEListLit(Vec<SubExpr>),
- /// Deprecated Optional literal form
- /// `[] : Optional a`
- /// `[x] : Optional a`
- OldOptionalLit(Option<SubExpr>, SubExpr),
/// `Some e`
SomeLit(SubExpr),
/// `{ k1 : t1, k2 : t1 }`
diff --git a/dhall_syntax/src/core/visitor.rs b/dhall_syntax/src/core/visitor.rs
index 99a9c11..1745fdb 100644
--- a/dhall_syntax/src/core/visitor.rs
+++ b/dhall_syntax/src/core/visitor.rs
@@ -137,10 +137,6 @@ where
),
EmptyListLit(t) => EmptyListLit(v.visit_subexpr(t)?),
NEListLit(es) => NEListLit(vec(es, |e| v.visit_subexpr(e))?),
- OldOptionalLit(x, t) => OldOptionalLit(
- opt(x, |e| v.visit_subexpr(e))?,
- v.visit_subexpr(t)?,
- ),
SomeLit(e) => SomeLit(v.visit_subexpr(e)?),
RecordType(kts) => RecordType(dupmap(kts, v)?),
RecordLit(kvs) => RecordLit(dupmap(kvs, v)?),
diff --git a/dhall_syntax/src/parser.rs b/dhall_syntax/src/parser.rs
index 9d9a374..db1699b 100644
--- a/dhall_syntax/src/parser.rs
+++ b/dhall_syntax/src/parser.rs
@@ -724,6 +724,9 @@ make_parser! {
[merge(()), expression(x), expression(y), expression(z)] => {
spanned(span, Merge(x, y, Some(z)))
},
+ [List(()), expression(x)] => {
+ spanned(span, EmptyListLit(x))
+ },
[expression(e)] => e,
));
@@ -738,21 +741,6 @@ make_parser! {
token_rule!(List<()>);
token_rule!(Optional<()>);
- rule!(empty_collection<ParsedSubExpr> as expression; span; children!(
- [List(_), expression(t)] => {
- spanned(span, EmptyListLit(t))
- },
- [Optional(_), expression(t)] => {
- spanned(span, OldOptionalLit(None, t))
- },
- ));
-
- rule!(non_empty_optional<ParsedSubExpr> as expression; span; children!(
- [expression(x), Optional(_), expression(t)] => {
- spanned(span, OldOptionalLit(Some(x), t))
- }
- ));
-
rule!(import_alt_expression<ParsedSubExpr> as expression; children!(
[expression(e)] => e,
[expression(first), expression(rest)..] => {
diff --git a/dhall_syntax/src/printer.rs b/dhall_syntax/src/printer.rs
index dbed55d..b585a5b 100644
--- a/dhall_syntax/src/printer.rs
+++ b/dhall_syntax/src/printer.rs
@@ -32,12 +32,6 @@ impl<SE: Display + Clone, E: Display> Display for ExprF<SE, E> {
NEListLit(es) => {
fmt_list("[", ", ", "]", es, f, Display::fmt)?;
}
- OldOptionalLit(None, t) => {
- write!(f, "[] : Optional {}", t)?;
- }
- OldOptionalLit(Some(x), t) => {
- write!(f, "[{}] : Optional {}", x, t)?;
- }
SomeLit(e) => {
write!(f, "Some {}", e)?;
}
@@ -154,7 +148,6 @@ impl<S: Clone, A: Display + Clone> Expr<S, A> {
| Let(_, _, _, _)
| EmptyListLit(_)
| NEListLit(_)
- | OldOptionalLit(_, _)
| SomeLit(_)
| Merge(_, _, _)
| Annot(_, _)
@@ -190,7 +183,6 @@ impl<S: Clone, A: Display + Clone> Expr<S, A> {
b.phase(PrintPhase::BinOp(op)),
),
EmptyListLit(t) => EmptyListLit(t.phase(Import)),
- OldOptionalLit(x, t) => OldOptionalLit(x, t.phase(Import)),
SomeLit(e) => SomeLit(e.phase(Import)),
ExprF::App(f, a) => ExprF::App(f.phase(Import), a.phase(Import)),
Field(a, b) => Field(a.phase(Primitive), b),