use std::collections::HashMap;
use std::time::Duration;
use crate::Compiler::AST::{ DataType, DixScript};
use crate::Compiler::Utilities::SymbolTable;
pub mod Tokenizer;
pub mod SectionParsers;
pub mod SectionAnalyzers;
pub mod SectionEnhancers;
pub mod ValueResolution;
pub mod BinarySerialization;
pub mod Config;
pub mod Functions;
mod general_parser;
mod general_ast_enhancer;
mod general_semantics_analyzer;
pub use Config::{
ConfigSectionHandler,
ProcessConfigResult,
OperationalSettings,
ErrorHandlingStrategy,
CompatibilityMode,
DebugMode,
};
pub use general_parser::GeneralParser;
pub use general_ast_enhancer::GeneralAstEnhancer;
pub use general_semantics_analyzer::GeneralSemanticAnalyzer;
pub use SectionAnalyzers::{SectionAnalysisResult, SemanticErrorInfo, SemanticWarningInfo};
#[derive(Debug, Clone)]
pub struct SemanticAnalysisResult {
pub is_success: bool,
pub symbol_table: Option<SymbolTable>,
pub errors: Vec<SemanticErrorInfo>,
pub warnings: Vec<SemanticWarningInfo>,
pub section_results: HashMap<String, SectionAnalysisResult>,
pub analysis_duration: Duration,
pub short_name_index: Option<HashMap<String, Vec<String>>>,
pub type_index: Option<HashMap<String, DataType>>,
}
impl SemanticAnalysisResult {
pub fn new() -> Self {
SemanticAnalysisResult {
is_success: false,
symbol_table: None,
errors: Vec::new(),
warnings: Vec::new(),
section_results: HashMap::new(),
analysis_duration: Duration::default(),
short_name_index: None,
type_index: None,
}
}
}
impl Default for SemanticAnalysisResult {
fn default() -> Self {
Self::new()
}
}
#[derive(Debug, Clone)]
pub struct EnhancementResult {
pub is_success: bool,
pub enhanced_ast: DixScript,
pub total_enhancements: usize,
pub errors: Vec<String>,
pub warnings: Vec<String>,
pub section_enhancements: HashMap<String, SectionEnhancementInfo>,
pub enhancement_duration: Duration,
}
impl EnhancementResult {
pub fn new() -> Self {
EnhancementResult {
is_success: false,
enhanced_ast: DixScript::new(),
total_enhancements: 0,
errors: Vec::new(),
warnings: Vec::new(),
section_enhancements: HashMap::new(),
enhancement_duration: Duration::default(),
}
}
}
impl Default for EnhancementResult {
fn default() -> Self {
Self::new()
}
}
#[derive(Debug, Clone)]
pub struct SectionEnhancementInfo {
pub section_name: String,
pub enhancements_applied: usize,
pub enhancement_types: Vec<String>,
}
impl SectionEnhancementInfo {
pub fn new(section_name: impl Into<String>) -> Self {
SectionEnhancementInfo {
section_name: section_name.into(),
enhancements_applied: 0,
enhancement_types: Vec::new(),
}
}
}