diff options
Diffstat (limited to '')
-rw-r--r-- | dhall/src/syntax/ast/expr.rs | 10 | ||||
-rw-r--r-- | dhall/src/syntax/binary/decode.rs | 5 | ||||
-rw-r--r-- | dhall/src/syntax/text/parser.rs | 10 | ||||
-rw-r--r-- | dhall/src/syntax/text/printer.rs | 2 |
4 files changed, 16 insertions, 11 deletions
diff --git a/dhall/src/syntax/ast/expr.rs b/dhall/src/syntax/ast/expr.rs index 93c2311..410fb1d 100644 --- a/dhall/src/syntax/ast/expr.rs +++ b/dhall/src/syntax/ast/expr.rs @@ -99,7 +99,7 @@ pub struct Expr<Embed> { span: Span, } -pub type RawExpr<Embed> = ExprKind<Expr<Embed>, Embed>; +pub type UnspannedExpr<Embed> = ExprKind<Expr<Embed>, Embed>; /// Syntax tree for expressions // Having the recursion out of the enum definition enables writing @@ -232,24 +232,24 @@ impl<SE, E> ExprKind<SE, E> { } impl<E> Expr<E> { - pub fn as_ref(&self) -> &RawExpr<E> { + pub fn as_ref(&self) -> &UnspannedExpr<E> { &self.kind } - pub fn as_mut(&mut self) -> &mut RawExpr<E> { + pub fn as_mut(&mut self) -> &mut UnspannedExpr<E> { &mut self.kind } pub fn span(&self) -> Span { self.span.clone() } - pub fn new(kind: RawExpr<E>, span: Span) -> Self { + pub fn new(kind: UnspannedExpr<E>, span: Span) -> Self { Expr { kind: Box::new(kind), span, } } - pub fn rewrap<E2>(&self, kind: RawExpr<E2>) -> Expr<E2> { + pub fn rewrap<E2>(&self, kind: UnspannedExpr<E2>) -> Expr<E2> { Expr { kind: Box::new(kind), span: self.span.clone(), diff --git a/dhall/src/syntax/binary/decode.rs b/dhall/src/syntax/binary/decode.rs index 8b73e46..254ab07 100644 --- a/dhall/src/syntax/binary/decode.rs +++ b/dhall/src/syntax/binary/decode.rs @@ -7,7 +7,8 @@ use crate::semantics::phase::DecodedExpr; use crate::syntax; use crate::syntax::{ Expr, ExprKind, FilePath, FilePrefix, Hash, ImportLocation, ImportMode, - Integer, InterpolatedText, Label, Natural, RawExpr, Scheme, Span, URL, V, + Integer, InterpolatedText, Label, Natural, Scheme, Span, UnspannedExpr, + URL, V, }; pub(crate) fn decode(data: &[u8]) -> Result<DecodedExpr, DecodeError> { @@ -18,7 +19,7 @@ pub(crate) fn decode(data: &[u8]) -> Result<DecodedExpr, DecodeError> { } // Should probably rename this -fn rc<E>(x: RawExpr<E>) -> Expr<E> { +fn rc<E>(x: UnspannedExpr<E>) -> Expr<E> { Expr::new(x, Span::Decoded) } diff --git a/dhall/src/syntax/text/parser.rs b/dhall/src/syntax/text/parser.rs index e1bb469..90cb4b1 100644 --- a/dhall/src/syntax/text/parser.rs +++ b/dhall/src/syntax/text/parser.rs @@ -12,7 +12,7 @@ use crate::syntax::ExprKind::*; use crate::syntax::{ Double, FilePath, FilePrefix, Hash, ImportLocation, ImportMode, Integer, InterpolatedText, InterpolatedTextContents, Label, NaiveDouble, Natural, - RawExpr, Scheme, Span, URL, V, + Scheme, Span, UnspannedExpr, URL, V, }; // This file consumes the parse tree generated by pest and turns it into @@ -76,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)) } diff --git a/dhall/src/syntax/text/printer.rs b/dhall/src/syntax/text/printer.rs index ccd5206..7b781ea 100644 --- a/dhall/src/syntax/text/printer.rs +++ b/dhall/src/syntax/text/printer.rs @@ -27,7 +27,7 @@ impl<'a, E: Display + Clone> PhasedExpr<'a, E> { } } -impl<E: Display + Clone> RawExpr<E> { +impl<E: Display + Clone> UnspannedExpr<E> { // Annotate subexpressions with the appropriate phase, defaulting to Base fn annotate_with_phases<'a>(&'a self) -> ExprKind<PhasedExpr<'a, E>, E> { use crate::syntax::ExprKind::*; |