greybel-interpreter 1.4.4 → 1.4.6

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 (93) hide show
  1. package/dist/context.d.ts +3 -2
  2. package/dist/context.js +113 -190
  3. package/dist/cps.js +135 -188
  4. package/dist/handler/error.js +6 -29
  5. package/dist/handler/output.js +15 -38
  6. package/dist/handler/resource.js +16 -39
  7. package/dist/handler-container.js +6 -8
  8. package/dist/index.d.ts +4 -3
  9. package/dist/index.js +10 -9
  10. package/dist/interpreter.d.ts +5 -4
  11. package/dist/interpreter.js +109 -203
  12. package/dist/operations/assign.d.ts +1 -1
  13. package/dist/operations/assign.js +28 -93
  14. package/dist/operations/block.d.ts +1 -1
  15. package/dist/operations/block.js +33 -89
  16. package/dist/operations/break.d.ts +1 -1
  17. package/dist/operations/break.js +11 -29
  18. package/dist/operations/call.d.ts +1 -1
  19. package/dist/operations/call.js +31 -106
  20. package/dist/operations/chunk.d.ts +1 -1
  21. package/dist/operations/chunk.js +15 -67
  22. package/dist/operations/continue.d.ts +1 -1
  23. package/dist/operations/continue.js +11 -29
  24. package/dist/operations/debugger-statement.d.ts +1 -1
  25. package/dist/operations/debugger-statement.js +11 -29
  26. package/dist/operations/evaluate.d.ts +1 -1
  27. package/dist/operations/evaluate.js +143 -247
  28. package/dist/operations/for.d.ts +1 -1
  29. package/dist/operations/for.js +62 -133
  30. package/dist/operations/function-reference.d.ts +1 -1
  31. package/dist/operations/function-reference.js +25 -84
  32. package/dist/operations/function.d.ts +1 -1
  33. package/dist/operations/function.js +49 -177
  34. package/dist/operations/if-statement.d.ts +1 -1
  35. package/dist/operations/if-statement.js +58 -154
  36. package/dist/operations/import.d.ts +1 -1
  37. package/dist/operations/import.js +35 -97
  38. package/dist/operations/include.d.ts +1 -1
  39. package/dist/operations/include.js +19 -73
  40. package/dist/operations/list.d.ts +1 -1
  41. package/dist/operations/list.js +24 -93
  42. package/dist/operations/literal.d.ts +1 -1
  43. package/dist/operations/literal.js +15 -33
  44. package/dist/operations/map.d.ts +1 -1
  45. package/dist/operations/map.js +26 -153
  46. package/dist/operations/negated-binary.d.ts +1 -1
  47. package/dist/operations/negated-binary.js +24 -91
  48. package/dist/operations/new-instance.d.ts +1 -1
  49. package/dist/operations/new-instance.js +21 -82
  50. package/dist/operations/noop.d.ts +1 -1
  51. package/dist/operations/noop.js +10 -27
  52. package/dist/operations/not.d.ts +1 -1
  53. package/dist/operations/not.js +17 -78
  54. package/dist/operations/operation.d.ts +2 -2
  55. package/dist/operations/operation.js +3 -5
  56. package/dist/operations/reference.d.ts +1 -1
  57. package/dist/operations/reference.js +10 -28
  58. package/dist/operations/resolve.d.ts +1 -1
  59. package/dist/operations/resolve.js +161 -281
  60. package/dist/operations/return.d.ts +1 -1
  61. package/dist/operations/return.js +27 -89
  62. package/dist/operations/while.d.ts +1 -1
  63. package/dist/operations/while.js +45 -116
  64. package/dist/types/base.d.ts +9 -0
  65. package/dist/types/base.js +5 -0
  66. package/dist/types/boolean.d.ts +3 -1
  67. package/dist/types/boolean.js +24 -36
  68. package/dist/types/default.d.ts +6 -9
  69. package/dist/types/default.js +11 -17
  70. package/dist/types/function.d.ts +1 -1
  71. package/dist/types/function.js +60 -130
  72. package/dist/types/interface.d.ts +2 -1
  73. package/dist/types/interface.js +44 -64
  74. package/dist/types/list.d.ts +4 -6
  75. package/dist/types/list.js +77 -128
  76. package/dist/types/map.d.ts +11 -15
  77. package/dist/types/map.js +101 -267
  78. package/dist/types/nil.d.ts +2 -1
  79. package/dist/types/nil.js +23 -36
  80. package/dist/types/number.d.ts +16 -2
  81. package/dist/types/number.js +60 -37
  82. package/dist/types/string.d.ts +4 -6
  83. package/dist/types/string.js +66 -90
  84. package/dist/types/{generics.d.ts → with-intrinsics.d.ts} +6 -9
  85. package/dist/types/with-intrinsics.js +19 -0
  86. package/dist/utils/deep-equal.js +9 -34
  87. package/dist/utils/object-value.d.ts +7 -0
  88. package/dist/utils/object-value.js +42 -0
  89. package/dist/utils/path.js +16 -43
  90. package/package.json +3 -3
  91. package/dist/intrinsics-container.d.ts +0 -7
  92. package/dist/intrinsics-container.js +0 -19
  93. package/dist/types/generics.js +0 -40
