diff options
Diffstat (limited to 'dhall/src/syntax/text/parser.rs')
-rw-r--r-- | dhall/src/syntax/text/parser.rs | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/dhall/src/syntax/text/parser.rs b/dhall/src/syntax/text/parser.rs index f6b6577..90cb4b1 100644 --- a/dhall/src/syntax/text/parser.rs +++ b/dhall/src/syntax/text/parser.rs @@ -7,13 +7,12 @@ use pest_consume::{match_nodes, Parser}; use crate::semantics::phase::Normalized; use crate::syntax; -use crate::syntax::core; use crate::syntax::map::{DupTreeMap, DupTreeSet}; -use crate::syntax::ExprF::*; +use crate::syntax::ExprKind::*; use crate::syntax::{ - FilePath, FilePrefix, Hash, ImportLocation, ImportMode, InterpolatedText, - InterpolatedTextContents, Label, NaiveDouble, RawExpr, Scheme, Span, URL, - V, + Double, FilePath, FilePrefix, Hash, ImportLocation, ImportMode, Integer, + InterpolatedText, InterpolatedTextContents, Label, NaiveDouble, Natural, + Scheme, Span, UnspannedExpr, URL, V, }; // This file consumes the parse tree generated by pest and turns it into @@ -77,10 +76,14 @@ impl crate::syntax::Builtin { fn input_to_span(input: ParseInput) -> Span { Span::make(input.user_data().clone(), input.as_pair().as_span()) } -fn spanned(input: ParseInput, x: RawExpr<Normalized>) -> Expr { +fn spanned(input: ParseInput, x: UnspannedExpr<Normalized>) -> Expr { Expr::new(x, input_to_span(input)) } -fn spanned_union(span1: Span, span2: Span, x: RawExpr<Normalized>) -> Expr { +fn spanned_union( + span1: Span, + span2: Span, + x: UnspannedExpr<Normalized>, +) -> Expr { Expr::new(x, span1.union(&span2)) } @@ -349,20 +352,20 @@ impl DhallParser { } #[alias(double_literal)] - fn NaN(_input: ParseInput) -> ParseResult<core::Double> { + fn NaN(_input: ParseInput) -> ParseResult<Double> { Ok(std::f64::NAN.into()) } #[alias(double_literal)] - fn minus_infinity_literal(_input: ParseInput) -> ParseResult<core::Double> { + fn minus_infinity_literal(_input: ParseInput) -> ParseResult<Double> { Ok(std::f64::NEG_INFINITY.into()) } #[alias(double_literal)] - fn plus_infinity_literal(_input: ParseInput) -> ParseResult<core::Double> { + fn plus_infinity_literal(_input: ParseInput) -> ParseResult<Double> { Ok(std::f64::INFINITY.into()) } #[alias(double_literal)] - fn numeric_double_literal(input: ParseInput) -> ParseResult<core::Double> { + fn numeric_double_literal(input: ParseInput) -> ParseResult<Double> { let s = input.as_str().trim(); match s.parse::<f64>() { Ok(x) if x.is_infinite() => Err(input.error(format!( @@ -374,7 +377,7 @@ impl DhallParser { } } - fn natural_literal(input: ParseInput) -> ParseResult<core::Natural> { + fn natural_literal(input: ParseInput) -> ParseResult<Natural> { input .as_str() .trim() @@ -382,7 +385,7 @@ impl DhallParser { .map_err(|e| input.error(format!("{}", e))) } - fn integer_literal(input: ParseInput) -> ParseResult<core::Integer> { + fn integer_literal(input: ParseInput) -> ParseResult<Integer> { input .as_str() .trim() |