@kogeet/scapin-core-agent 0.1.6 → 0.1.8
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/bin/core/context.d.ts +5 -6
- package/bin/core/context.d.ts.map +1 -1
- package/bin/core/context.js +4 -34
- package/bin/core/runsteps.d.ts +7 -3
- package/bin/core/runsteps.d.ts.map +1 -1
- package/bin/core/runsteps.js +23 -14
- package/bin/core/step.context.d.ts +1 -1
- package/bin/core/step.context.d.ts.map +1 -1
- package/bin/core/step.context.js +20 -26
- package/bin/core/wsocket.io.d.ts +7 -1
- package/bin/core/wsocket.io.d.ts.map +1 -1
- package/bin/core/wsocket.io.js +41 -18
- package/bin/models/run.model.d.ts +4 -0
- package/bin/models/run.model.d.ts.map +1 -1
- package/bin/models/run.model.js +12 -6
- package/package.json +8 -8
- package/bin/core/jison.parser.d.ts +0 -16
- package/bin/core/jison.parser.d.ts.map +0 -1
- package/bin/core/jison.parser.js +0 -82
- package/bin/jison/calc.grammar.d.ts +0 -20
- package/bin/jison/calc.grammar.d.ts.map +0 -1
- package/bin/jison/calc.grammar.js +0 -66
- package/bin/jison/datetime.grammar.d.ts +0 -11
- package/bin/jison/datetime.grammar.d.ts.map +0 -1
- package/bin/jison/datetime.grammar.js +0 -42
- package/bin/jison/logical.grammar.d.ts +0 -11
- package/bin/jison/logical.grammar.d.ts.map +0 -1
- package/bin/jison/logical.grammar.js +0 -39
- package/bin/jison/option.grammar.d.ts +0 -11
- package/bin/jison/option.grammar.d.ts.map +0 -1
- package/bin/jison/option.grammar.js +0 -24
- package/bin/jison/string.grammar.d.ts +0 -11
- package/bin/jison/string.grammar.d.ts.map +0 -1
- package/bin/jison/string.grammar.js +0 -31
- package/bin/jison/variable.grammar.d.ts +0 -10
- package/bin/jison/variable.grammar.d.ts.map +0 -1
- package/bin/jison/variable.grammar.js +0 -14
package/bin/core/context.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { type varType } from '../models/parameter.model.js';
|
|
1
|
+
import type { varType } from "../models/parameter.model.js";
|
|
3
2
|
/**
|
|
4
3
|
* La classe **Context** stocke les variables utilisées lors du test
|
|
5
4
|
*/
|
|
6
5
|
export declare class Context {
|
|
7
|
-
idxStep: number;
|
|
8
6
|
private variables;
|
|
9
7
|
getVariable(varname: string): varType;
|
|
10
8
|
setVariable(varname: string, value: varType): void;
|
|
11
|
-
loadVariable(params: RunParamModel[]): void;
|
|
12
|
-
valorize(param: RunParamModel): void;
|
|
13
9
|
dump(): [string, varType][];
|
|
14
|
-
resetVariables(
|
|
10
|
+
resetVariables(rVars?: {
|
|
11
|
+
name: string;
|
|
12
|
+
value: varType;
|
|
13
|
+
}[]): void;
|
|
15
14
|
}
|
|
16
15
|
export declare const context: Context;
|
|
17
16
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/core/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/core/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,8BAA8B,CAAC;AAE1D;;GAEG;AACH,qBAAa,OAAO;IAElB,OAAO,CAAC,SAAS,CAA6B;IAEvC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAIrC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;IAM3C,IAAI;IAIJ,cAAc,CAAC,KAAK,GAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,EAAO;CAMrE;AAED,eAAO,MAAM,OAAO,SAAgB,CAAA"}
|
package/bin/core/context.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { enumParamType } from '../models/parameter.model.js';
|
|
2
1
|
/**
|
|
3
2
|
* La classe **Context** stocke les variables utilisées lors du test
|
|
4
3
|
*/
|
|
5
4
|
export class Context {
|
|
6
|
-
idxStep = -1;
|
|
7
5
|
variables = new Map();
|
|
8
6
|
getVariable(varname) {
|
|
9
7
|
return this.variables.get(varname);
|
|
@@ -13,42 +11,14 @@ export class Context {
|
|
|
13
11
|
this.variables.set(varname, value);
|
|
14
12
|
}
|
|
15
13
|
}
|
|
16
|
-
loadVariable(params) {
|
|
17
|
-
const regex = /\$\w+/g;
|
|
18
|
-
params.forEach((p) => {
|
|
19
|
-
if (p && p.value && typeof p.value === 'string') {
|
|
20
|
-
const found = p.value.match(regex);
|
|
21
|
-
if (found) {
|
|
22
|
-
found.forEach((name) => {
|
|
23
|
-
if (!this.variables.has(name)) {
|
|
24
|
-
this.variables.set(name, undefined);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
valorize(param) {
|
|
32
|
-
// console.log('Valorize input :', param)
|
|
33
|
-
const quot = param.type === enumParamType.textdata || param.type === enumParamType.options ? '"' : '';
|
|
34
|
-
if (param.type !== enumParamType.receipt && param.value && typeof param.value === 'string') {
|
|
35
|
-
const found = param.value.match(/\$\w+/g);
|
|
36
|
-
if (found) {
|
|
37
|
-
found.forEach((vname) => {
|
|
38
|
-
if (this.variables.has(vname)) {
|
|
39
|
-
const vvalue = this.variables.get(vname);
|
|
40
|
-
param.value = param.value.replace(vname, quot + vvalue + quot);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
// console.log('Valorize output :', param)
|
|
46
|
-
}
|
|
47
14
|
dump() {
|
|
48
15
|
return [...this.variables.entries()];
|
|
49
16
|
}
|
|
50
|
-
resetVariables() {
|
|
17
|
+
resetVariables(rVars = []) {
|
|
51
18
|
this.variables.clear();
|
|
19
|
+
rVars.forEach((v) => {
|
|
20
|
+
this.setVariable(v.name, v.value);
|
|
21
|
+
});
|
|
52
22
|
}
|
|
53
23
|
}
|
|
54
24
|
export const context = new Context();
|
package/bin/core/runsteps.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import type { RunDataStepModel } from '../models/run.model.js';
|
|
1
|
+
import type { RunDataStepModel, Variable } from '../models/run.model.js';
|
|
2
2
|
export declare class RunSteps {
|
|
3
|
-
private
|
|
3
|
+
private runData;
|
|
4
|
+
private runStep;
|
|
4
5
|
private stepCtx;
|
|
5
6
|
stop: boolean;
|
|
6
|
-
|
|
7
|
+
constructor(rData: RunDataStepModel[], rVars: Variable[]);
|
|
8
|
+
run(pos: number, end: number): Promise<void>;
|
|
9
|
+
size(): number;
|
|
10
|
+
close(): void;
|
|
7
11
|
private runAStep;
|
|
8
12
|
}
|
|
9
13
|
//# sourceMappingURL=runsteps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runsteps.d.ts","sourceRoot":"","sources":["../../src/core/runsteps.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runsteps.d.ts","sourceRoot":"","sources":["../../src/core/runsteps.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,gBAAgB,EAAE,QAAQ,EAAC,MAAM,wBAAwB,CAAA;AAEtE,qBAAa,QAAQ;IACnB,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,OAAO,CAA2B;IACnC,IAAI,EAAE,OAAO,CAAQ;gBAET,KAAK,EAAE,gBAAgB,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE;IAKlD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAkBlC,IAAI;IAEJ,KAAK;YAKE,QAAQ;CAwBvB"}
|
package/bin/core/runsteps.js
CHANGED
|
@@ -1,35 +1,44 @@
|
|
|
1
|
-
import RunStep from './runstep.js';
|
|
2
|
-
import StepContext from './step.context.js';
|
|
3
1
|
import wSocketIo from './wsocket.io.js';
|
|
4
2
|
import { context, report } from "../index.js";
|
|
3
|
+
import StepContext from './step.context.js';
|
|
4
|
+
import RunStep from './runstep.js';
|
|
5
5
|
export class RunSteps {
|
|
6
|
-
|
|
6
|
+
runData;
|
|
7
|
+
runStep = new RunStep();
|
|
7
8
|
stepCtx = null;
|
|
8
9
|
stop = false;
|
|
9
|
-
|
|
10
|
-
this.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (this.
|
|
17
|
-
|
|
10
|
+
constructor(rData, rVars) {
|
|
11
|
+
this.runData = rData;
|
|
12
|
+
context.resetVariables(rVars);
|
|
13
|
+
}
|
|
14
|
+
async run(pos, end) {
|
|
15
|
+
if (this.runData.length != 0) {
|
|
16
|
+
for (let i = pos; i < end; i++) {
|
|
17
|
+
if (i < this.runData.length) {
|
|
18
|
+
const step = this.runData[i];
|
|
19
|
+
await this.runAStep(step);
|
|
20
|
+
if (this.stop) {
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
18
23
|
}
|
|
19
24
|
}
|
|
20
|
-
wSocketIo.end();
|
|
21
25
|
}
|
|
22
26
|
else {
|
|
23
27
|
report.error('No steps data found');
|
|
24
28
|
wSocketIo.end();
|
|
25
29
|
}
|
|
26
30
|
}
|
|
31
|
+
size() { return this.runData.length; }
|
|
32
|
+
close() {
|
|
33
|
+
this.runData = [];
|
|
34
|
+
context.resetVariables();
|
|
35
|
+
}
|
|
27
36
|
async runAStep(step) {
|
|
28
37
|
let stepResult;
|
|
29
38
|
report.stepStart(step.pos);
|
|
30
39
|
try {
|
|
31
40
|
this.stepCtx = new StepContext(step);
|
|
32
|
-
stepResult = await this.
|
|
41
|
+
stepResult = await this.runStep.run(this.stepCtx, step.lib, step.fn);
|
|
33
42
|
}
|
|
34
43
|
catch (e) {
|
|
35
44
|
const errMsg = e.message;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RunDataStepModel, RunParamModel } from '../models/run.model.js';
|
|
2
1
|
import { type varType } from '../models/parameter.model.js';
|
|
2
|
+
import type { RunDataStepModel, RunParamModel } from '../models/run.model.js';
|
|
3
3
|
/**
|
|
4
4
|
* La classe **StepContext** gère les paramètres.
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.context.d.ts","sourceRoot":"","sources":["../../src/core/step.context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"step.context.d.ts","sourceRoot":"","sources":["../../src/core/step.context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,OAAO,EAAC,MAAM,8BAA8B,CAAC;AAC1D,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,wBAAwB,CAAA;AAE3E;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW;IACvB,KAAK,EAAE,OAAO,CAAA;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IACzC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkB;IACzC,SAAgB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;gBAE1B,IAAI,EAAE,gBAAgB;IAa3B,YAAY;IAIZ,aAAa;IAIb,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,OAAmB,GAAG,OAAO;IAI3D,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAC,SAAqB,GAAG,MAAM;IAIzE,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,OAAmB,GAAG,OAAO;IAInE,OAAO,CAAC,GAAG;IAKX,OAAO,CAAC,WAAW;CA2BpB"}
|
package/bin/core/step.context.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { JisonSolver } from './jison.parser.js';
|
|
1
|
+
import { parseParam } from "@kogeet/sapi-parser";
|
|
3
2
|
import { context, report } from "../index.js";
|
|
3
|
+
import {} from '../models/parameter.model.js';
|
|
4
4
|
/**
|
|
5
5
|
* La classe **StepContext** gère les paramètres.
|
|
6
6
|
*
|
|
@@ -19,7 +19,7 @@ export default class StepContext {
|
|
|
19
19
|
this.istoy = step.istoy;
|
|
20
20
|
this.toolid = step.toolid ? step.toolid : null;
|
|
21
21
|
// Chargement si nécessaire des variables présentes dans les paramètres
|
|
22
|
-
context.loadVariable(this.params)
|
|
22
|
+
// context.loadVariable(this.params)
|
|
23
23
|
// Résolution des expressions
|
|
24
24
|
this.solveParams();
|
|
25
25
|
}
|
|
@@ -43,30 +43,24 @@ export default class StepContext {
|
|
|
43
43
|
return par && typeof par.value !== 'undefined' ? par.value : defaut;
|
|
44
44
|
}
|
|
45
45
|
solveParams() {
|
|
46
|
+
const ctxVars = context.dump().map(v => {
|
|
47
|
+
return { name: v[0], value: v[1] };
|
|
48
|
+
});
|
|
49
|
+
// console.log('variables: ', [...ctxVars.map<string>(v => `${v.name}=${v.value}`)])
|
|
46
50
|
this.params.map((param) => {
|
|
47
|
-
|
|
48
|
-
if (param.value
|
|
49
|
-
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
case enumParamType.datetime:
|
|
61
|
-
param.value = Date.parse(strSolveVal);
|
|
62
|
-
break;
|
|
63
|
-
default:
|
|
64
|
-
param.value = strSolveVal;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
param.value = null;
|
|
69
|
-
}
|
|
51
|
+
// console.log('Parameter ', {...param})
|
|
52
|
+
if (param.value[0] === "=" && param.type) {
|
|
53
|
+
let input = param.value;
|
|
54
|
+
if (input[0] === '=')
|
|
55
|
+
input = input.slice(1);
|
|
56
|
+
const result = parseParam(input, param.type, ctxVars, param.options);
|
|
57
|
+
if (result.isValid) {
|
|
58
|
+
const value = result.resolvedValue || '';
|
|
59
|
+
console.log(`Solve ${param.value} => ${value}`);
|
|
60
|
+
param.value = value;
|
|
61
|
+
}
|
|
62
|
+
else if (result.error && result.error.length > 0) {
|
|
63
|
+
report.error(`"${param.value}" parse error: ${result.error}`);
|
|
70
64
|
}
|
|
71
65
|
else {
|
|
72
66
|
report.error(`Impossible to solve expression : ${param.value}`);
|
package/bin/core/wsocket.io.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Socket } from "socket.io-client";
|
|
2
2
|
declare class WsocketIo {
|
|
3
3
|
ioClient: Socket | null;
|
|
4
|
-
private
|
|
4
|
+
private runSteps;
|
|
5
5
|
private connected;
|
|
6
6
|
private termId;
|
|
7
7
|
start(): void;
|
|
@@ -11,6 +11,12 @@ declare class WsocketIo {
|
|
|
11
11
|
*/
|
|
12
12
|
end(): void;
|
|
13
13
|
private onError;
|
|
14
|
+
/** Réception des données d'exécution en mode Debug **/
|
|
15
|
+
private onDebugData;
|
|
16
|
+
/** Ordre d'exécution en mode Debug**/
|
|
17
|
+
private onDebugRun;
|
|
18
|
+
private onDebugStop;
|
|
19
|
+
/** Ordre d'exécution en mode Job **/
|
|
14
20
|
private onRundata;
|
|
15
21
|
private onStatus;
|
|
16
22
|
private onPing;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wsocket.io.d.ts","sourceRoot":"","sources":["../../src/core/wsocket.io.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAW5C,cAAM,SAAS;IACN,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAO;IACrC,OAAO,CAAC,QAAQ,CAAwB;IACxC,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,MAAM,CAAa;IAEpB,KAAK;
|
|
1
|
+
{"version":3,"file":"wsocket.io.d.ts","sourceRoot":"","sources":["../../src/core/wsocket.io.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,MAAM,EAAC,MAAM,kBAAkB,CAAC;AAW5C,cAAM,SAAS;IACN,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAO;IACrC,OAAO,CAAC,QAAQ,CAAwB;IACxC,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,MAAM,CAAa;IAEpB,KAAK;IAkDL,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAQjD;;OAEG;IACI,GAAG;IASV,OAAO,CAAC,OAAO,CAUd;IAED,uDAAuD;IACvD,OAAO,CAAC,WAAW,CAGlB;IAED,sCAAsC;IACtC,OAAO,CAAC,UAAU,CAYjB;IAED,OAAO,CAAC,WAAW,CAGlB;IAED,qCAAqC;IACrC,OAAO,CAAC,SAAS,CAGhB;IAED,OAAO,CAAC,QAAQ,CAIf;IAED,OAAO,CAAC,MAAM,CAGb;IAED,OAAO,CAAC,SAAS,CAOhB;CAEF;AAED,QAAA,MAAM,SAAS,WAAkB,CAAA;AACjC,eAAe,SAAS,CAAA"}
|
package/bin/core/wsocket.io.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { io, Socket } from "socket.io-client";
|
|
2
|
-
import { RunSteps } from './runsteps.js';
|
|
3
2
|
import { report } from "../index.js";
|
|
3
|
+
import { RunSteps } from './runsteps.js';
|
|
4
4
|
const url = process.env.ScapinServerURL || 'https://scapin.loicg.com';
|
|
5
5
|
const scapinAgentId = process.env.ScapinAgentId;
|
|
6
6
|
class WsocketIo {
|
|
7
7
|
ioClient = null;
|
|
8
|
-
|
|
8
|
+
runSteps = null;
|
|
9
9
|
connected = true;
|
|
10
10
|
termId = '';
|
|
11
11
|
start() {
|
|
@@ -37,11 +37,13 @@ class WsocketIo {
|
|
|
37
37
|
console.log(`Terminal ${scapinAgentId} is now connected to automation server!`);
|
|
38
38
|
}));
|
|
39
39
|
this.ioClient.on('connect_error', this.onError);
|
|
40
|
-
this.ioClient.on('data', this.
|
|
41
|
-
this.ioClient.on('
|
|
40
|
+
this.ioClient.on('data', this.onDebugData);
|
|
41
|
+
this.ioClient.on('run', this.onDebugRun);
|
|
42
|
+
this.ioClient.on('stop-debugger', this.onDebugStop);
|
|
43
|
+
this.ioClient.on('run-data', this.onRundata);
|
|
42
44
|
this.ioClient.on('status', this.onStatus);
|
|
43
45
|
this.ioClient.on('status-ping', this.onPing);
|
|
44
|
-
this.ioClient.on('
|
|
46
|
+
this.ioClient.on('stop-run', this.onStopRun);
|
|
45
47
|
// this.ioClient.on('reconnect_attempt', (n: number) => { console.log(`${n} tentative de reconnexion`)})
|
|
46
48
|
this.ioClient.on('reconnect', (n) => {
|
|
47
49
|
console.log(`${n} reconnexion réussies`);
|
|
@@ -62,11 +64,12 @@ class WsocketIo {
|
|
|
62
64
|
* Fin d'exécution d'un run
|
|
63
65
|
*/
|
|
64
66
|
end() {
|
|
67
|
+
this.runSteps?.close();
|
|
68
|
+
this.runSteps = null;
|
|
69
|
+
report.clearStepLog();
|
|
65
70
|
if (this.ioClient) {
|
|
66
71
|
this.ioClient.emit('end');
|
|
67
72
|
}
|
|
68
|
-
this.runsteps = null;
|
|
69
|
-
report.clearStepLog();
|
|
70
73
|
}
|
|
71
74
|
onError = (err) => {
|
|
72
75
|
const msg = err.description ? err.description.message : '';
|
|
@@ -80,19 +83,39 @@ class WsocketIo {
|
|
|
80
83
|
}
|
|
81
84
|
}
|
|
82
85
|
};
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
/** Réception des données d'exécution en mode Debug **/
|
|
87
|
+
onDebugData = (stepsData, runVar) => {
|
|
88
|
+
console.log(`Data of the run are: ${stepsData?.length || 0} steps and ${runVar?.length || 0} variables`);
|
|
89
|
+
this.runSteps = stepsData && runVar ? new RunSteps(stepsData, runVar) : null;
|
|
90
|
+
};
|
|
91
|
+
/** Ordre d'exécution en mode Debug**/
|
|
92
|
+
onDebugRun = async (pos, end) => {
|
|
93
|
+
console.log(`Running in Debug mode from ${pos} to ${end}`);
|
|
94
|
+
if (this.runSteps && typeof pos === 'number' && typeof end === 'number') {
|
|
95
|
+
try {
|
|
96
|
+
await this.runSteps.run(pos, end);
|
|
97
|
+
}
|
|
98
|
+
catch (e) {
|
|
99
|
+
console.log('Unexpected error : ' + e.message);
|
|
100
|
+
wSocketIo.end();
|
|
101
|
+
}
|
|
87
102
|
}
|
|
88
|
-
|
|
89
|
-
console.log(
|
|
90
|
-
wSocketIo.end();
|
|
103
|
+
else {
|
|
104
|
+
console.log("Invalid executive data");
|
|
91
105
|
}
|
|
92
106
|
};
|
|
107
|
+
onDebugStop = () => {
|
|
108
|
+
console.log("Arrêt du mode debug");
|
|
109
|
+
wSocketIo.end();
|
|
110
|
+
};
|
|
111
|
+
/** Ordre d'exécution en mode Job **/
|
|
112
|
+
onRundata = async (stepsData, runVars) => {
|
|
113
|
+
this.onDebugData(stepsData, runVars);
|
|
114
|
+
await this.onDebugRun(0, this.runSteps?.size() || 0);
|
|
115
|
+
};
|
|
93
116
|
onStatus = () => {
|
|
94
117
|
if (this.ioClient) {
|
|
95
|
-
this.ioClient.emit('status', this.
|
|
118
|
+
this.ioClient.emit('status', this.runSteps ? 'busy' : 'available');
|
|
96
119
|
}
|
|
97
120
|
};
|
|
98
121
|
onPing = (ack) => {
|
|
@@ -101,10 +124,10 @@ class WsocketIo {
|
|
|
101
124
|
};
|
|
102
125
|
onStopRun = () => {
|
|
103
126
|
console.log('onStopRun');
|
|
104
|
-
if (this.
|
|
105
|
-
this.
|
|
127
|
+
if (this.runSteps) {
|
|
128
|
+
this.runSteps.stop = true;
|
|
106
129
|
}
|
|
107
|
-
this.
|
|
130
|
+
this.runSteps = null;
|
|
108
131
|
report.clearStepLog();
|
|
109
132
|
};
|
|
110
133
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.model.d.ts","sourceRoot":"","sources":["../../src/models/run.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,KAAK,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAEjE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,aAAa,CAAA;IACnB,GAAG,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IACxB,MAAM,EAAE,aAAa,EAAE,CAAA;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,aAAa,EAAE,CAAC;IAG5B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB;AAED;;;;;GAKG;AACH,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB;AAED,eAAO,MAAM,UAAU;;;;gBAIT,MAAM,GAAG,SAAS;
|
|
1
|
+
{"version":3,"file":"run.model.d.ts","sourceRoot":"","sources":["../../src/models/run.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,KAAK,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAEjE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,aAAa,CAAA;IACnB,GAAG,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAA;IACxB,MAAM,EAAE,aAAa,EAAE,CAAA;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,aAAa,EAAE,CAAC;IAG5B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB;AAED;;;;;GAKG;AACH,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB;AAED,eAAO,MAAM,UAAU;;;;gBAIT,MAAM,GAAG,SAAS;EAW9B,CAAA;AAEF,eAAO,MAAM,QAAQ;;;;gBAIP,MAAM,GAAG,SAAS;EAW9B,CAAA;AAEF,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAA;CACd"}
|
package/bin/models/run.model.js
CHANGED
|
@@ -5,9 +5,12 @@ export const stepStatus = Object.freeze({
|
|
|
5
5
|
fail: 2,
|
|
6
6
|
toString(n) {
|
|
7
7
|
switch (n) {
|
|
8
|
-
case 0:
|
|
9
|
-
|
|
10
|
-
case
|
|
8
|
+
case 0:
|
|
9
|
+
return 'cancel';
|
|
10
|
+
case 1:
|
|
11
|
+
return 'pass';
|
|
12
|
+
case 2:
|
|
13
|
+
return 'fail';
|
|
11
14
|
}
|
|
12
15
|
return '';
|
|
13
16
|
},
|
|
@@ -18,9 +21,12 @@ export const logLevel = Object.freeze({
|
|
|
18
21
|
error: 2,
|
|
19
22
|
toString(n) {
|
|
20
23
|
switch (n) {
|
|
21
|
-
case 0:
|
|
22
|
-
|
|
23
|
-
case
|
|
24
|
+
case 0:
|
|
25
|
+
return 'info';
|
|
26
|
+
case 1:
|
|
27
|
+
return 'warning';
|
|
28
|
+
case 2:
|
|
29
|
+
return 'error';
|
|
24
30
|
}
|
|
25
31
|
return '';
|
|
26
32
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kogeet/scapin-core-agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Scapin Core Agent",
|
|
5
5
|
"author": "Loïc Griveau",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,15 +17,15 @@
|
|
|
17
17
|
"np": "np --no-tests --message=core-agent-%s"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@types/node": "^
|
|
21
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
22
|
-
"@typescript-eslint/parser": "^
|
|
23
|
-
"eslint": "^
|
|
24
|
-
"typescript": "^5.
|
|
20
|
+
"@types/node": "^25.3.3",
|
|
21
|
+
"@typescript-eslint/eslint-plugin": "^8.56.1",
|
|
22
|
+
"@typescript-eslint/parser": "^8.56.1",
|
|
23
|
+
"eslint": "^9.39.3",
|
|
24
|
+
"typescript": "^5.9.3"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"
|
|
28
|
-
"socket.io-client": "^4.
|
|
27
|
+
"@kogeet/sapi-parser": "^1.0.4",
|
|
28
|
+
"socket.io-client": "^4.8.3"
|
|
29
29
|
},
|
|
30
30
|
"type": "module"
|
|
31
31
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { enumParamType } from '../models/parameter.model.js';
|
|
2
|
-
export declare class JisonParser {
|
|
3
|
-
error: string | null;
|
|
4
|
-
result: never | null;
|
|
5
|
-
private jparser;
|
|
6
|
-
constructor(grammar: unknown);
|
|
7
|
-
exec(exp: string): boolean | string;
|
|
8
|
-
static builder(type: enumParamType, options: string[]): JisonParser | null;
|
|
9
|
-
}
|
|
10
|
-
export declare class JisonSolver {
|
|
11
|
-
private jparser;
|
|
12
|
-
constructor(grammar: unknown);
|
|
13
|
-
exec(exp: string): string | null;
|
|
14
|
-
static builder(type: enumParamType, options: string[]): JisonSolver | null;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=jison.parser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jison.parser.d.ts","sourceRoot":"","sources":["../../src/core/jison.parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,8BAA8B,CAAC;AAU3D,qBAAa,WAAW;IACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC5B,MAAM,EAAE,KAAK,GAAC,IAAI,CAAQ;IACjC,OAAO,CAAC,OAAO,CAAoC;gBAGhC,OAAO,EAAE,OAAO;IAI5B,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM;WAiB5B,OAAO,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE;CAS7D;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,OAAO,CAA8C;gBAE1C,OAAO,EAAE,OAAO;IAI5B,IAAI,CAAC,GAAG,EAAE,MAAM;WAaT,OAAO,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE;CAQ7D"}
|
package/bin/core/jison.parser.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { enumParamType } from '../models/parameter.model.js';
|
|
2
|
-
import { variableGrammar } from '../jison/variable.grammar.js';
|
|
3
|
-
import { logicalGrammar } from '../jison/logical.grammar.js';
|
|
4
|
-
import { stringGrammar } from '../jison/string.grammar.js';
|
|
5
|
-
import { calcGrammar } from '../jison/calc.grammar.js';
|
|
6
|
-
import { datetimeGrammar } from '../jison/datetime.grammar.js';
|
|
7
|
-
import { optionGrammar } from '../jison/option.grammar.js';
|
|
8
|
-
import pkg from "jison";
|
|
9
|
-
const { Parser } = pkg;
|
|
10
|
-
export class JisonParser {
|
|
11
|
-
error = null;
|
|
12
|
-
result = null;
|
|
13
|
-
jparser;
|
|
14
|
-
constructor(grammar) {
|
|
15
|
-
this.jparser = new Parser(grammar);
|
|
16
|
-
}
|
|
17
|
-
exec(exp) {
|
|
18
|
-
try {
|
|
19
|
-
this.jparser.parse(exp);
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
catch (e) {
|
|
23
|
-
const m = e.message.split('\n');
|
|
24
|
-
if (m.length >= 2 && m[2].match(/^-*\^$/)) {
|
|
25
|
-
const pos = m[2].length;
|
|
26
|
-
return pos > exp.length
|
|
27
|
-
? 'Expression incomplete'
|
|
28
|
-
: `Syntax error near character '${exp.charAt(pos - 1)}' at position ${pos}`;
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
return e.message;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
static builder(type, options) {
|
|
36
|
-
const grammar = typeGrammar(type, false, options);
|
|
37
|
-
try {
|
|
38
|
-
return new JisonParser(grammar);
|
|
39
|
-
}
|
|
40
|
-
catch (e) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
export class JisonSolver {
|
|
46
|
-
jparser;
|
|
47
|
-
constructor(grammar) {
|
|
48
|
-
this.jparser = new Parser(grammar);
|
|
49
|
-
}
|
|
50
|
-
exec(exp) {
|
|
51
|
-
try {
|
|
52
|
-
const ret = this.jparser.parse(exp);
|
|
53
|
-
console.log(`Solve expression '${exp}' :`, ret);
|
|
54
|
-
return ret ? ret : null;
|
|
55
|
-
}
|
|
56
|
-
catch (e) {
|
|
57
|
-
const msg = e.message;
|
|
58
|
-
console.log(`Solve erreur expression '${exp}' :`, msg);
|
|
59
|
-
const errs = msg.split('\n');
|
|
60
|
-
throw errs.length > 1 ? errs[1] : errs[0];
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
static builder(type, options) {
|
|
64
|
-
const grammar = typeGrammar(type, true, options);
|
|
65
|
-
try {
|
|
66
|
-
return new JisonSolver(grammar);
|
|
67
|
-
}
|
|
68
|
-
catch (e) {
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function typeGrammar(type, solve = false, options = []) {
|
|
74
|
-
switch (type) {
|
|
75
|
-
case enumParamType.receipt: return variableGrammar;
|
|
76
|
-
case enumParamType.booldata: return logicalGrammar(solve);
|
|
77
|
-
case enumParamType.textdata: return stringGrammar(solve);
|
|
78
|
-
case enumParamType.numbdata: return calcGrammar(solve);
|
|
79
|
-
case enumParamType.datetime: return datetimeGrammar(solve);
|
|
80
|
-
case enumParamType.options: return optionGrammar(solve, options);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare function calcGrammar(solve?: boolean): {
|
|
2
|
-
lex: {
|
|
3
|
-
rules: string[][];
|
|
4
|
-
};
|
|
5
|
-
operators: string[][];
|
|
6
|
-
bnf: {
|
|
7
|
-
expressions: string[][];
|
|
8
|
-
e: (string | {
|
|
9
|
-
prec: string;
|
|
10
|
-
})[][];
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export declare const xxxGrammar: {
|
|
14
|
-
lex: {
|
|
15
|
-
rules: string[][];
|
|
16
|
-
};
|
|
17
|
-
operators: never[];
|
|
18
|
-
bnf: {};
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=calc.grammar.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"calc.grammar.d.ts","sourceRoot":"","sources":["../../src/jison/calc.grammar.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,KAAK,GAAE,OAAe;;;;;;;;;;;EAyDjD;AAGC,eAAO,MAAM,UAAU;;;;;;CAStB,CAAC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/* tslint:disable:quotemark trailing-comma */
|
|
2
|
-
export function calcGrammar(solve = false) {
|
|
3
|
-
const varValue = solve ? 'return null' : '$$ = 0';
|
|
4
|
-
return {
|
|
5
|
-
lex: {
|
|
6
|
-
rules: [
|
|
7
|
-
// Saute les espaces
|
|
8
|
-
['\\s+', '/* skip whitespace */'],
|
|
9
|
-
['[0-9]+(?:\\.[0-9]+)?\\b', 'return `NUMBER`'],
|
|
10
|
-
['\\$\\w+', 'return `VARIABLE`'],
|
|
11
|
-
['\\*', 'return `*`'],
|
|
12
|
-
['\\/', 'return `/`'],
|
|
13
|
-
['-', 'return `-`'],
|
|
14
|
-
['\\+', 'return `+`'],
|
|
15
|
-
['\\^', 'return `^`'],
|
|
16
|
-
['!', 'return `!`'],
|
|
17
|
-
['%', 'return `%`'],
|
|
18
|
-
['\\(', 'return `(`'],
|
|
19
|
-
['\\)', 'return `)`'],
|
|
20
|
-
['PI\\b', 'return `PI`'],
|
|
21
|
-
['E\\b', 'return `E`'],
|
|
22
|
-
['$', 'return `EOF`'],
|
|
23
|
-
['=', 'return `BEGEXP`']
|
|
24
|
-
]
|
|
25
|
-
},
|
|
26
|
-
operators: [
|
|
27
|
-
['left', '+', '-'],
|
|
28
|
-
['left', '*', '/'],
|
|
29
|
-
['left', '^'],
|
|
30
|
-
['right', '!'],
|
|
31
|
-
['right', '%'],
|
|
32
|
-
['left', 'UMINUS']
|
|
33
|
-
],
|
|
34
|
-
bnf: {
|
|
35
|
-
expressions: [['BEGEXP e EOF', 'return $2'], ['NUMBER EOF', 'return $1']],
|
|
36
|
-
e: [
|
|
37
|
-
['e + e', '$$ = $1+$3'],
|
|
38
|
-
['e - e', '$$ = $1-$3'],
|
|
39
|
-
['e * e', '$$ = $1*$3'],
|
|
40
|
-
['e / e', '$$ = $1/$3'],
|
|
41
|
-
['e ^ e', '$$ = Math.pow($1, $3)'],
|
|
42
|
-
['e !', '$$ = (function(n) {if(n==0) return 1; return arguments.callee(n-1) * n})($1)'],
|
|
43
|
-
['e - e %', '$$ = $e1-($e1*($e2/100))'],
|
|
44
|
-
['e + e %', '$$ = $e1+($e1*($e2/100))'],
|
|
45
|
-
['e * e %', '$$ = $e1*($e2/100)'],
|
|
46
|
-
['( e % )', '$$ = $2/100'],
|
|
47
|
-
['- e', '$$ = -$2', { prec: 'UMINUS' }],
|
|
48
|
-
['( e )', '$$ = $2'],
|
|
49
|
-
['NUMBER', '$$ = Number(yytext)'],
|
|
50
|
-
['VARIABLE', varValue],
|
|
51
|
-
['E', '$$ = Math.E'],
|
|
52
|
-
['PI', '$$ = Math.PI']
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
export const xxxGrammar = {
|
|
58
|
-
lex: {
|
|
59
|
-
rules: [
|
|
60
|
-
// Saute les espaces
|
|
61
|
-
['\\s+', '/* skip whitespace */'],
|
|
62
|
-
]
|
|
63
|
-
},
|
|
64
|
-
operators: [],
|
|
65
|
-
bnf: {}
|
|
66
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"datetime.grammar.d.ts","sourceRoot":"","sources":["../../src/jison/datetime.grammar.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO;;;;;;;;;EA2C7C"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export function datetimeGrammar(solve) {
|
|
2
|
-
const varValue = solve ? 'return null' : '$$ = ``';
|
|
3
|
-
return {
|
|
4
|
-
lex: {
|
|
5
|
-
rules: [
|
|
6
|
-
['\\s+', '/* skip whitespace */'],
|
|
7
|
-
['\\$\\w+', 'return `VARIABLE`'],
|
|
8
|
-
['=', 'return `BEGEXP`'],
|
|
9
|
-
['"', 'return `QUOT`'],
|
|
10
|
-
['\/', 'return `/`'],
|
|
11
|
-
['(0?[1-9]|1[012])', 'return `MM`'],
|
|
12
|
-
['(0?[1-9]|[12][0-9]|3[01])', 'return `DD`'],
|
|
13
|
-
['\\d\{4\}', 'return `YYYY`'],
|
|
14
|
-
['NOW|now', 'return `NOW`'],
|
|
15
|
-
// ['0?[0-9]|[1][0-9]|2[01234]', 'return `HH`'],
|
|
16
|
-
// ['0?[0-9]|[12345][0-9]', 'return `0-59`'],
|
|
17
|
-
// ['\-', 'return `-`'],
|
|
18
|
-
// ['[12]\\d\\d\\d\\-(0?[1-9]|1[012])\\-(0?[1-9]|[12][0-9]|3[01])', 'return USDATE'],
|
|
19
|
-
// ['[1-9]+[Dd]', 'return `ADD`'],
|
|
20
|
-
// ['\+', 'return `+`'],
|
|
21
|
-
['$', 'return `EOF`']
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
operators: [],
|
|
25
|
-
bnf: {
|
|
26
|
-
expressions: [['BEGEXP e EOF', 'return $2']],
|
|
27
|
-
e: [
|
|
28
|
-
['DD / e', '$$ = $1'],
|
|
29
|
-
['e / YYYY', '$$ = $3'],
|
|
30
|
-
['/ MM /', '$$ = $2'],
|
|
31
|
-
// ['YYYY - MM - DD', '$$ = new Date($e1, $e2, $e3)'],
|
|
32
|
-
// ['DD / MM / YYYY', '$$ = new Date($e3, $e2, $e1)'],
|
|
33
|
-
// ['HH : 0-59 : 0-59', '$$ = new Date(0, 0, 0, $e1, $e2, $e3)'],
|
|
34
|
-
// ['QUOT MM QUOT', '$$ = 0'],
|
|
35
|
-
['NOW', '$$ = Date.now()'],
|
|
36
|
-
// ['e + ADD', '$$ = ``'],
|
|
37
|
-
// ['e + ADD', '$$ = {const ret = new Date($e1); return ret.setDate(ret.getDate() + parseInt($e2))}'],
|
|
38
|
-
['VARIABLE', varValue]
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logical.grammar.d.ts","sourceRoot":"","sources":["../../src/jison/logical.grammar.ts"],"names":[],"mappings":"AACA,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO;;;;;;;;;EAsC5C"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export function logicalGrammar(solve) {
|
|
2
|
-
const varValue = solve ? 'return null' : '$$ = 0';
|
|
3
|
-
return {
|
|
4
|
-
lex: {
|
|
5
|
-
// startConditions: {
|
|
6
|
-
// expression: 'return e',
|
|
7
|
-
// value: 'return v'
|
|
8
|
-
// },
|
|
9
|
-
rules: [
|
|
10
|
-
['\\s+', '/* skip whitespace */'],
|
|
11
|
-
['[0-9]+(?:\\.[0-9]+)?\\b', 'return `NUMBER`'],
|
|
12
|
-
['\\$\\w+', 'return `VARIABLE`'],
|
|
13
|
-
['TRUE|true|FALSE|false', 'return `BOOLEAN`'],
|
|
14
|
-
['<=', 'return `INFEQ`'],
|
|
15
|
-
['>=', 'return `SUPEQ`'],
|
|
16
|
-
['<', 'return `INF`'],
|
|
17
|
-
['>', 'return `SUP`'],
|
|
18
|
-
['$', 'return `EOF`'],
|
|
19
|
-
['=', 'return `BEGEXP`']
|
|
20
|
-
]
|
|
21
|
-
},
|
|
22
|
-
operators: [
|
|
23
|
-
['left', 'INF', 'SUP', 'INFEQ', 'SUPEQ'],
|
|
24
|
-
['right', 'BEGEXP']
|
|
25
|
-
],
|
|
26
|
-
bnf: {
|
|
27
|
-
expressions: [['BEGEXP e EOF', 'return $2'], ['BOOLEAN EOF', 'return $1']],
|
|
28
|
-
e: [
|
|
29
|
-
['NUMBER', '$$ = Number(yytext)'],
|
|
30
|
-
['VARIABLE', varValue],
|
|
31
|
-
['BOOLEAN', '$$ = yytext === `TRUE` || yytext === `true`'],
|
|
32
|
-
['e INF e', '$$ = $1<$3'],
|
|
33
|
-
['e SUP e', '$$ = $1 > $3'],
|
|
34
|
-
['e SUPEQ e', '$$ = $1 >= $3'],
|
|
35
|
-
['e INFEQ e', '$$ = $1 <= $3'],
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"option.grammar.d.ts","sourceRoot":"","sources":["../../src/jison/option.grammar.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE;;;;;;;;;EAyB9D"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export function optionGrammar(solve, options) {
|
|
2
|
-
const varValue = solve ? 'return null' : '$$ = ``';
|
|
3
|
-
const optValue = options.join('|');
|
|
4
|
-
return {
|
|
5
|
-
lex: {
|
|
6
|
-
rules: [
|
|
7
|
-
['\\s+', '/* skip whitespace */'],
|
|
8
|
-
['\\$\\w+', 'return `VARIABLE`'],
|
|
9
|
-
['"', 'return `QUOT`'],
|
|
10
|
-
[optValue, 'return `OPTION`'],
|
|
11
|
-
['$', 'return `EOF`'],
|
|
12
|
-
['=', 'return `BEGEXP`']
|
|
13
|
-
]
|
|
14
|
-
},
|
|
15
|
-
operators: [],
|
|
16
|
-
bnf: {
|
|
17
|
-
expressions: [['BEGEXP e EOF', 'return $2'], ['OPTION EOF', 'return $1']],
|
|
18
|
-
e: [
|
|
19
|
-
['QUOT OPTION QUOT', '$$ = $2'],
|
|
20
|
-
['VARIABLE', varValue]
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"string.grammar.d.ts","sourceRoot":"","sources":["../../src/jison/string.grammar.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO;;;;;;;;;EA+B3C"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/* tslint:disable:trailing-comma */
|
|
2
|
-
export function stringGrammar(solve) {
|
|
3
|
-
const varVariable = solve ? 'return null' : '$$ = ``';
|
|
4
|
-
return {
|
|
5
|
-
lex: {
|
|
6
|
-
rules: [
|
|
7
|
-
// Saute les espaces
|
|
8
|
-
['\\s+', '/* skip whitespace */'],
|
|
9
|
-
['\\$\\w+', 'return `VARIABLE`'],
|
|
10
|
-
['_', 'return `SPACE`'],
|
|
11
|
-
['"', 'return `QUOT`'],
|
|
12
|
-
['\\&', 'return `&`'],
|
|
13
|
-
['=', 'return `BEGEXP`'],
|
|
14
|
-
['[^"]+', 'return `STRING`'],
|
|
15
|
-
['$', 'return `EOF`'],
|
|
16
|
-
]
|
|
17
|
-
},
|
|
18
|
-
operators: [
|
|
19
|
-
['left', '&']
|
|
20
|
-
],
|
|
21
|
-
bnf: {
|
|
22
|
-
expressions: [['BEGEXP e EOF', 'return $2'], ['STRING EOF', 'return $1']],
|
|
23
|
-
e: [
|
|
24
|
-
['e & e', '$$ = `${$1}${$3}`'],
|
|
25
|
-
['QUOT STRING QUOT', '$$ = $2'],
|
|
26
|
-
['SPACE', '$$ = ` `'],
|
|
27
|
-
['VARIABLE', varVariable]
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"variable.grammar.d.ts","sourceRoot":"","sources":["../../src/jison/variable.grammar.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,eAAe;;;;;;;;CAa3B,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export const variableGrammar = {
|
|
2
|
-
lex: {
|
|
3
|
-
rules: [
|
|
4
|
-
// Saute les espaces
|
|
5
|
-
['\\s+', '/* skip whitespace */'],
|
|
6
|
-
['\\$\\w+', 'return `VARIABLE`'],
|
|
7
|
-
['$', 'return `EOF`']
|
|
8
|
-
]
|
|
9
|
-
},
|
|
10
|
-
operators: [],
|
|
11
|
-
bnf: {
|
|
12
|
-
expressions: [['VARIABLE EOF', 'return $1']]
|
|
13
|
-
}
|
|
14
|
-
};
|