@eagleoutice/flowr 1.3.11 → 1.3.12

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 (125) hide show
  1. package/cli/common/scripts-info.d.ts +1 -1
  2. package/package.json +1 -1
  3. package/benchmark/benchmark-slicer.js +0 -223
  4. package/core/pipeline-executor.js +0 -221
  5. package/core/stepping-slicer.js +0 -160
  6. package/core/steps/all/00-parse.js +0 -19
  7. package/core/steps/all/10-normalize.js +0 -21
  8. package/core/steps/all/20-dataflow.js +0 -21
  9. package/core/steps/all/30-slice.js +0 -16
  10. package/core/steps/all/40-reconstruct.js +0 -16
  11. package/core/steps/all/core/00-parse.js +0 -24
  12. package/core/steps/all/core/10-normalize.js +0 -46
  13. package/core/steps/all/core/20-dataflow.js +0 -39
  14. package/core/steps/all/static-slicing/00-slice.js +0 -21
  15. package/core/steps/all/static-slicing/10-reconstruct.js +0 -21
  16. package/core/steps/index.js +0 -21
  17. package/core/steps/input.js +0 -3
  18. package/core/steps/output.js +0 -3
  19. package/core/steps/pipeline/create.js +0 -130
  20. package/core/steps/pipeline/default.js +0 -15
  21. package/core/steps/pipeline/dependency-checker.js +0 -76
  22. package/core/steps/pipeline/index.js +0 -20
  23. package/core/steps/pipeline/invalid-pipeline-error.js +0 -14
  24. package/core/steps/pipeline/pipeline.js +0 -28
  25. package/core/steps/step.js +0 -8
  26. package/core/steps/steps-provider.js +0 -3
  27. package/core/steps/steps.js +0 -35
  28. package/dataflow/common/environments/append.js +0 -48
  29. package/dataflow/common/environments/environment.js +0 -165
  30. package/dataflow/common/environments/index.js +0 -23
  31. package/dataflow/common/environments/overwrite.js +0 -82
  32. package/dataflow/common/environments/register.js +0 -49
  33. package/dataflow/common/environments/resolve-by-name.js +0 -35
  34. package/dataflow/common/environments/scopes.js +0 -6
  35. package/dataflow/common/environments/scoping.js +0 -27
  36. package/dataflow/graph/equal.js +0 -127
  37. package/dataflow/v1/extractor.js +0 -60
  38. package/dataflow/v1/graph/diff.js +0 -206
  39. package/dataflow/v1/graph/edge.js +0 -32
  40. package/dataflow/v1/graph/graph.js +0 -298
  41. package/dataflow/v1/graph/index.js +0 -21
  42. package/dataflow/v1/graph/quads.js +0 -27
  43. package/dataflow/v1/graph/vertex.js +0 -3
  44. package/dataflow/v1/index.js +0 -24
  45. package/dataflow/v1/internal/info.js +0 -16
  46. package/dataflow/v1/internal/linker.js +0 -255
  47. package/dataflow/v1/internal/process/access.js +0 -54
  48. package/dataflow/v1/internal/process/expression-list.js +0 -154
  49. package/dataflow/v1/internal/process/functions/argument.js +0 -46
  50. package/dataflow/v1/internal/process/functions/exit-points.js +0 -125
  51. package/dataflow/v1/internal/process/functions/function-call.js +0 -99
  52. package/dataflow/v1/internal/process/functions/function-definition.js +0 -176
  53. package/dataflow/v1/internal/process/functions/parameter.js +0 -47
  54. package/dataflow/v1/internal/process/if-then-else.js +0 -57
  55. package/dataflow/v1/internal/process/loops/for-loop.js +0 -54
  56. package/dataflow/v1/internal/process/loops/repeat-loop.js +0 -21
  57. package/dataflow/v1/internal/process/loops/while-loop.js +0 -31
  58. package/dataflow/v1/internal/process/operators/assignment.js +0 -129
  59. package/dataflow/v1/internal/process/operators/non-assignment-binary-op.js +0 -25
  60. package/dataflow/v1/internal/process/operators/pipe.js +0 -46
  61. package/dataflow/v1/internal/process/operators/unary-op.js +0 -10
  62. package/dataflow/v1/internal/process/symbol.js +0 -21
  63. package/dataflow/v1/internal/process/uninteresting-leaf.js +0 -9
  64. package/dataflow/v1/processor.js +0 -20
  65. package/dataflow/v2/entry.js +0 -11
  66. package/flowr-1.3.7.tgz +0 -0
  67. package/r-bridge/lang-4.x/ast/parser/xml/common/config.js +0 -16
  68. package/r-bridge/lang-4.x/ast/parser/xml/common/input-format.js +0 -42
  69. package/r-bridge/lang-4.x/ast/parser/xml/common/meta.js +0 -118
  70. package/r-bridge/lang-4.x/ast/parser/xml/common/xml-to-json.js +0 -58
  71. package/r-bridge/lang-4.x/ast/parser/xml/v1/data.js +0 -3
  72. package/r-bridge/lang-4.x/ast/parser/xml/v1/hooks.js +0 -136
  73. package/r-bridge/lang-4.x/ast/parser/xml/v1/index.js +0 -22
  74. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/access.js +0 -107
  75. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/control/if-then-else.js +0 -32
  76. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/control/if-then.js +0 -46
  77. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/control/index.js +0 -19
  78. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/expression/expression.js +0 -65
  79. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/expression/index.js +0 -18
  80. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/functions/argument.js +0 -74
  81. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/functions/call.js +0 -149
  82. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/functions/definition.js +0 -60
  83. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/functions/index.js +0 -20
  84. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/functions/parameter.js +0 -64
  85. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/index.js +0 -27
  86. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/loops/break.js +0 -24
  87. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/loops/for.js +0 -72
  88. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/loops/index.js +0 -22
  89. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/loops/next.js +0 -24
  90. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/loops/repeat.js +0 -42
  91. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/loops/while.js +0 -45
  92. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/operators/binary.js +0 -162
  93. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/operators/index.js +0 -20
  94. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/operators/special.js +0 -24
  95. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/operators/unary.js +0 -59
  96. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/other/comment.js +0 -34
  97. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/other/index.js +0 -18
  98. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/other/line-directive.js +0 -55
  99. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/structure/elements.js +0 -159
  100. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/structure/index.js +0 -20
  101. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/structure/root.js +0 -34
  102. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/structure/single-element.js +0 -64
  103. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/values/index.js +0 -20
  104. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/values/number.js +0 -56
  105. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/values/string.js +0 -41
  106. package/r-bridge/lang-4.x/ast/parser/xml/v1/internal/values/symbol.js +0 -56
  107. package/r-bridge/lang-4.x/ast/parser/xml/v1/normalize.js +0 -30
  108. package/r-bridge/lang-4.x/ast/parser/xml/v2/data.js +0 -3
  109. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/access.js +0 -95
  110. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/expression.js +0 -99
  111. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/functions/argument.js +0 -71
  112. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/operators/binary.js +0 -30
  113. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/operators/index.js +0 -19
  114. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/operators/unary.js +0 -35
  115. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/other/comment.js +0 -25
  116. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/other/index.js +0 -18
  117. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/other/line-directive.js +0 -38
  118. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/root.js +0 -26
  119. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/single-element.js +0 -63
  120. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/values/index.js +0 -18
  121. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/values/number.js +0 -46
  122. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/values/string.js +0 -33
  123. package/r-bridge/lang-4.x/ast/parser/xml/v2/internal/values/symbol.js +0 -63
  124. package/r-bridge/lang-4.x/ast/parser/xml/v2/normalize.js +0 -25
  125. package/util/summarizer/benchmark/benchmark-summarizer.js +0 -208
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processPipeOperation = void 0;
4
- const processor_1 = require("../../../processor");
5
- const linker_1 = require("../../linker");
6
- const environments_1 = require("../../../../common/environments");
7
- const index_1 = require("../../../index");
8
- const assert_1 = require("../../../../../util/assert");
9
- const argument_1 = require("../functions/argument");
10
- function processPipeOperation(op, data) {
11
- const lhs = (0, processor_1.processDataflowFor)(op.lhs, data);
12
- const rhs = (0, processor_1.processDataflowFor)(op.rhs, data);
13
- // in-and outgoing are similar to that of a binary operation, we only 1) expect the rhs to be a function call and 2) modify the arguments.
14
- const ingoing = [...lhs.in, ...rhs.in, ...lhs.unknownReferences, ...rhs.unknownReferences];
15
- const nextGraph = lhs.graph.mergeWith(rhs.graph);
16
- (0, linker_1.linkIngoingVariablesInSameScope)(nextGraph, ingoing);
17
- if (op.rhs.type !== "RFunctionCall" /* RType.FunctionCall */) {
18
- index_1.dataflowLogger.warn(`Expected rhs of pipe to be a function call, but got ${op.rhs.type} instead.`);
19
- }
20
- else {
21
- const maybeFunctionCallNode = nextGraph.get(op.rhs.info.id, true);
22
- (0, assert_1.guard)(maybeFunctionCallNode !== undefined, () => `Expected function call node with id ${op.rhs.info.id} to be present in graph, but got undefined instead (graph: ${(0, index_1.graphToMermaidUrl)(nextGraph, data.completeAst.idMap)}).`);
23
- const functionCallNode = maybeFunctionCallNode[0];
24
- (0, assert_1.guard)(functionCallNode.tag === 'function-call', () => `Expected function call node with id ${op.rhs.info.id} to be a function call node, but got ${functionCallNode.tag} instead.`);
25
- // make the lhs an argument node:
26
- const argId = op.lhs.info.id;
27
- index_1.dataflowLogger.trace(`Linking pipe arg ${argId} as first argument of ${op.rhs.info.id}`);
28
- functionCallNode.args.unshift({
29
- nodeId: argId,
30
- name: `${argument_1.UnnamedArgumentPrefix}${argId}`,
31
- scope: data.activeScope,
32
- used: 'always'
33
- });
34
- nextGraph.addEdge(functionCallNode.id, argId, index_1.EdgeType.Argument, 'always');
35
- }
36
- return {
37
- unknownReferences: [],
38
- in: ingoing,
39
- out: [...lhs.out, ...rhs.out],
40
- environments: (0, environments_1.overwriteEnvironments)(lhs.environments, rhs.environments),
41
- graph: nextGraph,
42
- scope: data.activeScope,
43
- };
44
- }
45
- exports.processPipeOperation = processPipeOperation;
46
- //# sourceMappingURL=pipe.js.map
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processUnaryOp = void 0;
4
- const processor_1 = require("../../../processor");
5
- function processUnaryOp(op, data) {
6
- /* nothing has to happen to our knowledge */
7
- return (0, processor_1.processDataflowFor)(op.operand, data);
8
- }
9
- exports.processUnaryOp = processUnaryOp;
10
- //# sourceMappingURL=unary-op.js.map
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processSymbol = void 0;
4
- const r_bridge_1 = require("../../../../r-bridge");
5
- const graph_1 = require("../../graph");
6
- const info_1 = require("../info");
7
- function processSymbol(symbol, data) {
8
- if (symbol.content === r_bridge_1.RNull || symbol.content === r_bridge_1.RNa) {
9
- return (0, info_1.initializeCleanDataflowInformation)(data);
10
- }
11
- return {
12
- unknownReferences: [{ nodeId: symbol.info.id, scope: data.activeScope, name: symbol.content, used: 'always' }],
13
- in: [],
14
- out: [],
15
- environments: data.environments,
16
- scope: data.activeScope,
17
- graph: new graph_1.DataflowGraph().addVertex({ tag: 'use', id: symbol.info.id, name: symbol.content, environment: data.environments })
18
- };
19
- }
20
- exports.processSymbol = processSymbol;
21
- //# sourceMappingURL=symbol.js.map
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processUninterestingLeaf = void 0;
4
- const info_1 = require("../info");
5
- function processUninterestingLeaf(_leaf, info) {
6
- return (0, info_1.initializeCleanDataflowInformation)(info);
7
- }
8
- exports.processUninterestingLeaf = processUninterestingLeaf;
9
- //# sourceMappingURL=uninteresting-leaf.js.map
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processDataflowFor = void 0;
4
- /**
5
- * Originally, dataflow processor was written as a two-way fold, but this produced problems when trying to resolve function calls
6
- * which require information regarding the calling *and* definition context. While this only is a problem for late bindings as they happen
7
- * with functions (and probably quote'd R-expressions) it is still a problem that must be dealt with.
8
- * Therefore, the dataflow processor has no complete control over the traversal and merge strategy of the graph, with each processor being in
9
- * the position to call the other processors as needed for its children.
10
- * <p>
11
- * Now this method can be called recursively within the other processors to parse the dataflow for nodes that you can not narrow down.
12
- *
13
- * @param current - The current node to start processing from
14
- * @param data - The initial information to be passed down
15
- */
16
- function processDataflowFor(current, data) {
17
- return data.processors[current.type](current, data);
18
- }
19
- exports.processDataflowFor = processDataflowFor;
20
- //# sourceMappingURL=processor.js.map
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.produceDataFlowGraph = void 0;
4
- const info_1 = require("../v1/internal/info");
5
- const environments_1 = require("../common/environments");
6
- const scopes_1 = require("../common/environments/scopes");
7
- function produceDataFlowGraph() {
8
- return (0, info_1.initializeCleanDataflowInformation)({ environments: (0, environments_1.initializeCleanEnvironments)(), activeScope: scopes_1.GlobalScope });
9
- }
10
- exports.produceDataFlowGraph = produceDataFlowGraph;
11
- //# sourceMappingURL=entry.js.map
package/flowr-1.3.7.tgz DELETED
Binary file
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_XML_PARSER_CONFIG = void 0;
4
- /**
5
- * Default configuration to be used for the {@link XmlParserConfig}.
6
- * <p>
7
- * Note, that this does not include a sensible {@link XmlParserConfig#tokenMap}, as this must be provided by the corresponding
8
- * shell environment.
9
- */
10
- exports.DEFAULT_XML_PARSER_CONFIG = {
11
- attr: '@a',
12
- content: '@v',
13
- children: '@c',
14
- tokenMap: { /* this should not be used, but just so that we can omit null-checks */}
15
- };
16
- //# sourceMappingURL=config.js.map
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getKeysGuarded = exports.getKeyGuarded = exports.XmlParseError = void 0;
4
- /**
5
- * Thrown if the given input xml is not valid/contains unexpected elements.
6
- */
7
- class XmlParseError extends Error {
8
- constructor(message) {
9
- super(message);
10
- this.name = 'XmlParseError';
11
- }
12
- }
13
- exports.XmlParseError = XmlParseError;
14
- function error(key, obj) {
15
- throw new XmlParseError(`expected obj to have key ${key}, yet received ${JSON.stringify(obj)}`);
16
- }
17
- /**
18
- * Single-key variant of {@link getKeysGuarded}. Will throw an {@link XmlParseError} if the key is not present.
19
- */
20
- function getKeyGuarded(obj, key) {
21
- const res = obj[key];
22
- if (res === undefined) {
23
- error(key, obj);
24
- }
25
- return res;
26
- }
27
- exports.getKeyGuarded = getKeyGuarded;
28
- /**
29
- * Retrieves the given keys from the converted xml. For a single key, see {@link getKeyGuarded}.
30
- * Will throw an {@link XmlParseError} if at least one of the keys is not present
31
- *
32
- * @typeParam T - the type of the values to retrieve. Note, that this type is not checked at runtime.
33
- */
34
- function getKeysGuarded(obj, ...keys) {
35
- const out = {};
36
- for (const k of keys) {
37
- out[k] = getKeyGuarded(obj, k);
38
- }
39
- return out;
40
- }
41
- exports.getKeysGuarded = getKeysGuarded;
42
- //# sourceMappingURL=input-format.js.map
@@ -1,118 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ensureExpressionList = exports.ensureChildrenAreLhsAndRhsOrdered = exports.retrieveOpName = exports.getWithTokenType = exports.getTokenType = exports.assureTokenType = exports.revertTokenReplacement = exports.retrieveMetaStructure = exports.extractLocation = exports.objectWithArrUnwrap = void 0;
4
- const input_format_1 = require("./input-format");
5
- const range_1 = require("../../../../../../util/range");
6
- const assert_1 = require("../../../../../../util/assert");
7
- const xml_to_json_1 = require("./xml-to-json");
8
- /**
9
- * if the passed object is an array with only one element, remove the array wrapper
10
- */
11
- function objectWithArrUnwrap(obj) {
12
- if (Array.isArray(obj)) {
13
- if (obj.length !== 1) {
14
- throw new input_format_1.XmlParseError(`expected only one element in the wrapped array, yet received ${JSON.stringify(obj)}`);
15
- }
16
- return obj[0];
17
- }
18
- else if (typeof obj === 'object') {
19
- return obj;
20
- }
21
- else {
22
- throw new input_format_1.XmlParseError(`expected array or object, yet received ${JSON.stringify(obj)}`);
23
- }
24
- }
25
- exports.objectWithArrUnwrap = objectWithArrUnwrap;
26
- /**
27
- * given a xml element, extract the source location of the corresponding element in the R-ast
28
- */
29
- function extractLocation(ast) {
30
- return (0, range_1.rangeFrom)(ast['line1'], ast['col1'], ast['line2'], ast['col2']);
31
- }
32
- exports.extractLocation = extractLocation;
33
- /**
34
- * The json object that represents the input xml contains various meta-information.
35
- * This function extracts the meta-information and returns it.
36
- *
37
- * @param config - The configuration of the parser to use to retrieve the corresponding name fields
38
- * @param obj - The json object to extract the meta-information from
39
- */
40
- function retrieveMetaStructure(config, obj) {
41
- const unwrappedObj = objectWithArrUnwrap(obj);
42
- const attributes = obj[config.attr];
43
- (0, assert_1.guard)(attributes !== undefined, () => `expected attributes to be defined for ${JSON.stringify(obj)}`);
44
- const content = obj[config.content] ?? '';
45
- const location = extractLocation(attributes);
46
- return {
47
- unwrappedObj,
48
- location,
49
- content
50
- };
51
- }
52
- exports.retrieveMetaStructure = retrieveMetaStructure;
53
- function revertTokenReplacement(tokenMap, token) {
54
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- it is still necessary as we do not know if we have a replacement for the given token
55
- return tokenMap[token] ?? token;
56
- }
57
- exports.revertTokenReplacement = revertTokenReplacement;
58
- function assureTokenType(tokenMap, obj, expectedName) {
59
- const name = getTokenType(tokenMap, obj);
60
- if (name !== expectedName) {
61
- throw new input_format_1.XmlParseError(`expected name to be ${expectedName}, yet received ${name} for ${JSON.stringify(obj)}`);
62
- }
63
- }
64
- exports.assureTokenType = assureTokenType;
65
- /**
66
- * Extract the token-type of the given object. This is based on the knowledge, that all json objects created
67
- * from the R xml have a name attached.
68
- *
69
- * @param tokenMap - used to revert token types (i.e., revert `xmlparsedata`)
70
- * @param content - the json object to extract the token-type from
71
- */
72
- function getTokenType(tokenMap, content) {
73
- return revertTokenReplacement(tokenMap, (0, input_format_1.getKeyGuarded)(content, xml_to_json_1.XML_NAME));
74
- }
75
- exports.getTokenType = getTokenType;
76
- function getWithTokenType(tokenMap, obj) {
77
- return obj.map(content => ({
78
- name: getTokenType(tokenMap, content),
79
- content
80
- }));
81
- }
82
- exports.getWithTokenType = getWithTokenType;
83
- function retrieveOpName(config, operator) {
84
- /*
85
- * only real arithmetic ops have their operation as their own name, the others identify via content
86
- */
87
- return operator.content[config.content];
88
- }
89
- exports.retrieveOpName = retrieveOpName;
90
- /**
91
- * Ensure that the first child is completely before the second child.
92
- *
93
- * @param config - the configuration of the parser to use to retrieve the corresponding name fields
94
- * @param first - the first child which should be the lhs
95
- * @param second - the second child which should be the rhs
96
- */
97
- function ensureChildrenAreLhsAndRhsOrdered(config, first, second) {
98
- const firstOtherLoc = extractLocation(first[config.attr]);
99
- const secondOtherLoc = extractLocation(second[config.attr]);
100
- if (!(0, range_1.rangeStartsCompletelyBefore)(firstOtherLoc, secondOtherLoc)) {
101
- throw new input_format_1.XmlParseError(`expected the first child to be the lhs, yet received ${JSON.stringify(first)} & ${JSON.stringify(second)}`);
102
- }
103
- }
104
- exports.ensureChildrenAreLhsAndRhsOrdered = ensureChildrenAreLhsAndRhsOrdered;
105
- function ensureExpressionList(node) {
106
- if (node.type !== "RExpressionList" /* RType.ExpressionList */) {
107
- return {
108
- type: "RExpressionList" /* RType.ExpressionList */,
109
- location: node.location,
110
- info: node.info,
111
- lexeme: undefined,
112
- children: [node]
113
- };
114
- }
115
- return node;
116
- }
117
- exports.ensureExpressionList = ensureExpressionList;
118
- //# sourceMappingURL=meta.js.map
@@ -1,58 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.xlm2jsonObject = exports.XML_NAME = void 0;
27
- const xml2js = __importStar(require("xml2js"));
28
- exports.XML_NAME = '#name';
29
- const xml2jsOptions = {
30
- charsAsChildren: false,
31
- explicitChildren: true,
32
- mergeAttrs: false,
33
- // we need this for semicolons etc., while we keep the old broken components we ignore them completely
34
- preserveChildrenOrder: true,
35
- trim: true,
36
- includeWhiteChars: true,
37
- normalize: false,
38
- normalizeTags: false,
39
- validator: undefined,
40
- xmlns: false,
41
- strict: true
42
- };
43
- /**
44
- * Parse the xml presented by R into a json object that will be used for conversion
45
- *
46
- * @param config - The configuration to use (i.e., what names should be used for the attributes, children, ...)
47
- * @param xmlString - The xml input to parse
48
- */
49
- function xlm2jsonObject(config, xmlString) {
50
- return xml2js.parseStringPromise(xmlString, {
51
- ...xml2jsOptions,
52
- attrkey: config.attr,
53
- charkey: config.content,
54
- childkey: config.children
55
- });
56
- }
57
- exports.xlm2jsonObject = xlm2jsonObject;
58
- //# sourceMappingURL=xml-to-json.js.map
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=data.js.map
@@ -1,136 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_PARSER_HOOKS = exports.executeUnknownHook = exports.executeHook = void 0;
4
- /* eslint-disable -- hooks are unsafe */
5
- /**
6
- * simple (rather type-wise unsafe ^^) function you can use to execute hooks and deal with {@link AutoIfOmit}
7
- *
8
- * @see executeUnknownHook
9
- */
10
- function executeHook(hook, data, input) {
11
- const result = hook(data, input);
12
- if (result === undefined) {
13
- return input;
14
- }
15
- return result;
16
- }
17
- exports.executeHook = executeHook;
18
- /**
19
- * @see executeHook
20
- */
21
- function executeUnknownHook(hook, data, input) {
22
- return hook(data, input);
23
- }
24
- exports.executeUnknownHook = executeUnknownHook;
25
- /* eslint-enable */
26
- const doNothing = () => undefined;
27
- exports.DEFAULT_PARSER_HOOKS = {
28
- values: {
29
- onNumber: {
30
- before: doNothing,
31
- after: doNothing
32
- },
33
- onString: {
34
- before: doNothing,
35
- after: doNothing
36
- },
37
- onSymbol: {
38
- unknown: doNothing,
39
- before: doNothing,
40
- after: doNothing
41
- }
42
- },
43
- onAccess: {
44
- unknown: doNothing,
45
- before: doNothing,
46
- after: doNothing
47
- },
48
- other: {
49
- onComment: {
50
- before: doNothing,
51
- after: doNothing
52
- },
53
- onLineDirective: {
54
- before: doNothing,
55
- after: doNothing
56
- }
57
- },
58
- control: {
59
- onIfThen: {
60
- unknown: doNothing,
61
- before: doNothing,
62
- after: doNothing
63
- },
64
- onIfThenElse: {
65
- unknown: doNothing,
66
- before: doNothing,
67
- after: doNothing
68
- }
69
- },
70
- loops: {
71
- onForLoop: {
72
- unknown: doNothing,
73
- before: doNothing,
74
- after: doNothing
75
- },
76
- onRepeatLoop: {
77
- unknown: doNothing,
78
- before: doNothing,
79
- after: doNothing
80
- },
81
- onWhileLoop: {
82
- unknown: doNothing,
83
- before: doNothing,
84
- after: doNothing
85
- },
86
- onBreak: {
87
- before: doNothing,
88
- after: doNothing
89
- },
90
- onNext: {
91
- before: doNothing,
92
- after: doNothing
93
- }
94
- },
95
- operators: {
96
- onBinary: {
97
- unknown: doNothing,
98
- before: doNothing,
99
- after: doNothing
100
- },
101
- onUnary: {
102
- unknown: doNothing,
103
- before: doNothing,
104
- after: doNothing
105
- }
106
- },
107
- functions: {
108
- onFunctionDefinition: {
109
- unknown: doNothing,
110
- before: doNothing,
111
- after: doNothing
112
- },
113
- onParameter: {
114
- unknown: doNothing,
115
- before: doNothing,
116
- after: doNothing
117
- },
118
- onFunctionCall: {
119
- unknown: doNothing,
120
- before: doNothing,
121
- after: doNothing
122
- },
123
- onArgument: {
124
- unknown: doNothing,
125
- before: doNothing,
126
- after: doNothing
127
- },
128
- },
129
- expression: {
130
- onExpression: {
131
- before: doNothing,
132
- after: doNothing
133
- }
134
- }
135
- };
136
- //# sourceMappingURL=hooks.js.map
@@ -1,22 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./data"), exports);
18
- __exportStar(require("./hooks"), exports);
19
- __exportStar(require("../common/config"), exports);
20
- __exportStar(require("./normalize"), exports);
21
- __exportStar(require("../common/input-format"), exports);
22
- //# sourceMappingURL=index.js.map
@@ -1,107 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tryNormalizeAccess = void 0;
4
- const meta_1 = require("../../common/meta");
5
- const normalize_1 = require("../normalize");
6
- const hooks_1 = require("../hooks");
7
- const structure_1 = require("./structure");
8
- const assert_1 = require("../../../../../../../util/assert");
9
- const arrays_1 = require("../../../../../../../util/arrays");
10
- const argument_1 = require("./functions/argument");
11
- /**
12
- * Tries to normalize the given data as access (e.g., indexing).
13
- *
14
- * @param data - The data used by the parser (see {@link ParserData})
15
- * @param mappedWithName - The json object to extract the meta-information from
16
- *
17
- * @returns The parsed {@link RAccess} or `undefined` if the given construct is not accessing a value
18
- */
19
- function tryNormalizeAccess(data, mappedWithName) {
20
- normalize_1.parseLog.trace('trying to parse access');
21
- mappedWithName = (0, hooks_1.executeHook)(data.hooks.onAccess.before, data, mappedWithName);
22
- if (mappedWithName.length < 3) {
23
- normalize_1.parseLog.trace('expected at least three elements are required to parse an access');
24
- return (0, hooks_1.executeUnknownHook)(data.hooks.onAccess.unknown, data, mappedWithName);
25
- }
26
- const accessOp = mappedWithName[1];
27
- let operator;
28
- let closingLength = 0;
29
- switch (accessOp.name) {
30
- case "[" /* RawRType.BracketLeft */:
31
- operator = '[';
32
- closingLength = 1;
33
- break;
34
- case "$" /* RawRType.Dollar */:
35
- operator = '$';
36
- break;
37
- case "@" /* RawRType.At */:
38
- operator = '@';
39
- break;
40
- case "LBB" /* RawRType.DoubleBracketLeft */:
41
- operator = '[[';
42
- closingLength = 2;
43
- break;
44
- default:
45
- normalize_1.parseLog.trace(`expected second element to be an access operator, yet received ${accessOp.name}`);
46
- return (0, hooks_1.executeUnknownHook)(data.hooks.onAccess.unknown, data, mappedWithName);
47
- }
48
- const accessed = mappedWithName[0];
49
- if (accessed.name !== "expr" /* RawRType.Expression */ && accessed.name !== "expr_or_assign_or_help" /* RawRType.ExprOfAssignOrHelp */) {
50
- normalize_1.parseLog.trace(`expected accessed element to be wrapped an expression, yet received ${accessed.name}`);
51
- return (0, hooks_1.executeUnknownHook)(data.hooks.onAccess.unknown, data, mappedWithName);
52
- }
53
- const parsedAccessed = (0, structure_1.normalizeBasedOnType)(data, [accessed]);
54
- if (parsedAccessed.length !== 1) {
55
- normalize_1.parseLog.trace(`expected accessed element to be wrapped an expression, yet received ${accessed.name}`);
56
- return (0, hooks_1.executeUnknownHook)(data.hooks.onAccess.unknown, data, mappedWithName);
57
- }
58
- const remaining = mappedWithName.slice(2, mappedWithName.length - closingLength);
59
- normalize_1.parseLog.trace(`${remaining.length} remaining arguments for access`);
60
- const splitAccessOnComma = (0, arrays_1.splitArrayOn)(remaining, x => x.name === "," /* RawRType.Comma */);
61
- const parsedAccess = splitAccessOnComma.map(x => {
62
- if (x.length === 0) {
63
- normalize_1.parseLog.trace('record empty access');
64
- return null;
65
- }
66
- normalize_1.parseLog.trace('trying to parse access');
67
- const gotAccess = parseAccessArgument(operator, data, x);
68
- (0, assert_1.guard)(gotAccess !== undefined, () => `expected one access result in access as argument, yet received ${JSON.stringify(gotAccess)} for ${JSON.stringify([operator, x])}`);
69
- return gotAccess;
70
- });
71
- let resultingAccess = parsedAccess;
72
- if (operator === '@' || operator === '$') {
73
- (0, assert_1.guard)(parsedAccess.length === 1, () => `expected one access result in access with ${JSON.stringify(operator)}, yet received ${JSON.stringify(parsedAccess)}`);
74
- const first = parsedAccess[0];
75
- (0, assert_1.guard)(first !== null && (first.type === "RSymbol" /* RType.Symbol */ || first.type === "RString" /* RType.String */ || first.type === "RLogical" /* RType.Logical */), () => `${JSON.stringify(operator)} requires one symbol, yet received ${JSON.stringify(parsedAccess)}`);
76
- resultingAccess = first.type === "RString" /* RType.String */ ? first.content.str : first.lexeme;
77
- }
78
- const { content, location } = (0, meta_1.retrieveMetaStructure)(data.config, accessOp.content);
79
- const result = {
80
- type: "RAccess" /* RType.Access */,
81
- location,
82
- lexeme: content,
83
- accessed: parsedAccessed[0],
84
- operator,
85
- access: resultingAccess,
86
- info: {
87
- fullRange: data.currentRange,
88
- additionalTokens: [],
89
- fullLexeme: data.currentLexeme
90
- }
91
- };
92
- return (0, hooks_1.executeHook)(data.hooks.onAccess.after, data, result);
93
- }
94
- exports.tryNormalizeAccess = tryNormalizeAccess;
95
- function parseAccessArgument(operator, data, elements) {
96
- // within access the content is *not* wrapped within another expression, that means if we have a SYMBOL_SUB we can directly parse the argument,
97
- // otherwise we have to add the expression layer
98
- // console.log('parseAccessArgument', elements.map(x => x.name))
99
- if (operator === '@' || operator === '$') {
100
- const parse = (0, structure_1.normalizeBasedOnType)(data, elements);
101
- return parse.length !== 1 ? undefined : parse[0];
102
- }
103
- else {
104
- return (0, argument_1.tryToNormalizeArgument)(data, elements);
105
- }
106
- }
107
- //# sourceMappingURL=access.js.map
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tryNormalizeIfThenElse = void 0;
4
- const structure_1 = require("../structure");
5
- const normalize_1 = require("../../normalize");
6
- const if_then_1 = require("./if-then");
7
- const assert_1 = require("../../../../../../../../util/assert");
8
- const hooks_1 = require("../../hooks");
9
- const meta_1 = require("../../../common/meta");
10
- /**
11
- * Try to parse the construct as a {@link RIfThenElse}.
12
- */
13
- function tryNormalizeIfThenElse(data, tokens) {
14
- // we start by parsing a regular if-then structure
15
- normalize_1.parseLog.trace('trying to parse if-then-else structure');
16
- tokens = (0, hooks_1.executeHook)(data.hooks.control.onIfThenElse.before, data, tokens);
17
- const parsedIfThen = (0, if_then_1.tryNormalizeIfThen)(data, [tokens[0], tokens[1], tokens[2], tokens[3], tokens[4]]);
18
- if (parsedIfThen === undefined) {
19
- return (0, hooks_1.executeUnknownHook)(data.hooks.control.onIfThenElse.unknown, data, tokens);
20
- }
21
- normalize_1.parseLog.trace('if-then part successful, now parsing else part');
22
- (0, assert_1.guard)(tokens[5].name === "ELSE" /* RawRType.Else */, () => `expected else token for if-then-else but found ${JSON.stringify(tokens[5])}`);
23
- const parsedElse = (0, structure_1.tryNormalizeSingleNode)(data, tokens[6]);
24
- (0, assert_1.guard)(parsedElse.type !== "RDelimiter" /* RType.Delimiter */, () => `unexpected missing else-part of if-then-else, received ${JSON.stringify([parsedIfThen, parsedElse])} for ${JSON.stringify(tokens)}`);
25
- const result = {
26
- ...parsedIfThen,
27
- otherwise: (0, meta_1.ensureExpressionList)(parsedElse)
28
- };
29
- return (0, hooks_1.executeHook)(data.hooks.control.onIfThenElse.after, data, result);
30
- }
31
- exports.tryNormalizeIfThenElse = tryNormalizeIfThenElse;
32
- //# sourceMappingURL=if-then-else.js.map