Cleanup: Break Loc out into a common module, rename WhileParsing => Parsing

This commit is contained in:
2024-01-23 01:51:00 -06:00
parent c4a32895df
commit b8d70d3393
8 changed files with 182 additions and 180 deletions

View File

@@ -54,12 +54,6 @@ mod display {
}
}
impl Display for Loc {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let Loc { line, col } = self;
write!(f, "{line}:{col}:")
}
}
impl Display for Mutability {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
@@ -630,7 +624,6 @@ pub mod format {
mod convert {
//! Converts between major enums and enum variants
use super::*;
use crate::lexer::Lexer;
impl<T: AsRef<str>> From<T> for Identifier {
fn from(value: T) -> Self {
@@ -735,10 +728,4 @@ mod convert {
Self { body: Some(value.into()) }
}
}
impl<'t> From<&Lexer<'t>> for Loc {
fn from(value: &Lexer<'t>) -> Self {
Self { line: value.line(), col: value.col() }
}
}
}