Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Phodal
scie
提交
6edd82ae
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 搜索 >>
未验证
提交
6edd82ae
编写于
9月 02, 2020
作者:
P
Phodal Huang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: fix lint issues
上级
96ab6a0e
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
134 addition
and
52 deletion
+134
-52
scie-grammar/src/rule/begin_end_rule.rs
scie-grammar/src/rule/begin_end_rule.rs
+1
-2
scie-grammar/src/rule/begin_while_rule.rs
scie-grammar/src/rule/begin_while_rule.rs
+1
-1
scie-grammar/src/rule/match_rule.rs
scie-grammar/src/rule/match_rule.rs
+1
-1
scie-grammar/src/rule/mod.rs
scie-grammar/src/rule/mod.rs
+2
-3
scie-grammar/src/rule/reg_exp_source.rs
scie-grammar/src/rule/reg_exp_source.rs
+2
-2
scie-scanner/src/scanner/mod.rs
scie-scanner/src/scanner/mod.rs
+1
-1
scie-scanner/src/scanner/scanner.rs
scie-scanner/src/scanner/scanner.rs
+126
-42
未找到文件。
scie-grammar/src/rule/begin_end_rule.rs
浏览文件 @
6edd82ae
...
@@ -113,7 +113,6 @@ impl AbstractRule for BeginEndRule {
...
@@ -113,7 +113,6 @@ impl AbstractRule for BeginEndRule {
}
}
// todo: support for hasBackReferences
// todo: support for hasBackReferences
cached_compiled_patterns
cached_compiled_patterns
.compile
(
grammar
,
allow_a
,
allow_g
)
.compile
(
grammar
,
allow_a
,
allow_g
)
}
}
}
}
scie-grammar/src/rule/begin_while_rule.rs
浏览文件 @
6edd82ae
...
@@ -102,6 +102,6 @@ impl AbstractRule for BeginWhileRule {
...
@@ -102,6 +102,6 @@ impl AbstractRule for BeginWhileRule {
return
cached_compiled_patterns
return
cached_compiled_patterns
.compile
(
grammar
,
allow_a
,
allow_g
)
.compile
(
grammar
,
allow_a
,
allow_g
)
.clone
()
.clone
()
;
}
}
}
}
scie-grammar/src/rule/match_rule.rs
浏览文件 @
6edd82ae
...
@@ -72,6 +72,6 @@ impl AbstractRule for MatchRule {
...
@@ -72,6 +72,6 @@ impl AbstractRule for MatchRule {
return
cached_compiled_patterns
return
cached_compiled_patterns
.compile
(
grammar
,
allow_a
,
allow_g
)
.compile
(
grammar
,
allow_a
,
allow_g
)
.clone
()
.clone
()
;
}
}
}
}
scie-grammar/src/rule/mod.rs
浏览文件 @
6edd82ae
...
@@ -8,8 +8,8 @@ pub mod compiled_rule;
...
@@ -8,8 +8,8 @@ pub mod compiled_rule;
pub
mod
empty_rule
;
pub
mod
empty_rule
;
pub
mod
include_only_rule
;
pub
mod
include_only_rule
;
pub
mod
match_rule
;
pub
mod
match_rule
;
pub
mod
rule
;
pub
mod
reg_exp_source
;
pub
mod
reg_exp_source
;
pub
mod
rule
;
pub
use
self
::
abstract_rule
::
AbstractRule
;
pub
use
self
::
abstract_rule
::
AbstractRule
;
pub
use
self
::
begin_end_rule
::
BeginEndRule
;
pub
use
self
::
begin_end_rule
::
BeginEndRule
;
...
@@ -19,9 +19,9 @@ pub use self::compiled_rule::CompiledRule;
...
@@ -19,9 +19,9 @@ pub use self::compiled_rule::CompiledRule;
pub
use
self
::
empty_rule
::
EmptyRule
;
pub
use
self
::
empty_rule
::
EmptyRule
;
pub
use
self
::
include_only_rule
::
IncludeOnlyRule
;
pub
use
self
::
include_only_rule
::
IncludeOnlyRule
;
pub
use
self
::
match_rule
::
MatchRule
;
pub
use
self
::
match_rule
::
MatchRule
;
pub
use
self
::
rule
::
Rule
;
pub
use
self
::
reg_exp_source
::
RegExpSource
;
pub
use
self
::
reg_exp_source
::
RegExpSource
;
pub
use
self
::
reg_exp_source
::
RegExpSourceList
;
pub
use
self
::
reg_exp_source
::
RegExpSourceList
;
pub
use
self
::
rule
::
Rule
;
use
crate
::
grammar
::
Grammar
;
use
crate
::
grammar
::
Grammar
;
use
crate
::
inter
::{
IRawGrammar
,
IRawRepository
};
use
crate
::
inter
::{
IRawGrammar
,
IRawRepository
};
...
@@ -44,4 +44,3 @@ pub trait IGrammarRegistry {
...
@@ -44,4 +44,3 @@ pub trait IGrammarRegistry {
}
}
pub
trait
IRuleFactoryHelper
:
IGrammarRegistry
+
IRuleRegistry
{}
pub
trait
IRuleFactoryHelper
:
IGrammarRegistry
+
IRuleRegistry
{}
scie-grammar/src/rule/reg_exp_source.rs
浏览文件 @
6edd82ae
use
crate
::
rule
::
CompiledRule
;
use
crate
::
grammar
::
Grammar
;
use
crate
::
grammar
::
Grammar
;
use
crate
::
rule
::
CompiledRule
;
#[derive(Clone,
Debug,
Serialize)]
#[derive(Clone,
Debug,
Serialize)]
pub
struct
AnchorCache
{
pub
struct
AnchorCache
{
...
@@ -70,7 +70,7 @@ impl RegExpSourceList {
...
@@ -70,7 +70,7 @@ impl RegExpSourceList {
.collect
::
<
Vec
<
i32
>>
();
.collect
::
<
Vec
<
i32
>>
();
let
compiled_rule
=
CompiledRule
::
new
(
reg_exps
,
rules
);
let
compiled_rule
=
CompiledRule
::
new
(
reg_exps
,
rules
);
self
._cached
=
Some
(
compiled_rule
.clone
());
self
._cached
=
Some
(
compiled_rule
.clone
());
return
compiled_rule
return
compiled_rule
;
}
}
}
else
{
}
else
{
println!
(
"// todo: cached {:?}"
,
self
._items
);
println!
(
"// todo: cached {:?}"
,
self
._items
);
...
...
scie-scanner/src/scanner/mod.rs
浏览文件 @
6edd82ae
pub
mod
scanner
;
pub
mod
scanner
;
\ No newline at end of file
scie-scanner/src/scanner/scanner.rs
浏览文件 @
6edd82ae
use
onig
::
{
Regex
}
;
use
onig
::
Regex
;
use
unicode_segmentation
::
UnicodeSegmentation
;
use
unicode_segmentation
::
UnicodeSegmentation
;
#[derive(Debug,
Clone,
Serialize)]
#[derive(Debug,
Clone,
Serialize)]
pub
struct
IOnigCaptureIndex
{
pub
struct
IOnigCaptureIndex
{
pub
start
:
usize
,
pub
start
:
usize
,
...
@@ -23,17 +22,18 @@ pub struct Scanner {
...
@@ -23,17 +22,18 @@ pub struct Scanner {
impl
Scanner
{
impl
Scanner
{
pub
fn
new
(
patterns
:
Vec
<
String
>
)
->
Self
{
pub
fn
new
(
patterns
:
Vec
<
String
>
)
->
Self
{
Scanner
{
Scanner
{
index
:
0
,
patterns
}
index
:
0
,
patterns
,
}
}
}
pub
fn
dispose
(
&
mut
self
)
{
pub
fn
dispose
(
&
mut
self
)
{
self
.index
=
0
self
.index
=
0
}
}
pub
fn
find_next_match_sync
(
&
mut
self
,
origin_str
:
String
,
start_position
:
i32
)
->
Option
<
IOnigMatch
>
{
pub
fn
find_next_match_sync
(
&
mut
self
,
origin_str
:
String
,
start_position
:
i32
,
)
->
Option
<
IOnigMatch
>
{
if
self
.index
>=
self
.patterns
.clone
()
.len
()
{
if
self
.index
>=
self
.patterns
.clone
()
.len
()
{
self
.index
=
0
;
self
.index
=
0
;
return
None
;
return
None
;
...
@@ -41,7 +41,7 @@ impl Scanner {
...
@@ -41,7 +41,7 @@ impl Scanner {
let
mut
after_pos_str
=
String
::
from
(
""
);
let
mut
after_pos_str
=
String
::
from
(
""
);
let
mut
start_pos
=
start_position
;
let
mut
start_pos
=
start_position
;
let
mut
string_vec
=
origin_str
.graphemes
(
true
)
.collect
::
<
Vec
<&
str
>>
();
let
string_vec
=
origin_str
.graphemes
(
true
)
.collect
::
<
Vec
<&
str
>>
();
let
mut
has_utf8
=
false
;
let
mut
has_utf8
=
false
;
if
string_vec
.len
()
!=
origin_str
.len
()
{
if
string_vec
.len
()
!=
origin_str
.len
()
{
...
@@ -83,7 +83,8 @@ impl Scanner {
...
@@ -83,7 +83,8 @@ impl Scanner {
if
has_utf8
{
if
has_utf8
{
let
x1
=
after_pos_str
.split_at
(
end
)
.0
;
let
x1
=
after_pos_str
.split_at
(
end
)
.0
;
let
utf8_end
=
before_vec
.len
()
+
x1
.graphemes
(
true
)
.collect
::
<
Vec
<&
str
>>
()
.len
()
+
1
;
let
utf8_end
=
before_vec
.len
()
+
x1
.graphemes
(
true
)
.collect
::
<
Vec
<&
str
>>
()
.len
()
+
1
;
let
utf8_start
=
utf8_end
-
length
;
let
utf8_start
=
utf8_end
-
length
;
capture
=
IOnigCaptureIndex
{
capture
=
IOnigCaptureIndex
{
...
@@ -112,10 +113,9 @@ impl Scanner {
...
@@ -112,10 +113,9 @@ impl Scanner {
}
}
}
}
#[cfg(test)]
#[cfg(test)]
mod
tests
{
mod
tests
{
use
crate
::
scanner
::
scanner
::
{
Scanner
,
IOnigMatch
}
;
use
crate
::
scanner
::
scanner
::
Scanner
;
#[test]
#[test]
fn
should_handle_simple_regex
()
{
fn
should_handle_simple_regex
()
{
...
@@ -144,14 +144,35 @@ mod tests {
...
@@ -144,14 +144,35 @@ mod tests {
assert_eq!
(
true
,
false
);
assert_eq!
(
true
,
false
);
}
}
let
result
=
scanner
.find_next_match_sync
(
String
::
from
(
"xxaxxbxxc"
),
0
)
.unwrap
();
let
result
=
scanner
assert_eq!
(
serde_json
::
to_string
(
&
result
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:0,
\"
capture_indices
\"
:[{
\"
start
\"
:2,
\"
end
\"
:3,
\"
length
\"
:1}]}"
));
.find_next_match_sync
(
String
::
from
(
"xxaxxbxxc"
),
0
)
.unwrap
();
let
result2
=
scanner
.find_next_match_sync
(
String
::
from
(
"xxaxxbxxc"
),
4
)
.unwrap
();
assert_eq!
(
assert_eq!
(
serde_json
::
to_string
(
&
result2
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:1,
\"
capture_indices
\"
:[{
\"
start
\"
:5,
\"
end
\"
:6,
\"
length
\"
:1}]}"
));
serde_json
::
to_string
(
&
result
)
.unwrap
(),
String
::
from
(
let
result3
=
scanner
.find_next_match_sync
(
String
::
from
(
"xxaxxbxxc"
),
7
)
.unwrap
();
"{
\"
index
\"
:0,
\"
capture_indices
\"
:[{
\"
start
\"
:2,
\"
end
\"
:3,
\"
length
\"
:1}]}"
assert_eq!
(
serde_json
::
to_string
(
&
result3
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:2,
\"
capture_indices
\"
:[{
\"
start
\"
:8,
\"
end
\"
:9,
\"
length
\"
:1}]}"
));
)
);
let
result2
=
scanner
.find_next_match_sync
(
String
::
from
(
"xxaxxbxxc"
),
4
)
.unwrap
();
assert_eq!
(
serde_json
::
to_string
(
&
result2
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:1,
\"
capture_indices
\"
:[{
\"
start
\"
:5,
\"
end
\"
:6,
\"
length
\"
:1}]}"
)
);
let
result3
=
scanner
.find_next_match_sync
(
String
::
from
(
"xxaxxbxxc"
),
7
)
.unwrap
();
assert_eq!
(
serde_json
::
to_string
(
&
result3
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:2,
\"
capture_indices
\"
:[{
\"
start
\"
:8,
\"
end
\"
:9,
\"
length
\"
:1}]}"
)
);
if
let
None
=
scanner
.find_next_match_sync
(
String
::
from
(
"xxaxxbxxc"
),
9
)
{
if
let
None
=
scanner
.find_next_match_sync
(
String
::
from
(
"xxaxxbxxc"
),
9
)
{
assert_eq!
(
true
,
true
);
assert_eq!
(
true
,
true
);
...
@@ -165,35 +186,84 @@ mod tests {
...
@@ -165,35 +186,84 @@ mod tests {
let
regex
=
vec!
[
String
::
from
(
"1"
),
String
::
from
(
"2"
)];
let
regex
=
vec!
[
String
::
from
(
"1"
),
String
::
from
(
"2"
)];
let
mut
scanner
=
Scanner
::
new
(
regex
);
let
mut
scanner
=
Scanner
::
new
(
regex
);
let
result
=
scanner
.find_next_match_sync
(
String
::
from
(
"ab…cde21"
),
5
)
.unwrap
();
let
result
=
scanner
assert_eq!
(
serde_json
::
to_string
(
&
result
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:0,
\"
capture_indices
\"
:[{
\"
start
\"
:8,
\"
end
\"
:9,
\"
length
\"
:1}]}"
));
.find_next_match_sync
(
String
::
from
(
"ab…cde21"
),
5
)
.unwrap
();
assert_eq!
(
serde_json
::
to_string
(
&
result
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:0,
\"
capture_indices
\"
:[{
\"
start
\"
:8,
\"
end
\"
:9,
\"
length
\"
:1}]}"
)
);
}
}
#[test]
#[test]
fn
should_handle_unicode2
()
{
fn
should_handle_unicode2
()
{
let
mut
scanner2
=
Scanner
::
new
(
vec!
[
String
::
from
(
"
\"
"
)]);
let
mut
scanner2
=
Scanner
::
new
(
vec!
[
String
::
from
(
"
\"
"
)]);
let
result2
=
scanner2
.find_next_match_sync
(
String
::
from
(
"{
\"
…
\"
: 1}"
),
1
)
.unwrap
();
let
result2
=
scanner2
assert_eq!
(
serde_json
::
to_string
(
&
result2
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:0,
\"
capture_indices
\"
:[{
\"
start
\"
:2,
\"
end
\"
:3,
\"
length
\"
:1}]}"
));
.find_next_match_sync
(
String
::
from
(
"{
\"
…
\"
: 1}"
),
1
)
.unwrap
();
assert_eq!
(
serde_json
::
to_string
(
&
result2
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:0,
\"
capture_indices
\"
:[{
\"
start
\"
:2,
\"
end
\"
:3,
\"
length
\"
:1}]}"
)
);
}
}
#[test]
#[test]
fn
should_handle_unicode3
()
{
fn
should_handle_unicode3
()
{
let
regex
=
vec!
[
String
::
from
(
"Y"
),
String
::
from
(
"X"
)];
let
regex
=
vec!
[
String
::
from
(
"Y"
),
String
::
from
(
"X"
)];
let
mut
scanner
=
Scanner
::
new
(
regex
);
let
mut
scanner
=
Scanner
::
new
(
regex
);
let
result
=
scanner
.find_next_match_sync
(
String
::
from
(
"a💻bYX"
),
0
)
.unwrap
();
let
result
=
scanner
assert_eq!
(
serde_json
::
to_string
(
&
result
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:0,
\"
capture_indices
\"
:[{
\"
start
\"
:4,
\"
end
\"
:5,
\"
length
\"
:1}]}"
));
.find_next_match_sync
(
String
::
from
(
"a💻bYX"
),
0
)
.unwrap
();
let
result1
=
scanner
.find_next_match_sync
(
String
::
from
(
"a💻bYX"
),
1
)
.unwrap
();
assert_eq!
(
assert_eq!
(
serde_json
::
to_string
(
&
result1
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:0,
\"
capture_indices
\"
:[{
\"
start
\"
:4,
\"
end
\"
:5,
\"
length
\"
:1}]}"
));
serde_json
::
to_string
(
&
result
)
.unwrap
(),
String
::
from
(
let
result2
=
scanner
.find_next_match_sync
(
String
::
from
(
"a💻bYX"
),
2
)
.unwrap
();
"{
\"
index
\"
:0,
\"
capture_indices
\"
:[{
\"
start
\"
:4,
\"
end
\"
:5,
\"
length
\"
:1}]}"
assert_eq!
(
serde_json
::
to_string
(
&
result2
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:0,
\"
capture_indices
\"
:[{
\"
start
\"
:4,
\"
end
\"
:5,
\"
length
\"
:1}]}"
));
)
);
let
result3
=
scanner
.find_next_match_sync
(
String
::
from
(
"a💻bYX"
),
3
)
.unwrap
();
assert_eq!
(
serde_json
::
to_string
(
&
result3
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:0,
\"
capture_indices
\"
:[{
\"
start
\"
:4,
\"
end
\"
:5,
\"
length
\"
:1}]}"
));
let
result1
=
scanner
.find_next_match_sync
(
String
::
from
(
"a💻bYX"
),
1
)
let
result4
=
scanner
.find_next_match_sync
(
String
::
from
(
"a💻bYX"
),
4
)
.unwrap
();
.unwrap
();
assert_eq!
(
serde_json
::
to_string
(
&
result4
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:1,
\"
capture_indices
\"
:[{
\"
start
\"
:5,
\"
end
\"
:6,
\"
length
\"
:1}]}"
));
assert_eq!
(
serde_json
::
to_string
(
&
result1
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:0,
\"
capture_indices
\"
:[{
\"
start
\"
:4,
\"
end
\"
:5,
\"
length
\"
:1}]}"
)
);
let
result2
=
scanner
.find_next_match_sync
(
String
::
from
(
"a💻bYX"
),
2
)
.unwrap
();
assert_eq!
(
serde_json
::
to_string
(
&
result2
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:0,
\"
capture_indices
\"
:[{
\"
start
\"
:4,
\"
end
\"
:5,
\"
length
\"
:1}]}"
)
);
let
result3
=
scanner
.find_next_match_sync
(
String
::
from
(
"a💻bYX"
),
3
)
.unwrap
();
assert_eq!
(
serde_json
::
to_string
(
&
result3
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:0,
\"
capture_indices
\"
:[{
\"
start
\"
:4,
\"
end
\"
:5,
\"
length
\"
:1}]}"
)
);
let
result4
=
scanner
.find_next_match_sync
(
String
::
from
(
"a💻bYX"
),
4
)
.unwrap
();
assert_eq!
(
serde_json
::
to_string
(
&
result4
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:1,
\"
capture_indices
\"
:[{
\"
start
\"
:5,
\"
end
\"
:6,
\"
length
\"
:1}]}"
)
);
// let result5 = scanner.find_next_match_sync(String::from("a💻bYX"), 5).unwrap();
// let result5 = scanner.find_next_match_sync(String::from("a💻bYX"), 5).unwrap();
// assert_eq!(serde_json::to_string(&result5).unwrap(), String::from("{\"index\":1,\"capture_indices\":[{\"start\":4,\"end\":5,\"length\":1}]}"));
// assert_eq!(serde_json::to_string(&result5).unwrap(), String::from("{\"index\":1,\"capture_indices\":[{\"start\":4,\"end\":5,\"length\":1}]}"));
...
@@ -202,8 +272,15 @@ mod tests {
...
@@ -202,8 +272,15 @@ mod tests {
#[test]
#[test]
fn
should_out_of_bounds
()
{
fn
should_out_of_bounds
()
{
let
mut
scanner
=
Scanner
::
new
(
vec!
[
String
::
from
(
"X"
)]);
let
mut
scanner
=
Scanner
::
new
(
vec!
[
String
::
from
(
"X"
)]);
let
result
=
scanner
.find_next_match_sync
(
String
::
from
(
"X💻X"
),
-
10000
)
.unwrap
();
let
result
=
scanner
assert_eq!
(
serde_json
::
to_string
(
&
result
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:0,
\"
capture_indices
\"
:[{
\"
start
\"
:1,
\"
end
\"
:2,
\"
length
\"
:1}]}"
));
.find_next_match_sync
(
String
::
from
(
"X💻X"
),
-
10000
)
.unwrap
();
assert_eq!
(
serde_json
::
to_string
(
&
result
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:0,
\"
capture_indices
\"
:[{
\"
start
\"
:1,
\"
end
\"
:2,
\"
length
\"
:1}]}"
)
);
let
result2
=
scanner
.find_next_match_sync
(
String
::
from
(
"X💻X"
),
10000
);
let
result2
=
scanner
.find_next_match_sync
(
String
::
from
(
"X💻X"
),
10000
);
assert_eq!
(
format!
(
"{:?}"
,
result2
),
"None"
);
assert_eq!
(
format!
(
"{:?}"
,
result2
),
"None"
);
...
@@ -215,7 +292,14 @@ mod tests {
...
@@ -215,7 +292,14 @@ mod tests {
let
result
=
scanner
.find_next_match_sync
(
String
::
from
(
"first-and-second"
),
0
);
let
result
=
scanner
.find_next_match_sync
(
String
::
from
(
"first-and-second"
),
0
);
assert_eq!
(
format!
(
"{:?}"
,
result
),
"None"
);
assert_eq!
(
format!
(
"{:?}"
,
result
),
"None"
);
let
result2
=
scanner
.find_next_match_sync
(
String
::
from
(
"first-and-second"
),
5
)
.unwrap
();
let
result2
=
scanner
assert_eq!
(
serde_json
::
to_string
(
&
result2
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:0,
\"
capture_indices
\"
:[{
\"
start
\"
:5,
\"
end
\"
:9,
\"
length
\"
:4}]}"
));
.find_next_match_sync
(
String
::
from
(
"first-and-second"
),
5
)
.unwrap
();
assert_eq!
(
serde_json
::
to_string
(
&
result2
)
.unwrap
(),
String
::
from
(
"{
\"
index
\"
:0,
\"
capture_indices
\"
:[{
\"
start
\"
:5,
\"
end
\"
:9,
\"
length
\"
:4}]}"
)
);
}
}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录