@freelog/freelog-cg-collection 1.0.22 → 1.0.23
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/CollectionPolicyCustomDataVisitor.js +14 -1
- package/CollectionPolicyCustomVisitor.js +9 -6
- package/gen/CollectionPolicyListener.js +9 -0
- package/gen/CollectionPolicyParser.js +907 -836
- package/gen/CollectionPolicyVisitor.js +6 -0
- package/package.json +1 -1
- package/resources/context_config/function_configs.json +16 -0
- package/resources/zhaojn.json +908 -614
- package/resources/zhaojn.sc +38 -31
|
@@ -41,8 +41,21 @@ class CollectionPolicyCustomDataVisitor extends CollectionPolicyVisitor {
|
|
|
41
41
|
return super.visitExpression_definition(ctx);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
visitState_definition_section(ctx) {
|
|
45
|
+
let result = super.visitState_definition_section(ctx);
|
|
46
|
+
if (this.stateNames.indexOf("Initial") === -1) {
|
|
47
|
+
throw new Error(`缺少【Initial】状态!`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
|
|
44
53
|
visitState_definition(ctx) {
|
|
45
|
-
|
|
54
|
+
let stateName = ctx.state_name_section().state_name().getText();
|
|
55
|
+
if (this.stateNames.indexOf(stateName) !== -1) {
|
|
56
|
+
throw new Error(`已存在该状态 --- ${stateName} | ${ctx.state_name_section().getText()}`);
|
|
57
|
+
}
|
|
58
|
+
this.stateNames.push(stateName);
|
|
46
59
|
|
|
47
60
|
return super.visitState_definition(ctx);
|
|
48
61
|
}
|
|
@@ -304,16 +304,16 @@ class CollectionPolicyCustomVisitor extends CollectionPolicyVisitor {
|
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
visitState_definition(ctx) {
|
|
307
|
-
console.debug(`^^ ${ctx.state_name().getText()}`)
|
|
307
|
+
console.debug(`^^ ${ctx.state_name_section().state_name().getText()}`)
|
|
308
308
|
|
|
309
309
|
this.parseState.inFsmState = 1;
|
|
310
|
-
this.currentState = ctx.state_name().getText();
|
|
310
|
+
this.currentState = ctx.state_name_section().state_name().getText();
|
|
311
311
|
this.currentStateObj = {stateName: this.currentState, assignments: [], events: []};
|
|
312
|
-
if (ctx.service_state_section() != null) {
|
|
313
|
-
this.currentStateObj["serviceStateSection"] = this.visitService_state_section(ctx.service_state_section());
|
|
312
|
+
if (ctx.state_name_section().service_state_section() != null) {
|
|
313
|
+
this.currentStateObj["serviceStateSection"] = this.visitService_state_section(ctx.state_name_section().service_state_section());
|
|
314
314
|
}
|
|
315
|
-
if (ctx.state_context_args_section() != null) {
|
|
316
|
-
this.currentStateObj["stateContextArgs"] = ctx.state_context_args_section().ID().map(i => i.getText());
|
|
315
|
+
if (ctx.state_name_section().state_context_args_section() != null) {
|
|
316
|
+
this.currentStateObj["stateContextArgs"] = ctx.state_name_section().state_context_args_section().ID().map(i => i.getText());
|
|
317
317
|
} else {
|
|
318
318
|
this.currentStateObj["stateContextArgs"] = [];
|
|
319
319
|
}
|
|
@@ -453,6 +453,9 @@ class CollectionPolicyCustomVisitor extends CollectionPolicyVisitor {
|
|
|
453
453
|
throw new Error(`存在无效的变量引用 --- ${vc} | ${this.currentEventElem["content"]}`);
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
|
+
if (this.policyData["stateNames"].indexOf(this.currentEventElem["toState"]) === -1) {
|
|
457
|
+
throw new Error(`无效的状态 --- ${this.currentEventElem["toState"]} | ${this.currentEventElem["content"]}`);
|
|
458
|
+
}
|
|
456
459
|
|
|
457
460
|
if (ctx.state_context_args_section_at_event() != null) {
|
|
458
461
|
this.visitState_context_args_section_at_event(ctx.state_context_args_section_at_event());
|
|
@@ -200,6 +200,15 @@ CollectionPolicyListener.prototype.exitState_definition = function(ctx) {
|
|
|
200
200
|
};
|
|
201
201
|
|
|
202
202
|
|
|
203
|
+
// Enter a parse tree produced by CollectionPolicyParser#state_name_section.
|
|
204
|
+
CollectionPolicyListener.prototype.enterState_name_section = function(ctx) {
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
// Exit a parse tree produced by CollectionPolicyParser#state_name_section.
|
|
208
|
+
CollectionPolicyListener.prototype.exitState_name_section = function(ctx) {
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
|
|
203
212
|
// Enter a parse tree produced by CollectionPolicyParser#state_name.
|
|
204
213
|
CollectionPolicyListener.prototype.enterState_name = function(ctx) {
|
|
205
214
|
};
|