summaryrefslogtreecommitdiff
path: root/dhall_syntax/src/parser.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--dhall_syntax/src/parser.rs24
1 files changed, 9 insertions, 15 deletions
diff --git a/dhall_syntax/src/parser.rs b/dhall_syntax/src/parser.rs
index bdef553..83ccc1e 100644
--- a/dhall_syntax/src/parser.rs
+++ b/dhall_syntax/src/parser.rs
@@ -8,13 +8,7 @@ use std::rc::Rc;
use dhall_generated_parser::{DhallParser, Rule};
-use crate::ExprF::{
- Annot, App, BinOp, BoolIf, BoolLit, Builtin, Const, DoubleLit, Embed,
- EmptyListLit, Field, IntegerLit, Lam, Let, Merge, NEListLit, NaturalLit,
- OldOptionalLit, Pi, Projection, RecordLit, RecordType, SomeLit, TextLit,
- UnionLit, UnionType,
-};
-
+use crate::ExprF::*;
use crate::*;
// This file consumes the parse tree generated by pest and turns it into
@@ -22,10 +16,10 @@ use crate::*;
// their own crate because they are quite general and useful. For now they
// are here and hopefully you can figure out how they work.
-type ParsedExpr = Expr<Label, Span, Import>;
-type ParsedSubExpr = SubExpr<Label, Span, Import>;
-type ParsedText = InterpolatedText<ParsedSubExpr>;
-type ParsedTextContents = InterpolatedTextContents<ParsedSubExpr>;
+type ParsedExpr = Expr<Span, Import>;
+type ParsedSubExpr = SubExpr<Span, Import>;
+type ParsedText = InterpolatedText<SubExpr<Span, Import>>;
+type ParsedTextContents = InterpolatedTextContents<SubExpr<Span, Import>>;
pub type ParseError = pest::error::Error<Rule>;
@@ -510,17 +504,17 @@ make_parser! {
rule!(identifier<ParsedSubExpr> as expression; span; children!(
[variable(v)] => {
- spanned(span, ExprF::Var(v))
+ spanned(span, Var(v))
},
[builtin(e)] => e,
));
- rule!(variable<Var<Label>>; children!(
+ rule!(variable<V<Label>>; children!(
[label(l), natural_literal(idx)] => {
- Var(l, idx)
+ V(l, idx)
},
[label(l)] => {
- Var(l, 0)
+ V(l, 0)
},
));