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.
Files changed (95) hide show
  1. package/dist/context.d.ts +9 -9
  2. package/dist/context.js +19 -22
  3. package/dist/cps.d.ts +3 -3
  4. package/dist/cps.js +56 -59
  5. package/dist/handler/output.d.ts +6 -7
  6. package/dist/handler/output.js +6 -11
  7. package/dist/handler-container.d.ts +1 -1
  8. package/dist/handler-container.js +2 -1
  9. package/dist/index.d.ts +42 -42
  10. package/dist/index.js +43 -46
  11. package/dist/interpreter.d.ts +9 -9
  12. package/dist/interpreter.js +33 -59
  13. package/dist/operations/assign.d.ts +5 -5
  14. package/dist/operations/assign.js +9 -11
  15. package/dist/operations/block.d.ts +4 -4
  16. package/dist/operations/block.js +6 -8
  17. package/dist/operations/break.d.ts +4 -4
  18. package/dist/operations/break.js +6 -8
  19. package/dist/operations/call.d.ts +5 -5
  20. package/dist/operations/call.js +12 -14
  21. package/dist/operations/chunk.d.ts +6 -6
  22. package/dist/operations/chunk.js +8 -10
  23. package/dist/operations/continue.d.ts +4 -4
  24. package/dist/operations/continue.js +6 -8
  25. package/dist/operations/debugger-statement.d.ts +5 -5
  26. package/dist/operations/debugger-statement.js +6 -8
  27. package/dist/operations/envar.d.ts +5 -5
  28. package/dist/operations/envar.js +6 -8
  29. package/dist/operations/evaluate.d.ts +6 -5
  30. package/dist/operations/evaluate.js +109 -112
  31. package/dist/operations/for.d.ts +6 -6
  32. package/dist/operations/for.js +15 -17
  33. package/dist/operations/function-reference.d.ts +5 -5
  34. package/dist/operations/function-reference.js +8 -10
  35. package/dist/operations/function.d.ts +5 -5
  36. package/dist/operations/function.js +17 -20
  37. package/dist/operations/if-statement.d.ts +6 -6
  38. package/dist/operations/if-statement.js +12 -15
  39. package/dist/operations/import.d.ts +7 -7
  40. package/dist/operations/import.js +15 -18
  41. package/dist/operations/include.d.ts +5 -5
  42. package/dist/operations/include.js +4 -6
  43. package/dist/operations/list.d.ts +5 -5
  44. package/dist/operations/list.js +6 -8
  45. package/dist/operations/literal.d.ts +5 -5
  46. package/dist/operations/literal.js +12 -14
  47. package/dist/operations/map.d.ts +5 -5
  48. package/dist/operations/map.js +8 -10
  49. package/dist/operations/negated-binary.d.ts +5 -5
  50. package/dist/operations/negated-binary.js +7 -9
  51. package/dist/operations/new-instance.d.ts +5 -5
  52. package/dist/operations/new-instance.js +8 -10
  53. package/dist/operations/noop.d.ts +5 -5
  54. package/dist/operations/noop.js +6 -8
  55. package/dist/operations/not.d.ts +5 -5
  56. package/dist/operations/not.js +6 -8
  57. package/dist/operations/operation.d.ts +3 -3
  58. package/dist/operations/operation.js +2 -1
  59. package/dist/operations/reference.d.ts +4 -4
  60. package/dist/operations/reference.js +4 -6
  61. package/dist/operations/resolve.d.ts +6 -6
  62. package/dist/operations/resolve.js +27 -30
  63. package/dist/operations/return.d.ts +5 -5
  64. package/dist/operations/return.js +8 -10
  65. package/dist/operations/while.d.ts +6 -6
  66. package/dist/operations/while.js +9 -11
  67. package/dist/types/base.d.ts +1 -1
  68. package/dist/types/base.js +2 -1
  69. package/dist/types/boolean.d.ts +2 -2
  70. package/dist/types/boolean.js +4 -7
  71. package/dist/types/default.d.ts +7 -7
  72. package/dist/types/default.js +9 -8
  73. package/dist/types/function.d.ts +5 -5
  74. package/dist/types/function.js +27 -30
  75. package/dist/types/interface.d.ts +4 -4
  76. package/dist/types/interface.js +10 -13
  77. package/dist/types/list.d.ts +4 -4
  78. package/dist/types/list.js +21 -24
  79. package/dist/types/map.d.ts +5 -5
  80. package/dist/types/map.js +26 -29
  81. package/dist/types/nil.d.ts +2 -2
  82. package/dist/types/nil.js +4 -7
  83. package/dist/types/number.d.ts +4 -4
  84. package/dist/types/number.js +8 -11
  85. package/dist/types/string.d.ts +4 -4
  86. package/dist/types/string.js +19 -22
  87. package/dist/types/with-intrinsics.d.ts +4 -4
  88. package/dist/types/with-intrinsics.js +2 -5
  89. package/dist/utils/deep-equal.d.ts +1 -1
  90. package/dist/utils/deep-equal.js +4 -3
  91. package/dist/utils/object-value.d.ts +2 -2
  92. package/dist/utils/object-value.js +6 -8
  93. package/dist/utils/path.d.ts +1 -1
  94. package/dist/utils/path.js +2 -1
  95. 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 = __importDefault(require("./base"));
8
- class CustomValueWithIntrinsics extends base_1.default {
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 default function equal(a: any, b: any, maxDepth?: number): boolean;
1
+ export declare function deepEqual(a: any, b: any, maxDepth?: number): boolean;
@@ -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 === NaN && b.value === NaN;
33
+ return Number.isNaN(a.value) && Number.isNaN(b.value);
33
34
  }
34
- function equal(a, b, maxDepth = 10) {
35
+ function deepEqual(a, b, maxDepth = 10) {
35
36
  return equalInner(a, b, maxDepth);
36
37
  }
37
- exports.default = equal;
38
+ exports.deepEqual = deepEqual;
@@ -1,5 +1,5 @@
1
- import CustomValue from '../types/base';
2
- export default class ObjectValue extends Map<CustomValue, CustomValue> {
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 = __importDefault(require("./deep-equal"));
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.default)(key, mapKey)) {
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.default)(key, mapKey)) {
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.default)(key, mapKey)) {
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.default = ObjectValue;
40
+ exports.ObjectValue = ObjectValue;
@@ -1,4 +1,4 @@
1
- export default class Path<T> {
1
+ export declare class Path<T> {
2
2
  readonly path: Array<T>;
3
3
  constructor(path?: Array<T>);
4
4
  next(): T | null;
@@ -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.default = Path;
33
+ exports.Path = Path;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "greybel-interpreter",
3
- "version": "1.7.0",
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": "^4.5.4"
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
  },