pub struct ExtensionRegistry { /* private fields */ }Expand description
Registry for managing DSL extensions with conflict resolution
Implementations§
Source§impl ExtensionRegistry
impl ExtensionRegistry
Sourcepub fn new() -> ExtensionRegistry
pub fn new() -> ExtensionRegistry
Create a new empty extension registry
Sourcepub fn register_grammar<T>(&mut self, extension: T) -> Result<(), ParseError>where
T: GrammarExtension + 'static,
pub fn register_grammar<T>(&mut self, extension: T) -> Result<(), ParseError>where
T: GrammarExtension + 'static,
Register a grammar extension with conflict detection
Sourcepub fn register_parser<T>(&mut self, parser: T, parser_id: String)where
T: StatementParser + 'static,
pub fn register_parser<T>(&mut self, parser: T, parser_id: String)where
T: StatementParser + 'static,
Register a statement parser
Sourcepub fn compose_grammar(&self, base_grammar: &str) -> String
pub fn compose_grammar(&self, base_grammar: &str) -> String
Get all grammar rules from registered extensions
Sourcepub fn find_parser(&self, rule_name: &str) -> Option<&dyn StatementParser>
pub fn find_parser(&self, rule_name: &str) -> Option<&dyn StatementParser>
Find parser for a given rule name
Sourcepub fn can_handle(&self, rule_name: &str) -> bool
pub fn can_handle(&self, rule_name: &str) -> bool
Check if a rule is handled by an extension
Sourcepub fn has_extensions(&self) -> bool
pub fn has_extensions(&self) -> bool
Check if any extensions are registered
Sourcepub fn grammar_extensions(&self) -> impl Iterator<Item = &dyn GrammarExtension>
pub fn grammar_extensions(&self) -> impl Iterator<Item = &dyn GrammarExtension>
Get all grammar extensions
Sourcepub fn has_extension(&self, extension_id: &str) -> bool
pub fn has_extension(&self, extension_id: &str) -> bool
Check if a specific extension is registered
Sourcepub fn get_parser_for_rule(&self, rule_name: &str) -> Option<&str>
pub fn get_parser_for_rule(&self, rule_name: &str) -> Option<&str>
Get parser for a rule name
Sourcepub fn get_statement_parser(
&self,
parser_id: &str,
) -> Option<&dyn StatementParser>
pub fn get_statement_parser( &self, parser_id: &str, ) -> Option<&dyn StatementParser>
Get statement parser by ID
Sourcepub fn statement_parser_count(&self) -> usize
pub fn statement_parser_count(&self) -> usize
Get the number of registered statement parsers.
Sourcepub fn statement_rules(&self) -> Vec<&str>
pub fn statement_rules(&self) -> Vec<&str>
Get the registered extension statement rules in stable order.
Sourcepub fn add_dependency(&mut self, dependent: &str, required: &str)
pub fn add_dependency(&mut self, dependent: &str, required: &str)
Add dependency between extensions
Sourcepub fn validate_dependencies(&self) -> Result<(), ParseError>
pub fn validate_dependencies(&self) -> Result<(), ParseError>
Validate all extension dependencies are satisfied
Sourcepub fn get_conflicts(&self) -> &BTreeMap<String, Vec<String>>
pub fn get_conflicts(&self) -> &BTreeMap<String, Vec<String>>
Get all rule conflicts for debugging
Sourcepub fn get_detailed_conflicts(&self) -> Vec<String>
pub fn get_detailed_conflicts(&self) -> Vec<String>
Get detailed conflict information with resolution suggestions
Sourcepub fn check_compatibility(
&self,
extension_ids: &[&str],
) -> Result<(), ParseError>
pub fn check_compatibility( &self, extension_ids: &[&str], ) -> Result<(), ParseError>
Check extension compatibility
Sourcepub fn with_builtin_extensions() -> ExtensionRegistry
pub fn with_builtin_extensions() -> ExtensionRegistry
Create a registry with built-in extensions
Sourcepub fn for_third_party() -> ExtensionRegistry
pub fn for_third_party() -> ExtensionRegistry
Create a minimal registry for 3rd party integration
Sourcepub fn generate_docs(&self) -> String
pub fn generate_docs(&self) -> String
Generate basic documentation for all registered extensions