|
| 1 | +use compiler_macros::EnumKindName; |
| 2 | + |
| 3 | +/// Configuration options for semantic analysis. |
| 4 | +/// Validation mode configuration |
| 5 | +#[derive(Debug, Clone, Copy, PartialEq, Eq)] |
| 6 | +pub enum ValidationMode { |
| 7 | + /// Lenient validation - allows warnings and continues |
| 8 | + Lenient, |
| 9 | + /// Strict validation - stops on first error |
| 10 | + Strict, |
| 11 | +} |
| 12 | + |
| 13 | +/// Feature validation configuration |
| 14 | +#[derive(Debug, Clone)] |
| 15 | +pub struct FeatureOptions { |
| 16 | + /// Validate experimental features |
| 17 | + pub validate_experimental: bool, |
| 18 | + /// Enable performance warnings |
| 19 | + pub performance_warnings: bool, |
| 20 | + /// Enable parallel analysis where possible |
| 21 | + pub enable_parallelism: bool, |
| 22 | +} |
| 23 | + |
| 24 | +/// Concurrency mode for semantic analysis |
| 25 | +#[derive(Debug, Clone, Copy, PartialEq, Eq)] |
| 26 | +pub enum ConcurrencyMode { |
| 27 | + /// Single-threaded analysis |
| 28 | + Sequential, |
| 29 | + /// Multi-threaded analysis with specified thread count and threshold |
| 30 | + Concurrent { |
| 31 | + max_threads: usize, |
| 32 | + threshold: usize, |
| 33 | + }, |
| 34 | +} |
| 35 | + |
| 36 | +#[derive(Debug, Clone)] |
| 37 | +pub struct AnalyzerOptions { |
| 38 | + /// Validation mode |
| 39 | + pub validation_mode: ValidationMode, |
| 40 | + |
| 41 | + /// Feature validation options |
| 42 | + pub features: FeatureOptions, |
| 43 | + |
| 44 | + /// Concurrency mode for analysis |
| 45 | + pub concurrency: ConcurrencyMode, |
| 46 | + |
| 47 | + /// Maximum analysis time per phase |
| 48 | + pub phase_timeout: std::time::Duration, |
| 49 | + |
| 50 | + /// Target database provider for validation |
| 51 | + pub target_provider: Option<DatabaseProvider>, |
| 52 | + |
| 53 | + /// Maximum number of diagnostics to collect before stopping |
| 54 | + pub max_diagnostics: usize, |
| 55 | +} |
| 56 | + |
| 57 | +/// Supported database providers for provider-specific validation. |
| 58 | +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, EnumKindName)] |
| 59 | +pub enum DatabaseProvider { |
| 60 | + PostgreSQL, |
| 61 | + MySQL, |
| 62 | + SQLite, |
| 63 | + SQLServer, |
| 64 | + MongoDB, |
| 65 | +} |
| 66 | + |
| 67 | +impl Default for AnalyzerOptions { |
| 68 | + fn default() -> Self { |
| 69 | + Self { |
| 70 | + validation_mode: ValidationMode::Lenient, |
| 71 | + features: FeatureOptions { |
| 72 | + validate_experimental: true, |
| 73 | + performance_warnings: true, |
| 74 | + enable_parallelism: true, |
| 75 | + }, |
| 76 | + concurrency: ConcurrencyMode::Concurrent { |
| 77 | + max_threads: 4, |
| 78 | + threshold: 2, |
| 79 | + }, |
| 80 | + phase_timeout: std::time::Duration::from_secs(30), |
| 81 | + target_provider: None, |
| 82 | + max_diagnostics: 100, |
| 83 | + } |
| 84 | + } |
| 85 | +} |
0 commit comments