svg-filters & basic parser #15

Merged
schrottkatze merged 67 commits from schrottkatze/iowo:svg-filters into main 2024-07-08 18:29:05 +00:00
4 changed files with 12 additions and 15 deletions
Showing only changes of commit 1a533eb788 - Show all commits

View file

@ -58,11 +58,4 @@ impl World {
module_tree,
})
}
// fn parse_mod_tree(files: &mut HashMap<PathBuf, SourceFile>)
}
// struct SourceFile {
// tree: SyntaxNode,
// items: Vec<TopLevelItem>,
// }

View file

@ -18,7 +18,7 @@ use super::{
};
pub struct ModuleTree {
modules: Rc<HashMap<String, Module>>,
modules: Rc<HashMap<String, Rc<Module>>>,
}
#[derive(Clone)]
@ -71,7 +71,7 @@ impl ModuleParsingContext {
&self,
node: &SyntaxNode,
name: Option<String>,
) -> HashMap<String, Module> {
) -> HashMap<String, Rc<Module>> {
let mut ctx = self.clone();
if let Some(name) = name {
ctx.push_cur_path(name)
@ -79,13 +79,13 @@ impl ModuleParsingContext {
node.children()
.filter_map(Mod::cast)
.filter_map(|m| match Module::parse_mod(m, self.clone()) {
Ok(module) => Some((module.name(), module)),
Ok(module) => Some((module.name(), Rc::new(module))),
Err(error) => {
self.errors.borrow_mut().push(error);
None
}
})
.collect::<HashMap<String, Module>>()
.collect::<HashMap<String, Rc<Module>>>()
}
fn dissolve(self) -> (HashMap<PathBuf, SourceFile>, Vec<Error>) {
@ -118,8 +118,8 @@ pub struct Module {
path: Vec<String>,
name: String,
kind: ModuleKind,
children: Rc<HashMap<String, Module>>,
parent: Option<Arc<Module>>,
children: Rc<HashMap<String, Rc<Module>>>,
parent: Option<Rc<Module>>,
}
impl Module {
@ -214,7 +214,7 @@ impl Module {
}
}
fn print_tree(name: &str, children: Rc<HashMap<String, Module>>, level: u32) {
fn print_tree(name: &str, children: Rc<HashMap<String, Rc<Module>>>, level: u32) {
const INDENT_STR: &str = " ";
for _ in 0..level {

View file

@ -1 +1,3 @@
mod meow;
def broken

View file

@ -1,2 +1,4 @@
mod mrawr {}
mod mrow {}
mod mrow {
def gay = ;
}