@aster-cloud/aster-lang-ts 0.0.28 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/peg/headers-parser.js +459 -233
- package/dist/scripts/aster.js +0 -0
- package/dist/scripts/emit-core.js +0 -0
- package/dist/scripts/generate-lexicons.d.ts +13 -0
- package/dist/scripts/generate-lexicons.d.ts.map +1 -0
- package/dist/scripts/generate-lexicons.js +152 -0
- package/dist/scripts/generate-lexicons.js.map +1 -0
- package/dist/scripts/generate-vocabularies.d.ts +13 -0
- package/dist/scripts/generate-vocabularies.d.ts.map +1 -0
- package/dist/scripts/generate-vocabularies.js +205 -0
- package/dist/scripts/generate-vocabularies.js.map +1 -0
- package/dist/scripts/golden.js +4 -4
- package/dist/scripts/golden.js.map +1 -1
- package/dist/scripts/perf-assert.js +2 -2
- package/dist/scripts/perf-assert.js.map +1 -1
- package/dist/scripts/perf-lsp.js +2 -2
- package/dist/scripts/perf-lsp.js.map +1 -1
- package/dist/scripts/scaffold.js +4 -4
- package/dist/scripts/verify-lexicon-sync.d.ts +14 -0
- package/dist/scripts/verify-lexicon-sync.d.ts.map +1 -0
- package/dist/scripts/verify-lexicon-sync.js +248 -0
- package/dist/scripts/verify-lexicon-sync.js.map +1 -0
- package/dist/src/browser.d.ts +2 -0
- package/dist/src/browser.d.ts.map +1 -1
- package/dist/src/browser.js +14 -3
- package/dist/src/browser.js.map +1 -1
- package/dist/src/cli/policy-converter.js +0 -0
- package/dist/src/config/lexicons/de-DE.d.ts +0 -9
- package/dist/src/config/lexicons/de-DE.d.ts.map +1 -1
- package/dist/src/config/lexicons/de-DE.js +27 -53
- package/dist/src/config/lexicons/de-DE.js.map +1 -1
- package/dist/src/config/lexicons/en-US.d.ts +0 -12
- package/dist/src/config/lexicons/en-US.d.ts.map +1 -1
- package/dist/src/config/lexicons/en-US.js +27 -50
- package/dist/src/config/lexicons/en-US.js.map +1 -1
- package/dist/src/config/lexicons/identifiers/domains/finance.loan.de-DE.d.ts +3 -0
- package/dist/src/config/lexicons/identifiers/domains/finance.loan.de-DE.d.ts.map +1 -0
- package/dist/src/config/lexicons/identifiers/domains/finance.loan.de-DE.js +310 -0
- package/dist/src/config/lexicons/identifiers/domains/finance.loan.de-DE.js.map +1 -0
- package/dist/src/config/lexicons/identifiers/domains/finance.loan.en-US.d.ts +3 -0
- package/dist/src/config/lexicons/identifiers/domains/finance.loan.en-US.d.ts.map +1 -0
- package/dist/src/config/lexicons/identifiers/domains/finance.loan.en-US.js +291 -0
- package/dist/src/config/lexicons/identifiers/domains/finance.loan.en-US.js.map +1 -0
- package/dist/src/config/lexicons/identifiers/domains/finance.loan.zh-CN.d.ts +1 -11
- package/dist/src/config/lexicons/identifiers/domains/finance.loan.zh-CN.d.ts.map +1 -1
- package/dist/src/config/lexicons/identifiers/domains/finance.loan.zh-CN.js +47 -33
- package/dist/src/config/lexicons/identifiers/domains/finance.loan.zh-CN.js.map +1 -1
- package/dist/src/config/lexicons/identifiers/domains/index.d.ts +7 -0
- package/dist/src/config/lexicons/identifiers/domains/index.d.ts.map +1 -0
- package/dist/src/config/lexicons/identifiers/domains/index.js +8 -0
- package/dist/src/config/lexicons/identifiers/domains/index.js.map +1 -0
- package/dist/src/config/lexicons/identifiers/domains/insurance.auto.de-DE.d.ts +3 -0
- package/dist/src/config/lexicons/identifiers/domains/insurance.auto.de-DE.d.ts.map +1 -0
- package/dist/src/config/lexicons/identifiers/domains/insurance.auto.de-DE.js +275 -0
- package/dist/src/config/lexicons/identifiers/domains/insurance.auto.de-DE.js.map +1 -0
- package/dist/src/config/lexicons/identifiers/domains/insurance.auto.en-US.d.ts +3 -0
- package/dist/src/config/lexicons/identifiers/domains/insurance.auto.en-US.d.ts.map +1 -0
- package/dist/src/config/lexicons/identifiers/domains/insurance.auto.en-US.js +261 -0
- package/dist/src/config/lexicons/identifiers/domains/insurance.auto.en-US.js.map +1 -0
- package/dist/src/config/lexicons/identifiers/domains/insurance.auto.zh-CN.d.ts +1 -23
- package/dist/src/config/lexicons/identifiers/domains/insurance.auto.zh-CN.d.ts.map +1 -1
- package/dist/src/config/lexicons/identifiers/domains/insurance.auto.zh-CN.js +81 -155
- package/dist/src/config/lexicons/identifiers/domains/insurance.auto.zh-CN.js.map +1 -1
- package/dist/src/config/lexicons/identifiers/examples/canonicalizer-integration.js +8 -8
- package/dist/src/config/lexicons/identifiers/examples/canonicalizer-integration.js.map +1 -1
- package/dist/src/config/lexicons/identifiers/index.d.ts +1 -2
- package/dist/src/config/lexicons/identifiers/index.d.ts.map +1 -1
- package/dist/src/config/lexicons/identifiers/index.js +2 -3
- package/dist/src/config/lexicons/identifiers/index.js.map +1 -1
- package/dist/src/config/lexicons/identifiers/registry.d.ts +2 -2
- package/dist/src/config/lexicons/identifiers/registry.d.ts.map +1 -1
- package/dist/src/config/lexicons/identifiers/registry.js +16 -3
- package/dist/src/config/lexicons/identifiers/registry.js.map +1 -1
- package/dist/src/config/lexicons/template.d.ts.map +1 -1
- package/dist/src/config/lexicons/template.js +18 -8
- package/dist/src/config/lexicons/template.js.map +1 -1
- package/dist/src/config/lexicons/types.d.ts +1 -1
- package/dist/src/config/lexicons/types.d.ts.map +1 -1
- package/dist/src/config/lexicons/zh-CN.d.ts +0 -18
- package/dist/src/config/lexicons/zh-CN.d.ts.map +1 -1
- package/dist/src/config/lexicons/zh-CN.js +26 -61
- package/dist/src/config/lexicons/zh-CN.js.map +1 -1
- package/dist/src/config/semantic.d.ts +9 -4
- package/dist/src/config/semantic.d.ts.map +1 -1
- package/dist/src/config/semantic.js +16 -5
- package/dist/src/config/semantic.js.map +1 -1
- package/dist/src/config/token-kind.d.ts +17 -5
- package/dist/src/config/token-kind.d.ts.map +1 -1
- package/dist/src/config/token-kind.js +23 -7
- package/dist/src/config/token-kind.js.map +1 -1
- package/dist/src/frontend/canonicalizer.d.ts +20 -2
- package/dist/src/frontend/canonicalizer.d.ts.map +1 -1
- package/dist/src/frontend/canonicalizer.js +58 -2
- package/dist/src/frontend/canonicalizer.js.map +1 -1
- package/dist/src/frontend/index.d.ts +1 -0
- package/dist/src/frontend/index.d.ts.map +1 -1
- package/dist/src/frontend/index.js.map +1 -1
- package/dist/src/frontend/keyword-translator.d.ts.map +1 -1
- package/dist/src/frontend/keyword-translator.js +51 -15
- package/dist/src/frontend/keyword-translator.js.map +1 -1
- package/dist/src/lsp/codeaction.js +9 -9
- package/dist/src/lsp/codeaction.js.map +1 -1
- package/dist/src/lsp/completion.js +2 -2
- package/dist/src/lsp/completion.js.map +1 -1
- package/dist/src/lsp/module_cache.js +2 -2
- package/dist/src/lsp/module_cache.js.map +1 -1
- package/dist/src/lsp/server.js +0 -0
- package/dist/src/lsp/symbols.js +2 -2
- package/dist/src/lsp/symbols.js.map +1 -1
- package/dist/src/parser/decl-parser.d.ts +2 -2
- package/dist/src/parser/decl-parser.js +12 -12
- package/dist/src/parser/decl-parser.js.map +1 -1
- package/dist/src/parser/expr-stmt-parser.js +2 -2
- package/dist/src/parser/expr-stmt-parser.js.map +1 -1
- package/dist/src/parser.d.ts +1 -1
- package/dist/src/parser.js +1 -1
- package/dist/test/compiler/depends-on.test.js +2 -2
- package/dist/test/compiler/depends-on.test.js.map +1 -1
- package/dist/test/compiler/workflow-emitter-helpers.js +2 -2
- package/dist/test/compiler/workflow-emitter-helpers.js.map +1 -1
- package/dist/test/generators.js +18 -18
- package/dist/test/generators.js.map +1 -1
- package/dist/test/integration/lsp/lsp-completion.test.js +13 -13
- package/dist/test/integration/lsp/lsp-completion.test.js.map +1 -1
- package/dist/test/integration/lsp/lsp-diagnostics.test.js +7 -7
- package/dist/test/integration/lsp/lsp-diagnostics.test.js.map +1 -1
- package/dist/test/integration/lsp/lsp-file-watcher.test.js +8 -8
- package/dist/test/integration/lsp/lsp-file-watcher.test.js.map +1 -1
- package/dist/test/integration/lsp/lsp-modules.test.js +6 -6
- package/dist/test/integration/lsp/lsp-multi-rename.test.js +1 -1
- package/dist/test/integration/lsp/lsp-multi-rename.test.js.map +1 -1
- package/dist/test/integration/lsp/lsp-navigation.test.js +21 -21
- package/dist/test/integration/lsp/lsp-navigation.test.js.map +1 -1
- package/dist/test/integration/pipeline/pipeline.test.js +38 -38
- package/dist/test/integration/pipeline/pipeline.test.js.map +1 -1
- package/dist/test/property/lsp-props.test.js +2 -2
- package/dist/test/property/lsp-props.test.js.map +1 -1
- package/dist/test/property/property.test.js +25 -25
- package/dist/test/property/property.test.js.map +1 -1
- package/dist/test/type-checker/cross-module-packages.test.js +2 -1
- package/dist/test/type-checker/cross-module-packages.test.js.map +1 -1
- package/dist/test/unit/async/async-discipline.test.js +81 -81
- package/dist/test/unit/async/async-schedule.test.js +23 -23
- package/dist/test/unit/canonicalizer/canonicalizer.test.js +19 -13
- package/dist/test/unit/canonicalizer/canonicalizer.test.js.map +1 -1
- package/dist/test/unit/config/lexicons/zh-CN.test.js +44 -71
- package/dist/test/unit/config/lexicons/zh-CN.test.js.map +1 -1
- package/dist/test/unit/generator.test.js +3 -3
- package/dist/test/unit/generator.test.js.map +1 -1
- package/dist/test/unit/keyword-translator.test.js +55 -56
- package/dist/test/unit/keyword-translator.test.js.map +1 -1
- package/dist/test/unit/lexer/lexer.test.js +5 -5
- package/dist/test/unit/lexer/lexer.test.js.map +1 -1
- package/dist/test/unit/lowering/lowering.test.js +13 -13
- package/dist/test/unit/lsp/codeaction.test.js +9 -9
- package/dist/test/unit/lsp/codeaction.test.js.map +1 -1
- package/dist/test/unit/lsp/symbols.test.js +2 -2
- package/dist/test/unit/lsp/symbols.test.js.map +1 -1
- package/dist/test/unit/module-cache-packages.test.js +4 -4
- package/dist/test/unit/module-cache-packages.test.js.map +1 -1
- package/dist/test/unit/parser/parser.test.js +137 -137
- package/dist/test/unit/parser/parser.test.js.map +1 -1
- package/dist/test/unit/provenance-integration.test.js +16 -16
- package/dist/test/unit/provenance.test.js +5 -5
- package/dist/test/unit/provenance.test.js.map +1 -1
- package/dist/test/unit/typecheck/async-discipline-extended.test.js +4 -4
- package/dist/test/unit/typecheck/effects-and-capabilities.test.js +18 -18
- package/dist/test/unit/typecheck/type-inference.test.js +23 -23
- package/dist/test/unit/typecheck/typecheck-advanced.test.js +10 -10
- package/dist/test/unit/validator.test.js +14 -14
- package/dist/test/unit/validator.test.js.map +1 -1
- package/package.json +57 -39
|
@@ -38,15 +38,15 @@ describe('异步纪律检查', () => {
|
|
|
38
38
|
describe('Start 未 Wait 场景', () => {
|
|
39
39
|
it('应该检测单个 Start 未 Wait', () => {
|
|
40
40
|
const source = `
|
|
41
|
-
|
|
41
|
+
Module test.async.start_not_waited.
|
|
42
42
|
|
|
43
|
-
Define User
|
|
43
|
+
Define User has id: Text.
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
Rule fetchData given u: User, produce Text. It performs io:
|
|
46
46
|
Start profile as async fetchProfile(u.id).
|
|
47
47
|
Return "Done".
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
Rule fetchProfile given id: Text, produce Text. It performs io:
|
|
50
50
|
Return "Profile".
|
|
51
51
|
`;
|
|
52
52
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -57,23 +57,23 @@ To fetchProfile with id: Text, produce Text. It performs io:
|
|
|
57
57
|
});
|
|
58
58
|
it('应该检测多个 Start 未 Wait', () => {
|
|
59
59
|
const source = `
|
|
60
|
-
|
|
60
|
+
Module test.async.multiple_not_waited.
|
|
61
61
|
|
|
62
|
-
Define User
|
|
62
|
+
Define User has id: Text.
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
Rule fetchData given u: User, produce Text. It performs io:
|
|
65
65
|
Start profile as async fetchProfile(u.id).
|
|
66
66
|
Start timeline as async fetchTimeline(u.id).
|
|
67
67
|
Start settings as async fetchSettings(u.id).
|
|
68
68
|
Return "Done".
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
Rule fetchProfile given id: Text, produce Text. It performs io:
|
|
71
71
|
Return "Profile".
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
Rule fetchTimeline given id: Text, produce Text. It performs io:
|
|
74
74
|
Return "Timeline".
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
Rule fetchSettings given id: Text, produce Text. It performs io:
|
|
77
77
|
Return "Settings".
|
|
78
78
|
`;
|
|
79
79
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -88,11 +88,11 @@ To fetchSettings with id: Text, produce Text. It performs io:
|
|
|
88
88
|
describe('Wait 未 Start 场景', () => {
|
|
89
89
|
it('应该检测单个 Wait 未 Start', () => {
|
|
90
90
|
const source = `
|
|
91
|
-
|
|
91
|
+
Module test.async.wait_not_started.
|
|
92
92
|
|
|
93
|
-
Define User
|
|
93
|
+
Define User has id: Text.
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
Rule fetchData given u: User, produce Text. It performs io:
|
|
96
96
|
Wait for profile.
|
|
97
97
|
Return "Done".
|
|
98
98
|
`;
|
|
@@ -104,11 +104,11 @@ To fetchData with u: User, produce Text. It performs io:
|
|
|
104
104
|
});
|
|
105
105
|
it('应该检测多个 Wait 未 Start', () => {
|
|
106
106
|
const source = `
|
|
107
|
-
|
|
107
|
+
Module test.async.multiple_wait_not_started.
|
|
108
108
|
|
|
109
|
-
Define User
|
|
109
|
+
Define User has id: Text.
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
Rule fetchData given u: User, produce Text. It performs io:
|
|
112
112
|
Wait for profile and timeline and settings.
|
|
113
113
|
Return "Done".
|
|
114
114
|
`;
|
|
@@ -124,17 +124,17 @@ To fetchData with u: User, produce Text. It performs io:
|
|
|
124
124
|
describe('重复 Start 场景', () => {
|
|
125
125
|
it('应该检测重复 Start 同一任务', () => {
|
|
126
126
|
const source = `
|
|
127
|
-
|
|
127
|
+
Module test.async.duplicate_start.
|
|
128
128
|
|
|
129
|
-
Define User
|
|
129
|
+
Define User has id: Text.
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
Rule fetchData given u: User, produce Text. It performs io:
|
|
132
132
|
Start profile as async fetchProfile(u.id).
|
|
133
133
|
Start profile as async fetchProfile(u.id).
|
|
134
134
|
Wait for profile.
|
|
135
135
|
Return "Done".
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
Rule fetchProfile given id: Text, produce Text. It performs io:
|
|
138
138
|
Return "Profile".
|
|
139
139
|
`;
|
|
140
140
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -146,18 +146,18 @@ To fetchProfile with id: Text, produce Text. It performs io:
|
|
|
146
146
|
});
|
|
147
147
|
it('应该检测三次 Start 同一任务', () => {
|
|
148
148
|
const source = `
|
|
149
|
-
|
|
149
|
+
Module test.async.triple_start.
|
|
150
150
|
|
|
151
|
-
Define User
|
|
151
|
+
Define User has id: Text.
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
Rule fetchData given u: User, produce Text. It performs io:
|
|
154
154
|
Start profile as async fetchProfile(u.id).
|
|
155
155
|
Start profile as async fetchProfile(u.id).
|
|
156
156
|
Start profile as async fetchProfile(u.id).
|
|
157
157
|
Wait for profile.
|
|
158
158
|
Return "Done".
|
|
159
159
|
|
|
160
|
-
|
|
160
|
+
Rule fetchProfile given id: Text, produce Text. It performs io:
|
|
161
161
|
Return "Profile".
|
|
162
162
|
`;
|
|
163
163
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -170,17 +170,17 @@ To fetchProfile with id: Text, produce Text. It performs io:
|
|
|
170
170
|
describe('重复 Wait 场景', () => {
|
|
171
171
|
it('应该检测重复 Wait 同一任务(warning)', () => {
|
|
172
172
|
const source = `
|
|
173
|
-
|
|
173
|
+
Module test.async.duplicate_wait.
|
|
174
174
|
|
|
175
|
-
Define User
|
|
175
|
+
Define User has id: Text.
|
|
176
176
|
|
|
177
|
-
|
|
177
|
+
Rule fetchData given u: User, produce Text. It performs io:
|
|
178
178
|
Start profile as async fetchProfile(u.id).
|
|
179
179
|
Wait for profile.
|
|
180
180
|
Wait for profile.
|
|
181
181
|
Return "Done".
|
|
182
182
|
|
|
183
|
-
|
|
183
|
+
Rule fetchProfile given id: Text, produce Text. It performs io:
|
|
184
184
|
Return "Profile".
|
|
185
185
|
`;
|
|
186
186
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -192,18 +192,18 @@ To fetchProfile with id: Text, produce Text. It performs io:
|
|
|
192
192
|
});
|
|
193
193
|
it('应该检测三次 Wait 同一任务', () => {
|
|
194
194
|
const source = `
|
|
195
|
-
|
|
195
|
+
Module test.async.triple_wait.
|
|
196
196
|
|
|
197
|
-
Define User
|
|
197
|
+
Define User has id: Text.
|
|
198
198
|
|
|
199
|
-
|
|
199
|
+
Rule fetchData given u: User, produce Text. It performs io:
|
|
200
200
|
Start profile as async fetchProfile(u.id).
|
|
201
201
|
Wait for profile.
|
|
202
202
|
Wait for profile.
|
|
203
203
|
Wait for profile.
|
|
204
204
|
Return "Done".
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
Rule fetchProfile given id: Text, produce Text. It performs io:
|
|
207
207
|
Return "Profile".
|
|
208
208
|
`;
|
|
209
209
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -216,16 +216,16 @@ To fetchProfile with id: Text, produce Text. It performs io:
|
|
|
216
216
|
describe('正常场景', () => {
|
|
217
217
|
it('单个 Start-Wait 对应该无错误', () => {
|
|
218
218
|
const source = `
|
|
219
|
-
|
|
219
|
+
Module test.async.normal_single.
|
|
220
220
|
|
|
221
|
-
Define User
|
|
221
|
+
Define User has id: Text.
|
|
222
222
|
|
|
223
|
-
|
|
223
|
+
Rule fetchData given u: User, produce Text. It performs io:
|
|
224
224
|
Start profile as async fetchProfile(u.id).
|
|
225
225
|
Wait for profile.
|
|
226
226
|
Return "Done".
|
|
227
227
|
|
|
228
|
-
|
|
228
|
+
Rule fetchProfile given id: Text, produce Text. It performs io:
|
|
229
229
|
Return "Profile".
|
|
230
230
|
`;
|
|
231
231
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -234,24 +234,24 @@ To fetchProfile with id: Text, produce Text. It performs io:
|
|
|
234
234
|
});
|
|
235
235
|
it('多个 Start-Wait 对应该无错误', () => {
|
|
236
236
|
const source = `
|
|
237
|
-
|
|
237
|
+
Module test.async.normal_multiple.
|
|
238
238
|
|
|
239
|
-
Define User
|
|
239
|
+
Define User has id: Text.
|
|
240
240
|
|
|
241
|
-
|
|
241
|
+
Rule fetchData given u: User, produce Text. It performs io:
|
|
242
242
|
Start profile as async fetchProfile(u.id).
|
|
243
243
|
Start timeline as async fetchTimeline(u.id).
|
|
244
244
|
Start settings as async fetchSettings(u.id).
|
|
245
245
|
Wait for profile and timeline and settings.
|
|
246
246
|
Return "Done".
|
|
247
247
|
|
|
248
|
-
|
|
248
|
+
Rule fetchProfile given id: Text, produce Text. It performs io:
|
|
249
249
|
Return "Profile".
|
|
250
250
|
|
|
251
|
-
|
|
251
|
+
Rule fetchTimeline given id: Text, produce Text. It performs io:
|
|
252
252
|
Return "Timeline".
|
|
253
253
|
|
|
254
|
-
|
|
254
|
+
Rule fetchSettings given id: Text, produce Text. It performs io:
|
|
255
255
|
Return "Settings".
|
|
256
256
|
`;
|
|
257
257
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -260,11 +260,11 @@ To fetchSettings with id: Text, produce Text. It performs io:
|
|
|
260
260
|
});
|
|
261
261
|
it('分批 Wait 应该无错误', () => {
|
|
262
262
|
const source = `
|
|
263
|
-
|
|
263
|
+
Module test.async.normal_batched.
|
|
264
264
|
|
|
265
|
-
Define User
|
|
265
|
+
Define User has id: Text.
|
|
266
266
|
|
|
267
|
-
|
|
267
|
+
Rule fetchData given u: User, produce Text. It performs io:
|
|
268
268
|
Start profile as async fetchProfile(u.id).
|
|
269
269
|
Start timeline as async fetchTimeline(u.id).
|
|
270
270
|
Wait for profile.
|
|
@@ -272,13 +272,13 @@ To fetchData with u: User, produce Text. It performs io:
|
|
|
272
272
|
Wait for timeline and settings.
|
|
273
273
|
Return "Done".
|
|
274
274
|
|
|
275
|
-
|
|
275
|
+
Rule fetchProfile given id: Text, produce Text. It performs io:
|
|
276
276
|
Return "Profile".
|
|
277
277
|
|
|
278
|
-
|
|
278
|
+
Rule fetchTimeline given id: Text, produce Text. It performs io:
|
|
279
279
|
Return "Timeline".
|
|
280
280
|
|
|
281
|
-
|
|
281
|
+
Rule fetchSettings given id: Text, produce Text. It performs io:
|
|
282
282
|
Return "Settings".
|
|
283
283
|
`;
|
|
284
284
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -289,11 +289,11 @@ To fetchSettings with id: Text, produce Text. It performs io:
|
|
|
289
289
|
describe('混合场景', () => {
|
|
290
290
|
it('应该同时检测多种错误', () => {
|
|
291
291
|
const source = `
|
|
292
|
-
|
|
292
|
+
Module test.async.mixed_errors.
|
|
293
293
|
|
|
294
|
-
Define User
|
|
294
|
+
Define User has id: Text.
|
|
295
295
|
|
|
296
|
-
|
|
296
|
+
Rule fetchData given u: User, produce Text. It performs io:
|
|
297
297
|
Start profile as async fetchProfile(u.id).
|
|
298
298
|
Start profile as async fetchProfile(u.id).
|
|
299
299
|
Start timeline as async fetchTimeline(u.id).
|
|
@@ -302,10 +302,10 @@ To fetchData with u: User, produce Text. It performs io:
|
|
|
302
302
|
Wait for settings.
|
|
303
303
|
Return "Done".
|
|
304
304
|
|
|
305
|
-
|
|
305
|
+
Rule fetchProfile given id: Text, produce Text. It performs io:
|
|
306
306
|
Return "Profile".
|
|
307
307
|
|
|
308
|
-
|
|
308
|
+
Rule fetchTimeline given id: Text, produce Text. It performs io:
|
|
309
309
|
Return "Timeline".
|
|
310
310
|
`;
|
|
311
311
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -330,16 +330,16 @@ To fetchTimeline with id: Text, produce Text. It performs io:
|
|
|
330
330
|
describe('Wait 与 Start 顺序', () => {
|
|
331
331
|
it('Wait 在 Start 之前应报告错误', () => {
|
|
332
332
|
const source = `
|
|
333
|
-
|
|
333
|
+
Module test.async.wait_before_start.simple.
|
|
334
334
|
|
|
335
|
-
Define User
|
|
335
|
+
Define User has id: Text.
|
|
336
336
|
|
|
337
|
-
|
|
337
|
+
Rule fetchData given u: User, produce Text. It performs io:
|
|
338
338
|
Wait for profile.
|
|
339
339
|
Start profile as async fetchProfile(u.id).
|
|
340
340
|
Return "Done".
|
|
341
341
|
|
|
342
|
-
|
|
342
|
+
Rule fetchProfile given id: Text, produce Text. It performs io:
|
|
343
343
|
Return "Profile".
|
|
344
344
|
`;
|
|
345
345
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -349,17 +349,17 @@ To fetchProfile with id: Text, produce Text. It performs io:
|
|
|
349
349
|
});
|
|
350
350
|
it('Wait 在 Start 前且 Start 位于分支应报告错误', () => {
|
|
351
351
|
const source = `
|
|
352
|
-
|
|
352
|
+
Module test.async.wait_before_start.branch.
|
|
353
353
|
|
|
354
|
-
Define User
|
|
354
|
+
Define User has id: Text.
|
|
355
355
|
|
|
356
|
-
|
|
356
|
+
Rule fetchData given u: User, produce Text. It performs io:
|
|
357
357
|
Wait for profile.
|
|
358
358
|
If u.id equals to "vip":
|
|
359
359
|
Start profile as async fetchProfile(u.id).
|
|
360
360
|
Return "Done".
|
|
361
361
|
|
|
362
|
-
|
|
362
|
+
Rule fetchProfile given id: Text, produce Text. It performs io:
|
|
363
363
|
Return "Profile".
|
|
364
364
|
`;
|
|
365
365
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -371,11 +371,11 @@ To fetchProfile with id: Text, produce Text. It performs io:
|
|
|
371
371
|
describe('分支中的多重 Start', () => {
|
|
372
372
|
it('If 互斥分支的重复 Start 不再报错', () => {
|
|
373
373
|
const source = `
|
|
374
|
-
|
|
374
|
+
Module test.async.branch_duplicate.if.
|
|
375
375
|
|
|
376
|
-
Define User
|
|
376
|
+
Define User has id: Text.
|
|
377
377
|
|
|
378
|
-
|
|
378
|
+
Rule fetchData given u: User, produce Text. It performs io:
|
|
379
379
|
If u.id equals to "vip":
|
|
380
380
|
Start profile as async fetchProfile(u.id).
|
|
381
381
|
Otherwise:
|
|
@@ -383,7 +383,7 @@ To fetchData with u: User, produce Text. It performs io:
|
|
|
383
383
|
Wait for profile.
|
|
384
384
|
Return "Done".
|
|
385
385
|
|
|
386
|
-
|
|
386
|
+
Rule fetchProfile given id: Text, produce Text. It performs io:
|
|
387
387
|
Return "Profile".
|
|
388
388
|
`;
|
|
389
389
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -394,11 +394,11 @@ To fetchProfile with id: Text, produce Text. It performs io:
|
|
|
394
394
|
});
|
|
395
395
|
it('多个条件路径触发相同 Start 会被累计', () => {
|
|
396
396
|
const source = `
|
|
397
|
-
|
|
397
|
+
Module test.async.branch_duplicate.multi_paths.
|
|
398
398
|
|
|
399
|
-
Define User
|
|
399
|
+
Define User has id: Text, tier: Text.
|
|
400
400
|
|
|
401
|
-
|
|
401
|
+
Rule fetchData given u: User, produce Text. It performs io:
|
|
402
402
|
If u.tier equals to "vip":
|
|
403
403
|
Start profile as async fetchProfile(u.id).
|
|
404
404
|
If u.tier equals to "premium":
|
|
@@ -406,7 +406,7 @@ To fetchData with u: User, produce Text. It performs io:
|
|
|
406
406
|
Wait for profile.
|
|
407
407
|
Return "Done".
|
|
408
408
|
|
|
409
|
-
|
|
409
|
+
Rule fetchProfile given id: Text, produce Text. It performs io:
|
|
410
410
|
Return "Profile".
|
|
411
411
|
`;
|
|
412
412
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -419,11 +419,11 @@ To fetchProfile with id: Text, produce Text. It performs io:
|
|
|
419
419
|
describe('嵌套作用域的 Start 行为', () => {
|
|
420
420
|
it('嵌套分支中遗漏 Wait 会被视为 Start 未 Wait', () => {
|
|
421
421
|
const source = `
|
|
422
|
-
|
|
422
|
+
Module test.async.nested_missing_wait.branch.
|
|
423
423
|
|
|
424
|
-
Define User
|
|
424
|
+
Define User has id: Text.
|
|
425
425
|
|
|
426
|
-
|
|
426
|
+
Rule fetchData given u: User, produce Text. It performs io:
|
|
427
427
|
If u.id equals to "vip":
|
|
428
428
|
Start audit as async fetchAudit(u.id).
|
|
429
429
|
If u.id equals to "vip":
|
|
@@ -431,7 +431,7 @@ To fetchData with u: User, produce Text. It performs io:
|
|
|
431
431
|
Wait for audit.
|
|
432
432
|
Return "Done".
|
|
433
433
|
|
|
434
|
-
|
|
434
|
+
Rule fetchAudit given id: Text, produce Text. It performs io:
|
|
435
435
|
Return "Audit".
|
|
436
436
|
`;
|
|
437
437
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -441,18 +441,18 @@ To fetchAudit with id: Text, produce Text. It performs io:
|
|
|
441
441
|
});
|
|
442
442
|
it('外层与嵌套作用域重复 Start 会产生重复诊断', () => {
|
|
443
443
|
const source = `
|
|
444
|
-
|
|
444
|
+
Module test.async.nested_duplicate_start.
|
|
445
445
|
|
|
446
|
-
Define User
|
|
446
|
+
Define User has id: Text.
|
|
447
447
|
|
|
448
|
-
|
|
448
|
+
Rule fetchData given u: User, produce Text. It performs io:
|
|
449
449
|
Start profile as async fetchProfile(u.id).
|
|
450
450
|
If u.id equals to "vip":
|
|
451
451
|
Start profile as async fetchProfile(u.id).
|
|
452
452
|
Wait for profile.
|
|
453
453
|
Return "Done".
|
|
454
454
|
|
|
455
|
-
|
|
455
|
+
Rule fetchProfile given id: Text, produce Text. It performs io:
|
|
456
456
|
Return "Profile".
|
|
457
457
|
`;
|
|
458
458
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -465,11 +465,11 @@ To fetchProfile with id: Text, produce Text. It performs io:
|
|
|
465
465
|
describe('组合场景与诊断精确性', () => {
|
|
466
466
|
it('Wait 提前 + 分支重复 Start 仅产生重复诊断', () => {
|
|
467
467
|
const source = `
|
|
468
|
-
|
|
468
|
+
Module test.async.combo.branch_wait_first.
|
|
469
469
|
|
|
470
|
-
Define User
|
|
470
|
+
Define User has id: Text.
|
|
471
471
|
|
|
472
|
-
|
|
472
|
+
Rule fetchData given u: User, produce Text. It performs io:
|
|
473
473
|
Wait for profile.
|
|
474
474
|
If u.id equals to "vip":
|
|
475
475
|
Start profile as async fetchProfile(u.id).
|
|
@@ -477,7 +477,7 @@ To fetchData with u: User, produce Text. It performs io:
|
|
|
477
477
|
Start profile as async fetchProfile(u.id).
|
|
478
478
|
Return "Done".
|
|
479
479
|
|
|
480
|
-
|
|
480
|
+
Rule fetchProfile given id: Text, produce Text. It performs io:
|
|
481
481
|
Return "Profile".
|
|
482
482
|
`;
|
|
483
483
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -25,17 +25,17 @@ function compileAndGetDiagnostics(source) {
|
|
|
25
25
|
describe('异步调度 - Wait-before-Start', () => {
|
|
26
26
|
it('应检测 Wait 在 Start 之前', () => {
|
|
27
27
|
const source = `
|
|
28
|
-
|
|
28
|
+
Module test.async.schedule.wait_before_start.simple.
|
|
29
29
|
|
|
30
|
-
Define User
|
|
30
|
+
Define User has id: Text.
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Rule orchestrate given u: User, produce Text. It performs io:
|
|
33
33
|
Wait for job.
|
|
34
34
|
Start job as async launch(u.id).
|
|
35
35
|
Wait for job.
|
|
36
36
|
Return "Done".
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
Rule launch given id: Text, produce Text. It performs io:
|
|
39
39
|
Return "job".
|
|
40
40
|
`;
|
|
41
41
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -45,16 +45,16 @@ To launch with id: Text, produce Text. It performs io:
|
|
|
45
45
|
});
|
|
46
46
|
it('不应报错在 Start 之后正常 Wait', () => {
|
|
47
47
|
const source = `
|
|
48
|
-
|
|
48
|
+
Module test.async.schedule.wait_after_start.
|
|
49
49
|
|
|
50
|
-
Define User
|
|
50
|
+
Define User has id: Text.
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
Rule orchestrate given u: User, produce Text. It performs io:
|
|
53
53
|
Start task as async launch(u.id).
|
|
54
54
|
Wait for task.
|
|
55
55
|
Return "Done".
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
Rule launch given id: Text, produce Text. It performs io:
|
|
58
58
|
Return "ok".
|
|
59
59
|
`;
|
|
60
60
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -63,16 +63,16 @@ To launch with id: Text, produce Text. It performs io:
|
|
|
63
63
|
});
|
|
64
64
|
it('应检测嵌套块中的顺序违规', () => {
|
|
65
65
|
const source = `
|
|
66
|
-
|
|
66
|
+
Module test.async.schedule.wait_in_branch.
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
Rule orchestrate given enabled: Bool, produce Text. It performs io:
|
|
69
69
|
If enabled:
|
|
70
70
|
Wait for task.
|
|
71
71
|
Start task as async launch().
|
|
72
72
|
Wait for task.
|
|
73
73
|
Return "Done".
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
Rule launch produce Text. It performs io:
|
|
76
76
|
Return "ok".
|
|
77
77
|
`;
|
|
78
78
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -84,9 +84,9 @@ To launch, produce Text. It performs io:
|
|
|
84
84
|
describe('异步调度 - 条件分支', () => {
|
|
85
85
|
it('不应误报 If 互斥分支的重复 Start', () => {
|
|
86
86
|
const source = `
|
|
87
|
-
|
|
87
|
+
Module test.async.schedule.if_branch.
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
Rule orchestrate given tier: Text, produce Text. It performs io:
|
|
90
90
|
If tier equals to "vip":
|
|
91
91
|
Start session as async startVip().
|
|
92
92
|
Otherwise:
|
|
@@ -94,10 +94,10 @@ To orchestrate with tier: Text, produce Text. It performs io:
|
|
|
94
94
|
Wait for session.
|
|
95
95
|
Return "Done".
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
Rule startVip produce Text. It performs io:
|
|
98
98
|
Return "vip".
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
Rule startStandard produce Text. It performs io:
|
|
101
101
|
Return "standard".
|
|
102
102
|
`;
|
|
103
103
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -106,11 +106,11 @@ To startStandard, produce Text. It performs io:
|
|
|
106
106
|
});
|
|
107
107
|
it('不应误报 Match 互斥分支的重复 Start', () => {
|
|
108
108
|
const source = `
|
|
109
|
-
|
|
109
|
+
Module test.async.schedule.match_branch.
|
|
110
110
|
|
|
111
111
|
Define Choice as one of Primary, Secondary.
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
Rule orchestrate given choice: Choice, produce Text. It performs io:
|
|
114
114
|
Match choice:
|
|
115
115
|
When Primary:
|
|
116
116
|
Start session as async startPrimary().
|
|
@@ -119,10 +119,10 @@ To orchestrate with choice: Choice, produce Text. It performs io:
|
|
|
119
119
|
Wait for session.
|
|
120
120
|
Return "Done".
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
Rule startPrimary produce Text. It performs io:
|
|
123
123
|
Return "primary".
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
Rule startSecondary produce Text. It performs io:
|
|
126
126
|
Return "secondary".
|
|
127
127
|
`;
|
|
128
128
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -131,18 +131,18 @@ To startSecondary, produce Text. It performs io:
|
|
|
131
131
|
});
|
|
132
132
|
it('应报告同一执行路径上的重复 Start', () => {
|
|
133
133
|
const source = `
|
|
134
|
-
|
|
134
|
+
Module test.async.schedule.duplicate_start.path.
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
Rule orchestrate produce Text. It performs io:
|
|
137
137
|
Start session as async startOne().
|
|
138
138
|
Start session as async startTwo().
|
|
139
139
|
Wait for session.
|
|
140
140
|
Return "Done".
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
Rule startOne produce Text. It performs io:
|
|
143
143
|
Return "one".
|
|
144
144
|
|
|
145
|
-
|
|
145
|
+
Rule startTwo produce Text. It performs io:
|
|
146
146
|
Return "two".
|
|
147
147
|
`;
|
|
148
148
|
const diagnostics = compileAndGetDiagnostics(source);
|
|
@@ -22,14 +22,17 @@ describe('canonicalizer', () => {
|
|
|
22
22
|
});
|
|
23
23
|
describe('多词关键字替换', () => {
|
|
24
24
|
it('应该将多词关键字统一为小写', () => {
|
|
25
|
-
const input = '
|
|
25
|
+
const input = 'MODULE Example.\nWAIT FOR OPTION OF value.';
|
|
26
26
|
const result = canonicalize(input);
|
|
27
|
-
|
|
27
|
+
// 单词关键字(MODULE)不被 canonicalizer 处理,由 parser 的 case-insensitive 匹配处理
|
|
28
|
+
// 多词关键字(WAIT FOR, OPTION OF)被 canonicalizer 统一为小写
|
|
29
|
+
assert.strictEqual(result, 'MODULE Example.\nwait for option of value.');
|
|
28
30
|
});
|
|
29
31
|
it('应该避免误匹配紧凑单词', () => {
|
|
30
|
-
const input = 'Return WaitFor result and Module island
|
|
32
|
+
const input = 'Return WaitFor result and Module island scenic.';
|
|
31
33
|
const result = canonicalize(input);
|
|
32
|
-
|
|
34
|
+
// 单词 Module 不被 canonicalizer 小写化(由 parser 处理)
|
|
35
|
+
assert.strictEqual(result, 'Return WaitFor result and Module island scenic.');
|
|
33
36
|
});
|
|
34
37
|
});
|
|
35
38
|
describe('缩进与空白规范', () => {
|
|
@@ -69,7 +72,7 @@ describe('canonicalizer', () => {
|
|
|
69
72
|
});
|
|
70
73
|
describe('幂等性', () => {
|
|
71
74
|
it('应该在重复规范化后保持不变', () => {
|
|
72
|
-
const input = ['
|
|
75
|
+
const input = ['Module Example.', 'Return value , next.', ' Next line '].join('\n');
|
|
73
76
|
const once = canonicalize(input);
|
|
74
77
|
const twice = canonicalize(once);
|
|
75
78
|
assert.strictEqual(twice, once);
|
|
@@ -91,14 +94,16 @@ describe('canonicalizer', () => {
|
|
|
91
94
|
});
|
|
92
95
|
describe('关键字大小写扩展', () => {
|
|
93
96
|
it('应该统一多词关键字的大小写', () => {
|
|
94
|
-
const input = ['
|
|
97
|
+
const input = ['MODULE Sample.', 'WAIT FOR OPTION OF value.', 'ERR OF Issue.'].join('\n');
|
|
95
98
|
const result = canonicalize(input);
|
|
96
|
-
|
|
99
|
+
// 单词关键字(MODULE)不被 canonicalizer 处理
|
|
100
|
+
assert.strictEqual(result, ['MODULE Sample.', 'wait for option of value.', 'err of Issue.'].join('\n'));
|
|
97
101
|
});
|
|
98
102
|
it('应该在多行语句中保持关键字规范化', () => {
|
|
99
|
-
const input = ['It PERFORMS duty.', '
|
|
103
|
+
const input = ['It PERFORMS duty.', 'MODULE Example.', 'WAIT FOR option OF value.'].join('\n');
|
|
100
104
|
const result = canonicalize(input);
|
|
101
|
-
|
|
105
|
+
// 多词关键字 "it performs" 被小写化,单词关键字 MODULE 不变
|
|
106
|
+
assert.strictEqual(result, ['it performs duty.', 'MODULE Example.', 'wait for option of value.'].join('\n'));
|
|
102
107
|
});
|
|
103
108
|
});
|
|
104
109
|
describe('注释边界扩展', () => {
|
|
@@ -179,16 +184,17 @@ describe('canonicalizer', () => {
|
|
|
179
184
|
});
|
|
180
185
|
describe('结构保持', () => {
|
|
181
186
|
it('应该保留语句关键结构与缩进', () => {
|
|
182
|
-
const input = ['
|
|
187
|
+
const input = ['Rule greet produce Text:', '\tReturn value.'].join('\r\n');
|
|
183
188
|
const result = canonicalize(input);
|
|
184
|
-
assert.strictEqual(result, ['
|
|
189
|
+
assert.strictEqual(result, ['Rule greet produce Text:', ' Return value.'].join('\n'));
|
|
185
190
|
});
|
|
186
191
|
});
|
|
187
192
|
describe('组合场景', () => {
|
|
188
193
|
it('应该在组合场景下完成规范化', () => {
|
|
189
|
-
const input = ['
|
|
194
|
+
const input = ['MODULE Sample', '\tWait FOR Option OF value , please.', '# comment', 'Return "Tab\tInside".'].join('\r\n');
|
|
190
195
|
const result = canonicalize(input);
|
|
191
|
-
|
|
196
|
+
// 单词 MODULE 不被 canonicalizer 小写化
|
|
197
|
+
assert.strictEqual(result, ['MODULE Sample', ' wait for option of value, please.', '', 'Return "Tab Inside".'].join('\n'));
|
|
192
198
|
});
|
|
193
199
|
});
|
|
194
200
|
});
|