Move from language-reporting to codespan (#1825)

This commit is contained in:
Jonathan Turner
2020-05-18 11:44:27 -07:00
committed by GitHub
parent 5f1136dcb0
commit 0743b69ad5
12 changed files with 116 additions and 320 deletions

View File

@ -13,7 +13,7 @@ doctest = false
serde = { version = "1.0.106", features = ["derive"] }
derive-new = "0.5.8"
getset = "0.1.1"
language-reporting = "0.4.0"
codespan-reporting = "0.9.4"
termcolor = "1.1.0"
pretty = "0.5.2"

View File

@ -472,6 +472,15 @@ impl From<Option<Span>> for Span {
}
}
impl From<Span> for std::ops::Range<usize> {
fn from(input: Span) -> std::ops::Range<usize> {
std::ops::Range {
start: input.start,
end: input.end,
}
}
}
impl Span {
/// Creates a default new `Span` that has 0 start and 0 end.
pub fn default() -> Self {
@ -657,32 +666,6 @@ impl PartialEq<usize> for Span {
}
}
impl language_reporting::ReportingSpan for Span {
fn with_start(&self, start: usize) -> Self {
if self.end < start {
Span::new(start, start)
} else {
Span::new(start, self.end)
}
}
fn with_end(&self, end: usize) -> Self {
if end < self.start {
Span::new(end, end)
} else {
Span::new(self.start, end)
}
}
fn start(&self) -> usize {
self.start
}
fn end(&self) -> usize {
self.end
}
}
pub trait IntoSpanned {
type Output: HasFallibleSpan;