greybel-interpreter 1.7.0 → 1.7.2
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/context.d.ts +9 -9
- package/dist/context.js +19 -22
- package/dist/cps.d.ts +3 -3
- package/dist/cps.js +56 -59
- package/dist/handler/output.d.ts +6 -7
- package/dist/handler/output.js +6 -11
- package/dist/handler-container.d.ts +1 -1
- package/dist/handler-container.js +2 -1
- package/dist/index.d.ts +42 -42
- package/dist/index.js +43 -46
- package/dist/interpreter.d.ts +9 -9
- package/dist/interpreter.js +33 -59
- package/dist/operations/assign.d.ts +5 -5
- package/dist/operations/assign.js +9 -11
- package/dist/operations/block.d.ts +4 -4
- package/dist/operations/block.js +6 -8
- package/dist/operations/break.d.ts +4 -4
- package/dist/operations/break.js +6 -8
- package/dist/operations/call.d.ts +5 -5
- package/dist/operations/call.js +12 -14
- package/dist/operations/chunk.d.ts +6 -6
- package/dist/operations/chunk.js +8 -10
- package/dist/operations/continue.d.ts +4 -4
- package/dist/operations/continue.js +6 -8
- package/dist/operations/debugger-statement.d.ts +5 -5
- package/dist/operations/debugger-statement.js +6 -8
- package/dist/operations/envar.d.ts +5 -5
- package/dist/operations/envar.js +6 -8
- package/dist/operations/evaluate.d.ts +6 -5
- package/dist/operations/evaluate.js +109 -112
- package/dist/operations/for.d.ts +6 -6
- package/dist/operations/for.js +15 -17
- package/dist/operations/function-reference.d.ts +5 -5
- package/dist/operations/function-reference.js +8 -10
- package/dist/operations/function.d.ts +5 -5
- package/dist/operations/function.js +17 -20
- package/dist/operations/if-statement.d.ts +6 -6
- package/dist/operations/if-statement.js +12 -15
- package/dist/operations/import.d.ts +7 -7
- package/dist/operations/import.js +15 -18
- package/dist/operations/include.d.ts +5 -5
- package/dist/operations/include.js +4 -6
- package/dist/operations/list.d.ts +5 -5
- package/dist/operations/list.js +6 -8
- package/dist/operations/literal.d.ts +5 -5
- package/dist/operations/literal.js +12 -14
- package/dist/operations/map.d.ts +5 -5
- package/dist/operations/map.js +8 -10
- package/dist/operations/negated-binary.d.ts +5 -5
- package/dist/operations/negated-binary.js +7 -9
- package/dist/operations/new-instance.d.ts +5 -5
- package/dist/operations/new-instance.js +8 -10
- package/dist/operations/noop.d.ts +5 -5
- package/dist/operations/noop.js +6 -8
- package/dist/operations/not.d.ts +5 -5
- package/dist/operations/not.js +6 -8
- package/dist/operations/operation.d.ts +3 -3
- package/dist/operations/operation.js +2 -1
- package/dist/operations/reference.d.ts +4 -4
- package/dist/operations/reference.js +4 -6
- package/dist/operations/resolve.d.ts +6 -6
- package/dist/operations/resolve.js +27 -30
- package/dist/operations/return.d.ts +5 -5
- package/dist/operations/return.js +8 -10
- package/dist/operations/while.d.ts +6 -6
- package/dist/operations/while.js +9 -11
- package/dist/types/base.d.ts +1 -1
- package/dist/types/base.js +2 -1
- package/dist/types/boolean.d.ts +2 -2
- package/dist/types/boolean.js +4 -7
- package/dist/types/default.d.ts +7 -7
- package/dist/types/default.js +9 -8
- package/dist/types/function.d.ts +5 -5
- package/dist/types/function.js +27 -30
- package/dist/types/interface.d.ts +4 -4
- package/dist/types/interface.js +10 -13
- package/dist/types/list.d.ts +4 -4
- package/dist/types/list.js +21 -24
- package/dist/types/map.d.ts +5 -5
- package/dist/types/map.js +26 -29
- package/dist/types/nil.d.ts +2 -2
- package/dist/types/nil.js +4 -7
- package/dist/types/number.d.ts +4 -4
- package/dist/types/number.js +8 -11
- package/dist/types/string.d.ts +4 -4
- package/dist/types/string.js +19 -22
- package/dist/types/with-intrinsics.d.ts +4 -4
- package/dist/types/with-intrinsics.js +2 -5
- package/dist/utils/deep-equal.d.ts +1 -1
- package/dist/utils/deep-equal.js +4 -3
- package/dist/utils/object-value.d.ts +2 -2
- package/dist/utils/object-value.js +6 -8
- package/dist/utils/path.d.ts +1 -1
- package/dist/utils/path.js +2 -1
- package/package.json +2 -3
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.CustomObject = exports.CustomValueWithIntrinsics = void 0;
|
|
7
|
-
const base_1 =
|
|
8
|
-
class CustomValueWithIntrinsics extends base_1.
|
|
4
|
+
const base_1 = require("./base");
|
|
5
|
+
class CustomValueWithIntrinsics extends base_1.CustomValue {
|
|
9
6
|
static getIntrinsics() {
|
|
10
7
|
return this.intrinsics;
|
|
11
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function deepEqual(a: any, b: any, maxDepth?: number): boolean;
|
package/dist/utils/deep-equal.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deepEqual = void 0;
|
|
3
4
|
const with_intrinsics_1 = require("../types/with-intrinsics");
|
|
4
5
|
function equalInner(a, b, maxDepth, depth = 0) {
|
|
5
6
|
if (maxDepth <= depth)
|
|
@@ -29,9 +30,9 @@ function equalInner(a, b, maxDepth, depth = 0) {
|
|
|
29
30
|
return false;
|
|
30
31
|
}
|
|
31
32
|
// true if both NaN, false otherwise
|
|
32
|
-
return a.value
|
|
33
|
+
return Number.isNaN(a.value) && Number.isNaN(b.value);
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
+
function deepEqual(a, b, maxDepth = 10) {
|
|
35
36
|
return equalInner(a, b, maxDepth);
|
|
36
37
|
}
|
|
37
|
-
exports.
|
|
38
|
+
exports.deepEqual = deepEqual;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import CustomValue from '../types/base';
|
|
2
|
-
export
|
|
1
|
+
import { CustomValue } from '../types/base';
|
|
2
|
+
export declare class ObjectValue extends Map<CustomValue, CustomValue> {
|
|
3
3
|
get(mapKey: CustomValue): CustomValue;
|
|
4
4
|
has(mapKey: CustomValue): boolean;
|
|
5
5
|
set(mapKey: CustomValue, mapValue: CustomValue): this;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObjectValue = void 0;
|
|
6
4
|
const nil_1 = require("../types/nil");
|
|
7
|
-
const deep_equal_1 =
|
|
5
|
+
const deep_equal_1 = require("./deep-equal");
|
|
8
6
|
class ObjectValue extends Map {
|
|
9
7
|
get(mapKey) {
|
|
10
8
|
for (const [key, value] of this.entries()) {
|
|
11
|
-
if ((0, deep_equal_1.
|
|
9
|
+
if ((0, deep_equal_1.deepEqual)(key, mapKey)) {
|
|
12
10
|
return value;
|
|
13
11
|
}
|
|
14
12
|
}
|
|
@@ -16,7 +14,7 @@ class ObjectValue extends Map {
|
|
|
16
14
|
}
|
|
17
15
|
has(mapKey) {
|
|
18
16
|
for (const key of this.keys()) {
|
|
19
|
-
if ((0, deep_equal_1.
|
|
17
|
+
if ((0, deep_equal_1.deepEqual)(key, mapKey)) {
|
|
20
18
|
return true;
|
|
21
19
|
}
|
|
22
20
|
}
|
|
@@ -24,7 +22,7 @@ class ObjectValue extends Map {
|
|
|
24
22
|
}
|
|
25
23
|
set(mapKey, mapValue) {
|
|
26
24
|
for (const key of this.keys()) {
|
|
27
|
-
if ((0, deep_equal_1.
|
|
25
|
+
if ((0, deep_equal_1.deepEqual)(key, mapKey)) {
|
|
28
26
|
super.set(key, mapValue);
|
|
29
27
|
return;
|
|
30
28
|
}
|
|
@@ -39,4 +37,4 @@ class ObjectValue extends Map {
|
|
|
39
37
|
return this;
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
|
-
exports.
|
|
40
|
+
exports.ObjectValue = ObjectValue;
|
package/dist/utils/path.d.ts
CHANGED
package/dist/utils/path.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Path = void 0;
|
|
3
4
|
class Path {
|
|
4
5
|
constructor(path = []) {
|
|
5
6
|
this.path = [...path];
|
|
@@ -29,4 +30,4 @@ class Path {
|
|
|
29
30
|
return new Path(this.path);
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
|
-
exports.
|
|
33
|
+
exports.Path = Path;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "greybel-interpreter",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "Interpreter",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "dist/index",
|
|
@@ -45,10 +45,9 @@
|
|
|
45
45
|
"jest": "^27.4.5",
|
|
46
46
|
"nodemon": "^2.0.15",
|
|
47
47
|
"ts-node": "^10.4.0",
|
|
48
|
-
"typescript": "^
|
|
48
|
+
"typescript": "^5.0.4"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"cancelable-promise": "^4.3.1",
|
|
52
51
|
"greybel-core": "^0.6.7",
|
|
53
52
|
"greyscript-core": "^0.6.2"
|
|
54
53
|
},
|