greybel-interpreter 1.3.7 → 1.3.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.
Files changed (99) hide show
  1. package/.editorconfig +14 -14
  2. package/.eslintrc +47 -47
  3. package/LICENSE +21 -21
  4. package/README.md +2 -2
  5. package/dist/context.d.ts +109 -109
  6. package/dist/context.js +383 -382
  7. package/dist/cps.d.ts +14 -14
  8. package/dist/cps.js +213 -213
  9. package/dist/handler/error.d.ts +6 -6
  10. package/dist/handler/error.js +35 -35
  11. package/dist/handler/output.d.ts +18 -18
  12. package/dist/handler/output.js +52 -52
  13. package/dist/handler/resource.d.ts +12 -12
  14. package/dist/handler/resource.js +51 -51
  15. package/dist/handler-container.d.ts +14 -14
  16. package/dist/handler-container.js +16 -16
  17. package/dist/index.d.ts +45 -45
  18. package/dist/index.js +131 -131
  19. package/dist/interpreter.d.ts +41 -41
  20. package/dist/interpreter.js +312 -312
  21. package/dist/intrinsics-container.d.ts +7 -7
  22. package/dist/intrinsics-container.js +19 -19
  23. package/dist/operations/assign.d.ts +13 -13
  24. package/dist/operations/assign.js +111 -111
  25. package/dist/operations/block.d.ts +12 -12
  26. package/dist/operations/block.js +108 -108
  27. package/dist/operations/break.d.ts +10 -10
  28. package/dist/operations/break.js +41 -41
  29. package/dist/operations/call.d.ts +13 -13
  30. package/dist/operations/call.js +124 -124
  31. package/dist/operations/chunk.d.ts +12 -12
  32. package/dist/operations/chunk.js +85 -85
  33. package/dist/operations/continue.d.ts +10 -10
  34. package/dist/operations/continue.js +41 -41
  35. package/dist/operations/debugger-statement.d.ts +10 -10
  36. package/dist/operations/debugger-statement.js +39 -39
  37. package/dist/operations/evaluate.d.ts +41 -39
  38. package/dist/operations/evaluate.js +433 -367
  39. package/dist/operations/for.d.ts +14 -14
  40. package/dist/operations/for.js +152 -152
  41. package/dist/operations/function-reference.d.ts +12 -12
  42. package/dist/operations/function-reference.js +103 -103
  43. package/dist/operations/function.d.ts +14 -14
  44. package/dist/operations/function.js +200 -200
  45. package/dist/operations/if-statement.d.ts +19 -19
  46. package/dist/operations/if-statement.js +181 -181
  47. package/dist/operations/import.d.ts +17 -17
  48. package/dist/operations/import.js +119 -119
  49. package/dist/operations/include.d.ts +13 -13
  50. package/dist/operations/include.js +95 -95
  51. package/dist/operations/list.d.ts +11 -11
  52. package/dist/operations/list.js +111 -111
  53. package/dist/operations/literal.d.ts +11 -11
  54. package/dist/operations/literal.js +58 -58
  55. package/dist/operations/map.d.ts +11 -11
  56. package/dist/operations/map.js +171 -171
  57. package/dist/operations/negated-binary.d.ts +11 -11
  58. package/dist/operations/negated-binary.js +109 -109
  59. package/dist/operations/new-instance.d.ts +11 -11
  60. package/dist/operations/new-instance.js +100 -100
  61. package/dist/operations/noop.d.ts +9 -9
  62. package/dist/operations/noop.js +36 -36
  63. package/dist/operations/not.d.ts +11 -11
  64. package/dist/operations/not.js +96 -96
  65. package/dist/operations/operation.d.ts +13 -13
  66. package/dist/operations/operation.js +11 -11
  67. package/dist/operations/reference.d.ts +9 -9
  68. package/dist/operations/reference.js +37 -37
  69. package/dist/operations/resolve.d.ts +38 -38
  70. package/dist/operations/resolve.js +330 -330
  71. package/dist/operations/return.d.ts +11 -11
  72. package/dist/operations/return.js +107 -107
  73. package/dist/operations/while.d.ts +13 -13
  74. package/dist/operations/while.js +136 -136
  75. package/dist/types/boolean.d.ts +11 -11
  76. package/dist/types/boolean.js +46 -46
  77. package/dist/types/default.d.ts +11 -11
  78. package/dist/types/default.js +20 -20
  79. package/dist/types/function.d.ts +32 -32
  80. package/dist/types/function.js +174 -174
  81. package/dist/types/generics.d.ts +18 -18
  82. package/dist/types/generics.js +40 -40
  83. package/dist/types/interface.d.ts +23 -23
  84. package/dist/types/interface.js +103 -103
  85. package/dist/types/list.d.ts +31 -31
  86. package/dist/types/list.js +209 -209
  87. package/dist/types/map.d.ts +37 -37
  88. package/dist/types/map.js +366 -366
  89. package/dist/types/nil.d.ts +10 -10
  90. package/dist/types/nil.js +46 -46
  91. package/dist/types/number.d.ts +11 -11
  92. package/dist/types/number.js +46 -46
  93. package/dist/types/string.d.ts +33 -33
  94. package/dist/types/string.js +145 -145
  95. package/dist/utils/deep-equal.d.ts +1 -1
  96. package/dist/utils/deep-equal.js +62 -62
  97. package/dist/utils/path.d.ts +10 -10
  98. package/dist/utils/path.js +59 -59
  99. package/package.json +58 -58
