godprotocol 1.0.77 → 1.0.79
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/Index.js +3 -15
- package/Loader_sequence/main.js +255 -55
- package/Objects/Account.js +24 -21
- package/Objects/Block.js +4 -1
- package/Objects/Chain.js +8 -1
- package/Objects/Filesystem.js +11 -15
- package/Objects/Manager.js +19 -8
- package/Objects/Opcodes.js +5 -3
- package/Objects/Oracle.js +10 -0
- package/Objects/Virtual_machine.js +1 -7
- package/framer.js +2 -4
- package/opcodes/std.js +2 -1
- package/opcodes.js +6 -4
- package/package.json +13 -3
- package/readme.md +2 -2
- package/utils/create_server.js +23 -3
- package/.github/workflows/npm-publish-github-packages.yml +0 -36
- package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/0ee263de3fb9e3e08e7d5abe21db8c0fe66188829979996dcddd3533d855a817/30dc10d3485923c0c19083559094fe636f9491bff9c997306ffdbf3e1618a402/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
- package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/0ee263de3fb9e3e08e7d5abe21db8c0fe66188829979996dcddd3533d855a817/4dc569813ce0a2f446a3eec01358f5774f8564641ef8d579ff5b6d94b4d031a7/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
- package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/0ee263de3fb9e3e08e7d5abe21db8c0fe66188829979996dcddd3533d855a817/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
- package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/0ee263de3fb9e3e08e7d5abe21db8c0fe66188829979996dcddd3533d855a817/a965464a6d9f981543ce3aede226bd0fb989d9300cd8468f41cd1fc0139c8f44/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
- package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/12cd650efa4f63b7c61c3345db3daa0534f4c370a003ea6d8ae0d29a49f6f928/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
- package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/3ff3661353ccadcaf9c6759a539d8d31e19c07ed0dd888170b9e55c7a18721da/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
- package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/3ff3661353ccadcaf9c6759a539d8d31e19c07ed0dd888170b9e55c7a18721da/de551b5a493859e532316cbbf1e4a14eb06e0512556b1c1295ad60ffe07c185b/19270ea4f98808a63fbb99bc26a5ee6f0fe8df9c8182cf1d710b115d57250578 +0 -1
- package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/3ff3661353ccadcaf9c6759a539d8d31e19c07ed0dd888170b9e55c7a18721da/f8a165e3f556ca2ea189f4d4401d139b22a6f19d0b38329fe4a5f14599840634/4f52f1dc77e0233034c6566fc73c30234de85d2298ff90885a7c56502dffa0b2 +0 -1
- package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/3ff3661353ccadcaf9c6759a539d8d31e19c07ed0dd888170b9e55c7a18721da/f8a165e3f556ca2ea189f4d4401d139b22a6f19d0b38329fe4a5f14599840634/8d3c916f9c93a6f4c8be9c3f4493b1c02d3eb7516eac153a98320924b27739d8 +0 -1
- package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/f968ed8cf7958218d4604b3de0bf074f09bac7925e86f7d1f495f8b2c67f31a7/61bdf0593cd727752cb917ab968a08853d45142b8a8e4cdcd0fe03d1616f3586/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
- package/Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/f968ed8cf7958218d4604b3de0bf074f09bac7925e86f7d1f495f8b2c67f31a7/74234e98afe7498fb5daf1f36ac2d78acc339464f950703b8c019892f982b90b +0 -1
- package/Loader_sequence/functions/parse_expression.js +0 -107
- package/Loader_sequence/functions/parse_to_obj.js +0 -38
- package/Loader_sequence/functions/parse_variable.js +0 -38
- package/Loader_sequence/functions/tokenise.js +0 -135
- package/Loader_sequence/functions/utils.js +0 -14
- package/Loader_sequence/keywords/parse.js +0 -23
- package/Loader_sequence/native_classes/Variable.js +0 -49
- package/Loader_sequence/native_classes/datatypes/Array.js +0 -56
- package/Loader_sequence/native_classes/datatypes/Boolean.js +0 -42
- package/Loader_sequence/native_classes/datatypes/Number.js +0 -42
- package/Loader_sequence/native_classes/datatypes/String.js +0 -42
- package/Loader_sequence/native_classes/datatypes/Twain.js +0 -65
- package/Loader_sequence/native_classes/datatypes/Void.js +0 -42
- package/Loader_sequence/native_classes/global.js +0 -48
- package/Loader_sequence/native_classes/native.js +0 -63
- package/Loader_sequence/native_classes/operators.js +0 -64
- package/Loader_sequence/native_classes/parse.js +0 -54
- package/Loader_sequence/utils/format_instructions.js +0 -52
- package/build/Account.js +0 -245
- package/build/Array.js +0 -142
- package/build/Block.js +0 -100
- package/build/Blockweb.js +0 -78
- package/build/Boolean.js +0 -128
- package/build/Chain.js +0 -198
- package/build/Explorer.js +0 -85
- package/build/Filesystem.js +0 -173
- package/build/Frame.js +0 -108
- package/build/Index.js +0 -31
- package/build/Manager.js +0 -167
- package/build/Number.js +0 -128
- package/build/Opcodes.js +0 -75
- package/build/Oracle.js +0 -70
- package/build/String.js +0 -128
- package/build/Twain.js +0 -151
- package/build/Variable.js +0 -135
- package/build/Virtual_machine.js +0 -220
- package/build/Void.js +0 -128
- package/build/format_instructions.js +0 -52
- package/build/framer.js +0 -90
- package/build/global.js +0 -134
- package/build/main.js +0 -83
- package/build/native.js +0 -101
- package/build/operators.js +0 -150
package/Objects/Oracle.js
CHANGED
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
+
var _fs = _interopRequireDefault(require("fs"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
7
9
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
10
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
9
11
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
@@ -25,6 +27,14 @@ var Oracle = /*#__PURE__*/_createClass(function Oracle(mgr) {
|
|
|
25
27
|
_defineProperty(this, "get", function (path) {
|
|
26
28
|
return _this.datapaths[path];
|
|
27
29
|
});
|
|
30
|
+
_defineProperty(this, "write", function (addr, data) {
|
|
31
|
+
var meta = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
32
|
+
encoding: "utf-8"
|
|
33
|
+
};
|
|
34
|
+
if (typeof data !== "string") data = JSON.stringify(data);
|
|
35
|
+
_this.fs.writeFileSync(addr, data, meta);
|
|
36
|
+
});
|
|
37
|
+
this.fs = _fs["default"];
|
|
28
38
|
this.mgr = mgr;
|
|
29
39
|
this.datapaths = new Object();
|
|
30
40
|
});
|
|
@@ -64,9 +64,6 @@ var Virtual_machine = /*#__PURE__*/function (_Opcodes) {
|
|
|
64
64
|
args: args
|
|
65
65
|
};
|
|
66
66
|
});
|
|
67
|
-
_defineProperty(_assertThisInitialized(_this), "run_traverse", function () {
|
|
68
|
-
if (!_this.running) return;
|
|
69
|
-
});
|
|
70
67
|
_defineProperty(_assertThisInitialized(_this), "execute", function (instruction, track) {
|
|
71
68
|
_this.track = track;
|
|
72
69
|
if (!instruction) return;
|
|
@@ -82,19 +79,16 @@ var Virtual_machine = /*#__PURE__*/function (_Opcodes) {
|
|
|
82
79
|
case "chain":
|
|
83
80
|
chain = context.account.add_chain(args, context);
|
|
84
81
|
_this.contexts.push(chain);
|
|
85
|
-
_this.run_traverse();
|
|
86
82
|
chain.append_buffer();
|
|
87
83
|
break;
|
|
88
84
|
case "link":
|
|
89
85
|
chain = context.account.manager.web.get(args);
|
|
90
|
-
var k = Object.keys(context.account.manager.web.physical_addresses);
|
|
91
86
|
if (!chain) {
|
|
92
87
|
console.log("LINKing Failed. - ".concat(args));
|
|
93
88
|
return;
|
|
94
89
|
}
|
|
95
90
|
chain.append_buffer();
|
|
96
91
|
_this.contexts.push(chain);
|
|
97
|
-
_this.run_traverse();
|
|
98
92
|
break;
|
|
99
93
|
case "mine":
|
|
100
94
|
var bloc = context.mine(_assertThisInitialized(_this), true);
|
|
@@ -113,7 +107,7 @@ var Virtual_machine = /*#__PURE__*/function (_Opcodes) {
|
|
|
113
107
|
_this.contexts.pop();
|
|
114
108
|
break;
|
|
115
109
|
case "cursor":
|
|
116
|
-
context.
|
|
110
|
+
context.set_cursor(args);
|
|
117
111
|
break;
|
|
118
112
|
case "write":
|
|
119
113
|
context.account.write(args, context);
|
package/framer.js
CHANGED
|
@@ -20,14 +20,12 @@ var framer = function framer(initiator) {
|
|
|
20
20
|
subtract: null,
|
|
21
21
|
divide: null,
|
|
22
22
|
exp: null
|
|
23
|
-
}, _defineProperty(_Opcodes, "equal", null), _defineProperty(_Opcodes, "not_equal", null), _defineProperty(_Opcodes, "greater_than", null), _defineProperty(_Opcodes, "less_than", null), _defineProperty(_Opcodes, "gte", null), _defineProperty(_Opcodes, "lte", null), _defineProperty(_Opcodes, "send", null), _defineProperty(_Opcodes, "readonly", null), _defineProperty(_Opcodes, "socket_send", null), _defineProperty(_Opcodes, "jmp", null), _defineProperty(_Opcodes, "jmp_if", null), _defineProperty(_Opcodes, "hold", null), _defineProperty(_Opcodes, "stdout", null), _defineProperty(_Opcodes, "stdin", null), _Opcodes),
|
|
23
|
+
}, _defineProperty(_Opcodes, "equal", null), _defineProperty(_Opcodes, "not_equal", null), _defineProperty(_Opcodes, "greater_than", null), _defineProperty(_Opcodes, "less_than", null), _defineProperty(_Opcodes, "gte", null), _defineProperty(_Opcodes, "lte", null), _defineProperty(_Opcodes, "send", null), _defineProperty(_Opcodes, "readonly", null), _defineProperty(_Opcodes, "socket_send", null), _defineProperty(_Opcodes, "jmp", null), _defineProperty(_Opcodes, "jmp_if", null), _defineProperty(_Opcodes, "hold", null), _defineProperty(_Opcodes, "stdout", null), _defineProperty(_Opcodes, "stdin", null), _defineProperty(_Opcodes, "run", null), _defineProperty(_Opcodes, "load", null), _defineProperty(_Opcodes, "parse", null), _defineProperty(_Opcodes, "create_account", null), _Opcodes),
|
|
24
24
|
Datatypes: {
|
|
25
25
|
Number: null,
|
|
26
26
|
String: null,
|
|
27
27
|
Twain: null,
|
|
28
|
-
Array: null
|
|
29
|
-
Void: null,
|
|
30
|
-
Boolean: null
|
|
28
|
+
Array: null
|
|
31
29
|
},
|
|
32
30
|
Objects: {
|
|
33
31
|
Blockchain: {
|
package/opcodes/std.js
CHANGED
package/opcodes.js
CHANGED
|
@@ -14,6 +14,7 @@ var opcodes = function opcodes(account) {
|
|
|
14
14
|
var set = account.vm.set;
|
|
15
15
|
_add.ops.map(function (op) {
|
|
16
16
|
set(op.name, function (args) {
|
|
17
|
+
if (!args) return;
|
|
17
18
|
try {
|
|
18
19
|
var result = eval("".concat(args.op0, " ").concat(op.sign, " ").concat(args.op1));
|
|
19
20
|
return result;
|
|
@@ -31,10 +32,11 @@ var opcodes = function opcodes(account) {
|
|
|
31
32
|
// set("socket_send", socket_send);
|
|
32
33
|
|
|
33
34
|
set("stdout", _std.stdout);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
["run", "load", "parse", "create_account"].map(function (op) {
|
|
36
|
+
return set(op, function (arg) {
|
|
37
|
+
return arg && arg.op0 && account[op](arg && arg.op0);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
38
40
|
};
|
|
39
41
|
var _default = opcodes;
|
|
40
42
|
exports["default"] = _default;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "godprotocol",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.79",
|
|
4
4
|
"description": "A data mediator.",
|
|
5
5
|
"main": "Index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
9
|
"start": "nodemon -r esm Index.js",
|
|
10
|
-
"
|
|
10
|
+
"prepack": "npmignore"
|
|
11
11
|
},
|
|
12
12
|
"author": "Savvy",
|
|
13
13
|
"license": "ISC",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"apidoc": "^0.54.0",
|
|
18
18
|
"babel-preset-env": "^1.7.0",
|
|
19
19
|
"esm": "^3.2.25",
|
|
20
|
-
"nodemon": "^3.1.0"
|
|
20
|
+
"nodemon": "^3.1.0",
|
|
21
|
+
"npmignore": "^0.3.1"
|
|
21
22
|
},
|
|
22
23
|
"repository": {
|
|
23
24
|
"type": "git",
|
|
@@ -45,5 +46,14 @@
|
|
|
45
46
|
"crypto": "^1.0.1",
|
|
46
47
|
"elliptic": "^6.5.5",
|
|
47
48
|
"fs": "^0.0.1-security"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"ignore": [
|
|
52
|
+
"Accounts/",
|
|
53
|
+
".github/",
|
|
54
|
+
"build/",
|
|
55
|
+
".babelrc",
|
|
56
|
+
"node_modules/"
|
|
57
|
+
]
|
|
48
58
|
}
|
|
49
59
|
}
|
package/readme.md
CHANGED
|
@@ -20,10 +20,10 @@ You can get overall comprehension in just 4 method calls.
|
|
|
20
20
|
Accounts comes with their own VM, thereby providing concurrency on processes being executed.
|
|
21
21
|
|
|
22
22
|
```js
|
|
23
|
-
import
|
|
23
|
+
import start from "godprotocol";
|
|
24
24
|
|
|
25
25
|
// Create an initial account
|
|
26
|
-
let initiator = start(`
|
|
26
|
+
let initiator = start(`name`, { private: true || false });
|
|
27
27
|
// if private is set to `true`, communication to the account instance must be validated by sigining with the private key.
|
|
28
28
|
// N.B your keypairs are generated offline.
|
|
29
29
|
```
|
package/utils/create_server.js
CHANGED
|
@@ -4,7 +4,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports["default"] = exports.PORT = void 0;
|
|
7
|
+
exports.extension = exports["default"] = exports.PORT = void 0;
|
|
8
8
|
var _http = _interopRequireDefault(require("http"));
|
|
9
9
|
var _functions = require("./functions");
|
|
10
10
|
var _PORT;
|
|
@@ -17,12 +17,22 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
17
17
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
18
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
19
19
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
20
|
-
var PORT = process.env.PORT || 1408;
|
|
20
|
+
var PORT = Number(process.env.PORT) || 1408;
|
|
21
21
|
exports.PORT = PORT;
|
|
22
22
|
var cb = function cb(res, data) {
|
|
23
23
|
if (typeof data !== "string") data = JSON.stringify(data);
|
|
24
24
|
res(data);
|
|
25
25
|
};
|
|
26
|
+
var extensions = new Object();
|
|
27
|
+
var extension = function extension(route, handler) {
|
|
28
|
+
var handlers = extensions[route];
|
|
29
|
+
if (!handlers) {
|
|
30
|
+
handlers = new Array();
|
|
31
|
+
extensions[route] = handlers;
|
|
32
|
+
}
|
|
33
|
+
handlers.push(handler);
|
|
34
|
+
};
|
|
35
|
+
exports.extension = extension;
|
|
26
36
|
var create_server = /*#__PURE__*/function () {
|
|
27
37
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(initiator) {
|
|
28
38
|
var av, server;
|
|
@@ -63,13 +73,23 @@ var create_server = /*#__PURE__*/function () {
|
|
|
63
73
|
if (req.url === "/create_account") {
|
|
64
74
|
var account = initiator.create_account(data);
|
|
65
75
|
res.end(account.stringify(true));
|
|
66
|
-
} else {
|
|
76
|
+
} else if (["run", "load", "parse"].includes(req.url.slice(1))) {
|
|
67
77
|
var payload = _objectSpread(_objectSpread({}, data), {}, {
|
|
68
78
|
callback: function callback(datagram) {
|
|
69
79
|
return cb(res.end, datagram);
|
|
70
80
|
}
|
|
71
81
|
});
|
|
72
82
|
initiator.endpoint(req.url.slice(1), payload);
|
|
83
|
+
} else {
|
|
84
|
+
var _extension = extensions[req.url.slice(1)];
|
|
85
|
+
if (_extension) {
|
|
86
|
+
_extension.map(function (ex) {
|
|
87
|
+
typeof ex === "function" && ex(data, {
|
|
88
|
+
req: req,
|
|
89
|
+
res: res
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
73
93
|
}
|
|
74
94
|
});
|
|
75
95
|
req.on("error", function (e) {
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
-
|
|
4
|
-
name: Node.js Package
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
release:
|
|
8
|
-
types: [created]
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
build:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v4
|
|
15
|
-
- uses: actions/setup-node@v3
|
|
16
|
-
with:
|
|
17
|
-
node-version: 16
|
|
18
|
-
- run: npm ci
|
|
19
|
-
- run: npm test
|
|
20
|
-
|
|
21
|
-
publish-gpr:
|
|
22
|
-
needs: build
|
|
23
|
-
runs-on: ubuntu-latest
|
|
24
|
-
permissions:
|
|
25
|
-
contents: read
|
|
26
|
-
packages: write
|
|
27
|
-
steps:
|
|
28
|
-
- uses: actions/checkout@v4
|
|
29
|
-
- uses: actions/setup-node@v3
|
|
30
|
-
with:
|
|
31
|
-
node-version: 16
|
|
32
|
-
registry-url: https://npm.pkg.github.com/
|
|
33
|
-
- run: npm ci
|
|
34
|
-
- run: npm publish
|
|
35
|
-
env:
|
|
36
|
-
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
null
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
null
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
null
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
null
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
null
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
null
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"Hello, world!"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"inputs":"Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/3ff3661353ccadcaf9c6759a539d8d31e19c07ed0dd888170b9e55c7a18721da/f8a165e3f556ca2ea189f4d4401d139b22a6f19d0b38329fe4a5f14599840634/8d3c916f9c93a6f4c8be9c3f4493b1c02d3eb7516eac153a98320924b27739d8"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"op0":"Accounts/59eb3cb130074f7b1ddb99c8fe14f27e1dbca735bb3da82e1ff0305340a32419/3ff3661353ccadcaf9c6759a539d8d31e19c07ed0dd888170b9e55c7a18721da/de551b5a493859e532316cbbf1e4a14eb06e0512556b1c1295ad60ffe07c185b/19270ea4f98808a63fbb99bc26a5ee6f0fe8df9c8182cf1d710b115d57250578"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
null
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
null
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.parse_expression = void 0;
|
|
7
|
-
var _parse_to_obj = _interopRequireDefault(require("./parse_to_obj"));
|
|
8
|
-
var _utils = require("./utils");
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
|
-
var capture_token = function capture_token(tokens) {
|
|
11
|
-
var token,
|
|
12
|
-
pos = 0;
|
|
13
|
-
token = tokens[pos];
|
|
14
|
-
pos++;
|
|
15
|
-
return {
|
|
16
|
-
token: token,
|
|
17
|
-
pos: pos
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
var slice_expression = function slice_expression(tokens, pos, parent) {
|
|
21
|
-
var expr = [];
|
|
22
|
-
if (parent.token.compiler.expr_types.includes(parent.token.type)) {
|
|
23
|
-
expr.push(parent.token);
|
|
24
|
-
}
|
|
25
|
-
while (pos < tokens.length) {
|
|
26
|
-
var _capture_token = capture_token(tokens.slice(pos)),
|
|
27
|
-
token = _capture_token.token,
|
|
28
|
-
pos_ = _capture_token.pos;
|
|
29
|
-
pos += pos_;
|
|
30
|
-
if (token.compiler.expr_types.includes(token.type)) {
|
|
31
|
-
if (expr.length && expr.slice(-1)[0].type !== "operator") break;
|
|
32
|
-
expr.push(token);
|
|
33
|
-
} else if (token.type === "operator") {
|
|
34
|
-
if (expr.length && !token.compiler.expr_types.includes(expr.slice(-1)[0].type)) break;
|
|
35
|
-
expr.push(token);
|
|
36
|
-
} else {
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
expr: expr,
|
|
42
|
-
pos: pos
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
var op_precedence = ["(", ">", "<", "<=", ">=", "==", "**", "/", "*", "+", "-", "~/", "~*", "~+", "~-"];
|
|
46
|
-
var has_op = function has_op(expr, op) {
|
|
47
|
-
var found = null;
|
|
48
|
-
for (var e = 0; e < expr.length; e++) {
|
|
49
|
-
var x = expr[e];
|
|
50
|
-
if (x.value === op) {
|
|
51
|
-
found = e;
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return found;
|
|
56
|
-
};
|
|
57
|
-
var resolve_expression = function resolve_expression(expr, parent, params) {
|
|
58
|
-
if (expr.length === 1) {
|
|
59
|
-
expr[0] = (0, _parse_to_obj["default"])(expr[0], parent, {
|
|
60
|
-
is_expr: !params
|
|
61
|
-
});
|
|
62
|
-
} else {
|
|
63
|
-
while (expr.length > 1) {
|
|
64
|
-
for (var i = 0; i < op_precedence.length; i++) {
|
|
65
|
-
var op = op_precedence[i];
|
|
66
|
-
var e = has_op(expr, op);
|
|
67
|
-
while (e != null) {
|
|
68
|
-
var tok_obj = (0, _parse_to_obj["default"])(expr[e], parent);
|
|
69
|
-
tok_obj.push((0, _parse_to_obj["default"])(expr[e - 1], parent, {
|
|
70
|
-
is_expr: !params && tok_obj.token.value !== "="
|
|
71
|
-
}));
|
|
72
|
-
tok_obj.push((0, _parse_to_obj["default"])(expr[e + 1], parent, {
|
|
73
|
-
is_expr: !params
|
|
74
|
-
}));
|
|
75
|
-
expr.splice(e - 1, 3, tok_obj);
|
|
76
|
-
e = has_op(expr, op);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return expr[0];
|
|
82
|
-
};
|
|
83
|
-
var parse_expression = function parse_expression(tokens, parent, no_one, params) {
|
|
84
|
-
var pos = 0,
|
|
85
|
-
obj;
|
|
86
|
-
var _slice_expression = slice_expression(tokens, pos, parent),
|
|
87
|
-
expr = _slice_expression.expr,
|
|
88
|
-
pos_ = _slice_expression.pos;
|
|
89
|
-
if (expr.length <= 1 && no_one) return {
|
|
90
|
-
obj: parent,
|
|
91
|
-
pos: pos_ + 1
|
|
92
|
-
};
|
|
93
|
-
var assign = expr.find(function (ex) {
|
|
94
|
-
return (0, _utils.is_token_value)(ex, "=", "operator");
|
|
95
|
-
});
|
|
96
|
-
if (assign) {
|
|
97
|
-
obj = resolve_expression(expr.slice(2), parent);
|
|
98
|
-
parent.assign(obj);
|
|
99
|
-
obj = parent;
|
|
100
|
-
} else obj = resolve_expression(expr, parent, params);
|
|
101
|
-
pos = pos_;
|
|
102
|
-
return {
|
|
103
|
-
pos: pos,
|
|
104
|
-
obj: obj
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
exports.parse_expression = parse_expression;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _Variable = _interopRequireDefault(require("../native_classes/Variable"));
|
|
8
|
-
var _Array = _interopRequireDefault(require("../native_classes/datatypes/Array"));
|
|
9
|
-
var _Boolean = _interopRequireDefault(require("../native_classes/datatypes/Boolean"));
|
|
10
|
-
var _Number = _interopRequireDefault(require("../native_classes/datatypes/Number"));
|
|
11
|
-
var _String = _interopRequireDefault(require("../native_classes/datatypes/String"));
|
|
12
|
-
var _Twain = _interopRequireDefault(require("../native_classes/datatypes/Twain"));
|
|
13
|
-
var _Void = _interopRequireDefault(require("../native_classes/datatypes/Void"));
|
|
14
|
-
var _operators = _interopRequireDefault(require("../native_classes/operators"));
|
|
15
|
-
var _parse = _interopRequireDefault(require("../native_classes/parse"));
|
|
16
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
17
|
-
var parse_to_obj = function parse_to_obj(token, parent) {
|
|
18
|
-
var meta = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
19
|
-
var obj;
|
|
20
|
-
if (token.type === "operator") obj = new _operators["default"](token);else if (token.type === "keyword") {
|
|
21
|
-
if (token.value === "parse") {
|
|
22
|
-
obj = new _parse["default"](token);
|
|
23
|
-
}
|
|
24
|
-
} else if (token.type === "number") obj = new _Number["default"](token);else if (token.type === "string") obj = new _String["default"](token);else if (token.type === "array") obj = new _Array["default"](token);else if (token.type === "void") obj = new _Void["default"](token);else if (token.type === "boolean") obj = new _Boolean["default"](token);else if (token.type === "twain") obj = new _Twain["default"](token);else if (token.type === "variable") {
|
|
25
|
-
obj = new _Variable["default"](token);
|
|
26
|
-
if (meta && meta.is_expr) {
|
|
27
|
-
var declaration = parent.find(obj);
|
|
28
|
-
if (!declaration) {
|
|
29
|
-
throw new Error("Variable is not declared!");
|
|
30
|
-
}
|
|
31
|
-
obj.declaration = declaration;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
obj && obj.set_parent(parent);
|
|
35
|
-
return obj || token;
|
|
36
|
-
};
|
|
37
|
-
var _default = parse_to_obj;
|
|
38
|
-
exports["default"] = _default;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _Variable = _interopRequireDefault(require("../native_classes/Variable"));
|
|
8
|
-
var _parse_expression3 = require("./parse_expression");
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
|
-
var parse_variable = function parse_variable(token, pos, parent) {
|
|
11
|
-
pos++;
|
|
12
|
-
var obj = new _Variable["default"](token);
|
|
13
|
-
var next_tok = compiler.tokens[pos];
|
|
14
|
-
if (next_tok.type === "operator") {
|
|
15
|
-
if (next_tok.value === "=") {
|
|
16
|
-
pos++;
|
|
17
|
-
var _parse_expression = (0, _parse_expression3.parse_expression)(compiler.tokens.slice(pos), obj),
|
|
18
|
-
obj_ = _parse_expression.obj,
|
|
19
|
-
pos_ = _parse_expression.pos;
|
|
20
|
-
pos = pos_;
|
|
21
|
-
obj.assign(obj_);
|
|
22
|
-
} else {
|
|
23
|
-
// Its an expression
|
|
24
|
-
|
|
25
|
-
var _parse_expression2 = (0, _parse_expression3.parse_expression)(compiler.tokens.slice(pos), parent),
|
|
26
|
-
_obj_ = _parse_expression2.obj,
|
|
27
|
-
_pos_ = _parse_expression2.pos;
|
|
28
|
-
pos = _pos_;
|
|
29
|
-
obj = _obj_;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return {
|
|
33
|
-
obj: obj,
|
|
34
|
-
pos: pos
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
var _default = parse_variable;
|
|
38
|
-
exports["default"] = _default;
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var tokenise = function tokenise(code, stop, compiler) {
|
|
8
|
-
var pos = 0,
|
|
9
|
-
col = 1,
|
|
10
|
-
line = 1;
|
|
11
|
-
var keywords = ["arr", "num", "str", "twain", "void", "bool", "parse"];
|
|
12
|
-
var nums = "0123456789";
|
|
13
|
-
var signs = "+-/*=<>!";
|
|
14
|
-
var tokens = new Array();
|
|
15
|
-
var var_chars = "abcdefghijklmnopqrstuvwxyzABCSEFGHUJKLMNOPQRSTUVWXYZ0123456789";
|
|
16
|
-
var separators = ";:";
|
|
17
|
-
var bools = ["False", "True"];
|
|
18
|
-
if (!code) return tokens;
|
|
19
|
-
var token_obj = function token_obj(value, type) {
|
|
20
|
-
var token = {
|
|
21
|
-
value: value,
|
|
22
|
-
type: type,
|
|
23
|
-
pos: pos,
|
|
24
|
-
col: col,
|
|
25
|
-
line: line,
|
|
26
|
-
compiler: compiler
|
|
27
|
-
};
|
|
28
|
-
tokens.push(token);
|
|
29
|
-
return token;
|
|
30
|
-
};
|
|
31
|
-
while (pos < code.length) {
|
|
32
|
-
var curr_char = code[pos];
|
|
33
|
-
if (curr_char === stop) break;
|
|
34
|
-
if (!curr_char) pos++;else if (curr_char === ",") {
|
|
35
|
-
token_obj(curr_char, "separator");
|
|
36
|
-
pos++;
|
|
37
|
-
col++;
|
|
38
|
-
} else if (separators.includes(curr_char)) {
|
|
39
|
-
token_obj(curr_char, "separator");
|
|
40
|
-
pos++;
|
|
41
|
-
col++;
|
|
42
|
-
} else if (signs.includes(curr_char)) {
|
|
43
|
-
var acc = curr_char;
|
|
44
|
-
pos++;
|
|
45
|
-
col++;
|
|
46
|
-
curr_char = code[pos];
|
|
47
|
-
if (curr_char === "=") {
|
|
48
|
-
acc = "".concat(acc).concat(curr_char);
|
|
49
|
-
pos++;
|
|
50
|
-
col++;
|
|
51
|
-
}
|
|
52
|
-
token_obj(acc, "operator");
|
|
53
|
-
} else if (curr_char === "\n") {
|
|
54
|
-
line++;
|
|
55
|
-
col = 1;
|
|
56
|
-
pos++;
|
|
57
|
-
} else if (curr_char === " ") {
|
|
58
|
-
pos++;
|
|
59
|
-
col++;
|
|
60
|
-
} else if ("[]{}()".includes(curr_char)) {
|
|
61
|
-
token_obj(curr_char, "params");
|
|
62
|
-
pos++;
|
|
63
|
-
col++;
|
|
64
|
-
} else if (nums.includes(curr_char)) {
|
|
65
|
-
var _acc = curr_char;
|
|
66
|
-
pos++;
|
|
67
|
-
curr_char = code[pos];
|
|
68
|
-
col++;
|
|
69
|
-
while (nums.includes(curr_char) || curr_char == "." && !_acc.includes(curr_char)) {
|
|
70
|
-
_acc = "".concat(_acc).concat(curr_char);
|
|
71
|
-
col++;
|
|
72
|
-
pos++;
|
|
73
|
-
curr_char = code[pos];
|
|
74
|
-
}
|
|
75
|
-
token_obj(_acc, "number", {
|
|
76
|
-
col: col - _acc.length
|
|
77
|
-
});
|
|
78
|
-
} else if (['"', "'"].includes(curr_char)) {
|
|
79
|
-
var _acc2 = "";
|
|
80
|
-
var opening_quote = curr_char;
|
|
81
|
-
pos++;
|
|
82
|
-
col++;
|
|
83
|
-
curr_char = code[pos];
|
|
84
|
-
while (curr_char !== opening_quote) {
|
|
85
|
-
_acc2 = "".concat(_acc2).concat(curr_char);
|
|
86
|
-
pos++;
|
|
87
|
-
col++;
|
|
88
|
-
curr_char = code[pos];
|
|
89
|
-
}
|
|
90
|
-
pos++;
|
|
91
|
-
col++;
|
|
92
|
-
token_obj(_acc2, "string", {
|
|
93
|
-
col: col - (_acc2.length + 2)
|
|
94
|
-
});
|
|
95
|
-
} else if (var_chars.includes(curr_char)) {
|
|
96
|
-
var _acc3 = curr_char;
|
|
97
|
-
pos++;
|
|
98
|
-
col++;
|
|
99
|
-
curr_char = code[pos];
|
|
100
|
-
while (var_chars.includes(curr_char)) {
|
|
101
|
-
_acc3 = "".concat(_acc3).concat(curr_char);
|
|
102
|
-
pos++;
|
|
103
|
-
col++;
|
|
104
|
-
curr_char = code[pos];
|
|
105
|
-
}
|
|
106
|
-
var type = void 0;
|
|
107
|
-
if (keywords.includes(_acc3)) {
|
|
108
|
-
type = "keyword";
|
|
109
|
-
} else if (bools.includes(_acc3)) type = "boolean";else type = "variable";
|
|
110
|
-
var token = token_obj(_acc3, type);
|
|
111
|
-
if (type === "keyword") {
|
|
112
|
-
var toks = void 0;
|
|
113
|
-
if (["arr", "twain"].includes(_acc3)) {
|
|
114
|
-
token.type = _acc3 === "arr" ? "array" : "twain";
|
|
115
|
-
pos++;
|
|
116
|
-
toks = tokenise(code.slice(pos), ")", compiler);
|
|
117
|
-
token.value = toks.tokens;
|
|
118
|
-
} else continue;
|
|
119
|
-
pos += toks.pos + 1;
|
|
120
|
-
col += toks.col;
|
|
121
|
-
line += toks.line;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
// console.log(tokens);
|
|
126
|
-
|
|
127
|
-
return stop ? {
|
|
128
|
-
col: col,
|
|
129
|
-
pos: pos,
|
|
130
|
-
tokens: tokens,
|
|
131
|
-
line: line
|
|
132
|
-
} : tokens;
|
|
133
|
-
};
|
|
134
|
-
var _default = tokenise;
|
|
135
|
-
exports["default"] = _default;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.is_token_value = void 0;
|
|
7
|
-
var is_token_value = function is_token_value(token, value, type) {
|
|
8
|
-
if (!Array.isArray(value)) value = [value];
|
|
9
|
-
if (!Array.isArray(type)) type = [type];
|
|
10
|
-
if (!type.includes(token.type)) return;
|
|
11
|
-
if (!value.includes(token.value)) return;
|
|
12
|
-
return true;
|
|
13
|
-
};
|
|
14
|
-
exports.is_token_value = is_token_value;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.kw_parse = void 0;
|
|
7
|
-
var _parse_expression2 = require("../functions/parse_expression");
|
|
8
|
-
var _parse = _interopRequireDefault(require("../native_classes/parse"));
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
|
-
var kw_parse = function kw_parse(tokens, pos, parent, compiler) {
|
|
11
|
-
var token = tokens[pos];
|
|
12
|
-
pos++;
|
|
13
|
-
var _parse_expression = (0, _parse_expression2.parse_expression)(tokens.slice(pos), parent, compiler),
|
|
14
|
-
obj = _parse_expression.obj,
|
|
15
|
-
pos_ = _parse_expression.pos;
|
|
16
|
-
pos += pos_;
|
|
17
|
-
var key_obj = new _parse["default"](token, obj);
|
|
18
|
-
return {
|
|
19
|
-
obj: key_obj,
|
|
20
|
-
pos: pos
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
exports.kw_parse = kw_parse;
|