greybel-interpreter 1.4.6 → 1.4.7
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/.editorconfig +14 -14
- package/.eslintrc +47 -47
- package/LICENSE +21 -21
- package/README.md +2 -2
- package/dist/context.d.ts +110 -110
- package/dist/context.js +306 -306
- package/dist/cps.d.ts +14 -14
- package/dist/cps.js +160 -160
- package/dist/handler/error.d.ts +6 -6
- package/dist/handler/error.js +12 -12
- package/dist/handler/output.d.ts +18 -18
- package/dist/handler/output.js +29 -29
- package/dist/handler/resource.d.ts +12 -12
- package/dist/handler/resource.js +28 -28
- package/dist/handler-container.d.ts +14 -14
- package/dist/handler-container.js +14 -14
- package/dist/index.d.ts +46 -46
- package/dist/index.js +132 -132
- package/dist/interpreter.d.ts +42 -42
- package/dist/interpreter.js +218 -218
- package/dist/operations/assign.d.ts +13 -13
- package/dist/operations/assign.js +46 -46
- package/dist/operations/block.d.ts +12 -12
- package/dist/operations/block.js +52 -52
- package/dist/operations/break.d.ts +10 -10
- package/dist/operations/break.js +23 -23
- package/dist/operations/call.d.ts +13 -13
- package/dist/operations/call.js +49 -49
- package/dist/operations/chunk.d.ts +12 -12
- package/dist/operations/chunk.js +33 -33
- package/dist/operations/continue.d.ts +10 -10
- package/dist/operations/continue.js +23 -23
- package/dist/operations/debugger-statement.d.ts +10 -10
- package/dist/operations/debugger-statement.js +21 -21
- package/dist/operations/evaluate.d.ts +40 -40
- package/dist/operations/evaluate.js +334 -334
- package/dist/operations/for.d.ts +14 -14
- package/dist/operations/for.js +81 -81
- package/dist/operations/function-reference.d.ts +12 -12
- package/dist/operations/function-reference.js +44 -44
- package/dist/operations/function.d.ts +14 -14
- package/dist/operations/function.js +72 -72
- package/dist/operations/if-statement.d.ts +19 -19
- package/dist/operations/if-statement.js +85 -85
- package/dist/operations/import.d.ts +17 -17
- package/dist/operations/import.js +57 -57
- package/dist/operations/include.d.ts +13 -13
- package/dist/operations/include.js +41 -41
- package/dist/operations/list.d.ts +11 -11
- package/dist/operations/list.js +42 -42
- package/dist/operations/literal.d.ts +11 -11
- package/dist/operations/literal.js +40 -40
- package/dist/operations/map.d.ts +11 -11
- package/dist/operations/map.js +44 -44
- package/dist/operations/negated-binary.d.ts +11 -11
- package/dist/operations/negated-binary.js +42 -42
- package/dist/operations/new-instance.d.ts +11 -11
- package/dist/operations/new-instance.js +39 -39
- package/dist/operations/noop.d.ts +9 -9
- package/dist/operations/noop.js +19 -19
- package/dist/operations/not.d.ts +11 -11
- package/dist/operations/not.js +35 -35
- package/dist/operations/operation.d.ts +13 -13
- package/dist/operations/operation.js +9 -9
- package/dist/operations/reference.d.ts +9 -9
- package/dist/operations/reference.js +19 -19
- package/dist/operations/resolve.d.ts +38 -38
- package/dist/operations/resolve.js +210 -210
- package/dist/operations/return.d.ts +11 -11
- package/dist/operations/return.js +45 -45
- package/dist/operations/while.d.ts +13 -13
- package/dist/operations/while.js +65 -65
- package/dist/types/base.d.ts +9 -9
- package/dist/types/base.js +5 -5
- package/dist/types/boolean.d.ts +13 -13
- package/dist/types/boolean.js +34 -34
- package/dist/types/default.d.ts +8 -8
- package/dist/types/default.js +14 -14
- package/dist/types/function.d.ts +32 -32
- package/dist/types/function.js +104 -104
- package/dist/types/interface.d.ts +24 -24
- package/dist/types/interface.js +83 -83
- package/dist/types/list.d.ts +29 -29
- package/dist/types/list.js +158 -158
- package/dist/types/map.d.ts +33 -33
- package/dist/types/map.js +200 -200
- package/dist/types/nil.d.ts +11 -11
- package/dist/types/nil.js +33 -33
- package/dist/types/number.d.ts +25 -25
- package/dist/types/number.js +69 -69
- package/dist/types/string.d.ts +31 -31
- package/dist/types/string.js +121 -121
- package/dist/types/with-intrinsics.d.ts +15 -15
- package/dist/types/with-intrinsics.js +19 -19
- package/dist/utils/deep-equal.d.ts +1 -1
- package/dist/utils/deep-equal.js +37 -37
- package/dist/utils/object-value.d.ts +7 -7
- package/dist/utils/object-value.js +42 -42
- package/dist/utils/path.d.ts +10 -10
- package/dist/utils/path.js +32 -32
- package/package.json +58 -58
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const nil_1 = require("../types/nil");
|
|
7
|
-
const deep_equal_1 = __importDefault(require("./deep-equal"));
|
|
8
|
-
class ObjectValue extends Map {
|
|
9
|
-
get(mapKey) {
|
|
10
|
-
for (const [key, value] of this.entries()) {
|
|
11
|
-
if ((0, deep_equal_1.default)(key, mapKey)) {
|
|
12
|
-
return value;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return nil_1.Void;
|
|
16
|
-
}
|
|
17
|
-
has(mapKey) {
|
|
18
|
-
for (const key of this.keys()) {
|
|
19
|
-
if ((0, deep_equal_1.default)(key, mapKey)) {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
set(mapKey, mapValue) {
|
|
26
|
-
for (const key of this.keys()) {
|
|
27
|
-
if ((0, deep_equal_1.default)(key, mapKey)) {
|
|
28
|
-
super.set(key, mapValue);
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
super.set(mapKey, mapValue);
|
|
33
|
-
return this;
|
|
34
|
-
}
|
|
35
|
-
extend(objVal) {
|
|
36
|
-
for (const [key, value] of objVal) {
|
|
37
|
-
this.set(key, value);
|
|
38
|
-
}
|
|
39
|
-
return this;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.default = ObjectValue;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const nil_1 = require("../types/nil");
|
|
7
|
+
const deep_equal_1 = __importDefault(require("./deep-equal"));
|
|
8
|
+
class ObjectValue extends Map {
|
|
9
|
+
get(mapKey) {
|
|
10
|
+
for (const [key, value] of this.entries()) {
|
|
11
|
+
if ((0, deep_equal_1.default)(key, mapKey)) {
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return nil_1.Void;
|
|
16
|
+
}
|
|
17
|
+
has(mapKey) {
|
|
18
|
+
for (const key of this.keys()) {
|
|
19
|
+
if ((0, deep_equal_1.default)(key, mapKey)) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
set(mapKey, mapValue) {
|
|
26
|
+
for (const key of this.keys()) {
|
|
27
|
+
if ((0, deep_equal_1.default)(key, mapKey)) {
|
|
28
|
+
super.set(key, mapValue);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
super.set(mapKey, mapValue);
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
extend(objVal) {
|
|
36
|
+
for (const [key, value] of objVal) {
|
|
37
|
+
this.set(key, value);
|
|
38
|
+
}
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.default = ObjectValue;
|
package/dist/utils/path.d.ts
CHANGED
|
@@ -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
|
+
}
|
package/dist/utils/path.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class Path {
|
|
4
|
-
constructor(path = []) {
|
|
5
|
-
this.path = [...path];
|
|
6
|
-
}
|
|
7
|
-
next() {
|
|
8
|
-
if (this.path.length === 0) {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
return this.path.shift();
|
|
12
|
-
}
|
|
13
|
-
last() {
|
|
14
|
-
if (this.path.length === 0) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
return this.path.pop();
|
|
18
|
-
}
|
|
19
|
-
add(value) {
|
|
20
|
-
this.path.push(value);
|
|
21
|
-
}
|
|
22
|
-
toString() {
|
|
23
|
-
return this.path.join('.');
|
|
24
|
-
}
|
|
25
|
-
count() {
|
|
26
|
-
return this.path.length;
|
|
27
|
-
}
|
|
28
|
-
clone() {
|
|
29
|
-
return new Path(this.path);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.default = Path;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class Path {
|
|
4
|
+
constructor(path = []) {
|
|
5
|
+
this.path = [...path];
|
|
6
|
+
}
|
|
7
|
+
next() {
|
|
8
|
+
if (this.path.length === 0) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return this.path.shift();
|
|
12
|
+
}
|
|
13
|
+
last() {
|
|
14
|
+
if (this.path.length === 0) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return this.path.pop();
|
|
18
|
+
}
|
|
19
|
+
add(value) {
|
|
20
|
+
this.path.push(value);
|
|
21
|
+
}
|
|
22
|
+
toString() {
|
|
23
|
+
return this.path.join('.');
|
|
24
|
+
}
|
|
25
|
+
count() {
|
|
26
|
+
return this.path.length;
|
|
27
|
+
}
|
|
28
|
+
clone() {
|
|
29
|
+
return new Path(this.path);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.default = Path;
|
package/package.json
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "greybel-interpreter",
|
|
3
|
-
"version": "1.4.
|
|
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.5.
|
|
52
|
-
"greyscript-core": "^0.5.
|
|
53
|
-
},
|
|
54
|
-
"keywords": [
|
|
55
|
-
"greyscript",
|
|
56
|
-
"greyhack"
|
|
57
|
-
]
|
|
58
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "greybel-interpreter",
|
|
3
|
+
"version": "1.4.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.5.7",
|
|
52
|
+
"greyscript-core": "^0.5.2"
|
|
53
|
+
},
|
|
54
|
+
"keywords": [
|
|
55
|
+
"greyscript",
|
|
56
|
+
"greyhack"
|
|
57
|
+
]
|
|
58
|
+
}
|