@eagleoutice/flowr 2.17.12 → 2.17.14
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/README.md +15 -15
- package/cli/repl/core.js +9 -27
- package/config.d.ts +1 -0
- package/config.js +4 -2
- package/data/r-datasets.generated.js +2 -2
- package/dataflow/environments/ambient-effect.d.ts +4 -0
- package/dataflow/environments/ambient-effect.js +5 -4
- package/dataflow/environments/ambient-state-name.d.ts +2 -2
- package/dataflow/environments/ambient-state-name.js +3 -3
- package/dataflow/environments/built-in-props.d.ts +5 -0
- package/dataflow/environments/default-builtin-config/base-functions.d.ts +1 -1
- package/dataflow/environments/default-builtin-config/base-functions.js +6 -2
- package/dataflow/environments/default-builtin-config/base-language.d.ts +12 -1
- package/dataflow/environments/default-builtin-config/base-language.js +3 -2
- package/dataflow/environments/default-builtin-config/guards.js +3 -1
- package/dataflow/environments/default-builtin-config/index.d.ts +12 -2
- package/dataflow/environments/default-builtin-config/misc-packages.d.ts +1 -1
- package/dataflow/environments/default-builtin-config/misc-packages.js +2 -0
- package/dataflow/environments/default-builtin-config/shared-configs.d.ts +24 -0
- package/dataflow/environments/default-builtin-config/shared-configs.js +8 -6
- package/dataflow/environments/pkg-name.d.ts +1 -0
- package/dataflow/eval/resolve/alias-tracking.js +11 -12
- package/dataflow/extractor.js +58 -0
- package/dataflow/fn/guards/built-in-guards.js +4 -4
- package/dataflow/fn/guards/call-contracts.js +8 -8
- package/dataflow/fn/guards/condition-grouping.js +4 -3
- package/dataflow/fn/guards/function-guards.js +103 -97
- package/dataflow/fn/guards/group-method-guards.js +10 -8
- package/dataflow/fn/guards/guard-claims.js +152 -128
- package/dataflow/fn/guards/guard-knowledge.js +19 -18
- package/dataflow/fn/guards/guard-term-syntax.js +13 -12
- package/dataflow/fn/guards/guard-term.d.ts +71 -0
- package/dataflow/fn/guards/guard-term.js +183 -75
- package/dataflow/graph/df-helper.d.ts +6 -6
- package/dataflow/graph/df-helper.js +1 -1
- package/dataflow/graph/graph.d.ts +9 -0
- package/dataflow/graph/graph.js +19 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +18 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +29 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-attach.js +2 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +6 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +9 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.d.ts +12 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +24 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +10 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +19 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +35 -3
- package/documentation/doc-readme.js +1 -2
- package/documentation/doc-util/doc-query.d.ts +1 -1
- package/documentation/doc-util/doc-query.js +4 -2
- package/documentation/wiki-interface.js +1 -0
- package/documentation/wiki-linter.d.ts +2 -0
- package/documentation/wiki-linter.js +7 -1
- package/documentation/wiki-query.js +28 -0
- package/linter/linter-format.d.ts +5 -1
- package/linter/linter-format.js +4 -0
- package/linter/linter-output.js +18 -16
- package/linter/linter-rules.d.ts +50 -0
- package/linter/linter-rules.js +5 -1
- package/linter/rules/notebook-cell-order.d.ts +43 -0
- package/linter/rules/notebook-cell-order.js +97 -0
- package/linter/rules/project-entry-point.d.ts +53 -0
- package/linter/rules/project-entry-point.js +62 -0
- package/linter/rules/undefined-symbol.d.ts +2 -0
- package/linter/rules/undefined-symbol.js +6 -1
- package/notebook/cell-graph.d.ts +23 -0
- package/notebook/cell-graph.js +48 -0
- package/notebook/cell-order-mermaid.d.ts +16 -0
- package/notebook/cell-order-mermaid.js +51 -0
- package/notebook/cell-order.d.ts +270 -0
- package/notebook/cell-order.js +1452 -0
- package/notebook/cell-split.d.ts +27 -0
- package/notebook/cell-split.js +99 -0
- package/package.json +1 -1
- package/project/context/flowr-analyzer-dependencies-context.d.ts +4 -0
- package/project/context/flowr-analyzer-files-context.d.ts +2 -0
- package/project/flowr-analyzer.js +5 -1
- package/project/plugins/file-plugins/files/cell-runner.d.ts +22 -0
- package/project/plugins/file-plugins/files/cell-runner.js +32 -0
- package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +4 -0
- package/project/plugins/file-plugins/files/flowr-jupyter-file.js +22 -6
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +22 -0
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +63 -7
- package/project/plugins/file-plugins/files/flowr-rsession-file.d.ts +2 -0
- package/project/plugins/file-plugins/files/flowr-rsession-file.js +2 -0
- package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +3 -5
- package/project/plugins/file-plugins/files/flowr-sweave-file.js +6 -0
- package/project/plugins/file-plugins/files/recorded-runs.d.ts +2 -0
- package/queries/catalog/aliases-query/aliases-query-executor.d.ts +6 -0
- package/queries/catalog/aliases-query/aliases-query-executor.js +108 -0
- package/queries/catalog/aliases-query/aliases-query-format.d.ts +21 -0
- package/queries/catalog/aliases-query/aliases-query-format.js +34 -0
- package/queries/catalog/cell-order-query/cell-order-query-format.d.ts +81 -0
- package/queries/catalog/cell-order-query/cell-order-query-format.js +82 -0
- package/queries/catalog/linter-query/linter-query-format.js +2 -1
- package/queries/query.d.ts +17 -2
- package/queries/query.js +6 -2
- package/queries/virtual-query/compound-query.d.ts +1 -1
- package/util/flowr-version.d.ts +1 -1
- package/util/flowr-version.js +2 -2
- package/util/mermaid/ast.js +4 -11
- package/util/mermaid/cfg.js +1 -2
- package/util/mermaid/dfg.d.ts +5 -0
- package/util/mermaid/dfg.js +23 -4
- package/util/mermaid/mermaid.d.ts +5 -0
- package/util/mermaid/mermaid.js +8 -0
- package/util/r-datasets.d.ts +2 -0
- package/util/r-datasets.js +3 -0
- package/util/text/playground-link.d.ts +2 -2
- package/util/text/playground-link.js +2 -2
|
@@ -75,7 +75,7 @@ function reasonsOf(clauses, idMap, ownerOf = () => undefined) {
|
|
|
75
75
|
const brief = briefOf(node, message, idMap);
|
|
76
76
|
const called = model_1.RNode.ownLexeme(node);
|
|
77
77
|
const reads = (0, guard_claims_1.readingOf)(requires, (0, guard_knowledge_1.defaultGuardFacts)(), called === undefined ? undefined : (0, group_generics_1.s3GroupGenericOf)(called));
|
|
78
|
-
const formals =
|
|
78
|
+
const formals = guard_term_1.GuardTerm.formalsOf(requires).values().toArray();
|
|
79
79
|
const loc = locationOf(node, idMap, qualified);
|
|
80
80
|
return (0, objects_1.compactRecord)({
|
|
81
81
|
requires: rendered,
|
|
@@ -146,13 +146,13 @@ function requirementsOf(name) {
|
|
|
146
146
|
}
|
|
147
147
|
const required = facts?.required ?? [];
|
|
148
148
|
const dispatched = formals.filter(f => f !== '...');
|
|
149
|
-
const terms =
|
|
149
|
+
const terms = stated.map(c => c.requires).concat((0, group_method_guards_1.groupMethodConditions)(name, dispatched.map(guard_term_1.GuardTerm.formal), new Set(), (0, guard_knowledge_1.defaultGuardFacts)()));
|
|
150
150
|
const claims = (0, guard_claims_1.claimsOf)(terms, (0, arrays_1.uniqueArrayMerge)(stated.map(c => c.formal), required), (0, guard_knowledge_1.defaultGuardFacts)());
|
|
151
151
|
const relations = (0, guard_claims_1.relationsOf)(terms, (0, guard_knowledge_1.defaultGuardFacts)());
|
|
152
152
|
const conditional = (0, guard_claims_1.conditionalClaimsOf)(terms, formals.filter(f => f !== '...'), (0, guard_knowledge_1.defaultGuardFacts)());
|
|
153
153
|
const calls = callsOfTerms(terms);
|
|
154
154
|
return (0, objects_1.compactRecord)({
|
|
155
|
-
requires: terms.length === 0 ? '' : guard_term_1.GuardTerm.render(guard_term_1.GuardTerm.
|
|
155
|
+
requires: terms.length === 0 ? '' : guard_term_1.GuardTerm.render(guard_term_1.GuardTerm.allOf(terms)),
|
|
156
156
|
required: (0, objects_1.nonEmpty)(required),
|
|
157
157
|
formals: Object.keys(claims).length > 0 ? claims : undefined,
|
|
158
158
|
relations: (0, objects_1.nonEmpty)(relations),
|
|
@@ -168,7 +168,7 @@ function namesWithGuards() {
|
|
|
168
168
|
const table = (0, r_base_guards_generated_1.RBaseGuards)();
|
|
169
169
|
const inTable = Object.entries(table).flatMap(([pkg, names]) => Object.keys(names).map(name => [pkg, name]));
|
|
170
170
|
const known = new Set(inTable.map(([pkg, name]) => `${pkg}::${name}`));
|
|
171
|
-
return
|
|
171
|
+
return inTable.concat((0, guards_1.namesWithGuardFacts)().filter(([, name]) => requirementsOf(name) !== undefined).map(([, name]) => [(0, r_base_packages_1.baseRExportOwner)(name) ?? "base" /* PkgName.Base */, name]).filter(([pkg, name]) => !known.has(`${pkg}::${name}`)));
|
|
172
172
|
}
|
|
173
173
|
/**
|
|
174
174
|
* What a function of the base packages asks of the calls returning from it: what its closure checks, and else what is known of it being written in C.
|
|
@@ -53,8 +53,8 @@ function of(graph, ctx, idMap = graph.idMap) {
|
|
|
53
53
|
let loads;
|
|
54
54
|
return {
|
|
55
55
|
graph, idMap, ctx, facts: (0, guard_knowledge_1.guardFactsOf)(ctx),
|
|
56
|
-
mayAddMethods: generic =>
|
|
57
|
-
rewritesFormals:
|
|
56
|
+
mayAddMethods: generic => bindings.keys().some(name => name.startsWith(`${generic}.`)) || (loads ??= loadsPackages(graph, ctx)),
|
|
57
|
+
rewritesFormals: graph.verticesOfType(vertex_1.VertexType.FunctionCall).some(([, v]) => FormalsRewriters.has(identifier_1.Identifier.getName(v.name))),
|
|
58
58
|
definitions: new Map(),
|
|
59
59
|
functions: new Map()
|
|
60
60
|
};
|
|
@@ -72,7 +72,7 @@ function statedClauses(name, stated, formals, scope) {
|
|
|
72
72
|
});
|
|
73
73
|
/* a value without a class attribute may still run a method another package registers for its implicit class */
|
|
74
74
|
const open = (stated.dispatches !== undefined || r_s3_generics_generated_1.RS3Generics.genericFormals[String(name)] !== undefined) && scope.mayAddMethods(name);
|
|
75
|
-
return terms.filter(t => !open || !guard_term_1.GuardTerm.mentions(t,
|
|
75
|
+
return terms.filter(t => !open || !guard_term_1.GuardTerm.mentions(t, guard_term_1.GuardFn.IsObject));
|
|
76
76
|
}
|
|
77
77
|
/** What is stated of a function by name: what the signature database answers (given a context to ask it in), or else flowR's table of the base packages. */
|
|
78
78
|
function statedOf(name, ctx) {
|
|
@@ -219,7 +219,7 @@ function literalsOf(value) {
|
|
|
219
219
|
}
|
|
220
220
|
/* the elements have one type: all integers or all doubles for numbers */
|
|
221
221
|
const variants = elements[0].map((_, at) => elements.map(e => e[at]));
|
|
222
|
-
return variants.map(v => guard_term_1.GuardTerm.
|
|
222
|
+
return variants.map(v => guard_term_1.GuardTerm.knownOf(guard_term_1.GuardFn.Combine, v));
|
|
223
223
|
}
|
|
224
224
|
/** The literals the argument may hold, `undefined` if not all of them are known. */
|
|
225
225
|
function argumentLiterals(node, vertex, scope) {
|
|
@@ -237,7 +237,7 @@ function argumentLiterals(node, vertex, scope) {
|
|
|
237
237
|
function combinations(choices) {
|
|
238
238
|
let result = [new Map()];
|
|
239
239
|
for (const [name, literals] of choices) {
|
|
240
|
-
result = result.flatMap(binding => literals.map(l => new Map(
|
|
240
|
+
result = result.flatMap(binding => literals.map(l => new Map(binding).set(name, l)));
|
|
241
241
|
if (result.length > MaxCombinations) {
|
|
242
242
|
return undefined;
|
|
243
243
|
}
|
|
@@ -278,14 +278,14 @@ function breaches(call, contract, scope) {
|
|
|
278
278
|
};
|
|
279
279
|
for (const clause of contract.clauses) {
|
|
280
280
|
const { requires } = (0, function_guards_1.atCall)(clause, binding, undefined, facts);
|
|
281
|
-
const placeholders =
|
|
282
|
-
const bindings = combinations(new Map(placeholders.map(p => [p, literalsAt(p)])));
|
|
281
|
+
const placeholders = guard_term_1.GuardTerm.formalsOf(requires);
|
|
282
|
+
const bindings = combinations(new Map(placeholders.values().map(p => [p, literalsAt(p)])));
|
|
283
283
|
if (bindings === undefined || !bindings.every(b => guard_term_1.GuardTerm.isFalse(guard_term_1.GuardTerm.substituteCondition(requires, b, undefined, facts)))) {
|
|
284
284
|
continue;
|
|
285
285
|
}
|
|
286
286
|
const values = contract.formals.flatMap(formal => {
|
|
287
287
|
const bound = binding.binding.get(formal);
|
|
288
|
-
const literals = bound?.kind === 'formal' && placeholders.
|
|
288
|
+
const literals = bound?.kind === 'formal' && placeholders.has(bound.name) ? literalsAt(bound.name) : [];
|
|
289
289
|
const node = bound?.kind === 'formal' ? args.get(bound.name)?.node : undefined;
|
|
290
290
|
return literals.length === 0 ? [] : [[formal, model_1.RConstant.is(node) ? node.lexeme : shown(literals).join(' or ')]];
|
|
291
291
|
});
|
|
@@ -37,7 +37,8 @@ function splitTopLevel(text, separator) {
|
|
|
37
37
|
i += separator.length - 1;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
parts.push(text.slice(start));
|
|
41
|
+
return parts;
|
|
41
42
|
}
|
|
42
43
|
/** the connectives a condition is written with, from the one binding loosest */
|
|
43
44
|
const Connectives = [' and ', ' unless ', ' || ', ' && '];
|
|
@@ -165,7 +166,7 @@ function mergedRelations(relations) {
|
|
|
165
166
|
entry.unless.push(relation.unless === undefined || relation.unless === '' ? undefined : splitTopLevel(bare(relation.unless), ' || '));
|
|
166
167
|
merged.set(key, entry);
|
|
167
168
|
}
|
|
168
|
-
return
|
|
169
|
+
return Array.from(merged.values(), ({ first, unless }) => {
|
|
169
170
|
if (unless.length === 1) {
|
|
170
171
|
return first;
|
|
171
172
|
}
|
|
@@ -176,7 +177,7 @@ function mergedRelations(relations) {
|
|
|
176
177
|
const common = offers[0].filter(d => offers.every(u => u.includes(d)));
|
|
177
178
|
const rests = offers.map(u => u.filter(d => !common.includes(d))).filter((rest, at, all) => all.findIndex(r => r.join() === rest.join()) === at);
|
|
178
179
|
const own = rests.some(r => r.length === 0) ? [] : [rests.length === 1 ? rests[0].join(' || ') : `(${allOf(rests.map(r => r.join(' || ')))})`];
|
|
179
|
-
return { ...first, unless:
|
|
180
|
+
return { ...first, unless: common.concat(own).join(' || ') };
|
|
180
181
|
});
|
|
181
182
|
}
|
|
182
183
|
//# sourceMappingURL=condition-grouping.js.map
|