summaryrefslogtreecommitdiff
path: root/dhall_syntax/src/core/expr.rs
diff options
context:
space:
mode:
authorNadrieril2019-11-11 10:52:57 +0000
committerNadrieril2019-11-11 13:50:36 +0000
commit0e4f4c5af67b4075174ace5a1c7800dae60a9d11 (patch)
tree0c8b80b2a3f1fe5e11181f012d29d982bc6b098e /dhall_syntax/src/core/expr.rs
parent539ab468dfeca7a7b863d5166b2516a2573c044e (diff)
Move Span definition to its own file
And prepare for more variants
Diffstat (limited to '')
-rw-r--r--dhall_syntax/src/core/expr.rs35
1 files changed, 0 insertions, 35 deletions
diff --git a/dhall_syntax/src/core/expr.rs b/dhall_syntax/src/core/expr.rs
index 2ad3ba8..70ce1dc 100644
--- a/dhall_syntax/src/core/expr.rs
+++ b/dhall_syntax/src/core/expr.rs
@@ -1,4 +1,3 @@
-use std::rc::Rc;
use crate::map::{DupTreeMap, DupTreeSet};
use crate::visitor::{self, ExprFMutVisitor, ExprFVisitor};
@@ -15,40 +14,6 @@ pub fn trivial_result<T>(x: Result<T, !>) -> T {
}
}
-/// A location in the source text
-#[derive(Debug, Clone)]
-pub struct Span {
- input: Rc<str>,
- /// # Safety
- ///
- /// Must be a valid character boundary index into `input`.
- start: usize,
- /// # Safety
- ///
- /// Must be a valid character boundary index into `input`.
- end: usize,
-}
-
-impl Span {
- pub(crate) fn make(input: Rc<str>, sp: pest::Span) -> Self {
- Span {
- input,
- start: sp.start(),
- end: sp.end(),
- }
- }
- /// Takes the union of the two spans. Assumes that the spans come from the same input.
- /// This will also capture any input between the spans.
- pub fn union(&self, other: &Span) -> Self {
- use std::cmp::{max, min};
- Span {
- input: self.input.clone(),
- start: min(self.start, other.start),
- end: max(self.start, other.start),
- }
- }
-}
-
/// Double with bitwise equality
#[derive(Debug, Copy, Clone)]
pub struct NaiveDouble(f64);