rapydscript-ns 0.9.2 → 0.9.3
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/.agignore +1 -1
- package/.github/workflows/ci.yml +38 -38
- package/=template.pyj +5 -5
- package/CHANGELOG.md +19 -0
- package/HACKING.md +103 -103
- package/LICENSE +24 -24
- package/PYTHON_GAPS.md +420 -0
- package/README.md +153 -29
- package/TODO.md +16 -118
- package/add-toc-to-readme +2 -2
- package/bin/export +75 -75
- package/bin/rapydscript +70 -70
- package/bin/web-repl-export +102 -102
- package/build +2 -2
- package/language-service/index.js +237 -8
- package/memory/project_string_impl.md +43 -0
- package/package.json +1 -1
- package/publish.py +37 -37
- package/release/baselib-plain-pretty.js +248 -38
- package/release/baselib-plain-ugly.js +8 -8
- package/release/compiler.js +778 -277
- package/release/signatures.json +30 -30
- package/session.vim +4 -4
- package/setup.cfg +2 -2
- package/src/ast.pyj +4 -1
- package/src/baselib-builtins.pyj +56 -2
- package/src/baselib-containers.pyj +2 -0
- package/src/baselib-errors.pyj +7 -3
- package/src/baselib-internal.pyj +51 -6
- package/src/baselib-str.pyj +5 -3
- package/src/compiler.pyj +36 -36
- package/src/errors.pyj +30 -30
- package/src/lib/aes.pyj +646 -646
- package/src/lib/asyncio.pyj +534 -0
- package/src/lib/base64.pyj +399 -0
- package/src/lib/bisect.pyj +73 -0
- package/src/lib/collections.pyj +1 -1
- package/src/lib/copy.pyj +120 -120
- package/src/lib/csv.pyj +494 -0
- package/src/lib/elementmaker.pyj +83 -83
- package/src/lib/encodings.pyj +126 -126
- package/src/lib/gettext.pyj +569 -569
- package/src/lib/heapq.pyj +98 -0
- package/src/lib/html.pyj +382 -0
- package/src/lib/http/__init__.pyj +98 -0
- package/src/lib/http/client.pyj +304 -0
- package/src/lib/http/cookies.pyj +236 -0
- package/src/lib/itertools.pyj +580 -580
- package/src/lib/logging.pyj +672 -0
- package/src/lib/math.pyj +193 -193
- package/src/lib/operator.pyj +11 -11
- package/src/lib/pythonize.pyj +20 -20
- package/src/lib/random.pyj +118 -118
- package/src/lib/react.pyj +74 -74
- package/src/lib/string.pyj +357 -0
- package/src/lib/textwrap.pyj +329 -0
- package/src/lib/traceback.pyj +63 -63
- package/src/lib/urllib/__init__.pyj +14 -0
- package/src/lib/urllib/error.pyj +66 -0
- package/src/lib/urllib/parse.pyj +475 -0
- package/src/lib/urllib/request.pyj +86 -0
- package/src/lib/uuid.pyj +77 -77
- package/src/monaco-language-service/analyzer.js +5 -2
- package/src/monaco-language-service/completions.js +26 -0
- package/src/monaco-language-service/diagnostics.js +202 -3
- package/src/monaco-language-service/dts.js +550 -550
- package/src/monaco-language-service/scope.js +1 -0
- package/src/output/comments.pyj +45 -45
- package/src/output/exceptions.pyj +201 -201
- package/src/output/functions.pyj +152 -6
- package/src/output/jsx.pyj +164 -164
- package/src/output/loops.pyj +17 -2
- package/src/output/modules.pyj +1 -1
- package/src/output/operators.pyj +15 -0
- package/src/output/stream.pyj +0 -1
- package/src/output/treeshake.pyj +182 -182
- package/src/output/utils.pyj +72 -72
- package/src/parse.pyj +80 -17
- package/src/string_interpolation.pyj +72 -72
- package/src/tokenizer.pyj +1 -1
- package/src/unicode_aliases.pyj +576 -576
- package/src/utils.pyj +192 -192
- package/test/_import_one.pyj +37 -37
- package/test/_import_two/__init__.pyj +11 -11
- package/test/_import_two/level2/deep.pyj +4 -4
- package/test/_import_two/other.pyj +6 -6
- package/test/_import_two/sub.pyj +13 -13
- package/test/aes_vectors.pyj +421 -421
- package/test/annotations.pyj +80 -80
- package/test/async_generators.pyj +144 -0
- package/test/asyncio.pyj +307 -0
- package/test/base64.pyj +202 -0
- package/test/bisect.pyj +178 -0
- package/test/csv.pyj +405 -0
- package/test/decorators.pyj +77 -77
- package/test/docstrings.pyj +39 -39
- package/test/elementmaker_test.pyj +45 -45
- package/test/float_special.pyj +64 -0
- package/test/functions.pyj +151 -151
- package/test/generators.pyj +41 -41
- package/test/generic.pyj +370 -370
- package/test/heapq.pyj +174 -0
- package/test/html.pyj +212 -0
- package/test/http.pyj +259 -0
- package/test/imports.pyj +79 -72
- package/test/internationalization.pyj +73 -73
- package/test/lint.pyj +164 -164
- package/test/logging.pyj +356 -0
- package/test/long.pyj +130 -0
- package/test/loops.pyj +85 -85
- package/test/numpy.pyj +734 -734
- package/test/parenthesized_with.pyj +141 -0
- package/test/python_compat.pyj +3 -5
- package/test/python_modulo.pyj +76 -0
- package/test/python_modulo_off.pyj +21 -0
- package/test/repl.pyj +121 -121
- package/test/scoped_flags.pyj +76 -76
- package/test/str.pyj +14 -0
- package/test/string.pyj +245 -0
- package/test/textwrap.pyj +172 -0
- package/test/type_display.pyj +48 -0
- package/test/type_enforcement.pyj +164 -0
- package/test/unit/index.js +14 -6
- package/test/unit/language-service-completions.js +119 -0
- package/test/unit/language-service-dts.js +543 -543
- package/test/unit/language-service-hover.js +455 -455
- package/test/unit/language-service-scope.js +32 -0
- package/test/unit/language-service.js +127 -3
- package/test/unit/run-language-service.js +17 -3
- package/test/unit/web-repl.js +2094 -29
- package/test/urllib.pyj +193 -0
- package/tools/compile.js +1 -1
- package/tools/compiler.d.ts +367 -367
- package/tools/completer.js +131 -131
- package/tools/embedded_compiler.js +7 -7
- package/tools/gettext.js +185 -185
- package/tools/ini.js +65 -65
- package/tools/msgfmt.js +187 -187
- package/tools/repl.js +223 -223
- package/tools/test.js +118 -118
- package/tools/utils.js +128 -128
- package/tools/web_repl.js +95 -95
- package/try +41 -41
- package/web-repl/env.js +196 -196
- package/web-repl/index.html +163 -163
- package/web-repl/main.js +1 -1
- package/web-repl/prism.css +139 -139
- package/web-repl/prism.js +113 -113
- package/web-repl/rapydscript.js +224 -224
- package/web-repl/sha1.js +25 -25
- package/test/omit_function_metadata.pyj +0 -20
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
let ρσ_len;
|
|
1
|
+
let ρσ_len, ρσ_NoneType, ρσ_js_builtin_names;
|
|
2
2
|
function ρσ_bool(val) {
|
|
3
3
|
if (val === null || val === undefined) return false;
|
|
4
4
|
var ρσ_bool_t = typeof val;
|
|
@@ -65,13 +65,25 @@ if (!ρσ_int.__argnames__) Object.defineProperties(ρσ_int, {
|
|
|
65
65
|
|
|
66
66
|
ρσ_int.__name__ = "int";
|
|
67
67
|
function ρσ_float(val) {
|
|
68
|
-
var ans;
|
|
68
|
+
var ans, s;
|
|
69
69
|
if (typeof val === "number") {
|
|
70
70
|
ans = val;
|
|
71
71
|
} else {
|
|
72
72
|
ans = parseFloat(val);
|
|
73
73
|
}
|
|
74
74
|
if (isNaN(ans)) {
|
|
75
|
+
if (typeof val === "string") {
|
|
76
|
+
s = val.trim().toLowerCase();
|
|
77
|
+
if (s === "inf" || s === "+inf" || s === "infinity" || s === "+infinity") {
|
|
78
|
+
return Infinity;
|
|
79
|
+
}
|
|
80
|
+
if (s === "-inf" || s === "-infinity") {
|
|
81
|
+
return -Infinity;
|
|
82
|
+
}
|
|
83
|
+
if (s === "nan" || s === "+nan" || s === "-nan") {
|
|
84
|
+
return NaN;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
75
87
|
throw new ValueError(ρσ_list_add("Could not convert string to float: ", arguments[0]));
|
|
76
88
|
}
|
|
77
89
|
return ans;
|
|
@@ -82,6 +94,58 @@ if (!ρσ_float.__argnames__) Object.defineProperties(ρσ_float, {
|
|
|
82
94
|
});
|
|
83
95
|
|
|
84
96
|
ρσ_float.__name__ = "float";
|
|
97
|
+
function ρσ_long(val, base) {
|
|
98
|
+
var t, b;
|
|
99
|
+
t = typeof val;
|
|
100
|
+
if (t === "bigint") {
|
|
101
|
+
return val;
|
|
102
|
+
}
|
|
103
|
+
if (t === "boolean") {
|
|
104
|
+
return BigInt(val ? 1 : 0);
|
|
105
|
+
}
|
|
106
|
+
if (t === "number") {
|
|
107
|
+
if (!Number.isInteger(val)) {
|
|
108
|
+
throw new TypeError("long() can't convert non-integer float to long");
|
|
109
|
+
}
|
|
110
|
+
try { return BigInt(val); } catch(e) { throw new ValueError("long() argument out of range: " + val); };
|
|
111
|
+
}
|
|
112
|
+
if (t === "string") {
|
|
113
|
+
b = (base !== null && base !== undefined) ? base : 10;
|
|
114
|
+
var ρσ_ls = val.trim();
|
|
115
|
+
try {
|
|
116
|
+
if (b === 16) {
|
|
117
|
+
if (ρσ_ls.slice(0, 2).toLowerCase() !== "0x") {
|
|
118
|
+
ρσ_ls = "0x" + ρσ_ls;
|
|
119
|
+
}
|
|
120
|
+
return BigInt(ρσ_ls);
|
|
121
|
+
} else if (b === 2) {
|
|
122
|
+
if (ρσ_ls.slice(0, 2).toLowerCase() !== "0b") {
|
|
123
|
+
ρσ_ls = "0b" + ρσ_ls;
|
|
124
|
+
}
|
|
125
|
+
return BigInt(ρσ_ls);
|
|
126
|
+
} else if (b === 8) {
|
|
127
|
+
if (ρσ_ls.slice(0, 2).toLowerCase() !== "0o") {
|
|
128
|
+
ρσ_ls = "0o" + ρσ_ls;
|
|
129
|
+
}
|
|
130
|
+
return BigInt(ρσ_ls);
|
|
131
|
+
} else {
|
|
132
|
+
return BigInt(ρσ_ls);
|
|
133
|
+
}
|
|
134
|
+
} catch (ρσ_Exception) {
|
|
135
|
+
ρσ_last_exception = ρσ_Exception;
|
|
136
|
+
{
|
|
137
|
+
throw new ValueError(ρσ_list_add(ρσ_list_add(ρσ_list_add("Invalid literal for long() with base ", b), ": "), val));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
throw new TypeError(ρσ_list_add(ρσ_list_add("long() argument must be a string, a number, or a boolean, not '", t), "'"));
|
|
142
|
+
};
|
|
143
|
+
if (!ρσ_long.__argnames__) Object.defineProperties(ρσ_long, {
|
|
144
|
+
__argnames__ : {value: ["val", "base"]},
|
|
145
|
+
__module__ : {value: "__main__"}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
ρσ_long.__name__ = "long";
|
|
85
149
|
function ρσ_arraylike_creator() {
|
|
86
150
|
var names;
|
|
87
151
|
names = "Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" ");
|
|
@@ -214,7 +278,7 @@ if (!ρσ_round.__argnames__) Object.defineProperties(ρσ_round, {
|
|
|
214
278
|
|
|
215
279
|
function ρσ_bin(x) {
|
|
216
280
|
var ans;
|
|
217
|
-
if (typeof x !== "number" || x
|
|
281
|
+
if (typeof x !== "number" || ρσ_op_mod_ns(x, 1) !== 0) {
|
|
218
282
|
throw new TypeError("integer required");
|
|
219
283
|
}
|
|
220
284
|
ans = x.toString(2);
|
|
@@ -232,7 +296,7 @@ if (!ρσ_bin.__argnames__) Object.defineProperties(ρσ_bin, {
|
|
|
232
296
|
|
|
233
297
|
function ρσ_hex(x) {
|
|
234
298
|
var ans;
|
|
235
|
-
if (typeof x !== "number" || x
|
|
299
|
+
if (typeof x !== "number" || ρσ_op_mod_ns(x, 1) !== 0) {
|
|
236
300
|
throw new TypeError("integer required");
|
|
237
301
|
}
|
|
238
302
|
ans = x.toString(16);
|
|
@@ -670,7 +734,7 @@ function ρσ_pow(x, y, z) {
|
|
|
670
734
|
var ans;
|
|
671
735
|
ans = Math.pow(x, y);
|
|
672
736
|
if (z !== undefined) {
|
|
673
|
-
ans
|
|
737
|
+
ans = ρσ_op_mod_ns(ans, z);
|
|
674
738
|
}
|
|
675
739
|
return ans;
|
|
676
740
|
};
|
|
@@ -679,8 +743,40 @@ if (!ρσ_pow.__argnames__) Object.defineProperties(ρσ_pow, {
|
|
|
679
743
|
__module__ : {value: "__main__"}
|
|
680
744
|
});
|
|
681
745
|
|
|
746
|
+
ρσ_NoneType = {"__name__": "NoneType"};
|
|
747
|
+
ρσ_NoneType.toString = (function() {
|
|
748
|
+
var ρσ_anonfunc = function () {
|
|
749
|
+
return "<class 'NoneType'>";
|
|
750
|
+
};
|
|
751
|
+
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
|
|
752
|
+
__module__ : {value: "__main__"}
|
|
753
|
+
});
|
|
754
|
+
return ρσ_anonfunc;
|
|
755
|
+
})();
|
|
756
|
+
ρσ_js_builtin_names = {"Number": "float", "String": "str", "Boolean": "bool", "Array": "list", "Object": "object", "Function": "function", "RegExp": "RegExp", "Date": "datetime", "Map": "dict", "Set": "set", "Uint8Array": "bytes"};
|
|
682
757
|
function ρσ_type(x) {
|
|
683
|
-
|
|
758
|
+
var c, n;
|
|
759
|
+
if (x === null || x === undefined) {
|
|
760
|
+
return ρσ_NoneType;
|
|
761
|
+
}
|
|
762
|
+
c = x.constructor;
|
|
763
|
+
if (!c) {
|
|
764
|
+
return ρσ_NoneType;
|
|
765
|
+
}
|
|
766
|
+
if (!Object.prototype.hasOwnProperty.call(c, "__ρσ_ts")) {
|
|
767
|
+
n = c.__name__ || ρσ_js_builtin_names[ρσ_bound_index(c.name, ρσ_js_builtin_names)] || c.name || "object";
|
|
768
|
+
c.toString = (function() {
|
|
769
|
+
var ρσ_anonfunc = function () {
|
|
770
|
+
return ρσ_list_add(ρσ_list_add("<class '", n), "'>");
|
|
771
|
+
};
|
|
772
|
+
if (!ρσ_anonfunc.__module__) Object.defineProperties(ρσ_anonfunc, {
|
|
773
|
+
__module__ : {value: "__main__"}
|
|
774
|
+
});
|
|
775
|
+
return ρσ_anonfunc;
|
|
776
|
+
})();
|
|
777
|
+
c.__ρσ_ts = true;
|
|
778
|
+
}
|
|
779
|
+
return c;
|
|
684
780
|
};
|
|
685
781
|
if (!ρσ_type.__argnames__) Object.defineProperties(ρσ_type, {
|
|
686
782
|
__argnames__ : {value: ["x"]},
|
|
@@ -729,14 +825,14 @@ function ρσ_hash(obj) {
|
|
|
729
825
|
}
|
|
730
826
|
return ρσ_h;
|
|
731
827
|
};
|
|
732
|
-
if (obj.__hash__ === null) throw new TypeError("unhashable type: '" + (obj.constructor && obj.constructor.name ? obj.constructor.name : "object") + "'");
|
|
828
|
+
if (obj.__hash__ === null) throw new TypeError("unhashable type: \'" + (obj.constructor && obj.constructor.name ? obj.constructor.name : "object") + "\'");
|
|
733
829
|
if (typeof obj.__hash__ === "function") return obj.__hash__();
|
|
734
|
-
if (Array.isArray(obj)) throw new TypeError("unhashable type: 'list'");
|
|
735
|
-
if (typeof ρσ_set === "function" && obj instanceof ρσ_set) throw new TypeError("unhashable type: 'set'");
|
|
736
|
-
if (typeof Set === "function" && obj instanceof Set) throw new TypeError("unhashable type: 'set'");
|
|
737
|
-
if (typeof ρσ_dict === "function" && obj instanceof ρσ_dict) throw new TypeError("unhashable type: 'dict'");
|
|
738
|
-
if (typeof Map === "function" && obj instanceof Map) throw new TypeError("unhashable type: 'dict'");
|
|
739
|
-
if (!obj.constructor || obj.constructor === Object) throw new TypeError("unhashable type: 'dict'");
|
|
830
|
+
if (Array.isArray(obj)) throw new TypeError("unhashable type: \'list\'");
|
|
831
|
+
if (typeof ρσ_set === "function" && obj instanceof ρσ_set) throw new TypeError("unhashable type: \'set\'");
|
|
832
|
+
if (typeof Set === "function" && obj instanceof Set) throw new TypeError("unhashable type: \'set\'");
|
|
833
|
+
if (typeof ρσ_dict === "function" && obj instanceof ρσ_dict) throw new TypeError("unhashable type: \'dict\'");
|
|
834
|
+
if (typeof Map === "function" && obj instanceof Map) throw new TypeError("unhashable type: \'dict\'");
|
|
835
|
+
if (!obj.constructor || obj.constructor === Object) throw new TypeError("unhashable type: \'dict\'");
|
|
740
836
|
if (obj.ρσ_object_id === undefined) obj.ρσ_object_id = ++ρσ_hash_id_counter;
|
|
741
837
|
return obj.ρσ_object_id;
|
|
742
838
|
};
|
|
@@ -1480,7 +1576,7 @@ Object.defineProperty(ρσ_complex.prototype, "__class__", {get: function() { re
|
|
|
1480
1576
|
|
|
1481
1577
|
ρσ_complex.__name__ = "complex";
|
|
1482
1578
|
var abs = ρσ_abs, max = ρσ_max.bind(Math.max), min = ρσ_max.bind(Math.min), bool = ρσ_bool, type = ρσ_type;
|
|
1483
|
-
var float = ρσ_float, int = ρσ_int, complex = ρσ_complex, arraylike = ρσ_arraylike_creator(), ρσ_arraylike = arraylike;
|
|
1579
|
+
var float = ρσ_float, int = ρσ_int, long = ρσ_long, complex = ρσ_complex, arraylike = ρσ_arraylike_creator(), ρσ_arraylike = arraylike;
|
|
1484
1580
|
var id = ρσ_id, get_module = ρσ_get_module, pow = ρσ_pow, divmod = ρσ_divmod, __import__ = ρσ__import__;
|
|
1485
1581
|
var dir = ρσ_dir, ord = ρσ_ord, chr = ρσ_chr, bin = ρσ_bin, hex = ρσ_hex, callable = ρσ_callable, round = ρσ_round;
|
|
1486
1582
|
var enumerate = ρσ_enumerate, iter = ρσ_iter, reversed = ρσ_reversed, len = ρσ_len;
|
|
@@ -1936,7 +2032,7 @@ if (!ρσ_bytes.prototype.decode.__argnames__) Object.defineProperties(ρσ_byte
|
|
|
1936
2032
|
ρσ_bytes.fromhex = function fromhex(s) {
|
|
1937
2033
|
var data, val;
|
|
1938
2034
|
s = s.replace(/ /g, "");
|
|
1939
|
-
if (s.length
|
|
2035
|
+
if (ρσ_op_mod_ns(s.length, 2) !== 0) {
|
|
1940
2036
|
throw new ValueError("non-hexadecimal number found in fromhex() arg");
|
|
1941
2037
|
}
|
|
1942
2038
|
data = ρσ_list_decorate([]);
|
|
@@ -3640,6 +3736,7 @@ if (!ρσ_set_wrap.__argnames__) Object.defineProperties(ρσ_set_wrap, {
|
|
|
3640
3736
|
__module__ : {value: "__main__"}
|
|
3641
3737
|
});
|
|
3642
3738
|
|
|
3739
|
+
ρσ_set.__name__ = "set";
|
|
3643
3740
|
var set = ρσ_set, set_wrap = ρσ_set_wrap;
|
|
3644
3741
|
function ρσ_frozenset(iterable) {
|
|
3645
3742
|
var ans, s, iterator, result, keys;
|
|
@@ -4565,6 +4662,7 @@ if (!ρσ_dict_wrap.__argnames__) Object.defineProperties(ρσ_dict_wrap, {
|
|
|
4565
4662
|
__module__ : {value: "__main__"}
|
|
4566
4663
|
});
|
|
4567
4664
|
|
|
4665
|
+
ρσ_dict.__name__ = "dict";
|
|
4568
4666
|
var dict = ρσ_dict, dict_wrap = ρσ_dict_wrap;
|
|
4569
4667
|
|
|
4570
4668
|
function ρσ_kwargs_to_dict(kw) {
|
|
@@ -4629,6 +4727,7 @@ var ρσ_json_parse = function(text, reviver) {
|
|
|
4629
4727
|
return JSON.parse(text, dict_reviver);
|
|
4630
4728
|
};;// }}}
|
|
4631
4729
|
var NameError = ReferenceError;
|
|
4730
|
+
var _ρσ_NativeError = Error;
|
|
4632
4731
|
function Exception() {
|
|
4633
4732
|
if (!(this instanceof Exception)) return new Exception(...arguments);
|
|
4634
4733
|
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
|
|
@@ -4638,7 +4737,7 @@ function Exception() {
|
|
|
4638
4737
|
Exception.prototype.__init__ = function __init__(message) {
|
|
4639
4738
|
var self = this;
|
|
4640
4739
|
self.message = message;
|
|
4641
|
-
self.stack = (
|
|
4740
|
+
self.stack = _ρσ_NativeError().stack;
|
|
4642
4741
|
self.name = self.constructor.name;
|
|
4643
4742
|
};
|
|
4644
4743
|
if (!Exception.prototype.__init__.__argnames__) Object.defineProperties(Exception.prototype.__init__, {
|
|
@@ -4700,65 +4799,95 @@ Object.defineProperty(AttributeError.prototype, "__class__", {get: function() {
|
|
|
4700
4799
|
|
|
4701
4800
|
if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(AttributeError);
|
|
4702
4801
|
|
|
4802
|
+
function LookupError() {
|
|
4803
|
+
if (!(this instanceof LookupError)) return new LookupError(...arguments);
|
|
4804
|
+
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
|
|
4805
|
+
LookupError.prototype.__init__.apply(this, arguments);
|
|
4806
|
+
}
|
|
4807
|
+
ρσ_extends(LookupError, Exception);
|
|
4808
|
+
LookupError.prototype.__init__ = function __init__ () {
|
|
4809
|
+
Exception.prototype.__init__ && Exception.prototype.__init__.apply(this, arguments);
|
|
4810
|
+
};
|
|
4811
|
+
LookupError.prototype.__repr__ = function __repr__ () {
|
|
4812
|
+
if(Exception.prototype.__repr__) return Exception.prototype.__repr__.call(this);
|
|
4813
|
+
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
|
|
4814
|
+
};
|
|
4815
|
+
LookupError.prototype.__str__ = function __str__ () {
|
|
4816
|
+
if(Exception.prototype.__str__) return Exception.prototype.__str__.call(this);
|
|
4817
|
+
return this.__repr__();
|
|
4818
|
+
};
|
|
4819
|
+
LookupError.prototype.__format__ = function __format__ () {
|
|
4820
|
+
if(Exception.prototype.__format__) return Exception.prototype.__format__.call(this, arguments[0]);
|
|
4821
|
+
if (!arguments[0]) return this.__str__();
|
|
4822
|
+
throw new TypeError("unsupported format specification");
|
|
4823
|
+
};
|
|
4824
|
+
Object.defineProperty(LookupError.prototype, "__bases__", {value: [Exception]});
|
|
4825
|
+
LookupError.__name__ = "LookupError";
|
|
4826
|
+
LookupError.__qualname__ = "LookupError";
|
|
4827
|
+
LookupError.__module__ = "__main__";
|
|
4828
|
+
Object.defineProperty(LookupError.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
|
|
4829
|
+
|
|
4830
|
+
if (typeof Exception.__init_subclass__ === "function") Exception.__init_subclass__.call(LookupError);
|
|
4831
|
+
|
|
4703
4832
|
function IndexError() {
|
|
4704
4833
|
if (!(this instanceof IndexError)) return new IndexError(...arguments);
|
|
4705
4834
|
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
|
|
4706
4835
|
IndexError.prototype.__init__.apply(this, arguments);
|
|
4707
4836
|
}
|
|
4708
|
-
ρσ_extends(IndexError,
|
|
4837
|
+
ρσ_extends(IndexError, LookupError);
|
|
4709
4838
|
IndexError.prototype.__init__ = function __init__ () {
|
|
4710
|
-
|
|
4839
|
+
LookupError.prototype.__init__ && LookupError.prototype.__init__.apply(this, arguments);
|
|
4711
4840
|
};
|
|
4712
4841
|
IndexError.prototype.__repr__ = function __repr__ () {
|
|
4713
|
-
if(
|
|
4842
|
+
if(LookupError.prototype.__repr__) return LookupError.prototype.__repr__.call(this);
|
|
4714
4843
|
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
|
|
4715
4844
|
};
|
|
4716
4845
|
IndexError.prototype.__str__ = function __str__ () {
|
|
4717
|
-
if(
|
|
4846
|
+
if(LookupError.prototype.__str__) return LookupError.prototype.__str__.call(this);
|
|
4718
4847
|
return this.__repr__();
|
|
4719
4848
|
};
|
|
4720
4849
|
IndexError.prototype.__format__ = function __format__ () {
|
|
4721
|
-
if(
|
|
4850
|
+
if(LookupError.prototype.__format__) return LookupError.prototype.__format__.call(this, arguments[0]);
|
|
4722
4851
|
if (!arguments[0]) return this.__str__();
|
|
4723
4852
|
throw new TypeError("unsupported format specification");
|
|
4724
4853
|
};
|
|
4725
|
-
Object.defineProperty(IndexError.prototype, "__bases__", {value: [
|
|
4854
|
+
Object.defineProperty(IndexError.prototype, "__bases__", {value: [LookupError]});
|
|
4726
4855
|
IndexError.__name__ = "IndexError";
|
|
4727
4856
|
IndexError.__qualname__ = "IndexError";
|
|
4728
4857
|
IndexError.__module__ = "__main__";
|
|
4729
4858
|
Object.defineProperty(IndexError.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
|
|
4730
4859
|
|
|
4731
|
-
if (typeof
|
|
4860
|
+
if (typeof LookupError.__init_subclass__ === "function") LookupError.__init_subclass__.call(IndexError);
|
|
4732
4861
|
|
|
4733
4862
|
function KeyError() {
|
|
4734
4863
|
if (!(this instanceof KeyError)) return new KeyError(...arguments);
|
|
4735
4864
|
if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
|
|
4736
4865
|
KeyError.prototype.__init__.apply(this, arguments);
|
|
4737
4866
|
}
|
|
4738
|
-
ρσ_extends(KeyError,
|
|
4867
|
+
ρσ_extends(KeyError, LookupError);
|
|
4739
4868
|
KeyError.prototype.__init__ = function __init__ () {
|
|
4740
|
-
|
|
4869
|
+
LookupError.prototype.__init__ && LookupError.prototype.__init__.apply(this, arguments);
|
|
4741
4870
|
};
|
|
4742
4871
|
KeyError.prototype.__repr__ = function __repr__ () {
|
|
4743
|
-
if(
|
|
4872
|
+
if(LookupError.prototype.__repr__) return LookupError.prototype.__repr__.call(this);
|
|
4744
4873
|
return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
|
|
4745
4874
|
};
|
|
4746
4875
|
KeyError.prototype.__str__ = function __str__ () {
|
|
4747
|
-
if(
|
|
4876
|
+
if(LookupError.prototype.__str__) return LookupError.prototype.__str__.call(this);
|
|
4748
4877
|
return this.__repr__();
|
|
4749
4878
|
};
|
|
4750
4879
|
KeyError.prototype.__format__ = function __format__ () {
|
|
4751
|
-
if(
|
|
4880
|
+
if(LookupError.prototype.__format__) return LookupError.prototype.__format__.call(this, arguments[0]);
|
|
4752
4881
|
if (!arguments[0]) return this.__str__();
|
|
4753
4882
|
throw new TypeError("unsupported format specification");
|
|
4754
4883
|
};
|
|
4755
|
-
Object.defineProperty(KeyError.prototype, "__bases__", {value: [
|
|
4884
|
+
Object.defineProperty(KeyError.prototype, "__bases__", {value: [LookupError]});
|
|
4756
4885
|
KeyError.__name__ = "KeyError";
|
|
4757
4886
|
KeyError.__qualname__ = "KeyError";
|
|
4758
4887
|
KeyError.__module__ = "__main__";
|
|
4759
4888
|
Object.defineProperty(KeyError.prototype, "__class__", {get: function() { return this.constructor; }, configurable: true});
|
|
4760
4889
|
|
|
4761
|
-
if (typeof
|
|
4890
|
+
if (typeof LookupError.__init_subclass__ === "function") LookupError.__init_subclass__.call(KeyError);
|
|
4762
4891
|
|
|
4763
4892
|
function ValueError() {
|
|
4764
4893
|
if (!(this instanceof ValueError)) return new ValueError(...arguments);
|
|
@@ -5167,7 +5296,7 @@ function ρσ_eslice(arr, step, start, end) {
|
|
|
5167
5296
|
}
|
|
5168
5297
|
arr = arr.slice(start, end).filter((function() {
|
|
5169
5298
|
var ρσ_anonfunc = function (e, i) {
|
|
5170
|
-
return i
|
|
5299
|
+
return ρσ_op_mod_ns(i, step) === 0;
|
|
5171
5300
|
};
|
|
5172
5301
|
if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
|
|
5173
5302
|
__argnames__ : {value: ["e", "i"]},
|
|
@@ -5652,6 +5781,9 @@ function ρσ_arith_type_name(v) {
|
|
|
5652
5781
|
if (t === "boolean") {
|
|
5653
5782
|
return "bool";
|
|
5654
5783
|
}
|
|
5784
|
+
if (t === "bigint") {
|
|
5785
|
+
return "long";
|
|
5786
|
+
}
|
|
5655
5787
|
if (t === "number") {
|
|
5656
5788
|
return (Number.isInteger(v)) ? "int" : "float";
|
|
5657
5789
|
}
|
|
@@ -5687,6 +5819,9 @@ function ρσ_op_add(a, b) {
|
|
|
5687
5819
|
if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
|
|
5688
5820
|
return a + b;
|
|
5689
5821
|
}
|
|
5822
|
+
if (ta === "bigint" && tb === "bigint") {
|
|
5823
|
+
return a + b;
|
|
5824
|
+
}
|
|
5690
5825
|
if ((ta === "string" || a instanceof String) && (tb === "string" || b instanceof String)) {
|
|
5691
5826
|
return a + b;
|
|
5692
5827
|
}
|
|
@@ -5710,6 +5845,9 @@ function ρσ_op_sub(a, b) {
|
|
|
5710
5845
|
if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
|
|
5711
5846
|
return a - b;
|
|
5712
5847
|
}
|
|
5848
|
+
if (ta === "bigint" && tb === "bigint") {
|
|
5849
|
+
return a - b;
|
|
5850
|
+
}
|
|
5713
5851
|
throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for -: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
|
|
5714
5852
|
};
|
|
5715
5853
|
if (!ρσ_op_sub.__argnames__) Object.defineProperties(ρσ_op_sub, {
|
|
@@ -5750,6 +5888,9 @@ function ρσ_op_mul(a, b) {
|
|
|
5750
5888
|
if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
|
|
5751
5889
|
return a * b;
|
|
5752
5890
|
}
|
|
5891
|
+
if (ta === "bigint" && tb === "bigint") {
|
|
5892
|
+
return a * b;
|
|
5893
|
+
}
|
|
5753
5894
|
throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for *: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
|
|
5754
5895
|
};
|
|
5755
5896
|
if (!ρσ_op_mul.__argnames__) Object.defineProperties(ρσ_op_mul, {
|
|
@@ -5770,6 +5911,9 @@ function ρσ_op_truediv(a, b) {
|
|
|
5770
5911
|
if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
|
|
5771
5912
|
return a / b;
|
|
5772
5913
|
}
|
|
5914
|
+
if (ta === "bigint" && tb === "bigint") {
|
|
5915
|
+
throw new TypeError("unsupported operand type(s) for /: 'long' and 'long' — use // for integer division of long values");
|
|
5916
|
+
}
|
|
5773
5917
|
throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for /: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
|
|
5774
5918
|
};
|
|
5775
5919
|
if (!ρσ_op_truediv.__argnames__) Object.defineProperties(ρσ_op_truediv, {
|
|
@@ -5790,6 +5934,9 @@ function ρσ_op_floordiv(a, b) {
|
|
|
5790
5934
|
if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
|
|
5791
5935
|
return Math.floor(a / b);
|
|
5792
5936
|
}
|
|
5937
|
+
if (ta === "bigint" && tb === "bigint") {
|
|
5938
|
+
var ρσ_bq = a / b, ρσ_br = a % b; if (ρσ_br !== 0n && (ρσ_br < 0n) !== (b < 0n)) { return ρσ_bq - 1n; } return ρσ_bq;;
|
|
5939
|
+
}
|
|
5793
5940
|
throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for //: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
|
|
5794
5941
|
};
|
|
5795
5942
|
if (!ρσ_op_floordiv.__argnames__) Object.defineProperties(ρσ_op_floordiv, {
|
|
@@ -5808,7 +5955,10 @@ function ρσ_op_mod(a, b) {
|
|
|
5808
5955
|
ta = typeof a;
|
|
5809
5956
|
tb = typeof b;
|
|
5810
5957
|
if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
|
|
5811
|
-
|
|
5958
|
+
var ρσ_mr = a % b; if (ρσ_mr !== 0 && (ρσ_mr < 0) !== (b < 0)) { return ρσ_mr + Number(b); } return ρσ_mr;;
|
|
5959
|
+
}
|
|
5960
|
+
if (ta === "bigint" && tb === "bigint") {
|
|
5961
|
+
var ρσ_mr = a % b; if (ρσ_mr !== 0n && (ρσ_mr < 0n) !== (b < 0n)) { return ρσ_mr + b; } return ρσ_mr;;
|
|
5812
5962
|
}
|
|
5813
5963
|
throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for %: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
|
|
5814
5964
|
};
|
|
@@ -5830,6 +5980,12 @@ function ρσ_op_pow(a, b) {
|
|
|
5830
5980
|
if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
|
|
5831
5981
|
return Math.pow(a, b);
|
|
5832
5982
|
}
|
|
5983
|
+
if (ta === "bigint" && tb === "bigint") {
|
|
5984
|
+
if (b < 0n) {
|
|
5985
|
+
throw new ValueError("negative exponent not supported for long values");
|
|
5986
|
+
}
|
|
5987
|
+
return a ** b;
|
|
5988
|
+
}
|
|
5833
5989
|
throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for **: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
|
|
5834
5990
|
};
|
|
5835
5991
|
if (!ρσ_op_pow.__argnames__) Object.defineProperties(ρσ_op_pow, {
|
|
@@ -5844,6 +6000,9 @@ function ρσ_op_and(a, b) {
|
|
|
5844
6000
|
if (b !== null && typeof b.__rand__ === "function") {
|
|
5845
6001
|
return b.__rand__(a);
|
|
5846
6002
|
}
|
|
6003
|
+
if (typeof a === "bigint" !== (typeof b === "bigint")) {
|
|
6004
|
+
throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for &: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
|
|
6005
|
+
}
|
|
5847
6006
|
return a & b;
|
|
5848
6007
|
};
|
|
5849
6008
|
if (!ρσ_op_and.__argnames__) Object.defineProperties(ρσ_op_and, {
|
|
@@ -5858,6 +6017,9 @@ function ρσ_op_or(a, b) {
|
|
|
5858
6017
|
if (b !== null && typeof b.__ror__ === "function") {
|
|
5859
6018
|
return b.__ror__(a);
|
|
5860
6019
|
}
|
|
6020
|
+
if (typeof a === "bigint" !== (typeof b === "bigint")) {
|
|
6021
|
+
throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for |: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
|
|
6022
|
+
}
|
|
5861
6023
|
return a | b;
|
|
5862
6024
|
};
|
|
5863
6025
|
if (!ρσ_op_or.__argnames__) Object.defineProperties(ρσ_op_or, {
|
|
@@ -5872,6 +6034,9 @@ function ρσ_op_xor(a, b) {
|
|
|
5872
6034
|
if (b !== null && typeof b.__rxor__ === "function") {
|
|
5873
6035
|
return b.__rxor__(a);
|
|
5874
6036
|
}
|
|
6037
|
+
if (typeof a === "bigint" !== (typeof b === "bigint")) {
|
|
6038
|
+
throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for ^: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
|
|
6039
|
+
}
|
|
5875
6040
|
return a ^ b;
|
|
5876
6041
|
};
|
|
5877
6042
|
if (!ρσ_op_xor.__argnames__) Object.defineProperties(ρσ_op_xor, {
|
|
@@ -5886,6 +6051,9 @@ function ρσ_op_lshift(a, b) {
|
|
|
5886
6051
|
if (b !== null && typeof b.__rlshift__ === "function") {
|
|
5887
6052
|
return b.__rlshift__(a);
|
|
5888
6053
|
}
|
|
6054
|
+
if (typeof a === "bigint" !== (typeof b === "bigint")) {
|
|
6055
|
+
throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for <<: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
|
|
6056
|
+
}
|
|
5889
6057
|
return a << b;
|
|
5890
6058
|
};
|
|
5891
6059
|
if (!ρσ_op_lshift.__argnames__) Object.defineProperties(ρσ_op_lshift, {
|
|
@@ -5900,6 +6068,9 @@ function ρσ_op_rshift(a, b) {
|
|
|
5900
6068
|
if (b !== null && typeof b.__rrshift__ === "function") {
|
|
5901
6069
|
return b.__rrshift__(a);
|
|
5902
6070
|
}
|
|
6071
|
+
if (typeof a === "bigint" !== (typeof b === "bigint")) {
|
|
6072
|
+
throw new TypeError(ρσ_list_add(ρσ_list_add(ρσ_list_add(ρσ_list_add("unsupported operand type(s) for >>: '", ρσ_arith_type_name(a)), "' and '"), ρσ_arith_type_name(b)), "'"));
|
|
6073
|
+
}
|
|
5903
6074
|
return a >> b;
|
|
5904
6075
|
};
|
|
5905
6076
|
if (!ρσ_op_rshift.__argnames__) Object.defineProperties(ρσ_op_rshift, {
|
|
@@ -5934,6 +6105,9 @@ function ρσ_op_lt(a, b) {
|
|
|
5934
6105
|
if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
|
|
5935
6106
|
return a < b;
|
|
5936
6107
|
}
|
|
6108
|
+
if (ta === "bigint" && tb === "bigint") {
|
|
6109
|
+
return a < b;
|
|
6110
|
+
}
|
|
5937
6111
|
if ((ta === "string" || a instanceof String) && (tb === "string" || b instanceof String)) {
|
|
5938
6112
|
return a < b;
|
|
5939
6113
|
}
|
|
@@ -5971,6 +6145,9 @@ function ρσ_op_le(a, b) {
|
|
|
5971
6145
|
if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
|
|
5972
6146
|
return a <= b;
|
|
5973
6147
|
}
|
|
6148
|
+
if (ta === "bigint" && tb === "bigint") {
|
|
6149
|
+
return a <= b;
|
|
6150
|
+
}
|
|
5974
6151
|
if ((ta === "string" || a instanceof String) && (tb === "string" || b instanceof String)) {
|
|
5975
6152
|
return a <= b;
|
|
5976
6153
|
}
|
|
@@ -5997,6 +6174,9 @@ function ρσ_op_gt(a, b) {
|
|
|
5997
6174
|
if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
|
|
5998
6175
|
return a > b;
|
|
5999
6176
|
}
|
|
6177
|
+
if (ta === "bigint" && tb === "bigint") {
|
|
6178
|
+
return a > b;
|
|
6179
|
+
}
|
|
6000
6180
|
if ((ta === "string" || a instanceof String) && (tb === "string" || b instanceof String)) {
|
|
6001
6181
|
return a > b;
|
|
6002
6182
|
}
|
|
@@ -6023,6 +6203,9 @@ function ρσ_op_ge(a, b) {
|
|
|
6023
6203
|
if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
|
|
6024
6204
|
return a >= b;
|
|
6025
6205
|
}
|
|
6206
|
+
if (ta === "bigint" && tb === "bigint") {
|
|
6207
|
+
return a >= b;
|
|
6208
|
+
}
|
|
6026
6209
|
if ((ta === "string" || a instanceof String) && (tb === "string" || b instanceof String)) {
|
|
6027
6210
|
return a >= b;
|
|
6028
6211
|
}
|
|
@@ -6322,6 +6505,9 @@ function ρσ_op_floordiv_ns(a, b) {
|
|
|
6322
6505
|
if (b !== null && typeof b.__rfloordiv__ === "function") {
|
|
6323
6506
|
return b.__rfloordiv__(a);
|
|
6324
6507
|
}
|
|
6508
|
+
if (typeof a === "bigint" && typeof b === "bigint") {
|
|
6509
|
+
var ρσ_bq = a / b, ρσ_br = a % b; if (ρσ_br !== 0n && (ρσ_br < 0n) !== (b < 0n)) { return ρσ_bq - 1n; } return ρσ_bq;;
|
|
6510
|
+
}
|
|
6325
6511
|
return Math.floor(a / b);
|
|
6326
6512
|
};
|
|
6327
6513
|
if (!ρσ_op_floordiv_ns.__argnames__) Object.defineProperties(ρσ_op_floordiv_ns, {
|
|
@@ -6330,12 +6516,21 @@ if (!ρσ_op_floordiv_ns.__argnames__) Object.defineProperties(ρσ_op_floordiv_
|
|
|
6330
6516
|
});
|
|
6331
6517
|
|
|
6332
6518
|
function ρσ_op_mod_ns(a, b) {
|
|
6519
|
+
var ta, tb;
|
|
6333
6520
|
if (a !== null && typeof a.__mod__ === "function") {
|
|
6334
6521
|
return a.__mod__(b);
|
|
6335
6522
|
}
|
|
6336
6523
|
if (b !== null && typeof b.__rmod__ === "function") {
|
|
6337
6524
|
return b.__rmod__(a);
|
|
6338
6525
|
}
|
|
6526
|
+
ta = typeof a;
|
|
6527
|
+
tb = typeof b;
|
|
6528
|
+
if ((ta === "number" || ta === "boolean") && (tb === "number" || tb === "boolean")) {
|
|
6529
|
+
var ρσ_mr = a % b; if (ρσ_mr !== 0 && (ρσ_mr < 0) !== (b < 0)) { return ρσ_mr + Number(b); } return ρσ_mr;;
|
|
6530
|
+
}
|
|
6531
|
+
if (ta === "bigint" && tb === "bigint") {
|
|
6532
|
+
var ρσ_mr = a % b; if (ρσ_mr !== 0n && (ρσ_mr < 0n) !== (b < 0n)) { return ρσ_mr + b; } return ρσ_mr;;
|
|
6533
|
+
}
|
|
6339
6534
|
return a % b;
|
|
6340
6535
|
};
|
|
6341
6536
|
if (!ρσ_op_mod_ns.__argnames__) Object.defineProperties(ρσ_op_mod_ns, {
|
|
@@ -6350,6 +6545,9 @@ function ρσ_op_pow_ns(a, b) {
|
|
|
6350
6545
|
if (b !== null && typeof b.__rpow__ === "function") {
|
|
6351
6546
|
return b.__rpow__(a);
|
|
6352
6547
|
}
|
|
6548
|
+
if (typeof a === "bigint" && typeof b === "bigint") {
|
|
6549
|
+
return a ** b;
|
|
6550
|
+
}
|
|
6353
6551
|
return Math.pow(a, b);
|
|
6354
6552
|
};
|
|
6355
6553
|
if (!ρσ_op_pow_ns.__argnames__) Object.defineProperties(ρσ_op_pow_ns, {
|
|
@@ -6541,15 +6739,24 @@ function ρσ_instanceof() {
|
|
|
6541
6739
|
if ((q === Array || q === ρσ_list_constructor) && Array.isArray(obj)) {
|
|
6542
6740
|
return true;
|
|
6543
6741
|
}
|
|
6742
|
+
if (q === ρσ_tuple_constructor && Array.isArray(obj)) {
|
|
6743
|
+
return true;
|
|
6744
|
+
}
|
|
6544
6745
|
if (q === ρσ_str && (typeof obj === "string" || obj instanceof String)) {
|
|
6545
6746
|
return true;
|
|
6546
6747
|
}
|
|
6748
|
+
if (q === ρσ_bool && (typeof obj === "boolean" || obj instanceof Boolean)) {
|
|
6749
|
+
return true;
|
|
6750
|
+
}
|
|
6547
6751
|
if (q === ρσ_int && typeof obj === "number" && Number.isInteger(obj)) {
|
|
6548
6752
|
return true;
|
|
6549
6753
|
}
|
|
6550
6754
|
if (q === ρσ_float && typeof obj === "number" && !Number.isInteger(obj)) {
|
|
6551
6755
|
return true;
|
|
6552
6756
|
}
|
|
6757
|
+
if (q === ρσ_long && typeof obj === "bigint") {
|
|
6758
|
+
return true;
|
|
6759
|
+
}
|
|
6553
6760
|
if (bases.length > 1) {
|
|
6554
6761
|
for (var c = 1; c < bases.length; c++) {
|
|
6555
6762
|
cls = bases[(typeof c === "number" && c < 0) ? bases.length + c : c];
|
|
@@ -7008,6 +7215,9 @@ function ρσ_str(x) {
|
|
|
7008
7215
|
if (x === undefined) {
|
|
7009
7216
|
return "undefined";
|
|
7010
7217
|
}
|
|
7218
|
+
if (typeof x === "bigint") {
|
|
7219
|
+
return String(x);
|
|
7220
|
+
}
|
|
7011
7221
|
ans = x;
|
|
7012
7222
|
if (typeof x.__str__ === "function") {
|
|
7013
7223
|
ans = x.__str__();
|
|
@@ -7970,13 +8180,13 @@ define_str_func("replace", (function() {
|
|
|
7970
8180
|
var ρσ_anonfunc = function (old, repl, count) {
|
|
7971
8181
|
var string, pos, idx;
|
|
7972
8182
|
string = this;
|
|
7973
|
-
if (
|
|
8183
|
+
if (old instanceof RegExp) {
|
|
7974
8184
|
return ρσ_orig_replace(string, old, repl);
|
|
7975
8185
|
}
|
|
7976
|
-
if (count
|
|
8186
|
+
if (count === 0) {
|
|
7977
8187
|
return string;
|
|
7978
8188
|
}
|
|
7979
|
-
count = count
|
|
8189
|
+
count = (count > 0) ? count : Number.MAX_VALUE;
|
|
7980
8190
|
pos = 0;
|
|
7981
8191
|
while (count > 0) {
|
|
7982
8192
|
count -= 1;
|
|
@@ -8010,7 +8220,7 @@ define_str_func("split", (function() {
|
|
|
8010
8220
|
for (var i = 0; i < ans.length; i++) {
|
|
8011
8221
|
if (parts.length >= ρσ_list_add(maxsplit, 1)) {
|
|
8012
8222
|
extra = ρσ_list_iadd(extra, ans[(typeof i === "number" && i < 0) ? ans.length + i : i]);
|
|
8013
|
-
} else if (i
|
|
8223
|
+
} else if (ρσ_op_mod_ns(i, 2) === 0) {
|
|
8014
8224
|
parts.push(ans[(typeof i === "number" && i < 0) ? ans.length + i : i]);
|
|
8015
8225
|
}
|
|
8016
8226
|
}
|
|
@@ -8122,7 +8332,7 @@ define_str_func("splitlines", (function() {
|
|
|
8122
8332
|
parts = split(this, /((?:\r?\n)|\r)/);
|
|
8123
8333
|
ans = [];
|
|
8124
8334
|
for (var i = 0; i < parts.length; i++) {
|
|
8125
|
-
if (i
|
|
8335
|
+
if (ρσ_op_mod_ns(i, 2) === 0) {
|
|
8126
8336
|
ans.push(parts[(typeof i === "number" && i < 0) ? parts.length + i : i]);
|
|
8127
8337
|
} else {
|
|
8128
8338
|
ans[ans.length-1] = ρσ_list_iadd(ans[ans.length-1], parts[(typeof i === "number" && i < 0) ? parts.length + i : i]);
|
|
@@ -8186,7 +8396,7 @@ define_str_func("expandtabs", (function() {
|
|
|
8186
8396
|
ch = string[(typeof i === "number" && i < 0) ? string.length + i : i];
|
|
8187
8397
|
if (ch === "\t") {
|
|
8188
8398
|
if (tabsize > 0) {
|
|
8189
|
-
spaces = tabsize - col
|
|
8399
|
+
spaces = tabsize - ρσ_op_mod_ns(col, tabsize);
|
|
8190
8400
|
ans = ρσ_list_iadd(ans, new Array(spaces + 1).join(" "));
|
|
8191
8401
|
col = ρσ_list_iadd(col, spaces);
|
|
8192
8402
|
}
|