Completed docs, added icon

This commit is contained in:
2023-05-28 17:24:56 +01:00
parent 6b71164aca
commit 6f5a9d05dd
28 changed files with 295 additions and 5 deletions

View File

@@ -5,7 +5,9 @@ use crate::utils::BoxedIter;
/// Error produced when an import refers to a nonexistent module
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct ModuleNotFound {
/// The file containing the invalid import
pub file: Vec<String>,
/// The invalid import path
pub subpath: Vec<String>,
}
impl ProjectError for ModuleNotFound {

View File

@@ -7,9 +7,13 @@ use crate::utils::BoxedIter;
/// An import refers to a symbol which exists but is not exported.
#[derive(Debug)]
pub struct NotExported {
/// The containing file - files are always exported
pub file: Vec<String>,
/// The path leading to the unexported module
pub subpath: Vec<String>,
/// The offending file
pub referrer_file: Vec<String>,
/// The module containing the offending import
pub referrer_subpath: Vec<String>,
}
impl ProjectError for NotExported {

View File

@@ -8,8 +8,11 @@ use crate::utils::BoxedIter;
/// Produced by stages that parse text when it fails.
#[derive(Debug)]
pub struct ParseErrorWithPath {
/// The complete source of the faulty file
pub full_source: String,
/// The path to the faulty file
pub path: Vec<String>,
/// The parse error produced by Chumsky
pub error: ParseError,
}
impl ProjectError for ParseErrorWithPath {

View File

@@ -7,7 +7,9 @@ use crate::utils::BoxedIter;
/// A point of interest in resolving the error, such as the point where
/// processing got stuck, a command that is likely to be incorrect
pub struct ErrorPosition {
/// The suspected location
pub location: Location,
/// Any information about the role of this location
pub message: Option<String>,
}

View File

@@ -9,8 +9,11 @@ use crate::utils::BoxedIter;
/// than the current module's absolute path
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct TooManySupers {
/// The offending import path
pub path: Vec<String>,
/// The file containing the offending import
pub offender_file: Vec<String>,
/// The module containing the offending import
pub offender_mod: Vec<String>,
}
impl ProjectError for TooManySupers {

View File

@@ -6,6 +6,7 @@ use crate::utils::BoxedIter;
/// a path that refers to a directory
#[derive(Debug)]
pub struct UnexpectedDirectory {
/// Path to the offending collection
pub path: Vec<String>,
}
impl ProjectError for UnexpectedDirectory {

View File

@@ -8,7 +8,9 @@ use crate::utils::BoxedIter;
/// Multiple occurences of the same namespace with different visibility
#[derive(Debug)]
pub struct VisibilityMismatch {
/// The namespace with ambiguous visibility
pub namespace: Vec<String>,
/// The file containing the namespace
pub file: Rc<Vec<String>>,
}
impl ProjectError for VisibilityMismatch {

View File

@@ -33,10 +33,14 @@ impl ProjectError for FileLoadingError {
/// as the file system.
#[derive(Clone, PartialEq, Eq, Hash)]
pub enum Loaded {
/// Conceptually equivalent to a sourcefile
Code(Rc<String>),
/// Conceptually equivalent to the list of *.orc files in a folder, without
/// the extension
Collection(Rc<Vec<String>>),
}
impl Loaded {
/// Is the loaded item source code (not a collection)?
pub fn is_code(&self) -> bool {
matches!(self, Loaded::Code(_))
}

View File

@@ -16,7 +16,9 @@ use crate::utils::{pushed, Substack};
/// describe libraries of external functions in Rust. It implements [Add] for
/// added convenience
pub enum ConstTree {
/// A function or constant
Const(Expr),
/// A submodule
Tree(HashMap<Tok<String>, ConstTree>),
}
impl ConstTree {