3xpr 1.8.0 → 1.9.1
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/{expression → application}/expressions.d.ts +6 -11
- package/{expression → application}/expressions.js +18 -43
- package/application/expressions.js.map +1 -0
- package/application/graphql/parser.d.ts +0 -0
- package/application/graphql/parser.js +89 -0
- package/application/graphql/parser.js.map +1 -0
- package/{expression → application/helper}/helper.d.ts +1 -1
- package/{expression → application/helper}/helper.js +2 -2
- package/application/helper/helper.js.map +1 -0
- package/application/helper/index.d.ts +2 -0
- package/application/helper/index.js +19 -0
- package/application/helper/index.js.map +1 -0
- package/{expression/operand/helper.d.ts → application/helper/operandHelper.d.ts} +1 -1
- package/{expression/operand/helper.js → application/helper/operandHelper.js} +17 -17
- package/application/helper/operandHelper.js.map +1 -0
- package/{expression → application}/index.d.ts +1 -2
- package/{expression → application}/index.js +1 -2
- package/application/index.js.map +1 -0
- package/{expression → application}/operand/builder.d.ts +3 -3
- package/{expression → application}/operand/builder.js +2 -2
- package/application/operand/builder.js.map +1 -0
- package/{expression/operand → application/operand/factory/basic}/evaluators.d.ts +1 -1
- package/{expression/operand → application/operand/factory/basic}/evaluators.js +25 -25
- package/application/operand/factory/basic/evaluators.js.map +1 -0
- package/{expression/operand → application/operand/factory/basic}/factory.d.ts +3 -3
- package/{expression/operand → application/operand/factory/basic}/factory.js +31 -31
- package/application/operand/factory/basic/factory.js.map +1 -0
- package/application/operand/factory/index.d.ts +2 -0
- package/application/operand/factory/index.js +19 -0
- package/application/operand/factory/index.js.map +1 -0
- package/{expression → application/operand/factory}/process/evaluators.d.ts +1 -1
- package/{expression → application/operand/factory}/process/evaluators.js +10 -10
- package/application/operand/factory/process/evaluators.js.map +1 -0
- package/{expression → application/operand/factory}/process/factory.d.ts +3 -3
- package/application/operand/factory/process/factory.js +122 -0
- package/application/operand/factory/process/factory.js.map +1 -0
- package/{expression → application}/operand/index.d.ts +1 -4
- package/{expression → application}/operand/index.js +1 -4
- package/application/operand/index.js.map +1 -0
- package/{expression → application}/operand/library.d.ts +3 -2
- package/{expression → application}/operand/library.js +70 -64
- package/application/operand/library.js.map +1 -0
- package/{expression → application}/operand/model.d.ts +2 -2
- package/{expression → application}/operand/model.js +6 -6
- package/application/operand/model.js.map +1 -0
- package/{expression → application}/operand/normalizer.d.ts +3 -3
- package/{expression → application}/operand/normalizer.js +7 -7
- package/application/operand/normalizer.js.map +1 -0
- package/application/operand/parameters.d.ts +4 -0
- package/{expression → application}/operand/parameters.js +5 -5
- package/application/operand/parameters.js.map +1 -0
- package/{expression → application}/operand/parser.d.ts +2 -2
- package/{expression → application}/operand/parser.js +58 -58
- package/application/operand/parser.js.map +1 -0
- package/{expression → application}/operand/reducer.d.ts +3 -3
- package/{expression → application}/operand/reducer.js +5 -5
- package/application/operand/reducer.js.map +1 -0
- package/{expression → application}/operand/serializer.d.ts +1 -1
- package/{expression → application}/operand/serializer.js +2 -2
- package/application/operand/serializer.js.map +1 -0
- package/{expression → application}/operand/type.d.ts +4 -4
- package/{expression → application}/operand/type.js +18 -18
- package/application/operand/type.js.map +1 -0
- package/domain/index.d.ts +3 -0
- package/{expression/process → domain}/index.js +2 -2
- package/domain/index.js.map +1 -0
- package/domain/model/base.js.map +1 -0
- package/domain/model/context.js.map +1 -0
- package/{expression/contract → domain/model}/index.d.ts +2 -1
- package/{expression/contract → domain/model}/index.js +2 -1
- package/domain/model/index.js.map +1 -0
- package/domain/model/observer.d.ts +14 -0
- package/{expression/contract/managers.js → domain/model/observer.js} +1 -1
- package/domain/model/observer.js.map +1 -0
- package/{expression/contract → domain/model}/operand.d.ts +1 -1
- package/domain/model/operand.js.map +1 -0
- package/domain/model/signals.js +3 -0
- package/domain/model/signals.js.map +1 -0
- package/domain/services/expressions.d.ts +26 -0
- package/domain/services/expressions.js +3 -0
- package/domain/services/expressions.js.map +1 -0
- package/domain/services/index.d.ts +5 -0
- package/domain/services/index.js +22 -0
- package/domain/services/index.js.map +1 -0
- package/domain/services/model.d.ts +28 -0
- package/domain/services/model.js.map +1 -0
- package/domain/services/operand.d.ts +14 -0
- package/domain/services/operand.js +3 -0
- package/domain/services/operand.js.map +1 -0
- package/domain/services/parameter.d.ts +4 -0
- package/domain/services/parameter.js +3 -0
- package/domain/services/parameter.js.map +1 -0
- package/domain/services/type.d.ts +5 -0
- package/domain/services/type.js +3 -0
- package/domain/services/type.js.map +1 -0
- package/index.d.ts +2 -19
- package/index.js +2 -35
- package/index.js.map +1 -1
- package/infrastructure/builder.d.ts +4 -0
- package/infrastructure/builder.js +20 -0
- package/infrastructure/builder.js.map +1 -0
- package/infrastructure/index.d.ts +19 -0
- package/infrastructure/index.js +52 -0
- package/infrastructure/index.js.map +1 -0
- package/package.json +2 -2
- package/expression/contract/base.js.map +0 -1
- package/expression/contract/context.js.map +0 -1
- package/expression/contract/index.js.map +0 -1
- package/expression/contract/managers.d.ts +0 -86
- package/expression/contract/managers.js.map +0 -1
- package/expression/contract/operand.js.map +0 -1
- package/expression/expressions.js.map +0 -1
- package/expression/helper.js.map +0 -1
- package/expression/index.js.map +0 -1
- package/expression/operand/builder.js.map +0 -1
- package/expression/operand/evaluators.js.map +0 -1
- package/expression/operand/factory.js.map +0 -1
- package/expression/operand/helper.js.map +0 -1
- package/expression/operand/index.js.map +0 -1
- package/expression/operand/library.js.map +0 -1
- package/expression/operand/model.js.map +0 -1
- package/expression/operand/normalizer.js.map +0 -1
- package/expression/operand/parameters.d.ts +0 -4
- package/expression/operand/parameters.js.map +0 -1
- package/expression/operand/parser.js.map +0 -1
- package/expression/operand/reducer.js.map +0 -1
- package/expression/operand/serializer.js.map +0 -1
- package/expression/operand/type.js.map +0 -1
- package/expression/process/evaluators.js.map +0 -1
- package/expression/process/factory.js +0 -122
- package/expression/process/factory.js.map +0 -1
- package/expression/process/index.d.ts +0 -3
- package/expression/process/index.js.map +0 -1
- package/expression/process/model.js.map +0 -1
- /package/{expression/contract → domain/model}/base.d.ts +0 -0
- /package/{expression/contract → domain/model}/base.js +0 -0
- /package/{expression/contract → domain/model}/context.d.ts +0 -0
- /package/{expression/contract → domain/model}/context.js +0 -0
- /package/{expression/contract → domain/model}/operand.js +0 -0
- /package/{expression/process/model.d.ts → domain/model/signals.d.ts} +0 -0
- /package/{expression/process → domain/services}/model.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OperatorMetadata,
|
|
2
|
-
export declare class
|
|
1
|
+
import { OperatorMetadata, IModelService, Format, OperatorAdditionalInfo, FunctionAdditionalInfo } from '../../domain';
|
|
2
|
+
export declare class ModelService implements IModelService {
|
|
3
3
|
private _enums;
|
|
4
4
|
private _constants;
|
|
5
5
|
private _formats;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ModelService = void 0;
|
|
4
4
|
/* eslint-disable @typescript-eslint/ban-types */
|
|
5
5
|
// import expConfig from './config.json'
|
|
6
|
-
const
|
|
7
|
-
class
|
|
6
|
+
const domain_1 = require("../../domain");
|
|
7
|
+
class ModelService {
|
|
8
8
|
constructor() {
|
|
9
9
|
this._enums = {};
|
|
10
10
|
this._constants = {};
|
|
@@ -91,7 +91,7 @@ class ModelManager {
|
|
|
91
91
|
params: singInfo.params,
|
|
92
92
|
returnType: singInfo.returnType
|
|
93
93
|
};
|
|
94
|
-
if (source instanceof
|
|
94
|
+
if (source instanceof domain_1.PrototypeEvaluator) {
|
|
95
95
|
metadata.custom = source;
|
|
96
96
|
}
|
|
97
97
|
else if (typeof source === 'function') {
|
|
@@ -116,7 +116,7 @@ class ModelManager {
|
|
|
116
116
|
params: singInfo.params,
|
|
117
117
|
returnType: singInfo.returnType
|
|
118
118
|
};
|
|
119
|
-
if (source instanceof
|
|
119
|
+
if (source instanceof domain_1.PrototypeEvaluator) {
|
|
120
120
|
metadata.custom = source;
|
|
121
121
|
}
|
|
122
122
|
else if (typeof source === 'function') {
|
|
@@ -319,5 +319,5 @@ class ModelManager {
|
|
|
319
319
|
return type;
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
|
-
exports.
|
|
322
|
+
exports.ModelService = ModelService;
|
|
323
323
|
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../../src/lib/application/operand/model.ts"],"names":[],"mappings":";;;AAAA,iDAAiD;AACjD,wCAAwC;AACxC,yCAA2J;AAE3J,MAAa,YAAY;IAQxB;QACC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAA;QAChB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAA;QACpB,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAA;QAClB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAA;QACpB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAA;QACpB,IAAI,CAAC,cAAc,GAAG,EAAE,CAAA;QACxB,IAAI,CAAC,cAAc,GAAG,EAAE,CAAA;IACzB,CAAC;IAED,IAAW,aAAa;QACvB,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;IAC3C,CAAC;IAED,IAAW,aAAa;QACvB,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;IAC3C,CAAC;IAED,IAAW,SAAS;QACnB,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;IACvC,CAAC;IAED,IAAW,OAAO;QACjB,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACrC,CAAC;IAED,IAAW,KAAK;QACf,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACnC,CAAC;IAED,IAAW,SAAS;QACnB,MAAM,SAAS,GAAgC,EAAE,CAAA;QACjD,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC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-1,7 +1,7 @@
|
|
|
1
|
-
import { Operand,
|
|
1
|
+
import { Operand, IModelService, IOperandNormalizer } from '../../domain';
|
|
2
2
|
export declare class OperandNormalizer implements IOperandNormalizer {
|
|
3
|
-
protected readonly model:
|
|
4
|
-
constructor(model:
|
|
3
|
+
protected readonly model: IModelService;
|
|
4
|
+
constructor(model: IModelService);
|
|
5
5
|
normalize(operand: Operand): Operand;
|
|
6
6
|
protected normalizeOperand(operand: Operand): void;
|
|
7
7
|
}
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OperandNormalizer = void 0;
|
|
4
4
|
/* eslint-disable no-case-declarations */
|
|
5
|
-
const
|
|
5
|
+
const domain_1 = require("../../domain");
|
|
6
6
|
class OperandNormalizer {
|
|
7
7
|
// eslint-disable-next-line no-useless-constructor
|
|
8
8
|
constructor(model) {
|
|
9
9
|
this.model = model;
|
|
10
10
|
}
|
|
11
11
|
normalize(operand) {
|
|
12
|
-
if (operand.type ===
|
|
12
|
+
if (operand.type === domain_1.OperandType.Var && operand.children.length === 0) {
|
|
13
13
|
// Example: Products => Products.map(p=>p)
|
|
14
|
-
const arrowVariable = new
|
|
15
|
-
const allFields = new
|
|
16
|
-
const map = new
|
|
14
|
+
const arrowVariable = new domain_1.Operand(operand.pos, 'p', domain_1.OperandType.Var);
|
|
15
|
+
const allFields = new domain_1.Operand(operand.pos, 'p', domain_1.OperandType.Var);
|
|
16
|
+
const map = new domain_1.Operand(operand.pos, 'map', domain_1.OperandType.Arrow, [operand, arrowVariable, allFields]);
|
|
17
17
|
this.normalizeOperand(map);
|
|
18
18
|
return map;
|
|
19
19
|
}
|
|
@@ -23,13 +23,13 @@ class OperandNormalizer {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
normalizeOperand(operand) {
|
|
26
|
-
if (operand.type ===
|
|
26
|
+
if (operand.type === domain_1.OperandType.Arrow || operand.type === domain_1.OperandType.ChildFunc || operand.type === domain_1.OperandType.CallFunc) {
|
|
27
27
|
const alias = this.model.functionAlias.find(p => p[0] === operand.name);
|
|
28
28
|
if (alias) {
|
|
29
29
|
operand.name = alias[1];
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
else if (operand.type ===
|
|
32
|
+
else if (operand.type === domain_1.OperandType.Operator) {
|
|
33
33
|
const alias = this.model.operatorAlias.find(p => p[0] === operand.name);
|
|
34
34
|
if (alias) {
|
|
35
35
|
operand.name = alias[1];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizer.js","sourceRoot":"","sources":["../../../../src/lib/application/operand/normalizer.ts"],"names":[],"mappings":";;;AAAA,yCAAyC;AACzC,yCAAsF;AAEtF,MAAa,iBAAiB;IAC7B,kDAAkD;IAClD,YAAuC,KAAoB;QAApB,UAAK,GAAL,KAAK,CAAe;IAAG,CAAC;IAExD,SAAS,CAAE,OAAgB;QACjC,IAAI,OAAO,CAAC,IAAI,KAAK,oBAAW,CAAC,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YACtE,0CAA0C;YAC1C,MAAM,aAAa,GAAG,IAAI,gBAAO,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,oBAAW,CAAC,GAAG,CAAC,CAAA;YACpE,MAAM,SAAS,GAAG,IAAI,gBAAO,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,oBAAW,CAAC,GAAG,CAAC,CAAA;YAChE,MAAM,GAAG,GAAG,IAAI,gBAAO,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,oBAAW,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC,CAAA;YACnG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAA;YAC1B,OAAO,GAAG,CAAA;SACV;aAAM;YACN,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAA;YAC9B,OAAO,OAAO,CAAA;SACd;IACF,CAAC;IAES,gBAAgB,CAAE,OAAgB;QAC3C,IAAI,OAAO,CAAC,IAAI,KAAK,oBAAW,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,KAAK,oBAAW,CAAC,SAAS,IAAI,OAAO,CAAC,IAAI,KAAK,oBAAW,CAAC,QAAQ,EAAE;YAC1H,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;YACvE,IAAI,KAAK,EAAE;gBACV,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;aACvB;SACD;aAAM,IAAI,OAAO,CAAC,IAAI,KAAK,oBAAW,CAAC,QAAQ,EAAE;YACjD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;YACvE,IAAI,KAAK,EAAE;gBACV,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;aACvB;SACD;QACD,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,QAAQ,EAAE;YACrC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAA;SAC5B;IACF,CAAC;CACD;AAlCD,8CAkCC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ParameterService = void 0;
|
|
4
4
|
// import { Const, Var, Template, Operator, CallFunc, Arrow, List, Obj, Property } from './operands'
|
|
5
|
-
const
|
|
5
|
+
const domain_1 = require("../../domain");
|
|
6
6
|
const json_light_1 = require("json-light");
|
|
7
|
-
class
|
|
7
|
+
class ParameterService {
|
|
8
8
|
parameters(operand) {
|
|
9
9
|
const parameters = [];
|
|
10
|
-
if (operand.type ===
|
|
10
|
+
if (operand.type === domain_1.OperandType.Var) {
|
|
11
11
|
parameters.push({ name: operand.name, type: json_light_1.Type.stringify(operand.returnType) });
|
|
12
12
|
}
|
|
13
13
|
for (const child of operand.children) {
|
|
@@ -20,5 +20,5 @@ class ParameterManager {
|
|
|
20
20
|
return parameters;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
exports.
|
|
23
|
+
exports.ParameterService = ParameterService;
|
|
24
24
|
//# sourceMappingURL=parameters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../../../src/lib/application/operand/parameters.ts"],"names":[],"mappings":";;;AAAA,oGAAoG;AACpG,yCAAiF;AACjF,2CAAiC;AACjC,MAAa,gBAAgB;IACrB,UAAU,CAAE,OAAgB;QAClC,MAAM,UAAU,GAAgB,EAAE,CAAA;QAClC,IAAI,OAAO,CAAC,IAAI,KAAK,oBAAW,CAAC,GAAG,EAAE;YACrC,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,iBAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;SACjF;QACD,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,QAAQ,EAAE;YACrC,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;YAC9C,MAAM,aAAa,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;YACxH,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC7B,UAAU,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAA;aACjC;SACD;QACD,OAAO,UAAU,CAAA;IAClB,CAAC;CACD;AAfD,4CAeC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Operand,
|
|
1
|
+
import { Operand, IModelService } from '../../domain';
|
|
2
2
|
export declare class Parser {
|
|
3
3
|
private model;
|
|
4
4
|
private positions;
|
|
@@ -9,7 +9,7 @@ export declare class Parser {
|
|
|
9
9
|
private doubleOperators;
|
|
10
10
|
private tripleOperators;
|
|
11
11
|
private assignmentOperators;
|
|
12
|
-
constructor(model:
|
|
12
|
+
constructor(model: IModelService, expression: string);
|
|
13
13
|
parse(): Operand;
|
|
14
14
|
private getExpression;
|
|
15
15
|
private getOperand;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Parser = void 0;
|
|
4
4
|
const h3lp_1 = require("h3lp");
|
|
5
|
-
const
|
|
5
|
+
const domain_1 = require("../../domain");
|
|
6
6
|
const json_light_1 = require("json-light");
|
|
7
7
|
class Parser {
|
|
8
8
|
constructor(model, expression) {
|
|
@@ -40,7 +40,7 @@ class Parser {
|
|
|
40
40
|
break;
|
|
41
41
|
operands.push(operand);
|
|
42
42
|
}
|
|
43
|
-
return operands.length === 1 ? operands[0] : new
|
|
43
|
+
return operands.length === 1 ? operands[0] : new domain_1.Operand(new domain_1.Position(0, 0), 'block', domain_1.OperandType.Block, operands);
|
|
44
44
|
}
|
|
45
45
|
getExpression(operand1, operator, _break = '') {
|
|
46
46
|
let expression;
|
|
@@ -67,24 +67,24 @@ class Parser {
|
|
|
67
67
|
if (_break.includes(this.current)) {
|
|
68
68
|
this.index += 1;
|
|
69
69
|
}
|
|
70
|
-
expression = new
|
|
70
|
+
expression = new domain_1.Operand(this.pos(operator.length), operator, domain_1.OperandType.Operator, [operand1, operand2]);
|
|
71
71
|
isBreak = true;
|
|
72
72
|
break;
|
|
73
73
|
}
|
|
74
74
|
else if (this.model.priority(operator) >= this.model.priority(nextOperator)) {
|
|
75
|
-
operand1 = new
|
|
75
|
+
operand1 = new domain_1.Operand(this.pos(operator.length), operator, domain_1.OperandType.Operator, [operand1, operand2]);
|
|
76
76
|
operator = nextOperator;
|
|
77
77
|
}
|
|
78
78
|
else {
|
|
79
79
|
operand2 = this.getExpression(operand2, nextOperator, _break);
|
|
80
|
-
expression = new
|
|
80
|
+
expression = new domain_1.Operand(this.pos(operator.length), operator, domain_1.OperandType.Operator, [operand1, operand2]);
|
|
81
81
|
isBreak = true;
|
|
82
82
|
break;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
if (!isBreak && operand1 && operand2) {
|
|
87
|
-
expression = new
|
|
87
|
+
expression = new domain_1.Operand(pos, operator, domain_1.OperandType.Operator, [operand1, operand2]);
|
|
88
88
|
}
|
|
89
89
|
return expression;
|
|
90
90
|
}
|
|
@@ -138,17 +138,17 @@ class Parser {
|
|
|
138
138
|
const names = h3lp_1.h3lp.obj.names(value);
|
|
139
139
|
const functionName = names.pop();
|
|
140
140
|
const variableName = names.join('.');
|
|
141
|
-
const variable = new
|
|
141
|
+
const variable = new domain_1.Operand(pos, variableName, domain_1.OperandType.Var);
|
|
142
142
|
operand = this.getChildFunc(functionName, variable);
|
|
143
143
|
}
|
|
144
144
|
else {
|
|
145
145
|
if (this.current === ')') {
|
|
146
146
|
this.index++;
|
|
147
|
-
operand = new
|
|
147
|
+
operand = new domain_1.Operand(pos, value, domain_1.OperandType.CallFunc, []);
|
|
148
148
|
}
|
|
149
149
|
else {
|
|
150
150
|
const args = this.getArgs(')');
|
|
151
|
-
operand = new
|
|
151
|
+
operand = new domain_1.Operand(pos, value, domain_1.OperandType.CallFunc, args);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
}
|
|
@@ -162,10 +162,10 @@ class Parser {
|
|
|
162
162
|
operand = this.getReturn(pos);
|
|
163
163
|
}
|
|
164
164
|
else if (value === 'break') {
|
|
165
|
-
operand = new
|
|
165
|
+
operand = new domain_1.Operand(pos, 'break', domain_1.OperandType.Break);
|
|
166
166
|
}
|
|
167
167
|
else if (value === 'continue') {
|
|
168
|
-
operand = new
|
|
168
|
+
operand = new domain_1.Operand(pos, 'continue', domain_1.OperandType.Continue);
|
|
169
169
|
}
|
|
170
170
|
else if (!this.end && this.current === '[') {
|
|
171
171
|
this.index += 1;
|
|
@@ -183,7 +183,7 @@ class Parser {
|
|
|
183
183
|
else {
|
|
184
184
|
value = parseInt(value);
|
|
185
185
|
}
|
|
186
|
-
operand = new
|
|
186
|
+
operand = new domain_1.Operand(pos, value, domain_1.OperandType.Const, [], json_light_1.Type.integer);
|
|
187
187
|
}
|
|
188
188
|
else if (h3lp_1.h3lp.val.isDecimalFormat(value)) {
|
|
189
189
|
if (isNegative) {
|
|
@@ -197,28 +197,28 @@ class Parser {
|
|
|
197
197
|
else {
|
|
198
198
|
value = parseFloat(value);
|
|
199
199
|
}
|
|
200
|
-
operand = new
|
|
200
|
+
operand = new domain_1.Operand(pos, value, domain_1.OperandType.Const, [], json_light_1.Type.decimal);
|
|
201
201
|
}
|
|
202
202
|
else if (this.model.isConstant(value)) {
|
|
203
203
|
const constantValue = this.model.getConstantValue(value);
|
|
204
|
-
operand = new
|
|
204
|
+
operand = new domain_1.Operand(pos, constantValue, domain_1.OperandType.Const, [], json_light_1.Type.get(constantValue));
|
|
205
205
|
}
|
|
206
206
|
else if (this.model.isEnum(value)) {
|
|
207
207
|
operand = this.getEnum(value, pos);
|
|
208
208
|
}
|
|
209
209
|
else {
|
|
210
|
-
operand = new
|
|
210
|
+
operand = new domain_1.Operand(pos, value, domain_1.OperandType.Var);
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
else if (char === '\'' || char === '"') {
|
|
214
214
|
this.index += 1;
|
|
215
215
|
const result = this.getString(char);
|
|
216
|
-
operand = new
|
|
216
|
+
operand = new domain_1.Operand(pos, result, domain_1.OperandType.Const, [], json_light_1.Type.string);
|
|
217
217
|
}
|
|
218
218
|
else if (char === '`') {
|
|
219
219
|
this.index += 1;
|
|
220
220
|
const result = this.getTemplate();
|
|
221
|
-
operand = new
|
|
221
|
+
operand = new domain_1.Operand(pos, result, domain_1.OperandType.Template, [], json_light_1.Type.string);
|
|
222
222
|
}
|
|
223
223
|
else if (char === '(') {
|
|
224
224
|
this.index += 1;
|
|
@@ -231,7 +231,7 @@ class Parser {
|
|
|
231
231
|
else if (char === '[') {
|
|
232
232
|
this.index += 1;
|
|
233
233
|
const elements = this.getArgs(']');
|
|
234
|
-
operand = new
|
|
234
|
+
operand = new domain_1.Operand(pos, 'array', domain_1.OperandType.List, elements);
|
|
235
235
|
}
|
|
236
236
|
else if (char === '$') {
|
|
237
237
|
let variableName;
|
|
@@ -249,18 +249,18 @@ class Parser {
|
|
|
249
249
|
this.index += 1;
|
|
250
250
|
variableName = this.getValue();
|
|
251
251
|
}
|
|
252
|
-
operand = new
|
|
252
|
+
operand = new domain_1.Operand(pos, variableName, domain_1.OperandType.Env);
|
|
253
253
|
}
|
|
254
254
|
if (operand === null) {
|
|
255
255
|
throw new Error('Operand undefined');
|
|
256
256
|
}
|
|
257
257
|
operand = this.solveChain(operand, pos);
|
|
258
258
|
if (isNegative)
|
|
259
|
-
operand = new
|
|
259
|
+
operand = new domain_1.Operand(new domain_1.Position(pos.ln, pos.col - 1), '-', domain_1.OperandType.Operator, [operand]);
|
|
260
260
|
if (isNot)
|
|
261
|
-
operand = new
|
|
261
|
+
operand = new domain_1.Operand(new domain_1.Position(pos.ln, pos.col - 1), '!', domain_1.OperandType.Operator, [operand]);
|
|
262
262
|
if (isBitNot)
|
|
263
|
-
operand = new
|
|
263
|
+
operand = new domain_1.Operand(new domain_1.Position(pos.ln, pos.col - 1), '~', domain_1.OperandType.Operator, [operand]);
|
|
264
264
|
return operand;
|
|
265
265
|
}
|
|
266
266
|
solveChain(operand, pos) {
|
|
@@ -277,7 +277,7 @@ class Parser {
|
|
|
277
277
|
const names = h3lp_1.h3lp.obj.names(name);
|
|
278
278
|
const propertyName = names.slice(0, -1).join('.');
|
|
279
279
|
const functionName = names.slice(-1)[0];
|
|
280
|
-
const property = new
|
|
280
|
+
const property = new domain_1.Operand(pos, propertyName, domain_1.OperandType.Property, [operand]);
|
|
281
281
|
return this.solveChain(this.getChildFunc(functionName, property), pos);
|
|
282
282
|
}
|
|
283
283
|
else {
|
|
@@ -289,27 +289,27 @@ class Parser {
|
|
|
289
289
|
this.index += 1;
|
|
290
290
|
if (name.includes('.')) {
|
|
291
291
|
// .xxx.xxx[x]
|
|
292
|
-
const property = new
|
|
292
|
+
const property = new domain_1.Operand(pos, name, domain_1.OperandType.Property, [operand]);
|
|
293
293
|
const idx = this.getExpression(undefined, undefined, ']');
|
|
294
|
-
return new
|
|
294
|
+
return new domain_1.Operand(pos, '[]', domain_1.OperandType.Operator, [property, idx]);
|
|
295
295
|
}
|
|
296
296
|
else {
|
|
297
297
|
// .xxx[x]
|
|
298
|
-
const property = new
|
|
298
|
+
const property = new domain_1.Operand(pos, name, domain_1.OperandType.Property, [operand]);
|
|
299
299
|
const idx = this.getExpression(undefined, undefined, ']');
|
|
300
|
-
return new
|
|
300
|
+
return new domain_1.Operand(pos, '[]', domain_1.OperandType.Operator, [property, idx]);
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
303
|
else {
|
|
304
304
|
// .xxx
|
|
305
|
-
return new
|
|
305
|
+
return new domain_1.Operand(pos, name, domain_1.OperandType.Property, [operand]);
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
308
|
else if (this.current === '[') {
|
|
309
309
|
// xxx[x][x] or xxx[x].xxx[x]
|
|
310
310
|
this.index += 1;
|
|
311
311
|
const idx = this.getExpression(undefined, undefined, ']');
|
|
312
|
-
return new
|
|
312
|
+
return new domain_1.Operand(pos, '[]', domain_1.OperandType.Operator, [operand, idx]);
|
|
313
313
|
}
|
|
314
314
|
else {
|
|
315
315
|
return operand;
|
|
@@ -399,7 +399,7 @@ class Parser {
|
|
|
399
399
|
}
|
|
400
400
|
pos(offset = 0) {
|
|
401
401
|
const position = this.positions[this.index - offset];
|
|
402
|
-
return new
|
|
402
|
+
return new domain_1.Position(position[1], position[2]);
|
|
403
403
|
}
|
|
404
404
|
nextIs(key) {
|
|
405
405
|
const array = key.split('');
|
|
@@ -482,12 +482,12 @@ class Parser {
|
|
|
482
482
|
throw new Error('attribute ' + name + ' without value');
|
|
483
483
|
const keyValPos = this.pos();
|
|
484
484
|
const value = this.getExpression(undefined, undefined, ',}');
|
|
485
|
-
const attribute = new
|
|
485
|
+
const attribute = new domain_1.Operand(keyValPos, name, domain_1.OperandType.KeyVal, [value]);
|
|
486
486
|
attributes.push(attribute);
|
|
487
487
|
if (this.offset(-1) === '}')
|
|
488
488
|
break;
|
|
489
489
|
}
|
|
490
|
-
return new
|
|
490
|
+
return new domain_1.Operand(pos, 'obj', domain_1.OperandType.Obj, attributes);
|
|
491
491
|
}
|
|
492
492
|
getBlock() {
|
|
493
493
|
const blockPos = this.pos();
|
|
@@ -505,7 +505,7 @@ class Parser {
|
|
|
505
505
|
break;
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
|
-
return new
|
|
508
|
+
return new domain_1.Operand(blockPos, 'block', domain_1.OperandType.Block, lines);
|
|
509
509
|
}
|
|
510
510
|
getControlBlock() {
|
|
511
511
|
if (this.current === '{') {
|
|
@@ -518,7 +518,7 @@ class Parser {
|
|
|
518
518
|
}
|
|
519
519
|
getReturn(pos) {
|
|
520
520
|
const value = this.getExpression(undefined, undefined, ';');
|
|
521
|
-
return new
|
|
521
|
+
return new domain_1.Operand(pos, 'return', domain_1.OperandType.Return, [value]);
|
|
522
522
|
}
|
|
523
523
|
getTryCatchBlock(pos) {
|
|
524
524
|
const children = [];
|
|
@@ -535,16 +535,16 @@ class Parser {
|
|
|
535
535
|
}
|
|
536
536
|
const catchBlock = this.getControlBlock();
|
|
537
537
|
catchChildren.push(catchBlock);
|
|
538
|
-
const catchNode = new
|
|
538
|
+
const catchNode = new domain_1.Operand(catchPos, 'catch', domain_1.OperandType.Catch, catchChildren);
|
|
539
539
|
children.push(catchNode);
|
|
540
540
|
}
|
|
541
541
|
if (this.current === ';')
|
|
542
542
|
this.index += 1;
|
|
543
|
-
return new
|
|
543
|
+
return new domain_1.Operand(pos, 'try', domain_1.OperandType.Try, children);
|
|
544
544
|
}
|
|
545
545
|
getThrow(pos) {
|
|
546
546
|
const exception = this.getExpression(undefined, undefined, ';');
|
|
547
|
-
return new
|
|
547
|
+
return new domain_1.Operand(pos, 'throw', domain_1.OperandType.Throw, [exception]);
|
|
548
548
|
}
|
|
549
549
|
getIfBlock(pos) {
|
|
550
550
|
const children = [];
|
|
@@ -557,7 +557,7 @@ class Parser {
|
|
|
557
557
|
this.index += 'elseif('.length;
|
|
558
558
|
const condition = this.getExpression(undefined, undefined, ')');
|
|
559
559
|
const elseIfBlock = this.getControlBlock();
|
|
560
|
-
const elseIfNode = new
|
|
560
|
+
const elseIfNode = new domain_1.Operand(elseIfPos, 'elseif', domain_1.OperandType.ElseIf, [condition, elseIfBlock]);
|
|
561
561
|
children.push(elseIfNode);
|
|
562
562
|
}
|
|
563
563
|
if (this.nextIs('else')) {
|
|
@@ -565,7 +565,7 @@ class Parser {
|
|
|
565
565
|
const elseBlock = this.getControlBlock();
|
|
566
566
|
children.push(elseBlock);
|
|
567
567
|
}
|
|
568
|
-
return new
|
|
568
|
+
return new domain_1.Operand(pos, 'if', domain_1.OperandType.If, children);
|
|
569
569
|
}
|
|
570
570
|
getSwitchBlock(pos) {
|
|
571
571
|
const children = [];
|
|
@@ -585,8 +585,8 @@ class Parser {
|
|
|
585
585
|
else {
|
|
586
586
|
compare = this.getValue();
|
|
587
587
|
}
|
|
588
|
-
const caseNode = new
|
|
589
|
-
const block = new
|
|
588
|
+
const caseNode = new domain_1.Operand(this.pos(), compare, domain_1.OperandType.Case);
|
|
589
|
+
const block = new domain_1.Operand(this.pos(), 'block', domain_1.OperandType.Block);
|
|
590
590
|
caseNode.children = [block];
|
|
591
591
|
if (this.current === ':')
|
|
592
592
|
this.index += 1;
|
|
@@ -613,8 +613,8 @@ class Parser {
|
|
|
613
613
|
}
|
|
614
614
|
if (next === 'default:') {
|
|
615
615
|
this.index += 'default:'.length;
|
|
616
|
-
const defaultNode = new
|
|
617
|
-
const block = new
|
|
616
|
+
const defaultNode = new domain_1.Operand(this.pos(), 'default', domain_1.OperandType.Default);
|
|
617
|
+
const block = new domain_1.Operand(this.pos(), 'block', domain_1.OperandType.Block);
|
|
618
618
|
defaultNode.children = [block];
|
|
619
619
|
const lines = [];
|
|
620
620
|
while (true) {
|
|
@@ -629,12 +629,12 @@ class Parser {
|
|
|
629
629
|
}
|
|
630
630
|
if (this.current === '}')
|
|
631
631
|
this.index += 1;
|
|
632
|
-
return new
|
|
632
|
+
return new domain_1.Operand(pos, 'switch', domain_1.OperandType.Switch, children);
|
|
633
633
|
}
|
|
634
634
|
getWhileBlock(pos) {
|
|
635
635
|
const condition = this.getExpression(undefined, undefined, ')');
|
|
636
636
|
const block = this.getControlBlock();
|
|
637
|
-
return new
|
|
637
|
+
return new domain_1.Operand(pos, 'while', domain_1.OperandType.While, [condition, block]);
|
|
638
638
|
}
|
|
639
639
|
getForBlock(pos) {
|
|
640
640
|
const first = this.getExpression(undefined, undefined, '; ');
|
|
@@ -642,7 +642,7 @@ class Parser {
|
|
|
642
642
|
const condition = this.getExpression(undefined, undefined, ';');
|
|
643
643
|
const increment = this.getExpression(undefined, undefined, ')');
|
|
644
644
|
const block = this.getControlBlock();
|
|
645
|
-
return new
|
|
645
|
+
return new domain_1.Operand(pos, 'for', domain_1.OperandType.For, [first, condition, increment, block]);
|
|
646
646
|
}
|
|
647
647
|
else if (this.nextIs('in')) {
|
|
648
648
|
this.index += 2;
|
|
@@ -652,7 +652,7 @@ class Parser {
|
|
|
652
652
|
}
|
|
653
653
|
const list = this.getExpression(undefined, undefined, ')');
|
|
654
654
|
const block = this.getControlBlock();
|
|
655
|
-
return new
|
|
655
|
+
return new domain_1.Operand(pos, 'forIn', domain_1.OperandType.ForIn, [first, list, block]);
|
|
656
656
|
}
|
|
657
657
|
throw new Error('expression for error');
|
|
658
658
|
}
|
|
@@ -663,8 +663,8 @@ class Parser {
|
|
|
663
663
|
const argsPos = this.pos();
|
|
664
664
|
const args = this.getArgs();
|
|
665
665
|
const block = this.getBlock();
|
|
666
|
-
const argsOperand = new
|
|
667
|
-
return new
|
|
666
|
+
const argsOperand = new domain_1.Operand(argsPos, 'args', domain_1.OperandType.Args, args);
|
|
667
|
+
return new domain_1.Operand(pos, name, domain_1.OperandType.Func, [argsOperand, block]);
|
|
668
668
|
}
|
|
669
669
|
getChildFunc(name, parent) {
|
|
670
670
|
let isArrow = false;
|
|
@@ -694,26 +694,26 @@ class Parser {
|
|
|
694
694
|
this.index += 2; // [=>]
|
|
695
695
|
}
|
|
696
696
|
if (isArrow) {
|
|
697
|
-
const variable = new
|
|
697
|
+
const variable = new domain_1.Operand(pos, variableName, domain_1.OperandType.Var);
|
|
698
698
|
const body = this.getExpression(undefined, undefined, ')');
|
|
699
|
-
return new
|
|
699
|
+
return new domain_1.Operand(pos, name, domain_1.OperandType.Arrow, [parent, variable, body]);
|
|
700
700
|
}
|
|
701
701
|
else {
|
|
702
702
|
if (this.current === ')') {
|
|
703
703
|
this.index += 1;
|
|
704
704
|
// Example: xxx.xxx()
|
|
705
|
-
return new
|
|
705
|
+
return new domain_1.Operand(pos, name, domain_1.OperandType.ChildFunc, [parent]);
|
|
706
706
|
}
|
|
707
707
|
// Example: xxx.xxx(x)
|
|
708
708
|
const args = this.getArgs(')');
|
|
709
709
|
args.splice(0, 0, parent);
|
|
710
|
-
return new
|
|
710
|
+
return new domain_1.Operand(pos, name, domain_1.OperandType.ChildFunc, args);
|
|
711
711
|
}
|
|
712
712
|
}
|
|
713
713
|
getIndexOperand(name, pos) {
|
|
714
714
|
const idx = this.getExpression(undefined, undefined, ']');
|
|
715
|
-
const operand = new
|
|
716
|
-
return new
|
|
715
|
+
const operand = new domain_1.Operand(pos, name, domain_1.OperandType.Var);
|
|
716
|
+
return new domain_1.Operand(pos, '[]', domain_1.OperandType.Operator, [operand, idx]);
|
|
717
717
|
}
|
|
718
718
|
getEnum(value, pos) {
|
|
719
719
|
if (value.includes('.') && this.model.isEnum(value)) {
|
|
@@ -721,17 +721,17 @@ class Parser {
|
|
|
721
721
|
const enumName = names[0];
|
|
722
722
|
const enumOption = names[1];
|
|
723
723
|
const enumValue = this.model.getEnumValue(enumName, enumOption);
|
|
724
|
-
return new
|
|
724
|
+
return new domain_1.Operand(pos, enumValue, domain_1.OperandType.Const, [], json_light_1.Type.get(value));
|
|
725
725
|
}
|
|
726
726
|
else {
|
|
727
727
|
const values = this.model.getEnum(value);
|
|
728
728
|
const attributes = [];
|
|
729
729
|
for (const name in values) {
|
|
730
730
|
const _value = values[name];
|
|
731
|
-
const attribute = new
|
|
731
|
+
const attribute = new domain_1.Operand(pos, name, domain_1.OperandType.KeyVal, [new domain_1.Operand(pos, _value, domain_1.OperandType.Const, [], json_light_1.Type.get(_value))]);
|
|
732
732
|
attributes.push(attribute);
|
|
733
733
|
}
|
|
734
|
-
return new
|
|
734
|
+
return new domain_1.Operand(pos, 'obj', domain_1.OperandType.Obj, attributes);
|
|
735
735
|
}
|
|
736
736
|
}
|
|
737
737
|
}
|