@eagleoutice/flowr 2.9.10 → 2.9.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 (175) hide show
  1. package/README.md +48 -50
  2. package/abstract-interpretation/absint-visitor.js +2 -1
  3. package/abstract-interpretation/data-frame/mappers/arguments.d.ts +1 -1
  4. package/abstract-interpretation/data-frame/mappers/arguments.js +2 -2
  5. package/abstract-interpretation/domains/set-range-domain.js +1 -1
  6. package/abstract-interpretation/normalized-ast-fold.d.ts +2 -2
  7. package/abstract-interpretation/normalized-ast-fold.js +4 -3
  8. package/benchmark/slicer.js +5 -5
  9. package/benchmark/summarizer/first-phase/process.js +4 -4
  10. package/cli/repl/commands/repl-normalize.js +2 -2
  11. package/cli/repl/core.js +2 -2
  12. package/config.js +1 -1
  13. package/control-flow/control-flow-graph.d.ts +1 -1
  14. package/control-flow/control-flow-graph.js +1 -2
  15. package/control-flow/extract-cfg.js +4 -3
  16. package/dataflow/cluster.js +12 -8
  17. package/dataflow/environments/built-in.d.ts +2 -15
  18. package/dataflow/environments/built-in.js +11 -31
  19. package/dataflow/eval/resolve/alias-tracking.d.ts +1 -1
  20. package/dataflow/eval/resolve/alias-tracking.js +2 -1
  21. package/dataflow/eval/resolve/resolve.js +4 -3
  22. package/dataflow/fn/exceptions-of-function.d.ts +1 -1
  23. package/dataflow/fn/exceptions-of-function.js +2 -1
  24. package/dataflow/graph/call-graph.d.ts +1 -1
  25. package/dataflow/graph/call-graph.js +4 -3
  26. package/dataflow/graph/dataflowgraph-builder.d.ts +1 -1
  27. package/dataflow/graph/dataflowgraph-builder.js +21 -21
  28. package/dataflow/graph/graph.d.ts +4 -4
  29. package/dataflow/graph/graph.js +27 -22
  30. package/dataflow/graph/quads.js +4 -7
  31. package/dataflow/internal/linker.d.ts +2 -2
  32. package/dataflow/internal/linker.js +15 -14
  33. package/dataflow/internal/process/functions/call/argument/make-argument.d.ts +2 -1
  34. package/dataflow/internal/process/functions/call/argument/make-argument.js +2 -1
  35. package/dataflow/internal/process/functions/call/built-in/built-in-access.d.ts +1 -1
  36. package/dataflow/internal/process/functions/call/built-in/built-in-access.js +2 -1
  37. package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +3 -5
  38. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.d.ts +1 -1
  39. package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +6 -5
  40. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.d.ts +1 -1
  41. package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +3 -2
  42. package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +4 -4
  43. package/dataflow/internal/process/functions/call/built-in/built-in-local.js +3 -3
  44. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +1 -1
  45. package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +2 -1
  46. package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +3 -3
  47. package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +3 -3
  48. package/dataflow/internal/process/functions/call/common.d.ts +1 -1
  49. package/dataflow/internal/process/functions/call/common.js +43 -35
  50. package/dataflow/internal/process/functions/process-argument.d.ts +1 -1
  51. package/dataflow/internal/process/functions/process-argument.js +3 -3
  52. package/dataflow/internal/process/functions/process-parameter.js +2 -2
  53. package/dataflow/origin/dfg-get-origin.d.ts +1 -1
  54. package/dataflow/origin/dfg-get-origin.js +2 -2
  55. package/documentation/doc-util/doc-types.js +1 -1
  56. package/documentation/wiki-cfg.js +3 -3
  57. package/documentation/wiki-dataflow-graph.js +86 -31
  58. package/documentation/wiki-engine.js +18 -0
  59. package/documentation/wiki-mk/doc-context.d.ts +52 -11
  60. package/documentation/wiki-mk/doc-context.js +20 -13
  61. package/documentation/wiki-normalized-ast.d.ts +1 -1
  62. package/documentation/wiki-normalized-ast.js +9 -6
  63. package/linter/linter-format.d.ts +10 -0
  64. package/linter/linter-format.js +15 -0
  65. package/linter/rules/absolute-path.js +3 -3
  66. package/linter/rules/file-path-validity.js +1 -1
  67. package/package.json +1 -1
  68. package/project/plugins/file-plugins/files/flowr-description-file.d.ts +5 -0
  69. package/project/plugins/file-plugins/files/flowr-description-file.js +8 -0
  70. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.d.ts +1 -1
  71. package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +4 -5
  72. package/queries/catalog/dependencies-query/dependencies-query-executor.js +2 -1
  73. package/queries/catalog/dependencies-query/dependencies-query-format.js +6 -5
  74. package/queries/catalog/dependencies-query/function-info/library-functions.js +2 -1
  75. package/queries/catalog/dependencies-query/function-info/read-functions.js +1 -1
  76. package/queries/catalog/dependencies-query/function-info/visualize-functions.js +9 -1
  77. package/queries/catalog/dependencies-query/function-info/write-functions.js +1 -0
  78. package/queries/catalog/does-call-query/does-call-query-executor.js +3 -3
  79. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +1 -1
  80. package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.js +2 -2
  81. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +1 -1
  82. package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.js +1 -1
  83. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +1 -1
  84. package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.js +1 -1
  85. package/queries/query-print.d.ts +1 -1
  86. package/queries/query-print.js +4 -3
  87. package/r-bridge/lang-4.x/ast/model/model.d.ts +151 -4
  88. package/r-bridge/lang-4.x/ast/model/model.js +249 -0
  89. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +11 -1
  90. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.js +13 -0
  91. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +19 -1
  92. package/r-bridge/lang-4.x/ast/model/nodes/r-access.js +26 -0
  93. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +36 -3
  94. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +48 -13
  95. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +16 -1
  96. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.js +21 -0
  97. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +11 -1
  98. package/r-bridge/lang-4.x/ast/model/nodes/r-break.js +14 -0
  99. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +8 -2
  100. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.js +11 -5
  101. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +23 -1
  102. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.js +32 -0
  103. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +11 -1
  104. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.js +14 -0
  105. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +19 -1
  106. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +26 -1
  107. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +11 -1
  108. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.js +14 -0
  109. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +11 -1
  110. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.js +14 -0
  111. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +12 -2
  112. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.js +14 -0
  113. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +20 -2
  114. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.js +26 -0
  115. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +12 -2
  116. package/r-bridge/lang-4.x/ast/model/nodes/r-next.js +14 -0
  117. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +8 -2
  118. package/r-bridge/lang-4.x/ast/model/nodes/r-number.js +11 -5
  119. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +17 -1
  120. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +22 -0
  121. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +16 -1
  122. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +22 -0
  123. package/r-bridge/lang-4.x/ast/model/nodes/r-project.d.ts +45 -8
  124. package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +57 -16
  125. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +12 -2
  126. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.js +14 -0
  127. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +15 -3
  128. package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +21 -6
  129. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +21 -6
  130. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +22 -5
  131. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +16 -1
  132. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.js +21 -0
  133. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +11 -1
  134. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.js +14 -0
  135. package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +39 -2
  136. package/r-bridge/lang-4.x/ast/model/processing/node-id.js +52 -9
  137. package/r-bridge/lang-4.x/ast/model/processing/visitor.d.ts +8 -7
  138. package/r-bridge/lang-4.x/ast/model/processing/visitor.js +6 -13
  139. package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +1 -1
  140. package/r-bridge/lang-4.x/ast/parser/json/parser.js +1 -1
  141. package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +4 -2
  142. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-number.js +1 -1
  143. package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-string.js +2 -2
  144. package/r-bridge/lang-4.x/convert-values.d.ts +14 -5
  145. package/r-bridge/lang-4.x/convert-values.js +76 -72
  146. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +2 -2
  147. package/r-bridge/roxygen2/roxygen-parse.js +1 -1
  148. package/r-bridge/shell-executor.js +1 -1
  149. package/reconstruct/auto-select/magic-comments.js +4 -4
  150. package/reconstruct/reconstruct.js +2 -1
  151. package/search/search-executor/search-generators.js +2 -2
  152. package/slicing/criterion/filters/all-variables.js +1 -1
  153. package/slicing/criterion/parse.d.ts +1 -1
  154. package/slicing/criterion/parse.js +5 -3
  155. package/slicing/static/slice-call.d.ts +1 -1
  156. package/slicing/static/slice-call.js +2 -2
  157. package/statistics/features/supported/assignments/assignments.js +2 -2
  158. package/statistics/features/supported/control-flow/control-flow.js +2 -2
  159. package/statistics/features/supported/data-access/data-access.js +4 -3
  160. package/statistics/features/supported/defined-functions/defined-functions.js +9 -8
  161. package/statistics/features/supported/expression-list/statistics-expression-list.js +2 -2
  162. package/statistics/features/supported/loops/loops.js +6 -5
  163. package/statistics/features/supported/used-functions/used-functions.js +2 -2
  164. package/statistics/features/supported/variables/variables.js +8 -8
  165. package/util/mermaid/ast.js +2 -2
  166. package/util/mermaid/cfg.js +3 -4
  167. package/util/mermaid/dfg.d.ts +9 -1
  168. package/util/mermaid/dfg.js +13 -9
  169. package/util/quads.js +14 -6
  170. package/util/range.d.ts +3 -0
  171. package/util/range.js +3 -0
  172. package/util/simple-df/dfg-ascii.js +1 -1
  173. package/util/version.js +1 -1
  174. package/r-bridge/lang-4.x/ast/model/collect.d.ts +0 -10
  175. package/r-bridge/lang-4.x/ast/model/collect.js +0 -25
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RNull = exports.RNa = exports.RInf = exports.RIntegerMarker = exports.RImaginaryMarker = exports.RNumHexFloatRegex = exports.RFalse = exports.RTrue = void 0;
3
+ exports.RNull = exports.RNa = exports.RStringValue = exports.RNumberValue = exports.RInf = exports.RIntegerMarker = exports.RImaginaryMarker = exports.RNumHexFloatRegex = exports.RFalse = exports.RTrue = void 0;
4
4
  exports.ts2r = ts2r;
