From 35f6fc17d0c98f424e01904b8856cf42c80bcfd3 Mon Sep 17 00:00:00 2001 From: Mica White Date: Sun, 27 Sep 2026 15:48:03 -0400 Subject: Add buggy diagnostics --- src/analyze.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/analyze.rs') diff --git a/src/analyze.rs b/src/analyze.rs index 7debb0d..b8a7012 100644 --- a/src/analyze.rs +++ b/src/analyze.rs @@ -1,7 +1,4 @@ -use std::{ - collections::HashMap, - sync::atomic::{AtomicUsize, Ordering::Relaxed}, -}; +use std::{collections::HashMap, sync::atomic::AtomicUsize}; use bumpalo::Bump; @@ -12,10 +9,12 @@ use crate::{ static NEXT_ID: AtomicUsize = AtomicUsize::new(0); +#[derive(Debug, Default)] pub struct SymbolTableSet<'a> { symbol_tables: HashMap>, } +#[derive(Debug, Default)] pub struct ScopedSymbolTable<'a> { pub modules: HashMap>, pub constants: HashMap>, @@ -32,6 +31,7 @@ pub struct ConstantSymbolId(pub usize); #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct HeadSymbolId(pub usize); +#[derive(Debug)] pub struct ModuleSymbol<'a> { pub id: ModuleSymbolId, pub name: Option<&'a str>, @@ -39,6 +39,7 @@ pub struct ModuleSymbol<'a> { pub definition_site: Option>, } +#[derive(Debug)] pub struct ConstantSymbol<'a> { pub id: ConstantSymbolId, pub name: Option<&'a str>, @@ -47,12 +48,14 @@ pub struct ConstantSymbol<'a> { pub definition_site: Option>, } +#[derive(Debug)] pub struct HeadSymbol<'a> { pub id: HeadSymbolId, pub contents: Option, pub definition_site: Option>, } +#[derive(Debug)] pub enum ConstantType<'a> { String, Block { @@ -61,10 +64,12 @@ pub enum ConstantType<'a> { }, } +#[derive(Debug)] pub enum ConstantValue<'a> { String(&'a str), } +#[derive(Debug)] pub enum ConstantExpression<'a> { Name(&'a str), Value(ConstantValue<'a>), @@ -77,7 +82,7 @@ pub enum ConstantExpression<'a> { } fn next_id() -> usize { - NEXT_ID.fetch_add(1, Relaxed) + NEXT_ID.fetch_add(1, std::sync::atomic::Ordering::Relaxed) } fn element_attributes<'a>( @@ -273,7 +278,7 @@ fn add_block<'a>( ConstantSymbol { id, name, - // fill this in + // TODO fill this in ty: None, value: Some(fragment), definition_site: Some(*element), -- cgit v1.3.1