feat: init scope depdency

上级 68970645
pub mod grammar;
pub mod grammar_reader;
pub mod grammar_registry;
pub mod line_tokens;
pub mod local_stack_element;
......
......@@ -28,15 +28,13 @@ impl GrammarRegistry {
_initial_scope_name: String,
_initial_language: i32,
_configuration: IGrammarConfiguration,
) {
) {}
// todo: modify logic to here for _collectDependenciesForDep
pub fn _load_grammar(&self, initial_scope_name: String, _initial_language: i32, _token_type: Option<ITokenTypeMap>) {
}
// todo: modify logic to here for _collectDependenciesForDep
pub fn load_grammar(
&self,
_initial_scope_name: String,
_initial_language: i32,
_configuration: IGrammarConfiguration,
) {
pub fn load_grammar(&self, initial_scope_name: String) {
self._load_grammar(initial_scope_name, 0, None)
}
}
......@@ -11,6 +11,8 @@ extern crate regex;
pub mod grammar;
pub mod inter;
pub mod matcher;
pub mod rule;
pub mod support;
pub mod grammar_registry;
pub mod sync_register;
pub mod scope_dependency;
use crate::inter::IRawRule;
use std::collections::HashSet;
#[derive(Clone, Debug, Serialize)]
pub struct PartialScopeDependency {
pub scope_name: String,
pub include: String
}
impl PartialScopeDependency {
pub fn to_key(&self) -> String {
format!("{:?}#{:?}", self.scope_name, self.include)
}
}
#[derive(Clone, Debug, Serialize)]
pub struct FullScopeDependency {
pub scope_name: String
}
#[derive(Clone, Debug, Serialize)]
pub enum ScopeDependency {
FullScopeDependency(FullScopeDependency),
PartialScopeDependency(PartialScopeDependency)
}
#[derive(Clone, Debug, Serialize)]
pub struct ScopeDependencyCollector {
pub full: Vec<FullScopeDependency>,
pub partial: Vec<PartialScopeDependency>,
// pub visited_rule: HashSet<IRawRule>,
pub _seen_full: HashSet<String>,
pub _seen_partial: HashSet<String>,
}
impl ScopeDependencyCollector {
pub fn new() -> ScopeDependencyCollector {
ScopeDependencyCollector {
full: vec![],
partial: vec![],
// visited_rule: Default::default(),
_seen_full: Default::default(),
_seen_partial: Default::default()
}
}
pub fn add(&mut self, dep: ScopeDependency) {
match dep {
ScopeDependency::FullScopeDependency(full_dep) => {
// self._seen_full.get_or_insert(full_dep.scope_name);
// self._seen_full.get(&*full_dep.scope_name.clone());
},
ScopeDependency::PartialScopeDependency(_) => {
},
}
}
}
pub mod regex_source;
pub mod matcher;
pub struct SyncRegister {
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册