Import and export improved

- Import paths are now vname and not sym
- Imports and exports accept multiple space-delimited operators in []

as a result, we can now reliably import and export the operator *

- error reporting ergonomics
This commit is contained in:
2023-08-18 21:10:29 +01:00
parent 3fdabc29da
commit 9186bce956
33 changed files with 269 additions and 228 deletions

View File

@@ -1,7 +1,7 @@
use super::{ErrorPosition, ProjectError};
use crate::utils::iter::box_once;
use crate::utils::BoxedIter;
use crate::{Interner, VName};
use std::rc::Rc;
use super::ProjectError;
use crate::{Interner, Location, VName};
/// Produced when a stage that deals specifically with code encounters
/// a path that refers to a directory
@@ -15,9 +15,10 @@ impl ProjectError for UnexpectedDirectory {
"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 one_position(&self, i: &Interner) -> crate::Location {
Location::File(Rc::new(i.extern_all(&self.path)))
}
fn message(&self, i: &Interner) -> String {
format!(
"{} was expected to be a file but a directory was found",