aboutsummaryrefslogtreecommitdiff
path: root/mingling_pathf/src/pattern_analyzer.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-08-17 02:29:30 +0800
committer魏曹先生 <1992414357@qq.com>2026-08-17 02:39:56 +0800
commit6980fbf2f9fb4c599d8dc6ff549a8b3288eb24e9 (patch)
treebc7049698955d7a40706ea691fd5bab526a6b5e5 /mingling_pathf/src/pattern_analyzer.rs
parent4c191b2b46a67a0dda6e9a867b40f45156af4f9c (diff)
refactor!: remove dynamic dispatcher registration API
Dispatchers are now always registered at compile time, removing the `with_dispatcher` / `with_dispatchers` methods and the `PathfinderConfig` API. The `dispatch_tree` feature now only controls the matching strategy (trie vs linear list).
Diffstat (limited to 'mingling_pathf/src/pattern_analyzer.rs')
-rw-r--r--mingling_pathf/src/pattern_analyzer.rs13
1 files changed, 2 insertions, 11 deletions
diff --git a/mingling_pathf/src/pattern_analyzer.rs b/mingling_pathf/src/pattern_analyzer.rs
index c2dd25f..b7f923c 100644
--- a/mingling_pathf/src/pattern_analyzer.rs
+++ b/mingling_pathf/src/pattern_analyzer.rs
@@ -9,14 +9,12 @@
//!
//! The entry points are:
//! - [`init()`] — creates a default `PatternAnalyzer` with all built-in patterns.
-//! - [`init_with_config()`] — creates a `PatternAnalyzer` with a given `PathfinderConfig`.
//! - [`PatternAnalyzer::analyze_file()`] / [`PatternAnalyzer::analyze_file_items()`] — run
//! analysis on a single file.
use std::collections::HashSet;
use std::path::Path;
-use crate::config::PathfinderConfig;
use crate::error::MinglingPathfinderError;
use crate::patterns::{
ChainPattern, CommandPattern, CompletionPattern, DispatcherClapPattern, DispatcherPattern,
@@ -26,13 +24,6 @@ use crate::patterns::{
/// Creates a default `PatternAnalyzer` with all built-in patterns pre-registered.
#[must_use]
pub fn init() -> PatternAnalyzer {
- init_with_config(&PathfinderConfig::default())
-}
-
-/// Creates a `PatternAnalyzer` with the given config, used by `mingling_core`'s pathf wrapper
-/// to inject feature-dependent settings (e.g., `dispatch_tree`).
-#[must_use]
-pub fn init_with_config(config: &PathfinderConfig) -> PatternAnalyzer {
let mut analyzer = PatternAnalyzer::new();
analyzer.add_pattern(PackPattern);
analyzer.add_pattern(GroupPattern);
@@ -43,8 +34,8 @@ pub fn init_with_config(config: &PathfinderConfig) -> PatternAnalyzer {
analyzer.add_pattern(HelpPattern);
analyzer.add_pattern(MetadataPattern);
analyzer.add_pattern(CompletionPattern);
- analyzer.add_pattern(DispatcherPattern::new(config.use_dispatch_tree));
- analyzer.add_pattern(DispatcherClapPattern::new(config.use_dispatch_tree));
+ analyzer.add_pattern(DispatcherPattern::new());
+ analyzer.add_pattern(DispatcherClapPattern::new());
analyzer
}