@@ -1,62 +1,62 @@
1
- "use strict";
2
- var __values = (this && this.__values) || function(o) {
3
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
4
- if (m) return m.call(o);
5
- if (o && typeof o.length === "number") return {
6
- next: function () {
7
- if (o && i >= o.length) o = void 0;
8
- return { value: o && o[i++], done: !o };
9
- }
10
- };
11
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- var generics_1 = require("../types/generics");
15
- function equalInner(a, b, maxDepth, depth) {
16
- var e_1, _a;
17
- if (depth === void 0) { depth = 0; }
18
- if (maxDepth <= depth)
19
- return a === b;
20
- if (a.value === b.value)
21
- return true;
22
- if (a && b && a instanceof generics_1.CustomObject && b instanceof generics_1.CustomObject) {
23
- if (a.constructor !== b.constructor)
24
- return false;
25
- if (Array.isArray(a.value)) {
26
- var length = a.value.length;
27
- if (length !== b.value.length)
28
- return false;
29
- for (var i = length; i-- !== 0;)
30
- if (!equalInner(a.value[i], b.value[i], maxDepth, depth + 1))
31
- return false;
32
- return true;
33
- }
34
- if (a.value instanceof Map) {
35
- if (a.value.size !== b.value.size)
36
- return false;
37
- try {
38
- for (var _b = __values(a.value.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
39
- var i = _c.value;
40
- if (!b.has(i) || !equalInner(a.get(i), b.get(i), maxDepth, depth + 1))
41
- return false;
42
- }
43
- }
44
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
45
- finally {
46
- try {
47
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
48
- }
49
- finally { if (e_1) throw e_1.error; }
50
- }
51
- return true;
52
- }
53
- return false;
54
- }
55
- // true if both NaN, false otherwise
56
- return a.value === NaN && b.value === NaN;
57
- }
58
- function equal(a, b, maxDepth) {
59
- if (maxDepth === void 0) { maxDepth = 2; }
60
- return equalInner(a, b, maxDepth);
61
- }
62
- exports.default = equal;
1
+ "use strict";
2
+ var __values = (this && this.__values) || function(o) {
3
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
4
+ if (m) return m.call(o);
5
+ if (o && typeof o.length === "number") return {
6
+ next: function () {
7
+ if (o && i >= o.length) o = void 0;
8
+ return { value: o && o[i++], done: !o };
9
+ }
10
+ };
11
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ var generics_1 = require("../types/generics");
15
+ function equalInner(a, b, maxDepth, depth) {
16
+ var e_1, _a;
17
+ if (depth === void 0) { depth = 0; }
18
+ if (maxDepth <= depth)
19
+ return a === b;
20
+ if (a.value === b.value)
21
+ return true;
22
+ if (a && b && a instanceof generics_1.CustomObject && b instanceof generics_1.CustomObject) {
23
+ if (a.constructor !== b.constructor)
24
+ return false;
25
+ if (Array.isArray(a.value)) {
26
+ var length = a.value.length;
27
+ if (length !== b.value.length)
28
+ return false;
29
+ for (var i = length; i-- !== 0;)
30
+ if (!equalInner(a.value[i], b.value[i], maxDepth, depth + 1))
31
+ return false;
32
+ return true;
33
+ }
34
+ if (a.value instanceof Map) {
35
+ if (a.value.size !== b.value.size)
36
+ return false;
37
+ try {
38
+ for (var _b = __values(a.value.keys()), _c = _b.next(); !_c.done; _c = _b.next()) {
39
+ var i = _c.value;
40
+ if (!b.has(i) || !equalInner(a.get(i), b.get(i), maxDepth, depth + 1))
41
+ return false;
42
+ }
43
+ }
44
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
45
+ finally {
46
+ try {
47
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
48
+ }
49
+ finally { if (e_1) throw e_1.error; }
50
+ }
51
+ return true;
52
+ }
53
+ return false;
54
+ }
55
+ // true if both NaN, false otherwise
56
+ return a.value === NaN && b.value === NaN;
57
+ }
58
+ function equal(a, b, maxDepth) {
59
+ if (maxDepth === void 0) { maxDepth = 2; }
60
+ return equalInner(a, b, maxDepth);
61
+ }
62
+ exports.default = equal;
@@ -1,10 +1,10 @@
1
- export default class Path<T> {
2
- readonly path: Array<T>;
3
- constructor(path?: Array<T>);
4
- next(): T | null;
5
- last(): T | null;
6
- add(value: T): void;
7
- toString(): string;
8
- count(): number;
9
- clone(): Path<T>;
10
- }
1
+ export default class Path<T> {
2
+ readonly path: Array<T>;
3
+ constructor(path?: Array<T>);
4
+ next(): T | null;
5
+ last(): T | null;
6
+ add(value: T): void;
7
+ toString(): string;
8
+ count(): number;
9
+ clone(): Path<T>;
10
+ }
@@ -1,59 +1,59 @@
1
- "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
- }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
19
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
20
- if (ar || !(i in from)) {
21
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
22
- ar[i] = from[i];
23
- }
24
- }
25
- return to.concat(ar || Array.prototype.slice.call(from));
26
- };
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- var Path = /** @class */ (function () {
29
- function Path(path) {
30
- if (path === void 0) { path = []; }
31
- this.path = __spreadArray([], __read(path), false);
32
- }
33
- Path.prototype.next = function () {
34
- if (this.path.length === 0) {
35
- return null;
36
- }
37
- return this.path.shift();
38
- };
39
- Path.prototype.last = function () {
40
- if (this.path.length === 0) {
41
- return null;
42
- }
43
- return this.path.pop();
44
- };
45
- Path.prototype.add = function (value) {
46
- this.path.push(value);
47
- };
48
- Path.prototype.toString = function () {
49
- return this.path.join('.');
50
- };
51
- Path.prototype.count = function () {
52
- return this.path.length;
53
- };
54
- Path.prototype.clone = function () {
55
- return new Path(this.path);
56
- };
57
- return Path;
58
- }());
59
- exports.default = Path;
1
+ "use strict";
2
+ var __read = (this && this.__read) || function (o, n) {
3
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
4
+ if (!m) return o;
5
+ var i = m.call(o), r, ar = [], e;
6
+ try {
7
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
+ }
9
+ catch (error) { e = { error: error }; }
10
+ finally {
11
+ try {
12
+ if (r && !r.done && (m = i["return"])) m.call(i);
13
+ }
14
+ finally { if (e) throw e.error; }
15
+ }
16
+ return ar;
17
+ };
18
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
19
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
20
+ if (ar || !(i in from)) {
21
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
22
+ ar[i] = from[i];
23
+ }
24
+ }
25
+ return to.concat(ar || Array.prototype.slice.call(from));
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ var Path = /** @class */ (function () {
29
+ function Path(path) {
30
+ if (path === void 0) { path = []; }
31
+ this.path = __spreadArray([], __read(path), false);
32
+ }
33
+ Path.prototype.next = function () {
34
+ if (this.path.length === 0) {
35
+ return null;
36
+ }
37
+ return this.path.shift();
38
+ };
39
+ Path.prototype.last = function () {
40
+ if (this.path.length === 0) {
41
+ return null;
42
+ }
43
+ return this.path.pop();
44
+ };
45
+ Path.prototype.add = function (value) {
46
+ this.path.push(value);
47
+ };
48
+ Path.prototype.toString = function () {
49
+ return this.path.join('.');
50
+ };
51
+ Path.prototype.count = function () {
52
+ return this.path.length;
53
+ };
54
+ Path.prototype.clone = function () {
55
+ return new Path(this.path);
56
+ };
57
+ return Path;
58
+ }());
59
+ exports.default = Path;
package/package.json CHANGED
@@ -1,58 +1,58 @@
1
- {
2
- "name": "greybel-interpreter",
3
- "version": "1.3.7",
4
- "description": "Interpreter",
5
- "main": "dist/index",
6
- "typings": "dist/index",
7
- "scripts": {
8
- "prepublishOnly": "npm run build",
9
- "build": "npm run clean && tsc -p .",
10
- "watch": "tsc -w -p .",
11
- "clean": "rm -rf dist",
12
- "test": "jest ./tests",
13
- "lint": "eslint ./src/**/*.ts",
14
- "lint:fix": "eslint --fix ./src/**/*.ts"
15
- },
16
- "repository": {
17
- "type": "git",
18
- "url": "git+https://github.com/ayecue/greybel-interpreter.git"
19
- },
20
- "author": {
21
- "name": "ayecue",
22
- "email": "soerenwehmeier@googlemail.com"
23
- },
24
- "license": "MIT",
25
- "bugs": {
26
- "url": "https://github.com/ayecue/greybel-interpreter/issues"
27
- },
28
- "homepage": "https://github.com/ayecue/greybel-interpreter#readme",
29
- "devDependencies": {
30
- "@types/jest": "^27.0.3",
31
- "@types/node": "^17.0.0",
32
- "@types/uuid": "^8.3.3",
33
- "@typescript-eslint/eslint-plugin": "^5.27.1",
34
- "@typescript-eslint/parser": "^5.27.1",
35
- "eslint": "^8.17.0",
36
- "eslint-config-prettier": "^8.5.0",
37
- "eslint-config-standard": "^17.0.0",
38
- "eslint-plugin-import": "^2.26.0",
39
- "eslint-plugin-jest": "^26.5.3",
40
- "eslint-plugin-node": "^11.1.0",
41
- "eslint-plugin-prettier": "^4.0.0",
42
- "eslint-plugin-promise": "^6.0.0",
43
- "eslint-plugin-security": "^1.5.0",
44
- "eslint-plugin-simple-import-sort": "^7.0.0",
45
- "jest": "^27.4.5",
46
- "nodemon": "^2.0.15",
47
- "ts-node": "^10.4.0",
48
- "typescript": "^4.5.4"
49
- },
50
- "dependencies": {
51
- "greybel-core": "^0.4.9",
52
- "greyscript-core": "^0.4.4"
53
- },
54
- "keywords": [
55
- "greyscript",
56
- "greyhack"
57
- ]
58
- }
1
+ {
2
+ "name": "greybel-interpreter",
3
+ "version": "1.3.8",
4
+ "description": "Interpreter",
5
+ "main": "dist/index",
6
+ "typings": "dist/index",
7
+ "scripts": {
8
+ "prepublishOnly": "npm run build",
9
+ "build": "npm run clean && tsc -p .",
10
+ "watch": "tsc -w -p .",
11
+ "clean": "rm -rf dist",
12
+ "test": "jest ./tests",
13
+ "lint": "eslint ./src/**/*.ts",
14
+ "lint:fix": "eslint --fix ./src/**/*.ts"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/ayecue/greybel-interpreter.git"
19
+ },
20
+ "author": {
21
+ "name": "ayecue",
22
+ "email": "soerenwehmeier@googlemail.com"
23
+ },
24
+ "license": "MIT",
25
+ "bugs": {
26
+ "url": "https://github.com/ayecue/greybel-interpreter/issues"
27
+ },
28
+ "homepage": "https://github.com/ayecue/greybel-interpreter#readme",
29
+ "devDependencies": {
30
+ "@types/jest": "^27.0.3",
31
+ "@types/node": "^17.0.0",
32
+ "@types/uuid": "^8.3.3",
33
+ "@typescript-eslint/eslint-plugin": "^5.27.1",
34
+ "@typescript-eslint/parser": "^5.27.1",
35
+ "eslint": "^8.17.0",
36
+ "eslint-config-prettier": "^8.5.0",
37
+ "eslint-config-standard": "^17.0.0",
38
+ "eslint-plugin-import": "^2.26.0",
39
+ "eslint-plugin-jest": "^26.5.3",
40
+ "eslint-plugin-node": "^11.1.0",
41
+ "eslint-plugin-prettier": "^4.0.0",
42
+ "eslint-plugin-promise": "^6.0.0",
43
+ "eslint-plugin-security": "^1.5.0",
44
+ "eslint-plugin-simple-import-sort": "^7.0.0",
45
+ "jest": "^27.4.5",
46
+ "nodemon": "^2.0.15",
47
+ "ts-node": "^10.4.0",
48
+ "typescript": "^4.5.4"
49
+ },
50
+ "dependencies": {
51
+ "greybel-core": "^0.4.9",
52
+ "greyscript-core": "^0.4.4"
53
+ },
54
+ "keywords": [
55
+ "greyscript",
56
+ "greyhack"
57
+ ]
58
+ }