@magnusopera/fscript 0.77.1 → 0.78.1
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/dist/FScript.Language/Ast.js +2 -2
- package/dist/FScript.Language/BuiltinFunctions.js +68 -67
- package/dist/FScript.Language/BuiltinSignatures.js +7 -7
- package/dist/FScript.Language/BuiltinTypes.js +3 -3
- package/dist/FScript.Language/Error.js +2 -2
- package/dist/FScript.Language/Eval.js +305 -213
- package/dist/FScript.Language/IncludeResolver.js +97 -79
- package/dist/FScript.Language/Interactive.js +149 -0
- package/dist/FScript.Language/Lexer.js +77 -77
- package/dist/FScript.Language/Parser.js +274 -272
- package/dist/FScript.Language/Pretty.js +4 -4
- package/dist/FScript.Language/Span.js +2 -2
- package/dist/FScript.Language/Token.js +59 -2
- package/dist/FScript.Language/TypeInfer.js +452 -348
- package/dist/FScript.Language/Types.js +22 -10
- package/dist/FScript.Language/Value.js +3 -2
- package/dist/Library.js +91 -79
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Array.js +36 -35
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Async.js +52 -23
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/AsyncBuilder.js +23 -2
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/BigInt.js +33 -32
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/BitConverter.js +2 -2
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/CHANGELOG.md +80 -1
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Date.js +8 -15
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/DateOffset.js +8 -17
- package/dist/fable_modules/fable-library-js.5.13.0/Directory.js +11 -0
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Double.js +8 -2
- package/dist/fable_modules/fable-library-js.5.13.0/Environment.js +3 -0
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Event.js +10 -1
- package/dist/fable_modules/fable-library-js.5.13.0/File.js +27 -0
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/List.js +35 -21
- package/dist/fable_modules/fable-library-js.5.13.0/Long.js +38 -0
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/MailboxProcessor.js +11 -5
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Map.js +8 -4
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/MutableMap.js +2 -2
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/MutableSet.js +1 -1
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Observable.js +5 -3
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Option.js +1 -18
- package/dist/fable_modules/fable-library-js.5.13.0/Path.js +31 -0
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Reflection.js +13 -3
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/RegExp.js +53 -24
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Seq.js +109 -22
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Set.js +16 -3
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/String.js +28 -1
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/System.js +15 -9
- package/dist/fable_modules/fable-library-js.5.13.0/Task.js +27 -0
- package/dist/fable_modules/fable-library-js.5.13.0/TaskBuilder.js +72 -0
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Types.js +12 -12
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Util.js +15 -3
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/package.json +1 -1
- package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/quotation.js +25 -8
- package/dist/fable_modules/project_cracked.json +1 -1
- package/package.json +1 -1
- package/dist/fable_modules/fable-library-js.5.2.0/Long.js +0 -47
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Boolean.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Char.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Choice.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/CollectionUtil.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/ConditionalWeakTable.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/DateOnly.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Decimal.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Encoding.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/FSharp.Collections.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/FSharp.Core.CompilerServices.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/FSharp.Core.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Global.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Guid.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Int32.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/MapUtil.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Native.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Numeric.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/README.md +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Random.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Range.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Result.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Seq2.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/System.Collections.Generic.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/System.Text.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/TimeOnly.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/TimeSpan.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Timer.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Unicode.13.0.0.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Uri.js +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/big.d.ts +0 -0
- /package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/lib/big.js +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { zero } from "./Task.js";
|
|
2
|
+
export class TaskBuilder {
|
|
3
|
+
Bind(computation, binder) {
|
|
4
|
+
return computation.then(binder);
|
|
5
|
+
}
|
|
6
|
+
Combine(computation1, computation2) {
|
|
7
|
+
return computation1.then(computation2);
|
|
8
|
+
}
|
|
9
|
+
Delay(generator) {
|
|
10
|
+
return generator;
|
|
11
|
+
}
|
|
12
|
+
For(sequence, body) {
|
|
13
|
+
const iter = sequence[Symbol.iterator]();
|
|
14
|
+
let cur = iter.next();
|
|
15
|
+
return this.While(() => !cur.done, this.Delay(() => {
|
|
16
|
+
const res = body(cur.value);
|
|
17
|
+
cur = iter.next();
|
|
18
|
+
return res;
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
Return(value) {
|
|
22
|
+
return Promise.resolve(value);
|
|
23
|
+
}
|
|
24
|
+
ReturnFrom(computation) {
|
|
25
|
+
return computation;
|
|
26
|
+
}
|
|
27
|
+
TryFinally(computation, compensation) {
|
|
28
|
+
try {
|
|
29
|
+
return computation().finally(compensation);
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
compensation();
|
|
33
|
+
return Promise.reject(e);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
TryWith(computation, catchHandler) {
|
|
37
|
+
try {
|
|
38
|
+
return computation().catch(catchHandler);
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
try {
|
|
42
|
+
return catchHandler(e);
|
|
43
|
+
}
|
|
44
|
+
catch (e2) {
|
|
45
|
+
return Promise.reject(e2);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
Using(resource, binder) {
|
|
50
|
+
return this.TryFinally(() => binder(resource), () => resource.Dispose());
|
|
51
|
+
}
|
|
52
|
+
While(guard, computation) {
|
|
53
|
+
return (async () => {
|
|
54
|
+
while (guard()) {
|
|
55
|
+
await computation();
|
|
56
|
+
}
|
|
57
|
+
})();
|
|
58
|
+
}
|
|
59
|
+
Zero() {
|
|
60
|
+
return zero();
|
|
61
|
+
}
|
|
62
|
+
Run(computation) {
|
|
63
|
+
try {
|
|
64
|
+
return computation();
|
|
65
|
+
}
|
|
66
|
+
catch (e) {
|
|
67
|
+
return Promise.reject(e);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export const singleton = new TaskBuilder();
|
|
72
|
+
export function task() { return singleton; }
|
|
@@ -4,19 +4,25 @@ export function seqToString(self) {
|
|
|
4
4
|
let str = "[";
|
|
5
5
|
for (const x of self) {
|
|
6
6
|
if (count === 0) {
|
|
7
|
-
str +=
|
|
7
|
+
str += toStringQuoted(x);
|
|
8
8
|
}
|
|
9
9
|
else if (count === 100) {
|
|
10
10
|
str += "; ...";
|
|
11
11
|
break;
|
|
12
12
|
}
|
|
13
13
|
else {
|
|
14
|
-
str += "; " +
|
|
14
|
+
str += "; " + toStringQuoted(x);
|
|
15
15
|
}
|
|
16
16
|
count++;
|
|
17
17
|
}
|
|
18
18
|
return str + "]";
|
|
19
19
|
}
|
|
20
|
+
// Structured (%A-style) rendering of a value used as an element/field of a
|
|
21
|
+
// container. F#'s structured formatting (which records, unions, lists, etc.
|
|
22
|
+
// use in their ToString) quotes strings, e.g. `["a"; "b"]` and `{ Name = "John" }`.
|
|
23
|
+
function toStringQuoted(x, callStack = 0) {
|
|
24
|
+
return typeof x === "string" ? "\"" + x + "\"" : toString(x, callStack);
|
|
25
|
+
}
|
|
20
26
|
export function toString(x, callStack = 0) {
|
|
21
27
|
if (x != null && typeof x === "object") {
|
|
22
28
|
if (typeof x.toString === "function" && x.toString !== Object.prototype.toString) {
|
|
@@ -29,19 +35,13 @@ export function toString(x, callStack = 0) {
|
|
|
29
35
|
const cons = Object.getPrototypeOf(x)?.constructor;
|
|
30
36
|
return cons === Object && callStack < 10
|
|
31
37
|
// Same format as recordToString
|
|
32
|
-
? "{ " + Object.entries(x).map(([k, v]) => k + " = " +
|
|
38
|
+
? "{ " + Object.entries(x).map(([k, v]) => k + " = " + toStringQuoted(v, callStack + 1)).join("\n ") + " }"
|
|
33
39
|
: cons?.name ?? "";
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
42
|
return String(x);
|
|
37
43
|
}
|
|
38
44
|
export function unionToString(name, fields) {
|
|
39
|
-
function unionFieldToString(x) {
|
|
40
|
-
if (typeof x === "string") {
|
|
41
|
-
return '"' + x + '"';
|
|
42
|
-
}
|
|
43
|
-
return toString(x);
|
|
44
|
-
}
|
|
45
45
|
if (fields.length === 0) {
|
|
46
46
|
return name;
|
|
47
47
|
}
|
|
@@ -49,11 +49,11 @@ export function unionToString(name, fields) {
|
|
|
49
49
|
let fieldStr;
|
|
50
50
|
let withParens = true;
|
|
51
51
|
if (fields.length === 1) {
|
|
52
|
-
fieldStr =
|
|
52
|
+
fieldStr = toStringQuoted(fields[0]);
|
|
53
53
|
withParens = fieldStr.indexOf(" ") >= 0;
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
|
-
fieldStr = fields.map((x) =>
|
|
56
|
+
fieldStr = fields.map((x) => toStringQuoted(x)).join(", ");
|
|
57
57
|
}
|
|
58
58
|
return name + (withParens ? " (" : " ") + fieldStr + (withParens ? ")" : "");
|
|
59
59
|
}
|
|
@@ -111,7 +111,7 @@ function recordToJSON(self) {
|
|
|
111
111
|
return o;
|
|
112
112
|
}
|
|
113
113
|
function recordToString(self) {
|
|
114
|
-
return "{ " + Object.entries(self).map(([k, v]) => k + " = " +
|
|
114
|
+
return "{ " + Object.entries(self).map(([k, v]) => k + " = " + toStringQuoted(v)).join("\n ") + " }";
|
|
115
115
|
}
|
|
116
116
|
function recordGetHashCode(self) {
|
|
117
117
|
const hashes = Object.values(self).map((v) => structuralHash(v));
|
|
@@ -6,8 +6,9 @@ export const DateTimeKind = {
|
|
|
6
6
|
};
|
|
7
7
|
// Exception is intentionally not derived from Error, for performance reasons (see #2160)
|
|
8
8
|
export class Exception {
|
|
9
|
-
constructor(msg) {
|
|
9
|
+
constructor(msg, innerException) {
|
|
10
10
|
this.message = msg ?? "";
|
|
11
|
+
this.innerException = innerException;
|
|
11
12
|
}
|
|
12
13
|
toString() {
|
|
13
14
|
return this.message;
|
|
@@ -403,7 +404,18 @@ export function compareDates(x, y) {
|
|
|
403
404
|
return xtime === ytime ? 0 : (xtime < ytime ? -1 : 1);
|
|
404
405
|
}
|
|
405
406
|
export function comparePrimitives(x, y) {
|
|
406
|
-
|
|
407
|
+
if (x === y) {
|
|
408
|
+
return 0;
|
|
409
|
+
}
|
|
410
|
+
if (x < y) {
|
|
411
|
+
return -1;
|
|
412
|
+
}
|
|
413
|
+
if (x > y) {
|
|
414
|
+
return 1;
|
|
415
|
+
}
|
|
416
|
+
// Neither equal nor ordered: at least one operand is NaN.
|
|
417
|
+
// Match .NET Double.CompareTo: NaN equals NaN and is less than any other value.
|
|
418
|
+
return Number.isNaN(x) ? (Number.isNaN(y) ? 0 : -1) : 1;
|
|
407
419
|
}
|
|
408
420
|
export function compareArraysWith(x, y, comp) {
|
|
409
421
|
if (x == null) {
|
|
@@ -465,7 +477,7 @@ export function compare(x, y) {
|
|
|
465
477
|
return isArrayLike(y) ? compareArrays(x, y) : -1;
|
|
466
478
|
}
|
|
467
479
|
else if (typeof x !== "object") {
|
|
468
|
-
return x
|
|
480
|
+
return comparePrimitives(x, y);
|
|
469
481
|
}
|
|
470
482
|
else if (x instanceof Date) {
|
|
471
483
|
return y instanceof Date ? compareDates(x, y) : -1;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* and pattern matching helpers compatible with Fable's option convention
|
|
6
6
|
* (undefined = no match, value/tuple = match).
|
|
7
7
|
*/
|
|
8
|
+
import { ofArray } from "./List.js";
|
|
8
9
|
// ===================================================================
|
|
9
10
|
// Var: represents an F# quotation variable
|
|
10
11
|
// ===================================================================
|
|
@@ -74,11 +75,12 @@ export class ExprIfThenElse {
|
|
|
74
75
|
toJSON() { return ["IfThenElse", this.guard, this.thenExpr, this.elseExpr]; }
|
|
75
76
|
}
|
|
76
77
|
export class ExprCall {
|
|
77
|
-
constructor(instance, method, args) {
|
|
78
|
+
constructor(instance, method, args, declaringType = "") {
|
|
78
79
|
this.tag = "Call";
|
|
79
80
|
this.instance = instance;
|
|
80
81
|
this.method = method;
|
|
81
82
|
this.args = args;
|
|
83
|
+
this.declaringType = declaringType;
|
|
82
84
|
}
|
|
83
85
|
toJSON() { return ["Call", this.instance, this.method, this.args]; }
|
|
84
86
|
}
|
|
@@ -176,6 +178,10 @@ export class ExprVarSet {
|
|
|
176
178
|
export function mkValue(value, type) {
|
|
177
179
|
return new ExprValue(value, type);
|
|
178
180
|
}
|
|
181
|
+
export function mkNull(type) {
|
|
182
|
+
// A null-value node (no instance / null literal / empty option or list).
|
|
183
|
+
return new ExprValue(null, type);
|
|
184
|
+
}
|
|
179
185
|
export function mkVar(v) {
|
|
180
186
|
return new ExprVarExpr(v);
|
|
181
187
|
}
|
|
@@ -191,8 +197,8 @@ export function mkLet(v, value, body) {
|
|
|
191
197
|
export function mkIfThenElse(guard, thenExpr, elseExpr) {
|
|
192
198
|
return new ExprIfThenElse(guard, thenExpr, elseExpr);
|
|
193
199
|
}
|
|
194
|
-
export function mkCall(instance, method, args) {
|
|
195
|
-
return new ExprCall(instance, method, args);
|
|
200
|
+
export function mkCall(instance, method, args, declaringType = "") {
|
|
201
|
+
return new ExprCall(instance, method, args, declaringType);
|
|
196
202
|
}
|
|
197
203
|
export function mkSequential(first, second) {
|
|
198
204
|
return new ExprSequential(first, second);
|
|
@@ -273,10 +279,17 @@ export function isIfThenElse(expr) {
|
|
|
273
279
|
return undefined;
|
|
274
280
|
}
|
|
275
281
|
export function isCall(expr) {
|
|
276
|
-
if (expr instanceof ExprCall)
|
|
277
|
-
|
|
282
|
+
if (expr instanceof ExprCall) {
|
|
283
|
+
// "novalue" is the "no instance" sentinel, distinct from a genuine quoted null ("null").
|
|
284
|
+
const instance = (expr.instance instanceof ExprValue && expr.instance.type === "novalue") ? null : expr.instance;
|
|
285
|
+
// Must be a real FSharpList (not the raw array), same reasoning as isFieldGet below.
|
|
286
|
+
return [instance, expr.method, ofArray(expr.args)];
|
|
287
|
+
}
|
|
278
288
|
return undefined;
|
|
279
289
|
}
|
|
290
|
+
export function callDeclaringType(expr) {
|
|
291
|
+
return expr instanceof ExprCall ? expr.declaringType : "";
|
|
292
|
+
}
|
|
280
293
|
export function isSequential(expr) {
|
|
281
294
|
if (expr instanceof ExprSequential)
|
|
282
295
|
return [expr.first, expr.second];
|
|
@@ -303,8 +316,12 @@ export function isTupleGet(expr) {
|
|
|
303
316
|
return undefined;
|
|
304
317
|
}
|
|
305
318
|
export function isFieldGet(expr) {
|
|
306
|
-
|
|
307
|
-
|
|
319
|
+
// Third element mirrors PropertyGet's indexer-args slot, always empty here (never indexed).
|
|
320
|
+
// "novalue" is the "no instance" sentinel, distinct from a genuine quoted null ("null").
|
|
321
|
+
if (expr instanceof ExprFieldGet) {
|
|
322
|
+
const instance = (expr.expr instanceof ExprValue && expr.expr.type === "novalue") ? null : expr.expr;
|
|
323
|
+
return [instance, expr.fieldName, []];
|
|
324
|
+
}
|
|
308
325
|
return undefined;
|
|
309
326
|
}
|
|
310
327
|
// ===================================================================
|
|
@@ -555,7 +572,7 @@ export function substitute(expr, fn) {
|
|
|
555
572
|
return new ExprIfThenElse(sub(e.guard), sub(e.thenExpr), sub(e.elseExpr));
|
|
556
573
|
if (e instanceof ExprCall) {
|
|
557
574
|
const newInst = e.instance != null ? sub(e.instance) : e.instance;
|
|
558
|
-
return new ExprCall(newInst, e.method, e.args.map(sub));
|
|
575
|
+
return new ExprCall(newInst, e.method, e.args.map(sub), e.declaringType);
|
|
559
576
|
}
|
|
560
577
|
if (e instanceof ExprSequential)
|
|
561
578
|
return new ExprSequential(sub(e.first), sub(e.second));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"Version":"5.
|
|
1
|
+
{"Version":"5.13.0","FableOptions":{"TypedArrays":true,"ClampByteArrays":false,"Language":["JavaScript"],"Define":["FABLE_COMPILER","FABLE_COMPILER_5","FABLE_COMPILER_JAVASCRIPT"],"DebugMode":false,"OptimizeFSharpAst":false,"Verbosity":["Normal"],"FileExtension":".js","TriggeredByDependency":false,"NoReflection":false},"ProjectPath":"/home/runner/work/FScript/FScript/src/FScript.JavaScript/FScript.JavaScript.fsproj","SourcePaths":["/home/runner/work/FScript/FScript/src/FScript.Language/Span.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Error.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Token.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Ast.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Types.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Value.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Lexer.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Parser.fs","/home/runner/work/FScript/FScript/src/FScript.Language/IncludeResolver.fs","/home/runner/work/FScript/FScript/src/FScript.Language/BuiltinTypes.fs","/home/runner/work/FScript/FScript/src/FScript.Language/BuiltinSignatures.fs","/home/runner/work/FScript/FScript/src/FScript.Language/BuiltinFunctions.fs","/home/runner/work/FScript/FScript/src/FScript.Language/TypeInfer.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Eval.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Interactive.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Pretty.fs","/home/runner/work/FScript/FScript/src/FScript.Language/Library.fs","/home/runner/work/FScript/FScript/src/FScript.JavaScript/Library.fs"],"FSharpOptions":["--define:FABLE_COMPILER","--define:FABLE_COMPILER_5","--define:FABLE_COMPILER_JAVASCRIPT","--define:TRACE","--define:RELEASE","--define:NETSTANDARD","--define:NETSTANDARD2_1","--define:NETSTANDARD1_0_OR_GREATER","--define:NETSTANDARD1_1_OR_GREATER","--define:NETSTANDARD1_2_OR_GREATER","--define:NETSTANDARD1_3_OR_GREATER","--define:NETSTANDARD1_4_OR_GREATER","--define:NETSTANDARD1_5_OR_GREATER","--define:NETSTANDARD1_6_OR_GREATER","--define:NETSTANDARD2_0_OR_GREATER","--define:NETSTANDARD2_1_OR_GREATER","--define:NULLABLE","--langversion:preview","--nowarn:FS0988","--noframework","--nologo","--simpleresolution","--nocopyfsharpcore","--nowin32manifest","--warn:3","--fullpaths","--flaterrors","--optimize-","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.ValueTuple.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Threading.Thread.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Threading.Tasks.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Threading.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Text.RegularExpressions.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Text.Encoding.Extensions.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Text.Encoding.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Runtime.Numerics.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Runtime.InteropServices.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Runtime.Extensions.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Runtime.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Reflection.Primitives.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Reflection.Extensions.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Reflection.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Numerics.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Net.Requests.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.IO.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Globalization.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Diagnostics.Tracing.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Diagnostics.Tools.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Diagnostics.Debug.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Core.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Console.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.ComponentModel.TypeConverter.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.ComponentModel.Primitives.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.ComponentModel.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Collections.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/System.Collections.Concurrent.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/netstandard.dll","-r:/usr/share/dotnet/packs/NETStandard.Library.Ref/2.1.0/ref/netstandard2.1/mscorlib.dll","-r:/home/runner/.nuget/packages/fable.core/5.2.0/lib/netstandard2.0/Fable.Core.dll","-r:/home/runner/.nuget/packages/fable/5.13.0/tools/net10.0/any/FSharp.Core.dll"],"References":["/home/runner/work/FScript/FScript/src/FScript.Language/FScript.Language.fsproj"],"OutDir":["Some","/home/runner/work/FScript/FScript/src/FScript.JavaScript/dist"],"FableLibDir":"/home/runner/work/FScript/FScript/src/FScript.JavaScript/dist/fable_modules/fable-library-js.5.13.0","FableModulesDir":"/home/runner/work/FScript/FScript/src/FScript.JavaScript/dist/fable_modules","OutputType":["Library"],"TargetFramework":["Some","netstandard2.1"],"Exclude":[],"SourceMaps":false,"SourceMapsRoot":null,"TreatWarningsAsErrors":true}
|
package/package.json
CHANGED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { getPrefix, isValid } from "./Int32.js";
|
|
2
|
-
import { fromString } from "./BigInt.js";
|
|
3
|
-
import { Exception } from "./Util.js";
|
|
4
|
-
function getMaxValue(unsigned, radix, isNegative) {
|
|
5
|
-
switch (radix) {
|
|
6
|
-
case 2: return unsigned ?
|
|
7
|
-
"1111111111111111111111111111111111111111111111111111111111111111" :
|
|
8
|
-
(isNegative ? "1000000000000000000000000000000000000000000000000000000000000000"
|
|
9
|
-
: "111111111111111111111111111111111111111111111111111111111111111");
|
|
10
|
-
case 8: return unsigned ?
|
|
11
|
-
"1777777777777777777777" :
|
|
12
|
-
(isNegative ? "1000000000000000000000" : "777777777777777777777");
|
|
13
|
-
case 10: return unsigned ?
|
|
14
|
-
"18446744073709551615" :
|
|
15
|
-
(isNegative ? "9223372036854775808" : "9223372036854775807");
|
|
16
|
-
case 16: return unsigned ?
|
|
17
|
-
"FFFFFFFFFFFFFFFF" :
|
|
18
|
-
(isNegative ? "8000000000000000" : "7FFFFFFFFFFFFFFF");
|
|
19
|
-
default: throw new Exception("Invalid radix.");
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export function parse(str, style, unsigned, _bitsize, radix) {
|
|
23
|
-
const res = isValid(str, style, radix);
|
|
24
|
-
if (res != null) {
|
|
25
|
-
const lessOrEqual = (x, y) => {
|
|
26
|
-
const len = Math.max(x.length, y.length);
|
|
27
|
-
return x.padStart(len, "0") <= y.padStart(len, "0");
|
|
28
|
-
};
|
|
29
|
-
const isNegative = res.sign === "-";
|
|
30
|
-
const maxValue = getMaxValue(unsigned || res.radix !== 10, res.radix, isNegative);
|
|
31
|
-
if (lessOrEqual(res.digits.toUpperCase(), maxValue)) {
|
|
32
|
-
str = getPrefix(res.radix) + res.digits;
|
|
33
|
-
str = isNegative ? res.sign + str : str;
|
|
34
|
-
return fromString(str);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
throw new Exception(`The input string ${str} was not in a correct format.`);
|
|
38
|
-
}
|
|
39
|
-
export function tryParse(str, style, unsigned, bitsize, defValue) {
|
|
40
|
-
try {
|
|
41
|
-
defValue.contents = parse(str, style, unsigned, bitsize);
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
catch {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/CollectionUtil.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/FSharp.Collections.js
RENAMED
|
File without changes
|
|
File without changes
|
/package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/FSharp.Core.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/System.Text.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/fable_modules/{fable-library-js.5.2.0 → fable-library-js.5.13.0}/Unicode.13.0.0.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|