@@ -1,41 +1,23 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
18
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
4
  };
20
5
  Object.defineProperty(exports, "__esModule", { value: true });
21
- var default_1 = __importDefault(require("../types/default"));
22
- var operation_1 = __importDefault(require("./operation"));
23
- var Continue = /** @class */ (function (_super) {
24
- __extends(Continue, _super);
25
- function Continue(item, target) {
26
- var _this = _super.call(this, null, target) || this;
27
- _this.item = item;
28
- return _this;
6
+ const default_1 = __importDefault(require("../types/default"));
7
+ const operation_1 = __importDefault(require("./operation"));
8
+ class Continue extends operation_1.default {
9
+ constructor(item, target) {
10
+ super(null, target);
11
+ this.item = item;
29
12
  }
30
- Continue.prototype.build = function (_visit) {
13
+ build(_visit) {
31
14
  return Promise.resolve(this);
32
- };
33
- Continue.prototype.handle = function (ctx) {
15
+ }
16
+ handle(ctx) {
34
17
  if (ctx.loopState !== null) {
35
18
  ctx.loopState.isContinue = true;
36
19
  }
37
20
  return Promise.resolve(default_1.default.Void);
38
- };
39
- return Continue;
40
- }(operation_1.default));
21
+ }
22
+ }
41
23
  exports.default = Continue;
@@ -1,6 +1,6 @@
1
1
  import { ASTBase } from 'greyscript-core';
2
2
  import context from '../context';
3
- import { CustomValue } from '../types/generics';
3
+ import CustomValue from '../types/base';
4
4
  import Operation, { CPSVisit } from './operation';
5
5
  export default class DebuggerStatement extends Operation {
6
6
  readonly item: ASTBase;
@@ -1,39 +1,21 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
18
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
19
4
  };
20
5
  Object.defineProperty(exports, "__esModule", { value: true });
21
- var default_1 = __importDefault(require("../types/default"));
22
- var operation_1 = __importDefault(require("./operation"));
23
- var DebuggerStatement = /** @class */ (function (_super) {
24
- __extends(DebuggerStatement, _super);
25
- function DebuggerStatement(item, target) {
26
- var _this = _super.call(this, null, target) || this;
27
- _this.item = item;
28
- return _this;
6
+ const default_1 = __importDefault(require("../types/default"));
7
+ const operation_1 = __importDefault(require("./operation"));
8
+ class DebuggerStatement extends operation_1.default {
9
+ constructor(item, target) {
10
+ super(null, target);
11
+ this.item = item;
29
12
  }
30
- DebuggerStatement.prototype.build = function (_visit) {
13
+ build(_visit) {
31
14
  return Promise.resolve(this);
32
- };
33
- DebuggerStatement.prototype.handle = function (ctx) {
15
+ }
16
+ handle(ctx) {
34
17
  ctx.debugger.setBreakpoint(true);
35
18
  return Promise.resolve(default_1.default.Void);
36
- };
37
- return DebuggerStatement;
38
- }(operation_1.default));
19
+ }
20
+ }
39
21
  exports.default = DebuggerStatement;
@@ -1,6 +1,6 @@
1
1
  import { ASTEvaluationExpression } from 'greyscript-core';
2
2
  import OperationContext from '../context';
3
- import { CustomValue } from '../types/generics';
3
+ import CustomValue from '../types/base';
4
4
  import Operation, { CPSVisit } from './operation';
5
5
  export interface ProcessorHandlerFunction {
6
6
  (op: string, a: CustomValue, b: CustomValue): CustomValue;