@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,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("./for"), exports);
18
- __exportStar(require("./while"), exports);
19
- __exportStar(require("./repeat"), exports);
20
- __exportStar(require("./break"), exports);
21
- __exportStar(require("./next"), exports);
22
- //# sourceMappingURL=index.js.map
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeNext = void 0;
4
- const normalize_1 = require("../../normalize");
5
- const hooks_1 = require("../../hooks");
6
- const meta_1 = require("../../../common/meta");
7
- function normalizeNext(data, obj) {
8
- normalize_1.parseLog.debug(`[next] try: ${JSON.stringify(obj)}`);
9
- obj = (0, hooks_1.executeHook)(data.hooks.loops.onNext.before, data, obj);
10
- const { location, content } = (0, meta_1.retrieveMetaStructure)(data.config, obj);
11
- const result = {
12
- type: "RNext" /* RType.Next */,
13
- location,
14
- lexeme: content,
15
- info: {
16
- fullRange: data.currentRange,
17
- additionalTokens: [],
18
- fullLexeme: data.currentLexeme
19
- }
20
- };
21
- return (0, hooks_1.executeHook)(data.hooks.loops.onNext.after, data, result);
22
- }
23
- exports.normalizeNext = normalizeNext;
24
- //# sourceMappingURL=next.js.map
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tryNormalizeRepeat = void 0;
4
- const meta_1 = require("../../../common/meta");
5
- const normalize_1 = require("../../normalize");
6
- const structure_1 = require("../structure");
7
- const assert_1 = require("../../../../../../../../util/assert");
8
- const hooks_1 = require("../../hooks");
9
- /**
10
- * Try to parse the construct as a {@link RRepeatLoop}.
11
- *
12
- * @param data - The data used by the parser (see {@link ParserData})
13
- * @param repeatToken - Token which represents the `repeat` keyword
14
- * @param body - The `body` of the repeat-loop
15
- *
16
- * @returns The parsed {@link RRepeatLoop} or `undefined` if the given construct is not a repeat-loop
17
- */
18
- function tryNormalizeRepeat(data, repeatToken, body) {
19
- if (repeatToken.name !== "REPEAT" /* RawRType.Repeat */) {
20
- normalize_1.parseLog.debug('encountered non-repeat token for supposed repeat-loop structure');
21
- return (0, hooks_1.executeUnknownHook)(data.hooks.loops.onRepeatLoop.unknown, data, { repeatToken, body });
22
- }
23
- normalize_1.parseLog.debug('trying to parse repeat-loop');
24
- ({ repeatToken, body } = (0, hooks_1.executeHook)(data.hooks.loops.onRepeatLoop.before, data, { repeatToken, body }));
25
- const parseBody = (0, structure_1.tryNormalizeSingleNode)(data, body);
26
- (0, assert_1.guard)(parseBody.type !== "RDelimiter" /* RType.Delimiter */, () => `no body for repeat-loop ${JSON.stringify(repeatToken)} (${JSON.stringify(body)})`);
27
- const { location, content } = (0, meta_1.retrieveMetaStructure)(data.config, repeatToken.content);
28
- const result = {
29
- type: "RRepeatLoop" /* RType.RepeatLoop */,
30
- location,
31
- lexeme: content,
32
- body: (0, meta_1.ensureExpressionList)(parseBody),
33
- info: {
34
- fullRange: data.currentRange,
35
- additionalTokens: [],
36
- fullLexeme: data.currentLexeme
37
- }
38
- };
39
- return (0, hooks_1.executeHook)(data.hooks.loops.onRepeatLoop.after, data, result);
40
- }
41
- exports.tryNormalizeRepeat = tryNormalizeRepeat;
42
- //# sourceMappingURL=repeat.js.map
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tryNormalizeWhile = void 0;
4
- const input_format_1 = require("../../../common/input-format");
5
- const meta_1 = require("../../../common/meta");
6
- const normalize_1 = require("../../normalize");
7
- const structure_1 = require("../structure");
8
- const hooks_1 = require("../../hooks");
9
- function tryNormalizeWhile(data, whileToken, leftParen, condition, rightParen, body) {
10
- if (whileToken.name !== "WHILE" /* RawRType.While */) {
11
- normalize_1.parseLog.debug('encountered non-while token for supposed while-loop structure');
12
- return (0, hooks_1.executeUnknownHook)(data.hooks.loops.onWhileLoop.unknown, data, { whileToken, leftParen, condition, rightParen, body });
13
- }
14
- else if (leftParen.name !== "(" /* RawRType.ParenLeft */) {
15
- throw new input_format_1.XmlParseError(`expected left-parenthesis for while but found ${JSON.stringify(leftParen)}`);
16
- }
17
- else if (rightParen.name !== ")" /* RawRType.ParenRight */) {
18
- throw new input_format_1.XmlParseError(`expected right-parenthesis for while but found ${JSON.stringify(rightParen)}`);
19
- }
20
- normalize_1.parseLog.debug('trying to parse while-loop');
21
- const parsedCondition = (0, structure_1.tryNormalizeSingleNode)(data, condition);
22
- const parseBody = (0, structure_1.tryNormalizeSingleNode)(data, body);
23
- if (parsedCondition.type === "RDelimiter" /* RType.Delimiter */ || parseBody.type === "RDelimiter" /* RType.Delimiter */) {
24
- throw new input_format_1.XmlParseError(`unexpected under-sided while-loop, received ${JSON.stringify([
25
- parsedCondition,
26
- parseBody,
27
- ])} for ${JSON.stringify([whileToken, condition, body])}`);
28
- }
29
- const { location, content } = (0, meta_1.retrieveMetaStructure)(data.config, whileToken.content);
30
- const result = {
31
- type: "RWhileLoop" /* RType.WhileLoop */,
32
- condition: parsedCondition,
33
- body: (0, meta_1.ensureExpressionList)(parseBody),
34
- lexeme: content,
35
- location,
36
- info: {
37
- fullRange: data.currentRange,
38
- additionalTokens: [],
39
- fullLexeme: data.currentLexeme
40
- }
41
- };
42
- return (0, hooks_1.executeHook)(data.hooks.loops.onWhileLoop.after, data, result);
43
- }
44
- exports.tryNormalizeWhile = tryNormalizeWhile;
45
- //# sourceMappingURL=while.js.map
@@ -1,162 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tryNormalizeBinary = void 0;
4
- const input_format_1 = require("../../../common/input-format");
5
- const normalize_1 = require("../../normalize");
6
- const meta_1 = require("../../../common/meta");
7
- const special_1 = require("./special");
8
- const structure_1 = require("../structure");
9
- const model_1 = require("../../../../../model");
10
- const hooks_1 = require("../../hooks");
11
- const assert_1 = require("../../../../../../../../util/assert");
12
- /**
13
- * Parsing binary operations includes the pipe, even though the produced PIPE construct is not a binary operation,
14
- * to ensure it is handled separately from the others (especially in the combination of a pipe bind)
15
- */
16
- function tryNormalizeBinary(data, lhs, operator, rhs) {
17
- normalize_1.parseLog.trace(`binary op for ${lhs.name} [${operator.name}] ${rhs.name}`);
18
- let flavor;
19
- if ("SPECIAL" /* RawRType.Special */ === operator.name) {
20
- flavor = 'special';
21
- }
22
- else if (model_1.ArithmeticOperatorsRAst.has(operator.name)) {
23
- flavor = 'arithmetic';
24
- }
25
- else if (model_1.ComparisonOperatorsRAst.has(operator.name)) {
26
- flavor = 'comparison';
27
- }
28
- else if (model_1.LogicalOperatorsRAst.has(operator.name)) {
29
- flavor = 'logical';
30
- }
31
- else if (model_1.ModelFormulaOperatorsRAst.has(operator.name)) {
32
- flavor = 'model formula';
33
- }
34
- else if (model_1.AssignmentsRAst.has(operator.name)) {
35
- flavor = 'assignment';
36
- }
37
- else if (operator.name === "PIPE" /* RawRType.Pipe */) {
38
- flavor = 'pipe';
39
- }
40
- else {
41
- return (0, hooks_1.executeUnknownHook)(data.hooks.operators.onBinary.unknown, data, { lhs, operator, rhs });
42
- }
43
- return parseBinaryOp(data, flavor, lhs, operator, rhs);
44
- }
45
- exports.tryNormalizeBinary = tryNormalizeBinary;
46
- function parseBinaryOp(data, flavor, lhs, operator, rhs) {
47
- normalize_1.parseLog.debug(`[binary op] trying to parse ${flavor}`);
48
- ({ flavor, lhs, rhs, operator } = (0, hooks_1.executeHook)(data.hooks.operators.onBinary.before, data, { flavor, lhs, operator, rhs }));
49
- (0, meta_1.ensureChildrenAreLhsAndRhsOrdered)(data.config, lhs.content, rhs.content);
50
- let parsedLhs = (0, structure_1.tryNormalizeSingleNode)(data, lhs);
51
- let parsedRhs = (0, structure_1.tryNormalizeSingleNode)(data, rhs);
52
- if (parsedLhs.type === "RDelimiter" /* RType.Delimiter */ || parsedRhs.type === "RDelimiter" /* RType.Delimiter */) {
53
- throw new input_format_1.XmlParseError(`unexpected under-sided binary op, received ${JSON.stringify([parsedLhs, parsedRhs])} for ${JSON.stringify([lhs, operator, rhs])}`);
54
- }
55
- const operationName = (0, meta_1.retrieveOpName)(data.config, operator);
56
- // special support for strings in assignments
57
- if (flavor === 'assignment') {
58
- [parsedLhs, parsedRhs] = processLhsAndRhsForAssignment(data, operationName, parsedLhs, parsedRhs);
59
- }
60
- const { location, content } = (0, meta_1.retrieveMetaStructure)(data.config, operator.content);
61
- if (flavor === 'special') {
62
- flavor = (0, special_1.identifySpecialOp)(content);
63
- }
64
- if (flavor === 'special') {
65
- (0, assert_1.guard)(parsedLhs.location !== undefined && parsedLhs.lexeme !== undefined && parsedRhs.location !== undefined && parsedRhs.lexeme !== undefined, () => `special op lhs and rhs must have a locations and lexemes, but ${JSON.stringify(parsedLhs)} and ${JSON.stringify(parsedRhs)})`);
66
- // parse as infix function call!
67
- const result = {
68
- type: "RFunctionCall" /* RType.FunctionCall */,
69
- flavor: 'named',
70
- infixSpecial: true,
71
- lexeme: data.currentLexeme ?? content,
72
- location,
73
- functionName: {
74
- type: "RSymbol" /* RType.Symbol */,
75
- location,
76
- lexeme: content,
77
- content,
78
- namespace: undefined,
79
- info: {}
80
- },
81
- arguments: [
82
- {
83
- type: "RArgument" /* RType.Argument */,
84
- location: parsedLhs.location,
85
- value: parsedLhs,
86
- name: undefined,
87
- lexeme: parsedLhs.lexeme,
88
- info: {}
89
- },
90
- {
91
- type: "RArgument" /* RType.Argument */,
92
- location: parsedRhs.location,
93
- value: parsedRhs,
94
- name: undefined,
95
- lexeme: parsedRhs.lexeme,
96
- info: {}
97
- }
98
- ],
99
- info: {}
100
- };
101
- return (0, hooks_1.executeHook)(data.hooks.operators.onBinary.after, data, result);
102
- }
103
- let result;
104
- if (flavor === 'pipe') {
105
- (0, assert_1.guard)(parsedLhs.location !== undefined, () => `pipe lhs must have a location, but ${JSON.stringify(parsedLhs)})`);
106
- (0, assert_1.guard)(parsedLhs.lexeme !== undefined, () => `pipe lhs must have a full lexeme, but ${JSON.stringify(parsedLhs)})`);
107
- result = {
108
- type: "RPipe" /* RType.Pipe */,
109
- location,
110
- lhs: {
111
- type: "RArgument" /* RType.Argument */,
112
- location: parsedLhs.location,
113
- value: parsedLhs,
114
- name: undefined,
115
- lexeme: parsedLhs.lexeme,
116
- info: {}
117
- },
118
- rhs: parsedRhs,
119
- lexeme: content,
120
- info: {
121
- fullRange: data.currentRange,
122
- additionalTokens: [],
123
- fullLexeme: data.currentLexeme
124
- }
125
- };
126
- }
127
- else {
128
- result = {
129
- type: "RBinaryOp" /* RType.BinaryOp */,
130
- flavor,
131
- location,
132
- lhs: parsedLhs,
133
- rhs: parsedRhs,
134
- operator: operationName,
135
- lexeme: content,
136
- info: {
137
- fullRange: data.currentRange,
138
- additionalTokens: [],
139
- fullLexeme: data.currentLexeme
140
- }
141
- };
142
- }
143
- return (0, hooks_1.executeHook)(data.hooks.operators.onBinary.after, data, result);
144
- }
145
- function processLhsAndRhsForAssignment(data, opName, parsedLhs, parsedRhs) {
146
- const isRhs = opName === '->' || opName === '->>';
147
- const assigned = isRhs ? parsedRhs : parsedLhs;
148
- if (assigned.type !== "RString" /* RType.String */) {
149
- return [parsedLhs, parsedRhs];
150
- }
151
- // update the assigned value to be parsed as a symbol
152
- const result = {
153
- type: "RSymbol" /* RType.Symbol */,
154
- lexeme: assigned.lexeme,
155
- location: assigned.location,
156
- content: assigned.content.str,
157
- namespace: undefined,
158
- info: assigned.info
159
- };
160
- return isRhs ? [parsedLhs, result] : [result, parsedRhs];
161
- }
162
- //# sourceMappingURL=binary.js.map
@@ -1,20 +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("./unary"), exports);
18
- __exportStar(require("./binary"), exports);
19
- __exportStar(require("./special"), exports);
20
- //# sourceMappingURL=index.js.map
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.identifySpecialOp = void 0;
4
- const model_1 = require("../../../../../model");
5
- /**
6
- * Identify the flavor of a given operator, as we do not really have a use for "special"
7
- * operators within our internal AST.
8
- */
9
- function identifySpecialOp(content) {
10
- if (model_1.ComparisonOperatorsRAst.has(content)) {
11
- return 'comparison';
12
- }
13
- else if (model_1.LogicalOperatorsRAst.has(content)) {
14
- return 'logical';
15
- }
16
- else if (model_1.ArithmeticOperatorsRAst.has(content)) {
17
- return 'arithmetic';
18
- }
19
- else {
20
- return 'special';
21
- }
22
- }
23
- exports.identifySpecialOp = identifySpecialOp;
24
- //# sourceMappingURL=special.js.map
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tryNormalizeUnary = void 0;
4
- const meta_1 = require("../../../common/meta");
5
- const normalize_1 = require("../../normalize");
6
- const structure_1 = require("../structure");
7
- const assert_1 = require("../../../../../../../../util/assert");
8
- const model_1 = require("../../../../../model");
9
- const hooks_1 = require("../../hooks");
10
- /**
11
- * Parses the construct as a {@link RUnaryOp} (automatically identifies the flavor).
12
- *
13
- * @param data - The data used by the parser (see {@link ParserData})
14
- * @param operator - The operator token
15
- * @param operand - The operand of the unary operator
16
- *
17
- * @returns The parsed {@link RUnaryOp} or `undefined` if the given construct is not a unary operator
18
- */
19
- function tryNormalizeUnary(data, operator, operand) {
20
- normalize_1.parseLog.trace(`unary op for ${operator.name} ${operand.name}`);
21
- let flavor;
22
- if (model_1.ArithmeticOperatorsRAst.has(operator.name)) {
23
- flavor = 'arithmetic';
24
- }
25
- else if (model_1.LogicalOperatorsRAst.has(operator.name)) {
26
- flavor = 'logical';
27
- }
28
- else if (model_1.ModelFormulaOperatorsRAst.has(operator.name)) {
29
- flavor = 'model formula';
30
- }
31
- else {
32
- return (0, hooks_1.executeUnknownHook)(data.hooks.operators.onUnary.unknown, data, { operator, operand });
33
- }
34
- return parseUnaryOp(data, flavor, operator, operand);
35
- }
36
- exports.tryNormalizeUnary = tryNormalizeUnary;
37
- function parseUnaryOp(data, flavor, operator, operand) {
38
- normalize_1.parseLog.debug(`[unary op] parse ${flavor}`); // <- semicolon sadly required for not miss-interpreting the destructuring match as call
39
- ({ flavor, operator, operand } = (0, hooks_1.executeHook)(data.hooks.operators.onUnary.before, data, { flavor, operator, operand }));
40
- const parsedOperand = (0, structure_1.tryNormalizeSingleNode)(data, operand);
41
- (0, assert_1.guard)(parsedOperand.type !== "RDelimiter" /* RType.Delimiter */, () => 'unexpected under-sided unary op');
42
- const operationName = (0, meta_1.retrieveOpName)(data.config, operator);
43
- const { location, content } = (0, meta_1.retrieveMetaStructure)(data.config, operator.content);
44
- const result = {
45
- type: "RUnaryOp" /* RType.UnaryOp */,
46
- flavor,
47
- location,
48
- operator: operationName,
49
- lexeme: content,
50
- operand: parsedOperand,
51
- info: {
52
- fullRange: data.currentRange,
53
- additionalTokens: [],
54
- fullLexeme: data.currentLexeme
55
- }
56
- };
57
- return (0, hooks_1.executeHook)(data.hooks.operators.onUnary.after, data, result);
58
- }
59
- //# sourceMappingURL=unary.js.map
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeComment = void 0;
4
- const normalize_1 = require("../../normalize");
5
- const meta_1 = require("../../../common/meta");
6
- const assert_1 = require("../../../../../../../../util/assert");
7
- const hooks_1 = require("../../hooks");
8
- /**
9
- * Normalize the given object as an R comment.
10
- * This requires you to check the corresponding name beforehand.
11
- *
12
- * @param data - The data used by the parser (see {@link ParserData})
13
- * @param obj - The json object to extract the meta-information from
14
- */
15
- function normalizeComment(data, obj) {
16
- normalize_1.parseLog.debug('[comment]');
17
- obj = (0, hooks_1.executeHook)(data.hooks.other.onComment.before, data, obj);
18
- const { location, content } = (0, meta_1.retrieveMetaStructure)(data.config, obj);
19
- (0, assert_1.guard)(content.startsWith('#'), 'comment must start with #');
20
- const result = {
21
- type: "RComment" /* RType.Comment */,
22
- location,
23
- content: content.slice(1),
24
- lexeme: content,
25
- info: {
26
- fullRange: data.currentRange,
27
- additionalTokens: [],
28
- fullLexeme: content
29
- }
30
- };
31
- return (0, hooks_1.executeHook)(data.hooks.other.onComment.after, data, result);
32
- }
33
- exports.normalizeComment = normalizeComment;
34
- //# sourceMappingURL=comment.js.map
@@ -1,18 +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("./comment"), exports);
18
- //# sourceMappingURL=index.js.map
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeLineDirective = void 0;
4
- const normalize_1 = require("../../normalize");
5
- const meta_1 = require("../../../common/meta");
6
- const assert_1 = require("../../../../../../../../util/assert");
7
- const hooks_1 = require("../../hooks");
8
- const LineDirectiveRegex = /^#line\s+(\d+)\s+"([^"]+)"\s*$/;
9
- /**
10
- * Normalize the given object as an R line directive (`#line <number> "<file>"`).
11
- * This requires you to check the corresponding name beforehand.
12
- * If the given object turns out to be no line directive, this returns a normal comment instead.
13
- *
14
- * @param data - The data used by the parser (see {@link ParserData})
15
- * @param obj - The json object to extract the meta-information from
16
- */
17
- function normalizeLineDirective(data, obj) {
18
- normalize_1.parseLog.debug('[line-directive]');
19
- obj = (0, hooks_1.executeHook)(data.hooks.other.onLineDirective.before, data, obj);
20
- const { location, content } = (0, meta_1.retrieveMetaStructure)(data.config, obj);
21
- (0, assert_1.guard)(content.startsWith('#line'), 'line directive must start with #line');
22
- const match = LineDirectiveRegex.exec(content);
23
- let result;
24
- if (match === null) {
25
- normalize_1.parseLog.debug(`[line-directive] does not match the regex ${LineDirectiveRegex.source} given ${JSON.stringify(content)}`);
26
- result = {
27
- type: "RComment" /* RType.Comment */,
28
- location,
29
- lexeme: content,
30
- info: {
31
- fullRange: data.currentRange,
32
- additionalTokens: [],
33
- fullLexeme: content
34
- },
35
- content: content.slice(1)
36
- };
37
- }
38
- else {
39
- result = {
40
- type: "RLineDirective" /* RType.LineDirective */,
41
- location,
42
- line: parseInt(match[1]),
43
- file: match[2],
44
- lexeme: content,
45
- info: {
46
- fullRange: data.currentRange,
47
- additionalTokens: [],
48
- fullLexeme: content
49
- }
50
- };
51
- }
52
- return (0, hooks_1.executeHook)(data.hooks.other.onLineDirective.after, data, result);
53
- }
54
- exports.normalizeLineDirective = normalizeLineDirective;
55
- //# sourceMappingURL=line-directive.js.map