integrate ast::Location into compilre-core::Location

This commit is contained in:
Jeong YunWon 2022-08-22 08:38:21 +09:00
parent bfac0355dc
commit 904fc477f1
8 changed files with 21 additions and 83 deletions

View file

@ -7,6 +7,16 @@ pub struct Location {
pub(super) column: u32,
}
impl Location {
pub fn fmt_with(
&self,
f: &mut std::fmt::Formatter,
e: &impl std::fmt::Display,
) -> std::fmt::Result {
write!(f, "{} at line {} column {}", e, self.row(), self.column())
}
}
impl Location {
/// Creates a new Location object at the given row and column.
///