@magnusopera/fscript 0.75.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +5 -0
  2. package/dist/FScript.Language/Ast.js +234 -0
  3. package/dist/FScript.Language/BuiltinFunctions.js +2039 -0
  4. package/dist/FScript.Language/BuiltinSignatures.js +24 -0
  5. package/dist/FScript.Language/BuiltinTypes.js +13 -0
  6. package/dist/FScript.Language/Error.js +74 -0
  7. package/dist/FScript.Language/Eval.js +2404 -0
  8. package/dist/FScript.Language/IncludeResolver.js +806 -0
  9. package/dist/FScript.Language/Lexer.js +1067 -0
  10. package/dist/FScript.Language/Library.js +28 -0
  11. package/dist/FScript.Language/Parser.js +2368 -0
  12. package/dist/FScript.Language/Pretty.js +115 -0
  13. package/dist/FScript.Language/Span.js +33 -0
  14. package/dist/FScript.Language/Token.js +32 -0
  15. package/dist/FScript.Language/TypeInfer.js +2561 -0
  16. package/dist/FScript.Language/Types.js +205 -0
  17. package/dist/FScript.Language/Value.js +91 -0
  18. package/dist/Library.js +732 -0
  19. package/dist/fable_modules/fable-library-js.5.2.0/Array.js +1347 -0
  20. package/dist/fable_modules/fable-library-js.5.2.0/Async.js +134 -0
  21. package/dist/fable_modules/fable-library-js.5.2.0/AsyncBuilder.js +183 -0
  22. package/dist/fable_modules/fable-library-js.5.2.0/BigInt.js +306 -0
  23. package/dist/fable_modules/fable-library-js.5.2.0/BitConverter.js +138 -0
  24. package/dist/fable_modules/fable-library-js.5.2.0/Boolean.js +22 -0
  25. package/dist/fable_modules/fable-library-js.5.2.0/CHANGELOG.md +234 -0
  26. package/dist/fable_modules/fable-library-js.5.2.0/Char.js +202 -0
  27. package/dist/fable_modules/fable-library-js.5.2.0/Choice.js +184 -0
  28. package/dist/fable_modules/fable-library-js.5.2.0/CollectionUtil.js +182 -0
  29. package/dist/fable_modules/fable-library-js.5.2.0/ConditionalWeakTable.js +21 -0
  30. package/dist/fable_modules/fable-library-js.5.2.0/Date.js +841 -0
  31. package/dist/fable_modules/fable-library-js.5.2.0/DateOffset.js +261 -0
  32. package/dist/fable_modules/fable-library-js.5.2.0/DateOnly.js +124 -0
  33. package/dist/fable_modules/fable-library-js.5.2.0/Decimal.js +238 -0
  34. package/dist/fable_modules/fable-library-js.5.2.0/Double.js +47 -0
  35. package/dist/fable_modules/fable-library-js.5.2.0/Encoding.js +185 -0
  36. package/dist/fable_modules/fable-library-js.5.2.0/Event.js +93 -0
  37. package/dist/fable_modules/fable-library-js.5.2.0/FSharp.Collections.js +45 -0
  38. package/dist/fable_modules/fable-library-js.5.2.0/FSharp.Core.CompilerServices.js +27 -0
  39. package/dist/fable_modules/fable-library-js.5.2.0/FSharp.Core.js +156 -0
  40. package/dist/fable_modules/fable-library-js.5.2.0/Global.js +29 -0
  41. package/dist/fable_modules/fable-library-js.5.2.0/Guid.js +161 -0
  42. package/dist/fable_modules/fable-library-js.5.2.0/Int32.js +135 -0
  43. package/dist/fable_modules/fable-library-js.5.2.0/List.js +1323 -0
  44. package/dist/fable_modules/fable-library-js.5.2.0/Long.js +47 -0
  45. package/dist/fable_modules/fable-library-js.5.2.0/MailboxProcessor.js +94 -0
  46. package/dist/fable_modules/fable-library-js.5.2.0/Map.js +1396 -0
  47. package/dist/fable_modules/fable-library-js.5.2.0/MapUtil.js +130 -0
  48. package/dist/fable_modules/fable-library-js.5.2.0/MutableMap.js +339 -0
  49. package/dist/fable_modules/fable-library-js.5.2.0/MutableSet.js +233 -0
  50. package/dist/fable_modules/fable-library-js.5.2.0/Native.js +14 -0
  51. package/dist/fable_modules/fable-library-js.5.2.0/Numeric.js +75 -0
  52. package/dist/fable_modules/fable-library-js.5.2.0/Observable.js +113 -0
  53. package/dist/fable_modules/fable-library-js.5.2.0/Option.js +104 -0
  54. package/dist/fable_modules/fable-library-js.5.2.0/README.md +3 -0
  55. package/dist/fable_modules/fable-library-js.5.2.0/Random.js +172 -0
  56. package/dist/fable_modules/fable-library-js.5.2.0/Range.js +45 -0
  57. package/dist/fable_modules/fable-library-js.5.2.0/Reflection.js +479 -0
  58. package/dist/fable_modules/fable-library-js.5.2.0/RegExp.js +141 -0
  59. package/dist/fable_modules/fable-library-js.5.2.0/Result.js +165 -0
  60. package/dist/fable_modules/fable-library-js.5.2.0/Seq.js +1417 -0
  61. package/dist/fable_modules/fable-library-js.5.2.0/Seq2.js +111 -0
  62. package/dist/fable_modules/fable-library-js.5.2.0/Set.js +1816 -0
  63. package/dist/fable_modules/fable-library-js.5.2.0/String.js +674 -0
  64. package/dist/fable_modules/fable-library-js.5.2.0/System.Collections.Generic.js +333 -0
  65. package/dist/fable_modules/fable-library-js.5.2.0/System.Text.js +200 -0
  66. package/dist/fable_modules/fable-library-js.5.2.0/System.js +283 -0
  67. package/dist/fable_modules/fable-library-js.5.2.0/TimeOnly.js +122 -0
  68. package/dist/fable_modules/fable-library-js.5.2.0/TimeSpan.js +180 -0
  69. package/dist/fable_modules/fable-library-js.5.2.0/Timer.js +67 -0
  70. package/dist/fable_modules/fable-library-js.5.2.0/Types.js +198 -0
  71. package/dist/fable_modules/fable-library-js.5.2.0/Unicode.13.0.0.js +4 -0
  72. package/dist/fable_modules/fable-library-js.5.2.0/Uri.js +165 -0
  73. package/dist/fable_modules/fable-library-js.5.2.0/Util.js +795 -0
  74. package/dist/fable_modules/fable-library-js.5.2.0/big.d.ts +338 -0
  75. package/dist/fable_modules/fable-library-js.5.2.0/lib/big.js +825 -0
  76. package/dist/fable_modules/fable-library-js.5.2.0/package.json +24 -0
  77. package/dist/fable_modules/fable-library-js.5.2.0/quotation.js +618 -0
  78. package/dist/fable_modules/project_cracked.json +1 -0
  79. package/package.json +36 -0
