forked from katzen-cafe/iowo
Compare commits
2 commits
3eee768ce1
...
dc44244e7b
Author | SHA1 | Date | |
---|---|---|---|
dc44244e7b | |||
1e0741e600 |
3 changed files with 18 additions and 2 deletions
|
@ -1,6 +1,8 @@
|
|||
use crate::lst_parser::syntax_kind::SyntaxKind::*;
|
||||
use crate::SyntaxNode;
|
||||
use rowan::Language;
|
||||
|
||||
// Heavily modified version of https://github.com/rust-analyzer/rowan/blob/e2d2e93e16c5104b136d0bc738a0d48346922200/examples/s_expressions.rs#L250-L266
|
||||
macro_rules! ast_nodes {
|
||||
($($ast:ident, $kind:ident);+) => {
|
||||
$(
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
use std::path::Path;
|
||||
|
||||
use self::files::{Files, OpenFileError};
|
||||
|
||||
mod error;
|
||||
mod files;
|
||||
|
||||
|
@ -7,8 +9,19 @@ struct World;
|
|||
|
||||
impl World {
|
||||
pub fn new(entry_point: &Path) -> Result<Self, WorldCreationError> {
|
||||
let mut files = Files::default();
|
||||
let (entry_point_id, errors) = files.add_file(entry_point)?;
|
||||
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
enum WorldCreationError {}
|
||||
enum WorldCreationError {
|
||||
FailedToOpenEntryPoint(OpenFileError),
|
||||
}
|
||||
|
||||
impl From<OpenFileError> for WorldCreationError {
|
||||
fn from(value: OpenFileError) -> Self {
|
||||
Self::FailedToOpenEntryPoint(value)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,8 @@ use crate::{
|
|||
world::{error::Error, files::source_file::SourceFile},
|
||||
};
|
||||
|
||||
struct Files {
|
||||
#[derive(Default)]
|
||||
pub struct Files {
|
||||
inner: Vec<source_file::SourceFile>,
|
||||
path_to_id_map: HashMap<PathBuf, FileId>,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue