mirror of
https://forge.katzen.cafe/katzen-cafe/iowo.git
synced 2025-09-24 23:41:30 +02:00
lang: add registry/namespace
This commit is contained in:
parent
1a533eb788
commit
3e2c5946c8
8 changed files with 264 additions and 14 deletions
|
@ -5,14 +5,18 @@ use rowan::ast::{AstNode, AstPtr};
|
|||
use self::{
|
||||
error::{Error, WorldCreationError},
|
||||
mod_tree::ModuleTree,
|
||||
namespace::Registry,
|
||||
source_file::SourceFile,
|
||||
};
|
||||
|
||||
mod error;
|
||||
mod mod_tree;
|
||||
mod namespace;
|
||||
mod nodes;
|
||||
mod path;
|
||||
mod source_file;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Loc<T: AstNode> {
|
||||
file: PathBuf,
|
||||
syntax_el: AstPtr<T>,
|
||||
|
@ -25,6 +29,10 @@ impl<T: AstNode> Loc<T> {
|
|||
syntax_el: AstPtr::new(syntax_el),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn file(&self) -> &PathBuf {
|
||||
&self.file
|
||||
}
|
||||
}
|
||||
|
||||
pub struct World {
|
||||
|
@ -32,6 +40,7 @@ pub struct World {
|
|||
files: HashMap<PathBuf, SourceFile>,
|
||||
errors: Vec<Error>,
|
||||
module_tree: ModuleTree,
|
||||
registry: Registry,
|
||||
}
|
||||
|
||||
impl World {
|
||||
|
@ -44,7 +53,8 @@ impl World {
|
|||
|
||||
let (src, mut errors) = SourceFile::parse_from(&entry_point, source);
|
||||
|
||||
let (module_tree, mut files, new_errors) = ModuleTree::parse_from_main(&entry_point, &src);
|
||||
let (module_tree, mut files, new_errors, registry) =
|
||||
ModuleTree::parse_from_main(&entry_point, &src);
|
||||
errors.extend(new_errors);
|
||||
module_tree.print_tree(&src.tree());
|
||||
dbg!(&errors);
|
||||
|
@ -56,6 +66,7 @@ impl World {
|
|||
entry_point,
|
||||
errors,
|
||||
module_tree,
|
||||
registry,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue