@eagleoutice/flowr 2.1.1 → 2.1.2
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 +2 -1
- package/cli/repl/commands/repl-parse.js +7 -16
- package/cli/repl/commands/repl-query.js +72 -3
- package/core/print/parse-printer.js +1 -22
- package/core/steps/pipeline/default-pipelines.d.ts +64 -0
- package/core/steps/pipeline/default-pipelines.js +2 -1
- package/dataflow/cluster.d.ts +20 -0
- package/dataflow/cluster.js +46 -0
- package/dataflow/graph/edge.d.ts +2 -3
- package/dataflow/graph/graph.d.ts +1 -1
- package/documentation/data/server/doc-data-server-messages.d.ts +1 -1
- package/documentation/data/server/doc-data-server-messages.js +10 -4
- package/documentation/doc-util/doc-code.d.ts +1 -0
- package/documentation/doc-util/doc-code.js +9 -0
- package/documentation/doc-util/doc-dfg.d.ts +1 -0
- package/documentation/doc-util/doc-dfg.js +5 -4
- package/documentation/doc-util/doc-normalized-ast.js +2 -2
- package/documentation/doc-util/doc-query.js +5 -7
- package/documentation/doc-util/doc-server-message.js +3 -5
- package/documentation/doc-util/doc-types.js +19 -11
- package/documentation/print-dataflow-graph-wiki.js +10 -1
- package/documentation/print-interface-wiki.js +1 -1
- package/documentation/print-normalized-ast-wiki.js +2 -2
- package/documentation/print-query-wiki.js +164 -37
- package/package.json +1 -1
- package/queries/{call-context-query → catalog/call-context-query}/call-context-query-executor.d.ts +4 -3
- package/queries/{call-context-query → catalog/call-context-query}/call-context-query-executor.js +22 -16
- package/queries/{call-context-query → catalog/call-context-query}/call-context-query-format.d.ts +6 -2
- package/queries/catalog/cluster-query/cluster-query-executor.d.ts +3 -0
- package/queries/catalog/cluster-query/cluster-query-executor.js +19 -0
- package/queries/catalog/cluster-query/cluster-query-format.d.ts +12 -0
- package/queries/catalog/cluster-query/cluster-query-format.js +3 -0
- package/queries/catalog/dataflow-query/dataflow-query-executor.d.ts +3 -0
- package/queries/catalog/dataflow-query/dataflow-query-executor.js +17 -0
- package/queries/catalog/dataflow-query/dataflow-query-format.d.ts +12 -0
- package/queries/catalog/dataflow-query/dataflow-query-format.js +3 -0
- package/queries/catalog/id-map-query/id-map-query-executor.d.ts +3 -0
- package/queries/catalog/id-map-query/id-map-query-executor.js +17 -0
- package/queries/catalog/id-map-query/id-map-query-format.d.ts +8 -0
- package/{r-bridge/lang-4.x/ast/parser/xml/normalizer-data.js → queries/catalog/id-map-query/id-map-query-format.js} +1 -1
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.d.ts +3 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-executor.js +17 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.d.ts +11 -0
- package/queries/catalog/normalized-ast-query/normalized-ast-query-format.js +3 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +4 -0
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +40 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.d.ts +24 -0
- package/queries/catalog/static-slice-query/static-slice-query-format.js +3 -0
- package/queries/query-schema.d.ts +5 -0
- package/queries/query-schema.js +22 -3
- package/queries/query.d.ts +19 -4
- package/queries/query.js +12 -2
- package/r-bridge/lang-4.x/ast/parser/json/format.d.ts +37 -13
- package/r-bridge/lang-4.x/ast/parser/json/format.js +59 -6
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +0 -3
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +2 -40
- package/r-bridge/lang-4.x/ast/parser/main/internal/control/normalize-if-then-else.d.ts +15 -0
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/control/normalize-if-then-else.js +5 -8
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/control/normalize-if-then.d.ts +7 -7
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/control/normalize-if-then.js +11 -12
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/expression/normalize-expression.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/expression/normalize-expression.js +4 -7
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-argument.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-argument.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-call.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-call.js +6 -9
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-definition.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-definition.js +1 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-parameter.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/functions/normalize-parameter.js +6 -5
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-break.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-for.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-for.js +5 -6
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-next.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-repeat.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-while.d.ts +4 -0
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-while.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/normalize-access.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/normalize-access.js +1 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/operators/normalize-binary.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/operators/normalize-binary.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/operators/normalize-unary.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/other/normalize-comment.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/other/normalize-comment.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/other/normalize-line-directive.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/other/normalize-line-directive.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-delimiter.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-expressions.d.ts +10 -0
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-root.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-root.js +3 -4
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-single-node.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-single-node.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-number.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-number.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-string.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-string.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-symbol.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/values/normalize-symbol.js +1 -3
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +41 -0
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +85 -0
- package/r-bridge/lang-4.x/ast/parser/{xml → main}/normalizer-data.d.ts +10 -4
- package/r-bridge/lang-4.x/ast/parser/main/normalizer-data.js +14 -0
- package/slicing/criterion/parse.d.ts +1 -1
- package/statistics/summarizer/post-process/clusterer.d.ts +1 -1
- package/util/ansi.js +9 -2
- package/util/time.d.ts +4 -0
- package/util/time.js +8 -0
- package/util/version.js +1 -1
- package/documentation/doc-util/doc-ms.d.ts +0 -1
- package/documentation/doc-util/doc-ms.js +0 -8
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.d.ts +0 -39
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.js +0 -38
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/normalize-if-then-else.d.ts +0 -15
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-while.d.ts +0 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-delimiter.d.ts +0 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-expressions.d.ts +0 -10
- package/r-bridge/lang-4.x/ast/parser/xml/normalize-meta.d.ts +0 -47
- package/r-bridge/lang-4.x/ast/parser/xml/normalize-meta.js +0 -110
- /package/queries/{call-context-query → catalog/call-context-query}/call-context-query-format.js +0 -0
- /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-break.js +0 -0
- /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-next.js +0 -0
- /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/loops/normalize-repeat.js +0 -0
- /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/operators/normalize-unary.js +0 -0
- /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-delimiter.js +0 -0
- /package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-expressions.js +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
-
import type { XmlBasedJson } from '../../input-format';
|
|
3
2
|
import type { RString } from '../../../../model/nodes/r-string';
|
|
3
|
+
import type { JsonEntry } from '../../../json/format';
|
|
4
4
|
/**
|
|
5
5
|
* Normalize the given object as a R string (see {@link string2ts}).
|
|
6
6
|
* This requires you to check the corresponding name beforehand.
|
|
7
7
|
*
|
|
8
8
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
9
|
-
* @param obj - The
|
|
9
|
+
* @param obj - The JSON object to extract the meta-information from
|
|
10
10
|
*/
|
|
11
|
-
export declare function normalizeString(data: NormalizerData, obj:
|
|
11
|
+
export declare function normalizeString(data: NormalizerData, obj: JsonEntry): RString;
|
|
@@ -10,7 +10,7 @@ const type_1 = require("../../../../model/type");
|
|
|
10
10
|
* This requires you to check the corresponding name beforehand.
|
|
11
11
|
*
|
|
12
12
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
13
|
-
* @param obj - The
|
|
13
|
+
* @param obj - The JSON object to extract the meta-information from
|
|
14
14
|
*/
|
|
15
15
|
function normalizeString(data, obj) {
|
|
16
16
|
const { location, content } = (0, normalize_meta_1.retrieveMetaStructure)(obj);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
-
import type { NamedXmlBasedJson } from '../../input-format';
|
|
3
2
|
import type { RSymbol } from '../../../../model/nodes/r-symbol';
|
|
3
|
+
import type { NamedJsonEntry } from '../../../json/format';
|
|
4
4
|
/**
|
|
5
5
|
* Normalize the given object as an R symbol (incorporating namespace information).
|
|
6
6
|
* <p>
|
|
7
7
|
* The special symbols `T` and `F` are parsed as logic values.
|
|
8
8
|
*
|
|
9
9
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
10
|
-
* @param objs - The
|
|
10
|
+
* @param objs - The JSON object to extract the meta-information from
|
|
11
11
|
*
|
|
12
12
|
* @returns The parsed symbol (with populated namespace information) or `undefined` if the given object is not a symbol.
|
|
13
13
|
*/
|
|
14
|
-
export declare function tryNormalizeSymbol(data: NormalizerData, objs: readonly
|
|
14
|
+
export declare function tryNormalizeSymbol(data: NormalizerData, objs: readonly NamedJsonEntry[]): RSymbol | undefined;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tryNormalizeSymbol = tryNormalizeSymbol;
|
|
4
4
|
const assert_1 = require("../../../../../../../util/assert");
|
|
5
|
-
const parser_1 = require("../../../json/parser");
|
|
6
5
|
const normalize_meta_1 = require("../../normalize-meta");
|
|
7
6
|
const strings_1 = require("../../../../../../../util/strings");
|
|
8
7
|
const type_1 = require("../../../../model/type");
|
|
@@ -12,13 +11,12 @@ const type_1 = require("../../../../model/type");
|
|
|
12
11
|
* The special symbols `T` and `F` are parsed as logic values.
|
|
13
12
|
*
|
|
14
13
|
* @param data - The data used by the parser (see {@link NormalizerData})
|
|
15
|
-
* @param objs - The
|
|
14
|
+
* @param objs - The JSON object to extract the meta-information from
|
|
16
15
|
*
|
|
17
16
|
* @returns The parsed symbol (with populated namespace information) or `undefined` if the given object is not a symbol.
|
|
18
17
|
*/
|
|
19
18
|
function tryNormalizeSymbol(data, objs) {
|
|
20
19
|
(0, assert_1.guard)(objs.length > 0, 'to parse symbols we need at least one object to work on!');
|
|
21
|
-
parser_1.parseLog.debug('trying to parse symbol');
|
|
22
20
|
let location, content, namespace;
|
|
23
21
|
if (objs.length === 1 && (0, type_1.isSymbol)(objs[0].name)) {
|
|
24
22
|
const meta = (0, normalize_meta_1.retrieveMetaStructure)(objs[0].content);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { JsonEntry, NamedJsonEntry } from '../json/format';
|
|
2
|
+
import type { SourceRange } from '../../../../../util/range';
|
|
3
|
+
import type { RawRType } from '../../model/type';
|
|
4
|
+
import type { RNode } from '../../model/model';
|
|
5
|
+
import type { RExpressionList } from '../../model/nodes/r-expression-list';
|
|
6
|
+
/**
|
|
7
|
+
* Given a JSON element, extract the source location of the corresponding element in the R-ast
|
|
8
|
+
*/
|
|
9
|
+
export declare function extractLocation(ast: JsonEntry): SourceRange;
|
|
10
|
+
/**
|
|
11
|
+
* The JSON object that represents the input contains various meta-information.
|
|
12
|
+
* This function extracts the meta-information and returns it.
|
|
13
|
+
*
|
|
14
|
+
* @param entry - The JSON object to extract the meta-information from
|
|
15
|
+
* @returns An object containing the passed entry, the location of the corresponding R-ast element, and the content of the passed entry
|
|
16
|
+
*/
|
|
17
|
+
export declare function retrieveMetaStructure(entry: JsonEntry): {
|
|
18
|
+
location: SourceRange;
|
|
19
|
+
content: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function assureTokenType(token: string, expectedName: RawRType): void;
|
|
22
|
+
/**
|
|
23
|
+
* Extract the token-type of the given object. This is based on the knowledge, that all JSON objects created
|
|
24
|
+
* from the R XML have a name attached.
|
|
25
|
+
*
|
|
26
|
+
* @param content - the JSON object to extract the token-type from
|
|
27
|
+
*/
|
|
28
|
+
export declare function getTokenType(content: JsonEntry): RawRType;
|
|
29
|
+
export declare function getWithTokenType(obj: JsonEntry[]): {
|
|
30
|
+
name: RawRType;
|
|
31
|
+
content: JsonEntry;
|
|
32
|
+
}[];
|
|
33
|
+
export declare function retrieveOpName(operator: NamedJsonEntry): string;
|
|
34
|
+
/**
|
|
35
|
+
* Ensure that the first child is completely before the second child.
|
|
36
|
+
*
|
|
37
|
+
* @param first - the first child which should be the lhs
|
|
38
|
+
* @param second - the second child which should be the rhs
|
|
39
|
+
*/
|
|
40
|
+
export declare function ensureChildrenAreLhsAndRhsOrdered(first: JsonEntry, second: JsonEntry): void;
|
|
41
|
+
export declare function ensureExpressionList<Info>(node: RNode<Info>): RExpressionList<Info>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractLocation = extractLocation;
|
|
4
|
+
exports.retrieveMetaStructure = retrieveMetaStructure;
|
|
5
|
+
exports.assureTokenType = assureTokenType;
|
|
6
|
+
exports.getTokenType = getTokenType;
|
|
7
|
+
exports.getWithTokenType = getWithTokenType;
|
|
8
|
+
exports.retrieveOpName = retrieveOpName;
|
|
9
|
+
exports.ensureChildrenAreLhsAndRhsOrdered = ensureChildrenAreLhsAndRhsOrdered;
|
|
10
|
+
exports.ensureExpressionList = ensureExpressionList;
|
|
11
|
+
const normalizer_data_1 = require("./normalizer-data");
|
|
12
|
+
const range_1 = require("../../../../../util/range");
|
|
13
|
+
const type_1 = require("../../model/type");
|
|
14
|
+
/**
|
|
15
|
+
* Given a JSON element, extract the source location of the corresponding element in the R-ast
|
|
16
|
+
*/
|
|
17
|
+
function extractLocation(ast) {
|
|
18
|
+
return (0, range_1.rangeFrom)(ast.line1, ast.col1, ast.line2, ast.col2);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The JSON object that represents the input contains various meta-information.
|
|
22
|
+
* This function extracts the meta-information and returns it.
|
|
23
|
+
*
|
|
24
|
+
* @param entry - The JSON object to extract the meta-information from
|
|
25
|
+
* @returns An object containing the passed entry, the location of the corresponding R-ast element, and the content of the passed entry
|
|
26
|
+
*/
|
|
27
|
+
function retrieveMetaStructure(entry) {
|
|
28
|
+
return {
|
|
29
|
+
location: extractLocation(entry),
|
|
30
|
+
content: entry.text
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function assureTokenType(token, expectedName) {
|
|
34
|
+
if (token !== expectedName) {
|
|
35
|
+
throw new normalizer_data_1.ParseError(`expected name to be ${expectedName}, yet received ${token}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Extract the token-type of the given object. This is based on the knowledge, that all JSON objects created
|
|
40
|
+
* from the R XML have a name attached.
|
|
41
|
+
*
|
|
42
|
+
* @param content - the JSON object to extract the token-type from
|
|
43
|
+
*/
|
|
44
|
+
function getTokenType(content) {
|
|
45
|
+
return content.token;
|
|
46
|
+
}
|
|
47
|
+
function getWithTokenType(obj) {
|
|
48
|
+
return obj.map((content) => ({
|
|
49
|
+
name: getTokenType(content),
|
|
50
|
+
content
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
function retrieveOpName(operator) {
|
|
54
|
+
/*
|
|
55
|
+
* only real arithmetic ops have their operation as their own name, the others identify via content/text
|
|
56
|
+
*/
|
|
57
|
+
return operator.content.text;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Ensure that the first child is completely before the second child.
|
|
61
|
+
*
|
|
62
|
+
* @param first - the first child which should be the lhs
|
|
63
|
+
* @param second - the second child which should be the rhs
|
|
64
|
+
*/
|
|
65
|
+
function ensureChildrenAreLhsAndRhsOrdered(first, second) {
|
|
66
|
+
const firstOtherLoc = extractLocation(first);
|
|
67
|
+
const secondOtherLoc = extractLocation(second);
|
|
68
|
+
if (!(0, range_1.rangeStartsCompletelyBefore)(firstOtherLoc, secondOtherLoc)) {
|
|
69
|
+
throw new normalizer_data_1.ParseError(`expected the first child to be the lhs, yet received ${JSON.stringify(first)} & ${JSON.stringify(second)}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function ensureExpressionList(node) {
|
|
73
|
+
if (node.type !== type_1.RType.ExpressionList) {
|
|
74
|
+
return {
|
|
75
|
+
type: type_1.RType.ExpressionList,
|
|
76
|
+
grouping: undefined,
|
|
77
|
+
location: node.location,
|
|
78
|
+
info: node.info,
|
|
79
|
+
lexeme: undefined,
|
|
80
|
+
children: [node]
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return node;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=normalize-meta.js.map
|
|
@@ -5,11 +5,17 @@ import type { SourceRange } from '../../../../../util/range';
|
|
|
5
5
|
*/
|
|
6
6
|
export interface NormalizerData extends MergeableRecord {
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
* The currently active source range during parsing, i.e., the full range of the current element.
|
|
9
|
+
*/
|
|
10
10
|
currentRange: SourceRange | undefined;
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
* The currently active lexeme during parsing, i.e., the full lexeme of the current element.
|
|
13
|
+
*/
|
|
14
14
|
currentLexeme: string | undefined;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Thrown if the given input is not valid/contains unexpected elements.
|
|
18
|
+
*/
|
|
19
|
+
export declare class ParseError extends Error {
|
|
20
|
+
constructor(message: string);
|
|
21
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ParseError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Thrown if the given input is not valid/contains unexpected elements.
|
|
6
|
+
*/
|
|
7
|
+
class ParseError extends Error {
|
|
8
|
+
constructor(message) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = 'ParseError';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.ParseError = ParseError;
|
|
14
|
+
//# sourceMappingURL=normalizer-data.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
|
|
2
2
|
import type { AstIdMap } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
|
|
3
3
|
/** Either `line:column`, `line@variable-name`, or `$id` */
|
|
4
|
-
export type SingleSlicingCriterion = `${number}:${number}` | `${number}@${string}` | `$${NodeId}`;
|
|
4
|
+
export type SingleSlicingCriterion = `${number}:${number}` | `${number}@${string}` | `$${NodeId | number}`;
|
|
5
5
|
export type SlicingCriteria = SingleSlicingCriterion[];
|
|
6
6
|
/**
|
|
7
7
|
* Thrown if the given slicing criteria can not be found
|
|
@@ -8,7 +8,7 @@ export type ClusterValueInfoMap = DefaultMap<string, ContextsWithCount>;
|
|
|
8
8
|
export interface ClusterReport extends MergeableRecord {
|
|
9
9
|
/** The input file which has been clustered */
|
|
10
10
|
readonly filepath: string;
|
|
11
|
-
/** Maps each context encountered (i.e., every file
|
|
11
|
+
/** Maps each context encountered (i.e., every file that contains something associated with the feature) to a unique id, used in the {@link ClusterReport#valueInfoMap|valueInfoMap}. */
|
|
12
12
|
contextIdMap: ClusterContextIdMap;
|
|
13
13
|
/**
|
|
14
14
|
* Counts which contexts contained which values of a feature.
|
package/util/ansi.js
CHANGED
|
@@ -34,8 +34,15 @@ exports.markdownFormatter = new class {
|
|
|
34
34
|
throw new Error(`Unsupported font style: ${options.style}`);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
let source = input.replaceAll(/\\"/g, '\'').replaceAll(/\\/g, '\\\\').replaceAll(/\n/g, '\\\n');
|
|
38
|
+
/* repeatedly replace all spaces but only at the beginning of a line */
|
|
39
|
+
let target = source;
|
|
40
|
+
do {
|
|
41
|
+
source = target;
|
|
42
|
+
/* or replace back to front */
|
|
43
|
+
target = source.replace(/^(?<leading>( )*) /m, '$<leading> ');
|
|
44
|
+
} while (target !== source);
|
|
45
|
+
return target;
|
|
39
46
|
}
|
|
40
47
|
getFormatString(_options) {
|
|
41
48
|
return '';
|
package/util/time.d.ts
CHANGED
|
@@ -4,3 +4,7 @@
|
|
|
4
4
|
* @param date - The date to convert, defaults to the current date
|
|
5
5
|
*/
|
|
6
6
|
export declare function date2string(date?: Date): string;
|
|
7
|
+
/**
|
|
8
|
+
* Print a number of milliseconds in a human-readable format including correct spacing.
|
|
9
|
+
*/
|
|
10
|
+
export declare function printAsMs(ms: number, precision?: number): string;
|
package/util/time.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.date2string = date2string;
|
|
4
|
+
exports.printAsMs = printAsMs;
|
|
4
5
|
/**
|
|
5
6
|
* Retrieve a string in the form of "YYYY-MM-DD-HH-MM-SS-MS" from a Date object.
|
|
6
7
|
*
|
|
@@ -9,4 +10,11 @@ exports.date2string = date2string;
|
|
|
9
10
|
function date2string(date = new Date()) {
|
|
10
11
|
return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}-${date.getHours()}-${date.getMinutes()}-${date.getSeconds()}-${date.getMilliseconds()}`;
|
|
11
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Print a number of milliseconds in a human-readable format including correct spacing.
|
|
15
|
+
*/
|
|
16
|
+
function printAsMs(ms, precision = 2) {
|
|
17
|
+
/* eslint-disable-next-line no-irregular-whitespace*/
|
|
18
|
+
return `${ms.toFixed(precision)} ms`;
|
|
19
|
+
}
|
|
12
20
|
//# sourceMappingURL=time.js.map
|
package/util/version.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.flowrVersion = flowrVersion;
|
|
4
4
|
const semver_1 = require("semver");
|
|
5
5
|
// this is automatically replaced with the current version by release-it
|
|
6
|
-
const version = '2.1.
|
|
6
|
+
const version = '2.1.2';
|
|
7
7
|
function flowrVersion() {
|
|
8
8
|
return new semver_1.SemVer(version);
|
|
9
9
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function printAsMs(ms: number, precision?: number): string;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.printAsMs = printAsMs;
|
|
4
|
-
function printAsMs(ms, precision = 2) {
|
|
5
|
-
/* eslint-disable-next-line no-irregular-whitespace*/
|
|
6
|
-
return `${ms.toFixed(precision)} ms`;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=doc-ms.js.map
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { RawRType } from '../../model/type';
|
|
2
|
-
export declare const attributesKey = "a";
|
|
3
|
-
export declare const childrenKey = "c";
|
|
4
|
-
export declare const contentKey = "@";
|
|
5
|
-
export declare const nameKey = "#";
|
|
6
|
-
/**
|
|
7
|
-
* Thrown if the given input xml is not valid/contains unexpected elements.
|
|
8
|
-
*/
|
|
9
|
-
export declare class XmlParseError extends Error {
|
|
10
|
-
constructor(message: string);
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* represents json format retrieved from processing the xml input
|
|
14
|
-
*/
|
|
15
|
-
export type XmlBasedJson = Record<string, XmlBasedJsonValue>;
|
|
16
|
-
/**
|
|
17
|
-
* A xml element in the json can either link to a string or another xml element
|
|
18
|
-
*/
|
|
19
|
-
export type XmlBasedJsonValue = string | Record<string, unknown> | readonly XmlBasedJson[];
|
|
20
|
-
/**
|
|
21
|
-
* We expect all xml elements to have a name attached which represents their R token type.
|
|
22
|
-
*/
|
|
23
|
-
export interface NamedXmlBasedJson {
|
|
24
|
-
/** corresponds to the R token type */
|
|
25
|
-
readonly name: RawRType;
|
|
26
|
-
/** remaining content (e.g., children, ...) */
|
|
27
|
-
readonly content: XmlBasedJson;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Single-key variant of {@link getKeysGuarded}. Will throw an {@link XmlParseError} if the key is not present.
|
|
31
|
-
*/
|
|
32
|
-
export declare function getKeyGuarded<T extends XmlBasedJsonValue>(obj: XmlBasedJson, key: string): T;
|
|
33
|
-
/**
|
|
34
|
-
* Retrieves the given keys from the converted xml. For a single key, see {@link getKeyGuarded}.
|
|
35
|
-
* Will throw an {@link XmlParseError} if at least one of the keys is not present
|
|
36
|
-
*
|
|
37
|
-
* @typeParam T - the type of the values to retrieve. Note, that this type is not checked at runtime.
|
|
38
|
-
*/
|
|
39
|
-
export declare function getKeysGuarded<T extends XmlBasedJsonValue>(obj: XmlBasedJson, ...keys: readonly string[]): Record<string, T>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.XmlParseError = exports.nameKey = exports.contentKey = exports.childrenKey = exports.attributesKey = void 0;
|
|
4
|
-
exports.getKeyGuarded = getKeyGuarded;
|
|
5
|
-
exports.getKeysGuarded = getKeysGuarded;
|
|
6
|
-
exports.attributesKey = 'a';
|
|
7
|
-
exports.childrenKey = 'c';
|
|
8
|
-
exports.contentKey = '@';
|
|
9
|
-
exports.nameKey = '#';
|
|
10
|
-
/**
|
|
11
|
-
* Thrown if the given input xml is not valid/contains unexpected elements.
|
|
12
|
-
*/
|
|
13
|
-
class XmlParseError extends Error {
|
|
14
|
-
constructor(message) {
|
|
15
|
-
super(message);
|
|
16
|
-
this.name = 'XmlParseError';
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.XmlParseError = XmlParseError;
|
|
20
|
-
function error(key, obj) {
|
|
21
|
-
throw new XmlParseError(`expected obj to have key ${key}, yet received ${JSON.stringify(obj)}`);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Single-key variant of {@link getKeysGuarded}. Will throw an {@link XmlParseError} if the key is not present.
|
|
25
|
-
*/
|
|
26
|
-
function getKeyGuarded(obj, key) {
|
|
27
|
-
return (obj[key] ?? error(key, obj));
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Retrieves the given keys from the converted xml. For a single key, see {@link getKeyGuarded}.
|
|
31
|
-
* Will throw an {@link XmlParseError} if at least one of the keys is not present
|
|
32
|
-
*
|
|
33
|
-
* @typeParam T - the type of the values to retrieve. Note, that this type is not checked at runtime.
|
|
34
|
-
*/
|
|
35
|
-
function getKeysGuarded(obj, ...keys) {
|
|
36
|
-
return Object.fromEntries(keys.map(k => [k, getKeyGuarded(obj, k)]));
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=input-format.js.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
-
import type { NamedXmlBasedJson } from '../../input-format';
|
|
3
|
-
import type { RIfThenElse } from '../../../../model/nodes/r-if-then-else';
|
|
4
|
-
/**
|
|
5
|
-
* Try to parse the construct as a {@link RIfThenElse}.
|
|
6
|
-
*/
|
|
7
|
-
export declare function tryNormalizeIfThenElse(data: NormalizerData, tokens: [
|
|
8
|
-
ifToken: NamedXmlBasedJson,
|
|
9
|
-
leftParen: NamedXmlBasedJson,
|
|
10
|
-
condition: NamedXmlBasedJson,
|
|
11
|
-
rightParen: NamedXmlBasedJson,
|
|
12
|
-
then: NamedXmlBasedJson,
|
|
13
|
-
elseToken: NamedXmlBasedJson,
|
|
14
|
-
elseBlock: NamedXmlBasedJson
|
|
15
|
-
]): RIfThenElse | undefined;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { NormalizerData } from '../../normalizer-data';
|
|
2
|
-
import type { NamedXmlBasedJson } from '../../input-format';
|
|
3
|
-
import type { RWhileLoop } from '../../../../model/nodes/r-while-loop';
|
|
4
|
-
export declare function tryNormalizeWhile(data: NormalizerData, [whileToken, leftParen, condition, rightParen, body]: [NamedXmlBasedJson, NamedXmlBasedJson, NamedXmlBasedJson, NamedXmlBasedJson, NamedXmlBasedJson]): RWhileLoop | undefined;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { NamedXmlBasedJson, XmlBasedJson } from '../../input-format';
|
|
2
|
-
import type { NormalizerData } from '../../normalizer-data';
|
|
3
|
-
import type { RDelimiter } from '../../../../model/nodes/info/r-delimiter';
|
|
4
|
-
import type { RNode } from '../../../../model/model';
|
|
5
|
-
export declare function splitComments(tokens: readonly NamedXmlBasedJson[]): {
|
|
6
|
-
comments: NamedXmlBasedJson[];
|
|
7
|
-
others: NamedXmlBasedJson[];
|
|
8
|
-
};
|
|
9
|
-
export declare function normalizeExpressions(data: NormalizerData, tokens: readonly XmlBasedJson[] | readonly NamedXmlBasedJson[]): (RNode | RDelimiter)[];
|
|
10
|
-
export declare function parseNodesWithUnknownType(data: NormalizerData, mappedWithName: readonly NamedXmlBasedJson[] | undefined): (RNode | RDelimiter)[];
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { SourceRange } from '../../../../../util/range';
|
|
2
|
-
import type { NamedXmlBasedJson, XmlBasedJson } from './input-format';
|
|
3
|
-
import type { RawRType } from '../../model/type';
|
|
4
|
-
import type { RExpressionList } from '../../model/nodes/r-expression-list';
|
|
5
|
-
import type { RNode } from '../../model/model';
|
|
6
|
-
/**
|
|
7
|
-
* if the passed object is an array with only one element, remove the array wrapper
|
|
8
|
-
*/
|
|
9
|
-
export declare function objectWithArrUnwrap(obj: XmlBasedJson[] | XmlBasedJson): XmlBasedJson;
|
|
10
|
-
/**
|
|
11
|
-
* given a xml element, extract the source location of the corresponding element in the R-ast
|
|
12
|
-
*/
|
|
13
|
-
export declare function extractLocation(ast: XmlBasedJson): SourceRange;
|
|
14
|
-
/**
|
|
15
|
-
* The json object that represents the input xml contains various meta-information.
|
|
16
|
-
* This function extracts the meta-information and returns it.
|
|
17
|
-
*
|
|
18
|
-
* @param obj - The json object to extract the meta-information from
|
|
19
|
-
*/
|
|
20
|
-
export declare function retrieveMetaStructure(obj: XmlBasedJson): {
|
|
21
|
-
/** the obj passed in, but potentially without surrounding array wrappers (see {@link objectWithArrUnwrap}) */
|
|
22
|
-
unwrappedObj: XmlBasedJson;
|
|
23
|
-
/** location information of the corresponding R-ast element */
|
|
24
|
-
location: SourceRange;
|
|
25
|
-
content: string;
|
|
26
|
-
};
|
|
27
|
-
export declare function assureTokenType(obj: XmlBasedJson, expectedName: RawRType): void;
|
|
28
|
-
/**
|
|
29
|
-
* Extract the token-type of the given object. This is based on the knowledge, that all json objects created
|
|
30
|
-
* from the R xml have a name attached.
|
|
31
|
-
*
|
|
32
|
-
* @param content - the json object to extract the token-type from
|
|
33
|
-
*/
|
|
34
|
-
export declare function getTokenType(content: XmlBasedJson): RawRType;
|
|
35
|
-
export declare function getWithTokenType(obj: readonly XmlBasedJson[]): {
|
|
36
|
-
name: RawRType;
|
|
37
|
-
content: XmlBasedJson;
|
|
38
|
-
}[];
|
|
39
|
-
export declare function retrieveOpName(operator: NamedXmlBasedJson): string;
|
|
40
|
-
/**
|
|
41
|
-
* Ensure that the first child is completely before the second child.
|
|
42
|
-
*
|
|
43
|
-
* @param first - the first child which should be the lhs
|
|
44
|
-
* @param second - the second child which should be the rhs
|
|
45
|
-
*/
|
|
46
|
-
export declare function ensureChildrenAreLhsAndRhsOrdered(first: XmlBasedJson, second: XmlBasedJson): void;
|
|
47
|
-
export declare function ensureExpressionList<Info>(node: RNode<Info>): RExpressionList<Info>;
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.objectWithArrUnwrap = objectWithArrUnwrap;
|
|
4
|
-
exports.extractLocation = extractLocation;
|
|
5
|
-
exports.retrieveMetaStructure = retrieveMetaStructure;
|
|
6
|
-
exports.assureTokenType = assureTokenType;
|
|
7
|
-
exports.getTokenType = getTokenType;
|
|
8
|
-
exports.getWithTokenType = getWithTokenType;
|
|
9
|
-
exports.retrieveOpName = retrieveOpName;
|
|
10
|
-
exports.ensureChildrenAreLhsAndRhsOrdered = ensureChildrenAreLhsAndRhsOrdered;
|
|
11
|
-
exports.ensureExpressionList = ensureExpressionList;
|
|
12
|
-
const range_1 = require("../../../../../util/range");
|
|
13
|
-
const assert_1 = require("../../../../../util/assert");
|
|
14
|
-
const input_format_1 = require("./input-format");
|
|
15
|
-
const type_1 = require("../../model/type");
|
|
16
|
-
/**
|
|
17
|
-
* if the passed object is an array with only one element, remove the array wrapper
|
|
18
|
-
*/
|
|
19
|
-
function objectWithArrUnwrap(obj) {
|
|
20
|
-
if (Array.isArray(obj)) {
|
|
21
|
-
if (obj.length !== 1) {
|
|
22
|
-
throw new input_format_1.XmlParseError(`expected only one element in the wrapped array, yet received ${JSON.stringify(obj)}`);
|
|
23
|
-
}
|
|
24
|
-
return obj[0];
|
|
25
|
-
}
|
|
26
|
-
else if (typeof obj === 'object') {
|
|
27
|
-
return obj;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
throw new input_format_1.XmlParseError(`expected array or object, yet received ${JSON.stringify(obj)}`);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* given a xml element, extract the source location of the corresponding element in the R-ast
|
|
35
|
-
*/
|
|
36
|
-
function extractLocation(ast) {
|
|
37
|
-
return (0, range_1.rangeFrom)(ast['line1'], ast['col1'], ast['line2'], ast['col2']);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* The json object that represents the input xml contains various meta-information.
|
|
41
|
-
* This function extracts the meta-information and returns it.
|
|
42
|
-
*
|
|
43
|
-
* @param obj - The json object to extract the meta-information from
|
|
44
|
-
*/
|
|
45
|
-
function retrieveMetaStructure(obj) {
|
|
46
|
-
const unwrappedObj = objectWithArrUnwrap(obj);
|
|
47
|
-
const attributes = obj[input_format_1.attributesKey];
|
|
48
|
-
(0, assert_1.guard)(attributes !== undefined, () => `expected attributes to be defined for ${JSON.stringify(obj)}`);
|
|
49
|
-
const content = obj[input_format_1.contentKey] ?? '';
|
|
50
|
-
const location = extractLocation(attributes);
|
|
51
|
-
return {
|
|
52
|
-
unwrappedObj,
|
|
53
|
-
location,
|
|
54
|
-
content
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
function assureTokenType(obj, expectedName) {
|
|
58
|
-
const name = getTokenType(obj);
|
|
59
|
-
if (name !== expectedName) {
|
|
60
|
-
throw new input_format_1.XmlParseError(`expected name to be ${expectedName}, yet received ${name} for ${JSON.stringify(obj)}`);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Extract the token-type of the given object. This is based on the knowledge, that all json objects created
|
|
65
|
-
* from the R xml have a name attached.
|
|
66
|
-
*
|
|
67
|
-
* @param content - the json object to extract the token-type from
|
|
68
|
-
*/
|
|
69
|
-
function getTokenType(content) {
|
|
70
|
-
return content[input_format_1.nameKey];
|
|
71
|
-
}
|
|
72
|
-
function getWithTokenType(obj) {
|
|
73
|
-
return obj.map(content => ({
|
|
74
|
-
name: getTokenType(content),
|
|
75
|
-
content
|
|
76
|
-
}));
|
|
77
|
-
}
|
|
78
|
-
function retrieveOpName(operator) {
|
|
79
|
-
/*
|
|
80
|
-
* only real arithmetic ops have their operation as their own name, the others identify via content
|
|
81
|
-
*/
|
|
82
|
-
return operator.content[input_format_1.contentKey];
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Ensure that the first child is completely before the second child.
|
|
86
|
-
*
|
|
87
|
-
* @param first - the first child which should be the lhs
|
|
88
|
-
* @param second - the second child which should be the rhs
|
|
89
|
-
*/
|
|
90
|
-
function ensureChildrenAreLhsAndRhsOrdered(first, second) {
|
|
91
|
-
const firstOtherLoc = extractLocation(first[input_format_1.attributesKey]);
|
|
92
|
-
const secondOtherLoc = extractLocation(second[input_format_1.attributesKey]);
|
|
93
|
-
if (!(0, range_1.rangeStartsCompletelyBefore)(firstOtherLoc, secondOtherLoc)) {
|
|
94
|
-
throw new input_format_1.XmlParseError(`expected the first child to be the lhs, yet received ${JSON.stringify(first)} & ${JSON.stringify(second)}`);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
function ensureExpressionList(node) {
|
|
98
|
-
if (node.type !== type_1.RType.ExpressionList) {
|
|
99
|
-
return {
|
|
100
|
-
type: type_1.RType.ExpressionList,
|
|
101
|
-
grouping: undefined,
|
|
102
|
-
location: node.location,
|
|
103
|
-
info: node.info,
|
|
104
|
-
lexeme: undefined,
|
|
105
|
-
children: [node]
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
return node;
|
|
109
|
-
}
|
|
110
|
-
//# sourceMappingURL=normalize-meta.js.map
|
/package/queries/{call-context-query → catalog/call-context-query}/call-context-query-format.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-delimiter.js
RENAMED
|
File without changes
|
/package/r-bridge/lang-4.x/ast/parser/{xml → main}/internal/structure/normalize-expressions.js
RENAMED
|
File without changes
|