Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Phodal
scie
提交
d9f0d8a3
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 搜索 >>
未验证
提交
d9f0d8a3
编写于
9月 10, 2020
作者:
P
Phodal Huang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: split utf string for testing
上级
92375667
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
27 addition
and
17 deletion
+27
-17
scie-scanner/src/scanner/old/mod.rs
scie-scanner/src/scanner/old/mod.rs
+3
-0
scie-scanner/src/scanner/old/scie_onig.rs
scie-scanner/src/scanner/old/scie_onig.rs
+2
-5
scie-scanner/src/scanner/old/scie_scanner.rs
scie-scanner/src/scanner/old/scie_scanner.rs
+1
-1
scie-scanner/src/scanner/onig_scanner.rs
scie-scanner/src/scanner/onig_scanner.rs
+3
-3
scie-scanner/src/scanner/onig_string.rs
scie-scanner/src/scanner/onig_string.rs
+12
-7
vscode-tests/vscode-onig/src/lib/utf-string.spec.ts
vscode-tests/vscode-onig/src/lib/utf-string.spec.ts
+6
-1
未找到文件。
scie-scanner/src/scanner/old/mod.rs
浏览文件 @
d9f0d8a3
pub
mod
scie_scanner
;
pub
mod
scie_onig
;
pub
mod
scie_error
;
\ No newline at end of file
scie-scanner/src/scanner/old/scie_onig.rs
浏览文件 @
d9f0d8a3
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
use
std
::
ptr
::
null_mut
;
use
std
::
ptr
::
null_mut
;
use
onig
::{
Syntax
,
EncodedChars
};
use
onig
::{
Syntax
,
EncodedChars
};
use
std
::
sync
::
Mutex
;
use
std
::
sync
::
Mutex
;
use
crate
::
scanner
::
scie_error
::
ScieOnigError
;
use
crate
::
scanner
::
old
::
scie_error
::
ScieOnigError
;
lazy_static!
{
lazy_static!
{
static
ref
REGEX_NEW_MUTEX
:
Mutex
<
()
>
=
Mutex
::
new
(());
static
ref
REGEX_NEW_MUTEX
:
Mutex
<
()
>
=
Mutex
::
new
(());
...
@@ -21,9 +21,6 @@ pub struct ScieOnig {
...
@@ -21,9 +21,6 @@ pub struct ScieOnig {
}
}
impl
ScieOnig
{
impl
ScieOnig
{
pub
fn
new
(
pattern
:
&
str
)
->
Result
<
Self
,
ScieOnigError
>
{
}
pub
fn
demo_new
(
pattern
:
&
str
)
->
Result
<
Self
,
ScieOnigError
>
{
pub
fn
demo_new
(
pattern
:
&
str
)
->
Result
<
Self
,
ScieOnigError
>
{
let
option
=
ScieOnigOptions
::
REGEX_OPTION_NONE
;
let
option
=
ScieOnigOptions
::
REGEX_OPTION_NONE
;
let
syntax
=
Syntax
::
default
();
let
syntax
=
Syntax
::
default
();
...
@@ -69,7 +66,7 @@ impl ScieOnig {
...
@@ -69,7 +66,7 @@ impl ScieOnig {
#[cfg(test)]
#[cfg(test)]
mod
tests
{
mod
tests
{
use
crate
::
scanner
::
scie_onig
::
ScieOnig
;
use
crate
::
scanner
::
old
::
scie_onig
::
ScieOnig
;
#[test]
#[test]
fn
it_works
()
{
fn
it_works
()
{
...
...
scie-scanner/src/scanner/old/scie_scanner.rs
浏览文件 @
d9f0d8a3
...
@@ -137,7 +137,7 @@ pub fn str_vec_to_string<I, T>(iter: I) -> Vec<String>
...
@@ -137,7 +137,7 @@ pub fn str_vec_to_string<I, T>(iter: I) -> Vec<String>
#[cfg(test)]
#[cfg(test)]
mod
tests
{
mod
tests
{
use
crate
::
scanner
::
scie_scanner
::{
str_vec_to_string
,
ScieScanner
};
use
crate
::
scanner
::
old
::
scie_scanner
::{
ScieScanner
,
str_vec_to_string
};
#[test]
#[test]
fn
should_handle_simple_regex
()
{
fn
should_handle_simple_regex
()
{
...
...
scie-scanner/src/scanner/onig_scanner.rs
浏览文件 @
d9f0d8a3
...
@@ -7,9 +7,9 @@ pub struct OnigScanner {
...
@@ -7,9 +7,9 @@ pub struct OnigScanner {
impl
OnigScanner
{
impl
OnigScanner
{
pub
fn
new
(
pattens
:
Vec
<&
str
>
)
->
Self
{
pub
fn
new
(
pattens
:
Vec
<&
str
>
)
->
Self
{
let
str_ptrs_arr
:
Vec
<
Pointer
>
=
vec!
[];
let
_
str_ptrs_arr
:
Vec
<
Pointer
>
=
vec!
[];
let
str_len_arr
:
Vec
<
i32
>
=
vec!
[];
let
_
str_len_arr
:
Vec
<
i32
>
=
vec!
[];
for
x
in
pattens
{
for
_
x
in
pattens
{
}
}
OnigScanner
{
_
ptr
:
0
}
OnigScanner
{
_
ptr
:
0
}
...
...
scie-scanner/src/scanner/onig_string.rs
浏览文件 @
d9f0d8a3
use
unicode_segmentation
::
UnicodeSegmentation
;
pub
struct
OnigString
{
pub
struct
OnigString
{
pub
utf16length
:
i32
,
pub
utf16length
:
i32
,
pub
utf8length
:
i32
,
pub
utf8length
:
i32
,
...
@@ -10,12 +12,15 @@ pub struct OnigString {
...
@@ -10,12 +12,15 @@ pub struct OnigString {
impl
OnigString
{
impl
OnigString
{
pub
fn
new
(
str
:
String
)
->
Self
{
pub
fn
new
(
str
:
String
)
->
Self
{
let
utf16Length
=
str
.len
();
let
utf16length
=
str
.len
();
let
utf8_str
=
str
.graphemes
(
true
)
.collect
::
<
Vec
<&
str
>>
()
.clone
();
println!
(
"{:?}"
,
utf8_str
);
let
utf8length
=
utf8_str
.len
();
OnigString
{
OnigString
{
utf16length
:
0
,
utf16length
:
utf16length
as
i32
,
utf8length
:
0
,
utf8length
:
utf8length
as
i32
,
utf16value
:
""
.to_string
(),
utf16value
:
""
.to_string
(),
utf8value
:
vec!
[],
utf8value
:
vec!
[],
utf16offset_to_utf8
:
None
,
utf16offset_to_utf8
:
None
,
...
@@ -27,12 +32,12 @@ impl OnigString {
...
@@ -27,12 +32,12 @@ impl OnigString {
#[cfg(test)]
#[cfg(test)]
mod
tests
{
mod
tests
{
use
crate
::
scanner
::
onig_scanner
::
OnigScanner
;
use
crate
::
scanner
::
onig_string
::
OnigString
;
use
crate
::
scanner
::
onig_string
::
OnigString
;
#[test]
#[test]
fn
it_show_works_works
()
{
fn
it_show_works_works
()
{
OnigString
::
new
(
String
::
from
(
""
));
let
onig_string
=
OnigString
::
new
(
String
::
from
(
"a💻bYX"
));
assert
!
(
true
)
assert_eq!
(
8
,
onig_string
.utf16length
);
assert_eq!
(
5
,
onig_string
.utf8length
);
}
}
}
}
vscode-tests/vscode-onig/src/lib/utf-string.spec.ts
浏览文件 @
d9f0d8a3
...
@@ -4,6 +4,11 @@ import UtfString from './utf-string';
...
@@ -4,6 +4,11 @@ import UtfString from './utf-string';
test
(
'
constructor
'
,
(
t
)
=>
{
test
(
'
constructor
'
,
(
t
)
=>
{
const
utfString
=
new
UtfString
(
"
hello, world
"
);
const
utfString
=
new
UtfString
(
"
hello, world
"
);
t
.
log
(
utfString
);
t
.
is
(
utfString
.
utf8Length
,
12
);
t
.
is
(
utfString
.
utf8Length
,
12
);
});
});
test
(
'
utf8 length
'
,
(
t
)
=>
{
const
utfString
=
new
UtfString
(
"
a💻bYX
"
);
console
.
log
(
utfString
);
t
.
is
(
utfString
.
utf8Length
,
8
);
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录