5
5
  exports.isBoolean = isBoolean;
6
6
  exports.boolean2ts = boolean2ts;
7
- exports.number2ts = number2ts;
8
- exports.string2ts = string2ts;
9
7
  exports.isNA = isNA;
10
8
  const strings_1 = require("../../util/text/strings");
11
9
  class ValueConversionError extends Error {
@@ -79,85 +77,91 @@ function getDecimalPlacesWithRadix(floatPart, radix) {
79
77
  exports.RImaginaryMarker = 'i';
80
78
  exports.RIntegerMarker = 'L';
81
79
  exports.RInf = 'Inf';
82
- /**
83
- * Convert a valid R number into a {@link RNumberValue}.
84
- */
85
- function number2ts(value) {
86
- // check for hexadecimal number with floating point addon which is supported by R but not by JS :/
87
- let lcValue = value.toLowerCase();
88
- /* both checks are case-sensitive! */
89
- const last = value.at(-1);
90
- const markedAsInt = last === exports.RIntegerMarker;
91
- const complexNumber = last === exports.RImaginaryMarker;
92
- if (markedAsInt || complexNumber) {
93
- lcValue = lcValue.slice(0, -1);
94
- }
95
- if (value === exports.RInf) {
96
- return {
97
- num: Infinity,
98
- complexNumber,
99
- markedAsInt
100
- };
101
- }
102
- if (value === exports.RNa) {
103
- return {
104
- num: NaN,
105
- complexNumber,
106
- markedAsInt
107
- };
108
- }
109
- const floatHex = lcValue.match(exports.RNumHexFloatRegex);
110
- if (floatHex == null) {
111
- return {
112
- num: Number(lcValue),
113
- complexNumber,
114
- markedAsInt
115
- };
116
- }
117
- else {
118
- const { intPart, floatPart, exp } = floatHex.groups;
119
- const base = intPart === undefined ? 0 : parseInt(`${intPart}`, 16);
120
- const floatSuffix = floatPart === undefined ? 0 : getDecimalPlacesWithRadix(floatPart, 16);
121
- const exponent = parseInt(exp, 10);
122
- return {
123
- num: (base + floatSuffix) * Math.pow(2, exponent),
124
- complexNumber,
125
- markedAsInt
126
- };
80
+ exports.RNumberValue = {
81
+ name: 'RNumberValue',
82
+ fromRLexeme(value) {
83
+ // check for hexadecimal number with floating point addon which is supported by R but not by JS :/
84
+ let lcValue = value.toLowerCase();
85
+ /* both checks are case-sensitive! */
86
+ const last = value.at(-1);
87
+ const markedAsInt = last === exports.RIntegerMarker;
88
+ const complexNumber = last === exports.RImaginaryMarker;
89
+ if (markedAsInt || complexNumber) {
90
+ lcValue = lcValue.slice(0, -1);
91
+ }
92
+ if (value === exports.RInf) {
93
+ return {
94
+ num: Infinity,
95
+ complexNumber,
96
+ markedAsInt
97
+ };
98
+ }
99
+ if (value === exports.RNa) {
100
+ return {
101
+ num: NaN,
102
+ complexNumber,
103
+ markedAsInt
104
+ };
105
+ }
106
+ const floatHex = lcValue.match(exports.RNumHexFloatRegex);
107
+ if (floatHex == null) {
108
+ return {
109
+ num: Number(lcValue),
110
+ complexNumber,
111
+ markedAsInt
112
+ };
113
+ }
114
+ else {
115
+ const { intPart, floatPart, exp } = floatHex.groups;
116
+ const base = intPart === undefined ? 0 : parseInt(`${intPart}`, 16);
117
+ const floatSuffix = floatPart === undefined ? 0 : getDecimalPlacesWithRadix(floatPart, 16);
118
+ const exponent = parseInt(exp, 10);
119
+ return {
120
+ num: (base + floatSuffix) * Math.pow(2, exponent),
121
+ complexNumber,
122
+ markedAsInt
123
+ };
124
+ }
127
125
  }
128
- }
126
+ };
129
127
  /**
130
- * Convert a valid R string into a {@link RStringValue}.
131
- * @throws {@link ValueConversionError} if the string has an unknown starting quote
128
+ * Checks whether the given string is an R string literal (including raw strings).
132
129
  */
133
- function string2ts(value) {
134
- if (value.length < 2) {
135
- throw new ValueConversionError(`cannot parse string '${value}' as it is too short`);
136
- }
137
- const init = value[0];
138
- if (init === '"' || init === '\'') {
139
- return {
140
- str: value.slice(1, -1),
141
- quotes: init
142
- };
143
- }
144
- else if (init === 'r' || init === 'R' && value.length >= 3) {
145
- const flags = value[1];
146
- if (flags === '"' || flags === '\'') {
130
+ exports.RStringValue = {
131
+ name: 'RStringValue',
132
+ /**
133
+ * Convert a valid R string into a {@link RStringValue}.
134
+ * @throws {@link ValueConversionError} if the string has an unknown starting quote
135
+ */
136
+ fromRLexeme(value) {
137
+ if (value.length < 2) {
138
+ throw new ValueConversionError(`cannot parse string '${value}' as it is too short`);
139
+ }
140
+ const init = value[0];
141
+ if (init === '"' || init === '\'') {
147
142
  return {
148
- str: (0, strings_1.dropRawStringSurround)(value.slice(2, -1)),
149
- quotes: flags,
150
- flag: 'raw'
143
+ str: value.slice(1, -1),
144
+ quotes: init
151
145
  };
152
146
  }
147
+ else if ((init === 'r' || init === 'R') && value.length >= 3) {
148
+ const flags = value[1];
149
+ if (flags === '"' || flags === '\'') {
150
+ return {
151
+ str: (0, strings_1.dropRawStringSurround)(value.slice(2, -1)),
152
+ quotes: flags,
153
+ flag: 'raw'
154
+ };
155
+ }
156
+ else {
157
+ throw new ValueConversionError(`expected string to start with a known quote (' or "), or raw, yet received ${value}`);
158
+ }
159
+ }
153
160
  else {
154
161
  throw new ValueConversionError(`expected string to start with a known quote (' or "), or raw, yet received ${value}`);
155
162
  }
156
163
  }
157
- else {
158
- throw new ValueConversionError(`expected string to start with a known quote (' or "), or raw, yet received ${value}`);
159
- }
160
- }
164
+ };
161
165
  exports.RNa = 'NA';
162
166
  exports.RNull = 'NULL';
163
167
  /**
@@ -415,7 +415,7 @@ function convertTreeNode(node) {
415
415
  return {
416
416
  type: type_1.RType.String,
417
417
  location: range,
418
- content: (0, convert_values_1.string2ts)(node.text),
418
+ content: convert_values_1.RStringValue.fromRLexeme(node.text),
419
419
  lexeme: node.text,
420
420
  ...defaultInfo
421
421
  };
@@ -427,7 +427,7 @@ function convertTreeNode(node) {
427
427
  return {
428
428
  type: type_1.RType.Number,
429
429
  location: range,
430
- content: (0, convert_values_1.number2ts)(node.text),
430
+ content: convert_values_1.RNumberValue.fromRLexeme(node.text),
431
431
  lexeme: node.text,
432
432
  ...defaultInfo
433
433
  };
@@ -36,7 +36,7 @@ function parseRoxygenCommentsOfNode(node, idMap) {
36
36
  let cur = node;
37
37
  do {
38
38
  comments = cur?.info.adToks
39
- ?.filter(r_comment_1.isRComment).filter(r => (0, assert_1.isNotUndefined)(r.lexeme));
39
+ ?.filter(r_comment_1.RComment.is).filter(r => (0, assert_1.isNotUndefined)(r.lexeme));
40
40
  cur = cur?.info.parent ? idMap?.get(cur.info.parent) : undefined;
41
41
  } while ((comments === undefined || comments.length === 0) && cur !== undefined);
42
42
  if (comments === undefined || comments.length === 0) {
@@ -35,7 +35,7 @@ class RShellExecutor {
35
35
  * Adds commands that should be executed for every {@link RShellExecutor#run|run}.
36
36
  */
37
37
  addPrerequisites(commands) {
38
- this.prerequisites.push(...(typeof commands == 'string' ? [commands] : commands));
38
+ this.prerequisites.push(...(typeof commands === 'string' ? [commands] : commands));
39
39
  return this;
40
40
  }
41
41
  /**
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeMagicCommentHandler = makeMagicCommentHandler;
4
- const visitor_1 = require("../../r-bridge/lang-4.x/ast/model/processing/visitor");
5
- const type_1 = require("../../r-bridge/lang-4.x/ast/model/type");
4
+ const r_comment_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-comment");
6
5
  const assert_1 = require("../../util/assert");
6
+ const r_project_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-project");
7
7
  function getLoc({ location, info: { fullRange } }) {
8
8
  const loc = location ?? fullRange;
9
9
  (0, assert_1.guard)(loc !== undefined, 'TODO: support location-less nodes!');
@@ -52,13 +52,13 @@ function makeMagicCommentHandler(and) {
52
52
  if (!lines) {
53
53
  lines = new Set();
54
54
  const startLineStack = [];
55
- (0, visitor_1.visitAst)(normalizedAst.ast.files.map(f => f.root), n => {
55
+ r_project_1.RProject.visitAst(normalizedAst.ast, n => {
56
56
  const comments = n.info.adToks;
57
57
  if (!comments) {
58
58
  return;
59
59
  }
60
60
  for (const c of comments) {
61
- if (c.type !== type_1.RType.Comment || !c.lexeme.startsWith('# flowr@')) {
61
+ if (!r_comment_1.RComment.is(c) || !c.lexeme.startsWith('# flowr@')) {
62
62
  continue;
63
63
  }
64
64
  const match = commentTriggerRegex.exec(c.lexeme);
@@ -9,6 +9,7 @@ exports.reconstructLogger = void 0;
9
9
  exports.reconstructToCode = reconstructToCode;
10
10
  const log_1 = require("../util/log");
11
11
  const assert_1 = require("../util/assert");
12
+ const model_1 = require("../r-bridge/lang-4.x/ast/model/model");
12
13
  const type_1 = require("../r-bridge/lang-4.x/ast/model/type");
13
14
  const r_function_call_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
14
15
  const stateful_fold_1 = require("../r-bridge/lang-4.x/ast/model/processing/stateful-fold");
@@ -19,7 +20,7 @@ function plain(text) {
19
20
  }
20
21
  exports.reconstructLogger = log_1.log.getSubLogger({ name: 'reconstruct' });
21
22
  function getLexeme(n) {
22
- return n.info.fullLexeme ?? n.lexeme ?? '';
23
+ return model_1.RNode.lexeme(n) ?? '';
23
24
  }
24
25
  function reconstructAsLeaf(leaf, configuration) {
25
26
  const selectionHasLeaf = configuration.selection.has(leaf.info.id) || configuration.autoSelectIf(leaf, configuration.fullAst);
@@ -7,8 +7,8 @@ const parse_1 = require("../../slicing/criterion/parse");
7
7
  const assert_1 = require("../../util/assert");
8
8
  const query_1 = require("../../queries/query");
9
9
  const search_enrichers_1 = require("./search-enrichers");
10
- const visitor_1 = require("../../r-bridge/lang-4.x/ast/model/processing/visitor");
11
10
  const log_1 = require("../../util/log");
11
+ const r_project_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-project");
12
12
  exports.searchLogger = log_1.log.getSubLogger({ name: 'search' });
13
13
  /**
14
14
  * All supported generators!
@@ -110,7 +110,7 @@ async function generateSyntax(input, args) {
110
110
  return new flowr_search_1.FlowrSearchElements([]);
111
111
  }
112
112
  const nodesByTreeSitterId = new Map();
113
- (0, visitor_1.visitAst)((await input.normalize()).ast.files.map(f => f.root), node => {
113
+ r_project_1.RProject.visitAst((await input.normalize()).ast, node => {
114
114
  const treeSitterInfo = node.info;
115
115
  if (treeSitterInfo.tsId) {
116
116
  nodesByTreeSitterId.set(treeSitterInfo.tsId, node);
@@ -16,7 +16,7 @@ const defaultAllVariablesCollectorFolds = {
16
16
  foldNumber: onLeaf,
17
17
  foldString: onLeaf,
18
18
  foldLogical: onLeaf,
19
- foldSymbol: (symbol) => (0, r_symbol_1.isSpecialSymbol)(symbol) ? [] : [symbol.info.id],
19
+ foldSymbol: (symbol) => r_symbol_1.RSymbol.isSpecial(symbol) ? [] : [symbol.info.id],
20
20
  foldAccess: (_, name, access) => [...name, ...access.filter(assert_1.isNotNull).flat()],
21
21
  foldBinaryOp: onBinary,
22
22
  foldPipe: onBinary,
@@ -1,4 +1,4 @@
1
- import { type NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
1
+ import { 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
4
  export type SingleSlicingCriterion = `${number}:${number}` | `${number}@${string}` | `$${NodeId | number}`;
@@ -25,11 +25,13 @@ exports.CriteriaParseError = CriteriaParseError;
25
25
  function slicingCriterionToId(criterion, idMap) {
26
26
  let resolved;
27
27
  if (criterion.startsWith('$')) {
28
- resolved = (0, node_id_1.normalizeIdToNumberIfPossible)(criterion.substring(1));
28
+ resolved = node_id_1.NodeId.normalize(criterion.substring(1));
29
29
  }
30
30
  else if (criterion.includes('@')) {
31
- const [line, name] = criterion.split(/@(.*)/s); // only split at first occurrence
32
- resolved = conventionalCriteriaToId(parseInt(line), name, idMap);
31
+ const at = criterion.indexOf('@');
32
+ const line = parseInt(criterion.substring(0, at));
33
+ const name = criterion.substring(at + 1);
34
+ resolved = conventionalCriteriaToId(line, name, idMap);
33
35
  }
34
36
  else if (criterion.includes(':')) {
35
37
  const [line, column] = criterion.split(':').map(c => parseInt(c));
@@ -4,7 +4,7 @@ import { type Fingerprint } from './fingerprint';
4
4
  import type { DataflowGraphVertexFunctionCall, DataflowGraphVertexInfo } from '../../dataflow/graph/vertex';
5
5
  import type { REnvironmentInformation } from '../../dataflow/environments/environment';
6
6
  import { type DataflowGraph, type OutgoingEdges } from '../../dataflow/graph/graph';
7
- import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
7
+ import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
8
8
  import type { DataflowInformation } from '../../dataflow/info';
9
9
  import type { ReadOnlyFlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
10
10
  /**
@@ -7,9 +7,9 @@ const assert_1 = require("../../util/assert");
7
7
  const fingerprint_1 = require("./fingerprint");
8
8
  const linker_1 = require("../../dataflow/internal/linker");
9
9
  const graph_1 = require("../../dataflow/graph/graph");
10
- const built_in_1 = require("../../dataflow/environments/built-in");
11
10
  const resolve_by_name_1 = require("../../dataflow/environments/resolve-by-name");
12
11
  const edge_1 = require("../../dataflow/graph/edge");
12
+ const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
13
13
  const identifier_1 = require("../../dataflow/environments/identifier");
14
14
  const built_in_function_definition_1 = require("../../dataflow/internal/process/functions/call/built-in/built-in-function-definition");
15
15
  const static_slicer_1 = require("./static-slicer");
@@ -24,7 +24,7 @@ function getAllFunctionCallTargetsForSlice(dataflowGraph, callerInfo, baseEnviro
24
24
  const activeEnvironment = (0, built_in_function_definition_1.retrieveActiveEnvironment)(callerInfo.environment, baseEnvironment, ctx);
25
25
  const name = callerInfo.name;
26
26
  (0, assert_1.guard)(name !== undefined, () => `name of id: ${callerInfo.id} can not be found in id map`);
27
- const functionCallDefs = (0, resolve_by_name_1.resolveByName)(name, activeEnvironment, identifier_1.ReferenceType.Unknown)?.filter(d => !(0, built_in_1.isBuiltIn)(d.definedAt))?.map(d => d.nodeId) ?? [];
27
+ const functionCallDefs = (0, resolve_by_name_1.resolveByName)(name, activeEnvironment, identifier_1.ReferenceType.Unknown)?.filter(d => !node_id_1.NodeId.isBuiltIn(d.definedAt))?.map(d => d.nodeId) ?? [];
28
28
  for (const [target, outgoingEdge] of outgoingEdges[1].entries()) {
29
29
  if (edge_1.DfEdge.includesType(outgoingEdge, edge_1.EdgeType.Calls)) {
30
30
  functionCallDefs.push(target);
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.assignments = exports.AssignmentOperators = void 0;
4
4
  const common_syntax_probability_1 = require("../../common-syntax-probability");
5
5
  const post_process_1 = require("./post-process");
6
- const visitor_1 = require("../../../../r-bridge/lang-4.x/ast/model/processing/visitor");
7
6
  const type_1 = require("../../../../r-bridge/lang-4.x/ast/model/type");
8
7
  const operators_1 = require("../../../../r-bridge/lang-4.x/ast/model/operators");
8
+ const model_1 = require("../../../../r-bridge/lang-4.x/ast/model/model");
9
9
  const initialAssignmentInfo = {
10
10
  // operator to occurrence count
11
11
  assignmentOperator: {},
@@ -17,7 +17,7 @@ const initialAssignmentInfo = {
17
17
  exports.AssignmentOperators = new Set(operators_1.Operators.filter(op => operators_1.OperatorDatabase[op].usedAs === 'assignment'));
18
18
  function visitAssignment(info, input) {
19
19
  const assignmentStack = [];
20
- (0, visitor_1.visitAst)(input.normalizedRAst.ast.files.map(r => r.root), node => {
20
+ model_1.RNode.visitAst(input.normalizedRAst.ast.files.map(r => r.root), node => {
21
21
  if (node.type !== type_1.RType.BinaryOp || !exports.AssignmentOperators.has(node.operator)) {
22
22
  return;
23
23
  }
@@ -5,7 +5,7 @@ const common_syntax_probability_1 = require("../../common-syntax-probability");
5
5
  const post_process_1 = require("./post-process");
6
6
  const unpack_argument_1 = require("../../../../dataflow/internal/process/functions/call/argument/unpack-argument");
7
7
  const type_1 = require("../../../../r-bridge/lang-4.x/ast/model/type");
8
- const visitor_1 = require("../../../../r-bridge/lang-4.x/ast/model/processing/visitor");
8
+ const r_project_1 = require("../../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
9
9
  const initialControlflowInfo = {
10
10
  ifThen: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(),
11
11
  thenBody: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(),
@@ -20,7 +20,7 @@ const initialControlflowInfo = {
20
20
  };
21
21
  function visitIfThenElse(info, input) {
22
22
  const ifThenElseStack = [];
23
- (0, visitor_1.visitAst)(input.normalizedRAst.ast.files.map(f => f.root), node => {
23
+ r_project_1.RProject.visitAst(input.normalizedRAst.ast, node => {
24
24
  if (node.type !== type_1.RType.IfThenElse) {
25
25
  if (node.type === type_1.RType.FunctionCall && node.named && node.functionName.content === 'switch') {
26
26
  const initialArg = (0, unpack_argument_1.unpackNonameArg)(node.arguments[0]);
@@ -5,10 +5,11 @@ const common_syntax_probability_1 = require("../../common-syntax-probability");
5
5
  const post_process_1 = require("./post-process");
6
6
  const assert_1 = require("../../../../util/assert");
7
7
  const type_1 = require("../../../../r-bridge/lang-4.x/ast/model/type");
8
- const visitor_1 = require("../../../../r-bridge/lang-4.x/ast/model/processing/visitor");
9
8
  const role_1 = require("../../../../r-bridge/lang-4.x/ast/model/processing/role");
10
9
  const statistics_file_1 = require("../../../output/statistics-file");
11
10
  const r_function_call_1 = require("../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
11
+ const r_project_1 = require("../../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
12
+ const model_1 = require("../../../../r-bridge/lang-4.x/ast/model/model");
12
13
  const initialDataAccessInfo = {
13
14
  // for the nth argument, how many of them are constant, etc.
14
15
  singleBracket: {
@@ -46,7 +47,7 @@ function visitAccess(info, input) {
46
47
  const accessNest = [];
47
48
  const accessChain = [];
48
49
  const parentRoleCache = new Map();
49
- (0, visitor_1.visitAst)(input.normalizedRAst.ast.files.map(f => f.root), node => {
50
+ r_project_1.RProject.visitAst(input.normalizedRAst.ast, node => {
50
51
  if (node.type !== type_1.RType.Access) {
51
52
  return;
52
53
  }
@@ -76,7 +77,7 @@ function visitAccess(info, input) {
76
77
  }
77
78
  parentRoleCache.set(node.info.id, { acc, idxAcc });
78
79
  if (accessNest.length === 0 && accessChain.length === 0) { // store topmost, after add as it must not be a child to do that
79
- (0, statistics_file_1.appendStatisticsFile)(exports.dataAccess.name, 'dataAccess', [node.info.fullLexeme ?? node.lexeme], input.filepath);
80
+ (0, statistics_file_1.appendStatisticsFile)(exports.dataAccess.name, 'dataAccess', [model_1.RNode.lexeme(node)], input.filepath);
80
81
  }
81
82
  const op = node.operator;
82
83
  switch (op) {
@@ -6,9 +6,10 @@ const range_1 = require("../../../../util/range");
6
6
  const assert_1 = require("../../../../util/assert");
7
7
  const edge_1 = require("../../../../dataflow/graph/edge");
8
8
  const type_1 = require("../../../../r-bridge/lang-4.x/ast/model/type");
9
- const visitor_1 = require("../../../../r-bridge/lang-4.x/ast/model/processing/visitor");
10
9
  const statistics_file_1 = require("../../../output/statistics-file");
11
10
  const vertex_1 = require("../../../../dataflow/graph/vertex");
11
+ const r_project_1 = require("../../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
12
+ const model_1 = require("../../../../r-bridge/lang-4.x/ast/model/model");
12
13
  const initialFunctionDefinitionInfo = {
13
14
  /** all, anonymous, assigned, non-assigned, ... */
14
15
  total: 0,
@@ -45,7 +46,7 @@ function retrieveAllCallsites(input, node, recursiveCalls) {
45
46
  function visitDefinitions(info, input) {
46
47
  const definitionStack = [];
47
48
  const allDefinitions = [];
48
- (0, visitor_1.visitAst)(input.normalizedRAst.ast.files.map(f => f.root), node => {
49
+ r_project_1.RProject.visitAst(input.normalizedRAst.ast, node => {
49
50
  if (node.type !== type_1.RType.FunctionDefinition) {
50
51
  return;
51
52
  }
@@ -67,15 +68,15 @@ function visitDefinitions(info, input) {
67
68
  if (definitionStack.length > 0) {
68
69
  info.nestedFunctions++;
69
70
  info.deepestNesting = Math.max(info.deepestNesting, definitionStack.length);
70
- (0, statistics_file_1.appendStatisticsFile)(exports.definedFunctions.name, 'nested-definitions', [node.info.fullLexeme ?? node.lexeme], input.filepath);
71
+ (0, statistics_file_1.appendStatisticsFile)(exports.definedFunctions.name, 'nested-definitions', [model_1.RNode.lexeme(node)], input.filepath);
71
72
  }
72
73
  // parameter names:
73
- const parameterNames = node.parameters.map(p => p.info.fullLexeme ?? p.lexeme);
74
+ const parameterNames = node.parameters.map(model_1.RNode.lexeme);
74
75
  (0, statistics_file_1.appendStatisticsFile)(exports.definedFunctions.name, 'usedParameterNames', parameterNames, input.filepath);
75
76
  const isLambda = node.lexeme.startsWith('\\');
76
77
  if (isLambda) {
77
78
  info.lambdasOnly++;
78
- (0, statistics_file_1.appendStatisticsFile)(exports.definedFunctions.name, 'allLambdas', [node.info.fullLexeme ?? node.lexeme], input.filepath);
79
+ (0, statistics_file_1.appendStatisticsFile)(exports.definedFunctions.name, 'allLambdas', [model_1.RNode.lexeme(node)], input.filepath);
79
80
  }
80
81
  definitionStack.push(node);
81
82
  // we find definitions with silly defined-by edges
@@ -86,7 +87,7 @@ function visitDefinitions(info, input) {
86
87
  if (edge_1.DfEdge.includesType(edge, edge_1.EdgeType.DefinedBy)) {
87
88
  const target = input.normalizedRAst.idMap.get(targetId);
88
89
  (0, assert_1.guard)(target !== undefined, 'Dataflow edge points to unknown node');
89
- const name = target.info.fullLexeme ?? target.lexeme;
90
+ const name = model_1.RNode.lexeme(target);
90
91
  if (name) {
91
92
  assigned.add(name);
92
93
  }
@@ -101,14 +102,14 @@ function visitDefinitions(info, input) {
101
102
  }
102
103
  // track all calls with the same name that do not already have a bound calls edge, superfluous if recursive tracking is explicit
103
104
  const recursiveCalls = [];
104
- (0, visitor_1.visitAst)(node.body, n => {
105
+ model_1.RNode.visitAst(node.body, n => {
105
106
  if (n.type === type_1.RType.FunctionCall && n.named && assigned.has(n.functionName.lexeme)) {
106
107
  recursiveCalls.push(n);
107
108
  }
108
109
  });
109
110
  // one recursive definition, but we record all
110
111
  info.recursive += recursiveCalls.length > 0 ? 1 : 0;
111
- (0, statistics_file_1.appendStatisticsFile)(exports.definedFunctions.name, 'recursive', recursiveCalls.map(n => n.info.fullLexeme ?? n.lexeme ?? 'unknown'), input.filepath);
112
+ (0, statistics_file_1.appendStatisticsFile)(exports.definedFunctions.name, 'recursive', recursiveCalls.map(n => model_1.RNode.lexeme(n) ?? 'unknown'), input.filepath);
112
113
  const lexeme = node.info.fullLexeme;
113
114
  const lexemeSplit = lexeme?.split('\n');
114
115
  allDefinitions.push({
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.expressionList = void 0;
4
4
  const post_process_1 = require("./post-process");
5
- const visitor_1 = require("../../../../r-bridge/lang-4.x/ast/model/processing/visitor");
6
5
  const type_1 = require("../../../../r-bridge/lang-4.x/ast/model/type");
6
+ const r_project_1 = require("../../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
7
7
  const initialExpressionListInfo = {
8
8
  allExpressionLists: 0,
9
9
  deepestNesting: 0
@@ -11,7 +11,7 @@ const initialExpressionListInfo = {
11
11
  function visitLists(info, input) {
12
12
  let nest = -1; // we start with nesting 0
13
13
  let total = 0;
14
- (0, visitor_1.visitAst)(input.normalizedRAst.ast.files.map(f => f.root), node => {
14
+ r_project_1.RProject.visitAst(input.normalizedRAst.ast, node => {
15
15
  if (node.type === type_1.RType.ExpressionList) {
16
16
  nest++;
17
17
  total++;
@@ -5,7 +5,8 @@ const common_syntax_probability_1 = require("../../common-syntax-probability");
5
5
  const post_process_1 = require("./post-process");
6
6
  const type_1 = require("../../../../r-bridge/lang-4.x/ast/model/type");
7
7
  const statistics_file_1 = require("../../../output/statistics-file");
8
- const visitor_1 = require("../../../../r-bridge/lang-4.x/ast/model/processing/visitor");
8
+ const r_project_1 = require("../../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
9
+ const model_1 = require("../../../../r-bridge/lang-4.x/ast/model/model");
9
10
  const initialLoopInfo = {
10
11
  forLoops: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(),
11
12
  forLoopVar: (0, common_syntax_probability_1.emptyCommonSyntaxTypeCounts)(),
@@ -25,7 +26,7 @@ const isImplicitLoop = /[lsvmt]?apply/;
25
26
  function visitLoops(info, input) {
26
27
  // holds number of loops and their nesting depths
27
28
  const loopStack = [];
28
- (0, visitor_1.visitAst)(input.normalizedRAst.ast.files.map(f => f.root), node => {
29
+ r_project_1.RProject.visitAst(input.normalizedRAst.ast, node => {
29
30
  switch (node.type) {
30
31
  case type_1.RType.Next:
31
32
  info.nextStatements++;
@@ -36,7 +37,7 @@ function visitLoops(info, input) {
36
37
  case type_1.RType.FunctionCall:
37
38
  if (node.named && isImplicitLoop.test(node.functionName.lexeme)) {
38
39
  info.implicitLoops++;
39
- (0, statistics_file_1.appendStatisticsFile)(exports.loops.name, 'implicit-loop', [node.functionName.info.fullLexeme ?? node.functionName.lexeme], input.filepath);
40
+ (0, statistics_file_1.appendStatisticsFile)(exports.loops.name, 'implicit-loop', [model_1.RNode.lexeme(node.functionName)], input.filepath);
40
41
  }
41
42
  return;
42
43
  case type_1.RType.ForLoop:
@@ -54,7 +55,7 @@ function visitLoops(info, input) {
54
55
  break;
55
56
  default: return;
56
57
  }
57
- (0, statistics_file_1.appendStatisticsFile)(exports.loops.name, 'all-loops', [node.info.fullLexeme ?? node.lexeme], input.filepath);
58
+ (0, statistics_file_1.appendStatisticsFile)(exports.loops.name, 'all-loops', [model_1.RNode.lexeme(node)], input.filepath);
58
59
  if (loopStack.length > 0) {
59
60
  info.nestedExplicitLoops++;
60
61
  info.deepestExplicitNesting = Math.max(info.deepestExplicitNesting, loopStack.length);
@@ -62,7 +63,7 @@ function visitLoops(info, input) {
62
63
  loopStack.push(node);
63
64
  }, node => {
64
65
  // drop again :D
65
- if (node.type === type_1.RType.ForLoop || node.type === type_1.RType.WhileLoop || node.type === type_1.RType.RepeatLoop) {
66
+ if (model_1.RLoopConstructs.is(node)) {
66
67
  loopStack.pop();
67
68
  }
68
69
  });
@@ -4,12 +4,12 @@ exports.usedFunctions = exports.AllCallsFileBase = void 0;
4
4
  const common_syntax_probability_1 = require("../../common-syntax-probability");
5
5
  const post_process_1 = require("./post-process");
6
6
  const unpack_argument_1 = require("../../../../dataflow/internal/process/functions/call/argument/unpack-argument");
7
- const visitor_1 = require("../../../../r-bridge/lang-4.x/ast/model/processing/visitor");
8
7
  const type_1 = require("../../../../r-bridge/lang-4.x/ast/model/type");
9
8
  const statistics_file_1 = require("../../../output/statistics-file");
10
9
  const edge_1 = require("../../../../dataflow/graph/edge");
11
10
  const identifier_1 = require("../../../../dataflow/environments/identifier");
12
11
  const range_1 = require("../../../../util/range");
12
+ const r_project_1 = require("../../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
13
13
  const initialFunctionUsageInfo = {
14
14
  allFunctionCalls: 0,
15
15
  args: {
@@ -51,7 +51,7 @@ function classifyArguments(args, existing) {
51
51
  function visitCalls(info, input) {
52
52
  const calls = [];
53
53
  const allCalls = [];
54
- (0, visitor_1.visitAst)(input.normalizedRAst.ast.files.map(f => f.root), node => {
54
+ r_project_1.RProject.visitAst(input.normalizedRAst.ast, node => {
55
55
  if (node.type !== type_1.RType.FunctionCall) {
56
56
  return;
57
57
  }
@@ -2,12 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.variables = void 0;
4
4
  const post_process_1 = require("./post-process");
5
- const visitor_1 = require("../../../../r-bridge/lang-4.x/ast/model/processing/visitor");
6
- const type_1 = require("../../../../r-bridge/lang-4.x/ast/model/type");
7
- const r_symbol_1 = require("../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
8
5
  const statistics_file_1 = require("../../../output/statistics-file");
9
6
  const vertex_1 = require("../../../../dataflow/graph/vertex");
10
7
  const range_1 = require("../../../../util/range");
8
+ const r_project_1 = require("../../../../r-bridge/lang-4.x/ast/model/nodes/r-project");
9
+ const r_symbol_1 = require("../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
10
+ const model_1 = require("../../../../r-bridge/lang-4.x/ast/model/model");
11
11
  const initialVariableInfo = {
12
12
  numberOfVariableUses: 0,
13
13
  numberOfDefinitions: 0,
@@ -16,8 +16,8 @@ const initialVariableInfo = {
16
16
  unknownVariables: 0
17
17
  };
18
18
  function visitVariables(info, input) {
19
- (0, visitor_1.visitAst)(input.normalizedRAst.ast.files.map(f => f.root), node => {
20
- if (node.type !== type_1.RType.Symbol || (0, r_symbol_1.isSpecialSymbol)(node)) {
19
+ r_project_1.RProject.visitAst(input.normalizedRAst.ast, node => {
20
+ if (!r_symbol_1.RSymbol.is(node) || r_symbol_1.RSymbol.isSpecial(node)) {
21
21
  return;
22
22
  }
23
23
  // search for the node in the DF graph
@@ -25,7 +25,7 @@ function visitVariables(info, input) {
25
25
  if (mayNode === undefined) {
26
26
  info.unknownVariables++;
27
27
  (0, statistics_file_1.appendStatisticsFile)(exports.variables.name, 'unknown', [[
28
- node.info.fullLexeme ?? node.lexeme,
28
+ model_1.RNode.lexeme(node),
29
29
  range_1.SourceRange.getStart(node.location)
30
30
  ]], input.filepath);
31
31
  return;
@@ -33,7 +33,7 @@ function visitVariables(info, input) {
33
33
  const [dfNode] = mayNode;
34
34
  if (dfNode.tag === vertex_1.VertexType.VariableDefinition) {
35
35
  info.numberOfDefinitions++;
36
- const lexeme = node.info.fullLexeme ?? node.lexeme;
36
+ const lexeme = model_1.RNode.lexeme(node);
37
37
  (0, statistics_file_1.appendStatisticsFile)(exports.variables.name, 'definedVariables', [[
38
38
  lexeme,
39
39
  range_1.SourceRange.getStart(node.location)
@@ -43,7 +43,7 @@ function visitVariables(info, input) {
43
43
  else if (dfNode.tag === 'use') {
44
44
  info.numberOfVariableUses++;
45
45
  (0, statistics_file_1.appendStatisticsFile)(exports.variables.name, 'usedVariables', [[
46
- node.info.fullLexeme ?? node.lexeme,
46
+ model_1.RNode.lexeme(node),
47
47
  range_1.SourceRange.getStart(node.location)
48
48
  ]], input.filepath);
49
49
  }