Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Phodal
scie
提交
b2da2b2f
S
scie
项目概览
Phodal
/
scie
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
scie
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
b2da2b2f
编写于
9月 08, 2020
作者:
P
Phodal Huang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: create register mod for register mode
上级
a2c8ae7f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
19 addition
and
18 deletion
+19
-18
scie-grammar/src/lib.rs
scie-grammar/src/lib.rs
+1
-3
scie-grammar/src/registry/grammar_registry.rs
scie-grammar/src/registry/grammar_registry.rs
+15
-15
scie-grammar/src/registry/mod.rs
scie-grammar/src/registry/mod.rs
+3
-0
scie-grammar/src/registry/scope_dependency.rs
scie-grammar/src/registry/scope_dependency.rs
+0
-0
scie-grammar/src/registry/sync_register.rs
scie-grammar/src/registry/sync_register.rs
+0
-0
未找到文件。
scie-grammar/src/lib.rs
浏览文件 @
b2da2b2f
...
...
@@ -13,6 +13,4 @@ pub mod grammar;
pub
mod
inter
;
pub
mod
rule
;
pub
mod
support
;
pub
mod
grammar_registry
;
pub
mod
sync_register
;
pub
mod
scope_dependency
;
pub
mod
registry
;
scie-grammar/src/grammar_registry.rs
→
scie-grammar/src/
registry/
grammar_registry.rs
浏览文件 @
b2da2b2f
use
std
::
collections
::{
HashMap
,
HashSet
};
use
crate
::
scope_dependency
::{
ScopeDependency
,
FullScopeDependency
,
ScopeDependencyCollector
};
use
crate
::
scope_dependency
::
ScopeDependency
::
Full
;
use
crate
::
registry
::
scope_dependency
::{
ScopeDependency
,
FullScopeDependency
,
ScopeDependencyCollector
};
use
crate
::
registry
::
scope_dependency
::
ScopeDependency
::
Full
;
pub
struct
IEmbeddedLanguagesMap
{
map
:
HashMap
<
String
,
i32
>
,
...
...
@@ -31,42 +31,42 @@ impl GrammarRegistry {
_
initial_language
:
i32
,
_
configuration
:
IGrammarConfiguration
,
)
{}
// todo: modify logic to here for _collect
DependenciesForD
ep
// todo: modify logic to here for _collect
_dependencies_for_d
ep
pub
fn
_
load_grammar
(
&
self
,
initial_scope_name
:
String
,
_
initial_language
:
i32
,
_
token_type
:
Option
<
ITokenTypeMap
>
)
{
let
mut
seen_full_scope_requests
:
HashSet
<
String
>
=
HashSet
::
new
();
let
seen_partial_scope_requests
:
HashSet
<
String
>
=
HashSet
::
new
();
let
_
seen_partial_scope_requests
:
HashSet
<
String
>
=
HashSet
::
new
();
seen_full_scope_requests
.insert
(
initial_scope_name
.clone
());
let
dependency
=
FullScopeDependency
::
new
(
initial_scope_name
.clone
());
let
mut
Q
:
Vec
<
ScopeDependency
>
=
vec!
[
ScopeDependency
::
Full
(
dependency
)];
let
mut
queue
:
Vec
<
ScopeDependency
>
=
vec!
[
ScopeDependency
::
Full
(
dependency
)];
while
Q
.len
()
>
0
{
let
q
=
Q
.clone
();
Q
=
vec!
[];
while
queue
.len
()
>
0
{
let
q
=
queue
.clone
();
queue
=
vec!
[];
for
x
in
q
{
for
x
in
q
.clone
()
{
match
x
{
Full
(
dep
)
=>
{
self
._load
SingleG
rammar
(
dep
.scope_name
);
self
._load
_single_g
rammar
(
dep
.scope_name
);
}
ScopeDependency
::
Partial
(
dep
)
=>
{
self
._load
SingleG
rammar
(
dep
.scope_name
);
self
._load
_single_g
rammar
(
dep
.scope_name
);
}
}
}
let
mut
deps
=
ScopeDependencyCollector
::
new
();
for
dep
in
q
{
self
._collect
DependenciesForD
ep
(
initial_scope_name
.clone
(),
&
mut
deps
,
dep
);
for
dep
in
q
.clone
()
{
self
._collect
_dependencies_for_d
ep
(
initial_scope_name
.clone
(),
&
mut
deps
,
dep
);
}
}
}
pub
fn
_
collect
DependenciesForDep
(
&
self
,
scope_name
:
String
,
deps
:
&
mut
ScopeDependencyCollector
,
dep
:
ScopeDependency
)
{
pub
fn
_
collect
_dependencies_for_dep
(
&
self
,
_
scope_name
:
String
,
_
deps
:
&
mut
ScopeDependencyCollector
,
_
dep
:
ScopeDependency
)
{
}
pub
fn
_
load
SingleGrammar
(
&
self
,
scope_name
:
String
)
{
pub
fn
_
load
_single_grammar
(
&
self
,
_
scope_name
:
String
)
{
// todo: add cache support
// todo: add load single gammar
}
...
...
scie-grammar/src/registry/mod.rs
0 → 100644
浏览文件 @
b2da2b2f
pub
mod
grammar_registry
;
pub
mod
sync_register
;
pub
mod
scope_dependency
;
scie-grammar/src/scope_dependency.rs
→
scie-grammar/src/
registry/
scope_dependency.rs
浏览文件 @
b2da2b2f
文件已移动
scie-grammar/src/sync_register.rs
→
scie-grammar/src/
registry/
sync_register.rs
浏览文件 @
b2da2b2f
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录