From 980e50f33a88559edcf8b12cdec91fd9bee84ca9 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Fri, 20 Dec 2019 19:01:07 +0000 Subject: s/RawExpr/UnspannedExpr/ --- dhall/src/semantics/phase/typecheck.rs | 6 +++--- dhall/src/syntax/ast/expr.rs | 10 +++++----- dhall/src/syntax/binary/decode.rs | 5 +++-- dhall/src/syntax/text/parser.rs | 10 +++++++--- dhall/src/syntax/text/printer.rs | 2 +- 5 files changed, 19 insertions(+), 14 deletions(-) (limited to 'dhall/src') diff --git a/dhall/src/semantics/phase/typecheck.rs b/dhall/src/semantics/phase/typecheck.rs index f83bb94..cf928d8 100644 --- a/dhall/src/semantics/phase/typecheck.rs +++ b/dhall/src/semantics/phase/typecheck.rs @@ -10,8 +10,8 @@ use crate::semantics::phase::normalize::merge_maps; use crate::semantics::phase::Normalized; use crate::syntax; use crate::syntax::{ - Builtin, Const, Expr, ExprKind, InterpolatedTextContents, Label, RawExpr, - Span, + Builtin, Const, Expr, ExprKind, InterpolatedTextContents, Label, Span, + UnspannedExpr, }; fn tck_pi_type( @@ -144,7 +144,7 @@ pub(crate) fn const_to_value(c: Const) -> Value { } } -pub fn rc(x: RawExpr) -> Expr { +pub fn rc(x: UnspannedExpr) -> Expr { Expr::new(x, Span::Artificial) } 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 { span: Span, } -pub type RawExpr = ExprKind, Embed>; +pub type UnspannedExpr = ExprKind, Embed>; /// Syntax tree for expressions // Having the recursion out of the enum definition enables writing @@ -232,24 +232,24 @@ impl ExprKind { } impl Expr { - pub fn as_ref(&self) -> &RawExpr { + pub fn as_ref(&self) -> &UnspannedExpr { &self.kind } - pub fn as_mut(&mut self) -> &mut RawExpr { + pub fn as_mut(&mut self) -> &mut UnspannedExpr { &mut self.kind } pub fn span(&self) -> Span { self.span.clone() } - pub fn new(kind: RawExpr, span: Span) -> Self { + pub fn new(kind: UnspannedExpr, span: Span) -> Self { Expr { kind: Box::new(kind), span, } } - pub fn rewrap(&self, kind: RawExpr) -> Expr { + pub fn rewrap(&self, kind: UnspannedExpr) -> Expr { 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 { @@ -18,7 +19,7 @@ pub(crate) fn decode(data: &[u8]) -> Result { } // Should probably rename this -fn rc(x: RawExpr) -> Expr { +fn rc(x: UnspannedExpr) -> Expr { 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) -> Expr { +fn spanned(input: ParseInput, x: UnspannedExpr) -> Expr { Expr::new(x, input_to_span(input)) } -fn spanned_union(span1: Span, span2: Span, x: RawExpr) -> Expr { +fn spanned_union( + span1: Span, + span2: Span, + x: UnspannedExpr, +) -> 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 RawExpr { +impl UnspannedExpr { // Annotate subexpressions with the appropriate phase, defaulting to Base fn annotate_with_phases<'a>(&'a self) -> ExprKind, E> { use crate::syntax::ExprKind::*; -- cgit v1.2.3