Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Phodal
scie
提交
6cf8e907
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 搜索 >>
未验证
提交
6cf8e907
编写于
9月 07, 2020
作者:
P
Phodal Huang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: fix begin rule error issues
上级
1e080798
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
3408 addition
and
12 deletion
+3408
-12
docs/issues/c.md
docs/issues/c.md
+30
-0
scie-grammar/src/grammar/grammar.rs
scie-grammar/src/grammar/grammar.rs
+7
-1
scie-grammar/src/rule/rule_factory.rs
scie-grammar/src/rule/rule_factory.rs
+2
-3
vscode-tests/index.js
vscode-tests/index.js
+3
-6
vscode-tests/testdata/c.out.json
vscode-tests/testdata/c.out.json
+3362
-0
vscode-tests/vendor/main.js
vscode-tests/vendor/main.js
+4
-2
未找到文件。
docs/issues/c.md
0 → 100644
浏览文件 @
6cf8e907
# C issues
## Lost begin_captures
```
bash
meta.preprocessor.c.include
```
### Correct
```
json
"beginCaptures"
:
[
null
,
{
"id"
:
86
,
"_name"
:
"keyword.control.import.include.c"
,
"_nameIsCapturing"
:
false
,
"_contentName"
:
null
,
"_contentNameIsCapturing"
:
false
,
"retokenizeCapturedWithRuleId"
:
0
,
"_type"
:
"CaptureRule"
}
]
,
```
### Error
```
json
"begin_captures"
:
[]
,
```
\ No newline at end of file
scie-grammar/src/grammar/grammar.rs
浏览文件 @
6cf8e907
...
...
@@ -660,7 +660,13 @@ return 0;
}
"
;
let
grammar
=
to_grammar_with_code
(
"test-cases/first-mate/fixtures/c.json"
,
code
);
// assert_eq!(grammar.rule_id2desc.len(), 162);
debug_output
(
&
grammar
,
String
::
from
(
"program.json"
));
}
#[test]
fn
should_identify_c_include
()
{
let
code
=
"#include <stdio.h>"
;
let
grammar
=
to_grammar_with_code
(
"test-cases/first-mate/fixtures/c.json"
,
code
);
debug_output
(
&
grammar
,
String
::
from
(
"program.json"
));
}
...
...
scie-grammar/src/rule/rule_factory.rs
浏览文件 @
6cf8e907
...
...
@@ -26,7 +26,6 @@ impl RuleFactory {
repository
:
&
mut
IRawRepository
,
)
->
Vec
<
Box
<
dyn
AbstractRule
>>
{
let
mut
r
:
Vec
<
Box
<
dyn
AbstractRule
>>
=
vec!
[];
if
let
Some
(
capts
)
=
captures
.clone
()
{
let
mut
maximum_capture_id
=
0
;
for
(
id_str
,
_
value
)
in
capts
.clone
()
.map.capture_map
{
...
...
@@ -305,8 +304,8 @@ impl RuleFactory {
}
let
begin_rule_factory
=
RuleFactory
::
compile_captures
(
begin_captures
,
helper
,
repository
);
let
end_rule_factory
=
RuleFactory
::
compile_captures
(
end_captures
,
helper
,
repository
);
RuleFactory
::
compile_captures
(
desc
.
begin_captures
,
helper
,
repository
);
let
end_rule_factory
=
RuleFactory
::
compile_captures
(
desc
.
end_captures
,
helper
,
repository
);
let
pattern_factory
=
RuleFactory
::
compile_patterns
(
desc
.patterns
,
helper
,
repository
);
let
begin_end_rule
=
BeginEndRule
::
new
(
...
...
vscode-tests/index.js
浏览文件 @
6cf8e907
...
...
@@ -15,15 +15,12 @@ const registry = new vsctm.Registry({
createOnigString
:
(
str
)
=>
new
oniguruma
.
OnigString
(
str
)
}),
loadGrammar
:
(
scopeName
)
=>
{
return
readFile
(
'
./syntaxes/json/
makefile.json
'
).
then
(
data
=>
vsctm
.
parseRawGrammar
(
data
.
toString
(),
"
makefile
.json
"
))
return
readFile
(
'
./syntaxes/json/
c.json
'
).
then
(
data
=>
vsctm
.
parseRawGrammar
(
data
.
toString
(),
"
c
.json
"
))
}
});
registry
.
loadGrammar
(
'
source.makefile
'
).
then
(
grammar
=>
{
const
text
=
`
hellomake: $(OBJ)
\t$(CC) -o $@ $^ $(CFLAGS)
`
.
split
(
"
\n
"
);
registry
.
loadGrammar
(
'
source.c
'
).
then
(
grammar
=>
{
const
text
=
`#include <stdio.h>`
.
split
(
"
\n
"
);
let
ruleStack
=
vsctm
.
INITIAL
;
for
(
let
i
=
0
;
i
<
text
.
length
;
i
++
)
{
const
line
=
text
[
i
];
...
...
vscode-tests/testdata/c.out.json
0 → 100644
浏览文件 @
6cf8e907
此差异已折叠。
点击以展开。
vscode-tests/vendor/main.js
浏览文件 @
6cf8e907
...
...
@@ -734,11 +734,11 @@ var Grammar = /** @class */ (function () {
if
(
this
.
_rootId
===
-
1
)
{
this
.
_rootId
=
rule_1
.
RuleFactory
.
getCompiledRuleId
(
this
.
_grammar
.
repository
.
$self
,
this
,
this
.
_grammar
.
repository
);
}
//
// console.log(this._ruleId2desc.length);
// let fs = require('fs');
// let data = JSON.stringify(this._ruleId2desc, null, 2);
// fs.writeFileSync("testdata/
makefile
.out.json", data, 'utf8');
// fs.writeFileSync("testdata/
c
.out.json", data, 'utf8');
var
isFirstLine
;
if
(
!
prevState
||
prevState
===
StackElement
.
NULL
)
{
...
...
@@ -3628,6 +3628,8 @@ var RuleFactory = /** @class */ (function () {
var
retokenizeCapturedWithRuleId
=
0
;
if
(
captures
[
captureId
].
patterns
)
{
retokenizeCapturedWithRuleId
=
RuleFactory
.
getCompiledRuleId
(
captures
[
captureId
],
helper
,
repository
);
}
else
{
console
.
log
(
captures
[
captureId
],
numericCaptureId
);
}
r
[
numericCaptureId
]
=
RuleFactory
.
createCaptureRule
(
helper
,
captures
[
captureId
].
$vscodeTextmateLocation
,
captures
[
captureId
].
name
,
captures
[
captureId
].
contentName
,
retokenizeCapturedWithRuleId
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录