@@ -0,0 +1,115 @@
1
+
2
+ import { length, isEmpty, map, singleton, append } from "../fable_modules/fable-library-js.5.2.0/List.js";
3
+ import { concat, join, printf, toText, replace } from "../fable_modules/fable-library-js.5.2.0/String.js";
4
+ import { int64ToString } from "../fable_modules/fable-library-js.5.2.0/Util.js";
5
+ import { toList } from "../fable_modules/fable-library-js.5.2.0/Map.js";
6
+ import { Types_typeToString } from "./Types.js";
7
+
8
+ function closureParameters(firstArg, body) {
9
+ const loop = (acc_mut, expr_mut) => {
10
+ loop:
11
+ while (true) {
12
+ const acc = acc_mut, expr = expr_mut;
13
+ if (expr.tag === 4) {
14
+ acc_mut = append(acc, singleton(expr.fields[0].Name));
15
+ expr_mut = expr.fields[1];
16
+ continue loop;
17
+ }
18
+ else {
19
+ return acc;
20
+ }
21
+ break;
22
+ }
23
+ };
24
+ return loop(singleton(firstArg), body);
25
+ }
26
+
27
+ function escapeStringLiteral(value) {
28
+ return replace(replace(replace(replace(replace(value, "\\", "\\\\"), "\"", "\\\""), "\r", "\\r"), "\n", "\\n"), "\t", "\\t");
29
+ }
30
+
31
+ export function valueToString(v) {
32
+ switch (v.tag) {
33
+ case 1:
34
+ return int64ToString(v.fields[0]);
35
+ case 2:
36
+ return v.fields[0].toString();
37
+ case 3:
38
+ if (v.fields[0]) {
39
+ return "true";
40
+ }
41
+ else {
42
+ return "false";
43
+ }
44
+ case 4: {
45
+ const arg = escapeStringLiteral(v.fields[0]);
46
+ return toText(printf("\"%s\""))(arg);
47
+ }
48
+ case 5: {
49
+ const arg_1 = join(";", map(valueToString, v.fields[0]));
50
+ return toText(printf("[%s]"))(arg_1);
51
+ }
52
+ case 6: {
53
+ const arg_2 = join(", ", map(valueToString, v.fields[0]));
54
+ return toText(printf("(%s)"))(arg_2);
55
+ }
56
+ case 7: {
57
+ const arg_5 = join("; ", map((tupledArg) => {
58
+ const arg_4 = valueToString(tupledArg[1]);
59
+ return toText(printf("%s = %s"))(tupledArg[0])(arg_4);
60
+ }, toList(v.fields[0])));
61
+ return toText(printf("{ %s }"))(arg_5);
62
+ }
63
+ case 8: {
64
+ const arg_8 = join("; ", map((tupledArg_1) => {
65
+ let arg_6;
66
+ const key = tupledArg_1[0];
67
+ arg_6 = ((key.tag === 1) ? int64ToString(key.fields[0]) : concat("\"", escapeStringLiteral(key.fields[0]), "\""));
68
+ const arg_7 = valueToString(tupledArg_1[1]);
69
+ return toText(printf("%s => %s"))(arg_6)(arg_7);
70
+ }, toList(v.fields[0])));
71
+ return toText(printf("map { %s }"))(arg_8);
72
+ }
73
+ case 9:
74
+ if (v.fields[0] != null) {
75
+ const v_3 = v.fields[0];
76
+ const arg_9 = valueToString(v_3);
77
+ return toText(printf("Some %s"))(arg_9);
78
+ }
79
+ else {
80
+ return "None";
81
+ }
82
+ case 10:
83
+ if (v.fields[2] != null) {
84
+ const v_4 = v.fields[2];
85
+ const arg_11 = valueToString(v_4);
86
+ return toText(printf("%s %s"))(v.fields[1])(arg_11);
87
+ }
88
+ else {
89
+ return v.fields[1];
90
+ }
91
+ case 12: {
92
+ const arg_12 = Types_typeToString(v.fields[0]);
93
+ return toText(printf("<type %s>"))(arg_12);
94
+ }
95
+ case 13:
96
+ return "<task>";
97
+ case 14: {
98
+ const arg_13 = join(" ", closureParameters(v.fields[0], v.fields[1]));
99
+ return toText(printf("<fun %s>"))(arg_13);
100
+ }
101
+ case 11:
102
+ return toText(printf("<ctor %s>"))(v.fields[1]);
103
+ case 15:
104
+ if (isEmpty(v.fields[1])) {
105
+ return toText(printf("<extern %s>"))(v.fields[0].Name);
106
+ }
107
+ else {
108
+ const arg_17 = length(v.fields[1]) | 0;
109
+ return toText(printf("<extern %s (%d/%d)>"))(v.fields[0].Name)(arg_17)(v.fields[0].Arity);
110
+ }
111
+ default:
112
+ return "()";
113
+ }
114
+ }
115
+
@@ -0,0 +1,33 @@
1
+
2
+ import { Record } from "../fable_modules/fable-library-js.5.2.0/Types.js";
3
+ import { record_type, int32_type, option_type, string_type } from "../fable_modules/fable-library-js.5.2.0/Reflection.js";
4
+
5
+ export class Position extends Record {
6
+ constructor(File, Line, Column) {
7
+ super();
8
+ this.File = File;
9
+ this.Line = (Line | 0);
10
+ this.Column = (Column | 0);
11
+ }
12
+ }
13
+
14
+ export function Position_$reflection() {
15
+ return record_type("FScript.Language.Position", [], Position, () => [["File", option_type(string_type)], ["Line", int32_type], ["Column", int32_type]]);
16
+ }
17
+
18
+ export class Span extends Record {
19
+ constructor(Start, End) {
20
+ super();
21
+ this.Start = Start;
22
+ this.End = End;
23
+ }
24
+ }
25
+
26
+ export function Span_$reflection() {
27
+ return record_type("FScript.Language.Span", [], Span, () => [["Start", Position_$reflection()], ["End", Position_$reflection()]]);
28
+ }
29
+
30
+ export function SpanModule_merge(a, b) {
31
+ return new Span(a.Start, b.End);
32
+ }
33
+
@@ -0,0 +1,32 @@
1
+
2
+ import { Record, Union } from "../fable_modules/fable-library-js.5.2.0/Types.js";
3
+ import { record_type, union_type, bool_type, float64_type, int64_type, string_type } from "../fable_modules/fable-library-js.5.2.0/Reflection.js";
4
+ import { Span_$reflection } from "./Span.js";
5
+
6
+ export class TokenKind extends Union {
7
+ constructor(tag, fields) {
8
+ super();
9
+ this.tag = tag;
10
+ this.fields = fields;
11
+ }
12
+ cases() {
13
+ return ["EOF", "Newline", "Indent", "Dedent", "Ident", "IntLit", "FloatLit", "StringLit", "InterpString", "BoolLit", "Let", "Rec", "And", "Fun", "Match", "With", "When", "If", "Then", "Else", "Elif", "Raise", "For", "In", "Arrow", "Equals", "Bar", "LParen", "RParen", "LBracket", "RBracket", "LBracketBar", "BarRBracket", "Semicolon", "Comma", "Colon", "Dot", "RangeDots", "Hash", "Import", "As", "Include", "Module", "LBrace", "RBrace", "Type", "Typeof", "Nameof", "Of", "Plus", "Minus", "Star", "Slash", "Percent", "Less", "Greater", "LessEqual", "GreaterEqual", "AndAnd", "OrOr", "PipeForward", "Cons", "Append"];
14
+ }
15
+ }
16
+
17
+ export function TokenKind_$reflection() {
18
+ return union_type("FScript.Language.TokenKind", [], TokenKind, () => [[], [], [], [], [["Item", string_type]], [["Item", int64_type]], [["Item", float64_type]], [["Item", string_type]], [["Item", string_type]], [["Item", bool_type]], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []]);
19
+ }
20
+
21
+ export class Token extends Record {
22
+ constructor(Kind, Span) {
23
+ super();
24
+ this.Kind = Kind;
25
+ this.Span = Span;
26
+ }
27
+ }
28
+
29
+ export function Token_$reflection() {
30
+ return record_type("FScript.Language.Token", [], Token, () => [["Kind", TokenKind_$reflection()], ["Span", Span_$reflection()]]);
31
+ }
32
+