@magnusopera/fscript 0.86.2 → 0.86.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/dist/FScript.Language/BuiltinFunctions.js +81 -48
- package/dist/FScript.Language/Eval.js +47 -55
- package/dist/FScript.Language/Lexer.js +10 -2
- package/dist/FScript.Language/Parser.js +8 -8
- package/dist/FScript.Language/TaskSharingAnalysis.js +191 -181
- package/dist/FScript.Language/TypeInfer.js +182 -162
- package/package.json +1 -1
|
@@ -267,7 +267,7 @@ function readInterpolatedRaw(sourceName, src, i, line, col) {
|
|
|
267
267
|
return [(contentLen <= 0) ? "" : substring(src, start, contentLen), idx, cLine, cCol];
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
|
|
270
|
+
function tokenizeCore(sourceName, startLine, startColumn, src) {
|
|
271
271
|
const tokens = [];
|
|
272
272
|
const indentStack = [];
|
|
273
273
|
void (indentStack.push(0));
|
|
@@ -1058,7 +1058,15 @@ export function tokenizeWithSourceNameAndOrigin(sourceName, startLine, startColu
|
|
|
1058
1058
|
addToken(TokenKind.Dedent, mkSpan(sourceName, line, col, 1), tokens);
|
|
1059
1059
|
}
|
|
1060
1060
|
addToken(TokenKind.EOF, mkSpan(sourceName, line, col, 1), tokens);
|
|
1061
|
-
return
|
|
1061
|
+
return tokens;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
export function tokenizeArrayWithSourceNameAndOrigin(sourceName, startLine, startColumn, src) {
|
|
1065
|
+
return tokenizeCore(sourceName, startLine, startColumn, src).slice();
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
export function tokenizeWithSourceNameAndOrigin(sourceName, startLine, startColumn, src) {
|
|
1069
|
+
return toList(tokenizeCore(sourceName, startLine, startColumn, src));
|
|
1062
1070
|
}
|
|
1063
1071
|
|
|
1064
1072
|
export function tokenizeWithSourceName(sourceName, src) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { class_type } from "../fable_modules/fable-library-js.5.24.0/Reflection.js";
|
|
3
|
-
import {
|
|
3
|
+
import { item } from "../fable_modules/fable-library-js.5.24.0/Array.js";
|
|
4
4
|
import { equals } from "../fable_modules/fable-library-js.5.24.0/Util.js";
|
|
5
5
|
import { ParseException, ParseError } from "./Error.js";
|
|
6
6
|
import { TokenKind } from "./Token.js";
|
|
@@ -8,12 +8,12 @@ import { Span, SpanModule_merge } from "./Span.js";
|
|
|
8
8
|
import { substring, isNullOrWhiteSpace, concat, join, isNullOrEmpty } from "../fable_modules/fable-library-js.5.24.0/String.js";
|
|
9
9
|
import { isUpper } from "../fable_modules/fable-library-js.5.24.0/Char.js";
|
|
10
10
|
import { Ast_spanOfStmt, Attribute, MapEntry, Ast_spanOfExpr, InterpolatedPart, Expr, Ast_spanOfPattern, Pattern, Stmt, TypeDef, BackendImport, Param, TypeRef, Literal } from "./Ast.js";
|
|
11
|
-
import {
|
|
11
|
+
import { tokenizeArrayWithSourceNameAndOrigin } from "./Lexer.js";
|
|
12
12
|
import { addToSet } from "../fable_modules/fable-library-js.5.24.0/MapUtil.js";
|
|
13
13
|
import { foldBack as foldBack_1, toList } from "../fable_modules/fable-library-js.5.24.0/Seq.js";
|
|
14
|
+
import { singleton, foldBack, head as head_1, tail as tail_1, isEmpty, empty } from "../fable_modules/fable-library-js.5.24.0/List.js";
|
|
14
15
|
import { StringBuilder__Append_244C7CD6, StringBuilder__Clear, StringBuilder__get_Length, StringBuilder_$ctor } from "../fable_modules/fable-library-js.5.24.0/System.Text.js";
|
|
15
16
|
import { toString } from "../fable_modules/fable-library-js.5.24.0/Types.js";
|
|
16
|
-
import { item as item_1 } from "../fable_modules/fable-library-js.5.24.0/Array.js";
|
|
17
17
|
|
|
18
18
|
class TokenStream {
|
|
19
19
|
constructor(tokens) {
|
|
@@ -26,7 +26,7 @@ function TokenStream_$reflection() {
|
|
|
26
26
|
return class_type("FScript.Language.Parser.TokenStream", undefined, TokenStream);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
function TokenStream_$
|
|
29
|
+
function TokenStream_$ctor_Z317EFDB2(tokens) {
|
|
30
30
|
return new TokenStream(tokens);
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -173,8 +173,8 @@ function parseLiteral(t) {
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
function parseProgramWithSourceNameAndOrigin(sourceName, startLine, startColumn, src) {
|
|
176
|
-
const tokens =
|
|
177
|
-
const stream = TokenStream_$
|
|
176
|
+
const tokens = tokenizeArrayWithSourceNameAndOrigin(sourceName, startLine, startColumn, src);
|
|
177
|
+
const stream = TokenStream_$ctor_Z317EFDB2(tokens);
|
|
178
178
|
const consumeLayoutSeparators = () => {
|
|
179
179
|
let consumed = false;
|
|
180
180
|
let progress = true;
|
|
@@ -224,7 +224,7 @@ function parseProgramWithSourceNameAndOrigin(sourceName, startLine, startColumn,
|
|
|
224
224
|
let i_3 = tokenIndex_1 + 1;
|
|
225
225
|
let keepSearching_1 = true;
|
|
226
226
|
let foundSameLine_1 = false;
|
|
227
|
-
while (keepSearching_1 && (i_3 < length
|
|
227
|
+
while (keepSearching_1 && (i_3 < tokens.length)) {
|
|
228
228
|
const tok_1 = TokenStream__TokenAt_Z524259A4(stream, i_3);
|
|
229
229
|
const matchValue_2 = tok_1.Kind;
|
|
230
230
|
switch (matchValue_2.tag) {
|
|
@@ -2341,7 +2341,7 @@ function parseProgramWithSourceNameAndOrigin(sourceName, startLine, startColumn,
|
|
|
2341
2341
|
return new Stmt(/* SLet */ 2, [bindingName_1, toList(args_5), returnAnnotation_2, value_79, true, isExported, mkSpanFrom(letTok_1.Span, Ast_spanOfExpr(value_79))]);
|
|
2342
2342
|
}
|
|
2343
2343
|
else {
|
|
2344
|
-
const patternInput_4 =
|
|
2344
|
+
const patternInput_4 = item(bindings_2.length - 1, bindings_2);
|
|
2345
2345
|
return new Stmt(/* SLetRecGroup */ 4, [toList(bindings_2), isExported, mkSpanFrom(letTok_1.Span, patternInput_4[4])]);
|
|
2346
2346
|
}
|
|
2347
2347
|
}
|