Most files suffered major changes
- Less ambiguous syntax - Better parser (Chumsky only does tokenization now) - Tidy(|ier) error handling - Facade for simplified embedding - External code grouped in (fairly) self-contained Systems - Dynamic action dispatch - Many STL additions
This commit is contained in:
27
src/error/unexpected_directory.rs
Normal file
27
src/error/unexpected_directory.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
use super::{ErrorPosition, ProjectError};
|
||||
use crate::utils::iter::box_once;
|
||||
use crate::utils::BoxedIter;
|
||||
use crate::{Interner, VName};
|
||||
|
||||
/// Produced when a stage that deals specifically with code encounters
|
||||
/// a path that refers to a directory
|
||||
#[derive(Debug)]
|
||||
pub struct UnexpectedDirectory {
|
||||
/// Path to the offending collection
|
||||
pub path: VName,
|
||||
}
|
||||
impl ProjectError for UnexpectedDirectory {
|
||||
fn description(&self) -> &str {
|
||||
"A stage that deals specifically with code encountered a path that refers \
|
||||
to a directory"
|
||||
}
|
||||
fn positions(&self, i: &Interner) -> BoxedIter<ErrorPosition> {
|
||||
box_once(ErrorPosition::just_file(i.extern_all(&self.path)))
|
||||
}
|
||||
fn message(&self, i: &Interner) -> String {
|
||||
format!(
|
||||
"{} was expected to be a file but a directory was found",
|
||||
i.extern_all(&self.path).join("/")
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user