Saved location in tokens post parsing, fixed parsing just skipping stuff

(shoulda thought of that)
This commit is contained in:
2024-12-22 02:01:04 +02:00
parent 323d3342a3
commit d2b0e57ce6
15 changed files with 1755 additions and 542 deletions

View File

@@ -1,6 +1,6 @@
use std::collections::HashMap;
use typ::Type;
use statement::{Enum, Function, Struct, TypeAlias};
pub use crate::tokeniser::tokentype::*;
@@ -12,17 +12,17 @@ pub mod typ;
#[derive(Debug, Clone)]
pub struct Program {
pub ast: expr::Block,
pub structs: HashMap<Ident, HashMap<Ident, usize>>,
pub enums: HashMap<Ident, usize>,
pub types: HashMap<Type, Type>,
pub functions: HashMap<Ident, (Vec<(Ident, Type)>, Type)>,
pub member_functions: HashMap<Ident, HashMap<Ident, (Vec<(Ident, Type)>, Type)>>,
pub structs: HashMap<Ident, Struct>,
pub enums: HashMap<Ident, Enum>,
pub types: HashMap<Ident, TypeAlias>,
pub functions: HashMap<Ident, Function>,
pub member_functions: HashMap<Ident, HashMap<Ident, Function>>,
}
#[derive(Debug, Clone)]
pub enum Ast {
Expr(expr::Expr),
Statement(statement::Statement),
Expr(expr::ExprBox),
Statement(statement::StatementBox),
}