@eagleoutice/flowr 1.3.14 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (309) hide show
  1. package/README.md +3 -3
  2. package/abstract-interpretation/domain.d.ts +27 -0
  3. package/abstract-interpretation/domain.js +146 -0
  4. package/abstract-interpretation/handler/binop/binop.d.ts +16 -0
  5. package/abstract-interpretation/handler/binop/binop.js +40 -0
  6. package/abstract-interpretation/handler/binop/operators.d.ts +2 -0
  7. package/abstract-interpretation/handler/binop/operators.js +42 -0
  8. package/abstract-interpretation/handler/handler.d.ts +6 -0
  9. package/abstract-interpretation/handler/handler.js +3 -0
  10. package/abstract-interpretation/processor.d.ts +10 -0
  11. package/abstract-interpretation/processor.js +84 -0
  12. package/benchmark/slicer.d.ts +6 -8
  13. package/benchmark/slicer.js +5 -15
  14. package/benchmark/stats/print.d.ts +1 -1
  15. package/benchmark/stats/print.js +0 -2
  16. package/benchmark/stats/stats.d.ts +3 -4
  17. package/benchmark/stats/stats.js +1 -1
  18. package/cli/benchmark-app.d.ts +1 -0
  19. package/cli/benchmark-app.js +21 -6
  20. package/cli/benchmark-helper-app.d.ts +2 -0
  21. package/cli/benchmark-helper-app.js +15 -6
  22. package/cli/common/features.d.ts +1 -1
  23. package/cli/common/options.d.ts +1 -1
  24. package/cli/common/options.js +4 -1
  25. package/cli/common/script.d.ts +1 -1
  26. package/cli/common/scripts-info.d.ts +3 -2
  27. package/cli/common/scripts-info.js +15 -1
  28. package/cli/export-quads-app.js +1 -5
  29. package/cli/repl/commands/cfg.d.ts +1 -1
  30. package/cli/repl/commands/cfg.js +3 -3
  31. package/cli/repl/commands/commands.d.ts +4 -2
  32. package/cli/repl/commands/commands.js +67 -28
  33. package/cli/repl/commands/dataflow.d.ts +1 -1
  34. package/cli/repl/commands/dataflow.js +2 -2
  35. package/cli/repl/commands/execute.d.ts +2 -2
  36. package/cli/repl/commands/main.d.ts +2 -2
  37. package/cli/repl/commands/normalize.d.ts +1 -1
  38. package/cli/repl/commands/normalize.js +2 -2
  39. package/cli/repl/commands/parse.d.ts +1 -1
  40. package/cli/repl/commands/parse.js +12 -12
  41. package/cli/repl/commands/quit.d.ts +1 -1
  42. package/cli/repl/commands/quit.js +4 -1
  43. package/cli/repl/commands/version.d.ts +1 -1
  44. package/cli/repl/core.d.ts +5 -3
  45. package/cli/repl/core.js +63 -7
  46. package/cli/repl/execute.d.ts +1 -1
  47. package/cli/repl/execute.js +3 -3
  48. package/cli/repl/server/connection.d.ts +2 -2
  49. package/cli/repl/server/connection.js +4 -8
  50. package/cli/repl/server/messages/analysis.d.ts +3 -3
  51. package/cli/repl/server/messages/analysis.js +12 -32
  52. package/cli/repl/server/messages/error.d.ts +1 -1
  53. package/cli/repl/server/messages/hello.d.ts +2 -2
  54. package/cli/repl/server/messages/messages.d.ts +5 -5
  55. package/cli/repl/server/messages/repl.d.ts +1 -1
  56. package/cli/repl/server/messages/slice.d.ts +3 -3
  57. package/cli/repl/server/net.d.ts +16 -0
  58. package/cli/repl/server/net.js +42 -3
  59. package/cli/repl/server/send.d.ts +2 -2
  60. package/cli/repl/server/server.d.ts +2 -2
  61. package/cli/repl/server/validate.d.ts +3 -3
  62. package/cli/statistics-helper-app.js +2 -3
  63. package/cli/summarizer-app.js +1 -2
  64. package/config.d.ts +16 -0
  65. package/config.js +75 -0
  66. package/core/input.d.ts +5 -5
  67. package/core/output.d.ts +1 -1
  68. package/core/print/dataflow-printer.d.ts +3 -3
  69. package/core/print/normalize-printer.d.ts +2 -2
  70. package/core/print/parse-printer.d.ts +2 -3
  71. package/core/print/parse-printer.js +6 -4
  72. package/core/print/print.d.ts +1 -1
  73. package/core/print/slice-diff-ansi.d.ts +1 -1
  74. package/core/slicer.d.ts +5 -4
  75. package/core/slicer.js +2 -2
  76. package/core/steps.d.ts +10 -9
  77. package/core/steps.js +5 -4
  78. package/dataflow/environments/append.d.ts +1 -1
  79. package/dataflow/environments/environment.d.ts +4 -4
  80. package/dataflow/environments/environment.js +8 -0
  81. package/dataflow/environments/overwrite.d.ts +1 -1
  82. package/dataflow/environments/register.d.ts +2 -2
  83. package/dataflow/environments/register.js +1 -0
  84. package/dataflow/environments/resolve-by-name.d.ts +2 -2
  85. package/dataflow/environments/scoping.d.ts +1 -1
  86. package/dataflow/extractor.d.ts +5 -5
  87. package/dataflow/extractor.js +10 -2
  88. package/dataflow/graph/diff.d.ts +3 -3
  89. package/dataflow/graph/graph.d.ts +8 -7
  90. package/dataflow/graph/quads.d.ts +2 -2
  91. package/dataflow/graph/vertex.d.ts +5 -5
  92. package/dataflow/internal/info.d.ts +2 -2
  93. package/dataflow/internal/linker.d.ts +3 -3
  94. package/dataflow/internal/process/access.d.ts +3 -3
  95. package/dataflow/internal/process/expression-list.d.ts +3 -3
  96. package/dataflow/internal/process/expression-list.js +0 -4
  97. package/dataflow/internal/process/functions/argument.d.ts +4 -4
  98. package/dataflow/internal/process/functions/exit-points.d.ts +1 -1
  99. package/dataflow/internal/process/functions/function-call.d.ts +3 -3
  100. package/dataflow/internal/process/functions/function-call.js +7 -1
  101. package/dataflow/internal/process/functions/function-definition.d.ts +3 -3
  102. package/dataflow/internal/process/functions/parameter.d.ts +3 -3
  103. package/dataflow/internal/process/functions/source.d.ts +8 -0
  104. package/dataflow/internal/process/functions/source.js +81 -0
  105. package/dataflow/internal/process/if-then-else.d.ts +3 -3
  106. package/dataflow/internal/process/loops/for-loop.d.ts +3 -3
  107. package/dataflow/internal/process/loops/repeat-loop.d.ts +3 -3
  108. package/dataflow/internal/process/loops/while-loop.d.ts +3 -3
  109. package/dataflow/internal/process/operators/assignment.d.ts +3 -3
  110. package/dataflow/internal/process/operators/non-assignment-binary-op.d.ts +3 -3
  111. package/dataflow/internal/process/operators/pipe.d.ts +3 -3
  112. package/dataflow/internal/process/operators/unary-op.d.ts +3 -3
  113. package/dataflow/internal/process/symbol.d.ts +3 -3
  114. package/dataflow/internal/process/uninteresting-leaf.d.ts +2 -2
  115. package/dataflow/processor.d.ts +12 -3
  116. package/flowr.d.ts +5 -2
  117. package/flowr.js +19 -12
  118. package/package.json +50 -18
  119. package/r-bridge/lang-4.x/ast/index.d.ts +1 -0
  120. package/r-bridge/lang-4.x/ast/index.js +3 -0
  121. package/r-bridge/lang-4.x/ast/model/collect.d.ts +2 -2
  122. package/r-bridge/lang-4.x/ast/model/model.d.ts +6 -6
  123. package/r-bridge/lang-4.x/ast/model/nodes/info/index.d.ts +2 -2
  124. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +3 -3
  125. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +3 -3
  126. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +3 -3
  127. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -3
  128. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -2
  129. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -2
  130. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -2
  131. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +4 -4
  132. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +4 -4
  133. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +4 -4
  134. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +3 -3
  135. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -2
  136. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -2
  137. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -2
  138. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -3
  139. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +3 -3
  140. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -2
  141. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +3 -3
  142. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -3
  143. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -2
  144. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +3 -3
  145. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +3 -3
  146. package/r-bridge/lang-4.x/ast/model/operators.d.ts +1 -1
  147. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +4 -2
  148. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +6 -1
  149. package/r-bridge/lang-4.x/ast/model/processing/fold.d.ts +3 -3
  150. package/r-bridge/lang-4.x/ast/model/processing/role.d.ts +1 -1
  151. package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +3 -3
  152. package/r-bridge/lang-4.x/ast/model/processing/visitor.d.ts +1 -1
  153. package/r-bridge/lang-4.x/ast/parser/json/format.d.ts +14 -0
  154. package/r-bridge/lang-4.x/ast/parser/json/format.js +26 -0
  155. package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +7 -0
  156. package/r-bridge/lang-4.x/ast/parser/json/parser.js +57 -0
  157. package/r-bridge/lang-4.x/ast/parser/xml/data.d.ts +4 -7
  158. package/r-bridge/lang-4.x/ast/parser/xml/hooks.d.ts +5 -5
  159. package/r-bridge/lang-4.x/ast/parser/xml/index.d.ts +0 -2
  160. package/r-bridge/lang-4.x/ast/parser/xml/index.js +0 -2
  161. package/r-bridge/lang-4.x/ast/parser/xml/input-format.d.ts +6 -2
  162. package/r-bridge/lang-4.x/ast/parser/xml/input-format.js +7 -10
  163. package/r-bridge/lang-4.x/ast/parser/xml/internal/access.d.ts +3 -3
  164. package/r-bridge/lang-4.x/ast/parser/xml/internal/access.js +2 -2
  165. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then-else.d.ts +3 -3
  166. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then-else.js +1 -1
  167. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then.d.ts +3 -3
  168. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then.js +2 -2
  169. package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/expression.d.ts +3 -3
  170. package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/expression.js +4 -4
  171. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/argument.d.ts +3 -3
  172. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/argument.js +2 -2
  173. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/call.d.ts +3 -3
  174. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/call.js +4 -4
  175. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/definition.d.ts +3 -3
  176. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/definition.js +2 -2
  177. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/parameter.d.ts +3 -3
  178. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/parameter.js +2 -2
  179. package/r-bridge/lang-4.x/ast/parser/xml/internal/index.d.ts +0 -1
  180. package/r-bridge/lang-4.x/ast/parser/xml/internal/index.js +0 -1
  181. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/break.d.ts +3 -3
  182. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/break.js +2 -2
  183. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/for.d.ts +3 -3
  184. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/for.js +3 -6
  185. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/next.d.ts +3 -3
  186. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/next.js +2 -2
  187. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/repeat.d.ts +3 -3
  188. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/repeat.js +2 -2
  189. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/while.d.ts +3 -3
  190. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/while.js +2 -2
  191. package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.d.ts +9 -14
  192. package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.js +15 -23
  193. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/binary.d.ts +3 -3
  194. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/binary.js +6 -6
  195. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/special.d.ts +1 -1
  196. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/unary.d.ts +3 -3
  197. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/unary.js +3 -3
  198. package/r-bridge/lang-4.x/ast/parser/xml/internal/other/comment.d.ts +3 -3
  199. package/r-bridge/lang-4.x/ast/parser/xml/internal/other/comment.js +2 -2
  200. package/r-bridge/lang-4.x/ast/parser/xml/internal/other/line-directive.d.ts +3 -3
  201. package/r-bridge/lang-4.x/ast/parser/xml/internal/other/line-directive.js +2 -2
  202. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/elements.d.ts +4 -4
  203. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/elements.js +3 -3
  204. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/root.d.ts +3 -3
  205. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/root.js +3 -4
  206. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/single-element.d.ts +4 -4
  207. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/single-element.js +2 -2
  208. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/number.d.ts +4 -4
  209. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/number.js +2 -2
  210. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/string.d.ts +3 -3
  211. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/string.js +2 -2
  212. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/symbol.d.ts +3 -3
  213. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/symbol.js +4 -4
  214. package/r-bridge/lang-4.x/values.d.ts +0 -1
  215. package/r-bridge/lang-4.x/values.js +14 -6
  216. package/r-bridge/retriever.d.ts +26 -22
  217. package/r-bridge/retriever.js +73 -23
  218. package/r-bridge/shell-executor.d.ts +11 -0
  219. package/r-bridge/shell-executor.js +50 -0
  220. package/r-bridge/shell.d.ts +12 -31
  221. package/r-bridge/shell.js +36 -94
  222. package/reconstruct/reconstruct.d.ts +1 -1
  223. package/slicing/criterion/collect-all.d.ts +3 -3
  224. package/slicing/criterion/filters/all-variables.d.ts +1 -1
  225. package/slicing/criterion/parse.d.ts +1 -1
  226. package/slicing/static/static-slicer.d.ts +3 -3
  227. package/statistics/features/common-syntax-probability.d.ts +3 -2
  228. package/statistics/features/common-syntax-probability.js +0 -3
  229. package/statistics/features/feature.d.ts +6 -6
  230. package/statistics/features/post-processing.d.ts +2 -2
  231. package/statistics/features/supported/assignments/assignments.d.ts +2 -2
  232. package/statistics/features/supported/assignments/post-process.d.ts +2 -2
  233. package/statistics/features/supported/assignments/post-process.js +6 -6
  234. package/statistics/features/supported/comments/comments.d.ts +2 -2
  235. package/statistics/features/supported/comments/post-process.d.ts +2 -2
  236. package/statistics/features/supported/comments/post-process.js +2 -2
  237. package/statistics/features/supported/control-flow/control-flow.d.ts +2 -2
  238. package/statistics/features/supported/control-flow/post-process.d.ts +2 -2
  239. package/statistics/features/supported/data-access/data-access.d.ts +3 -3
  240. package/statistics/features/supported/data-access/post-process.d.ts +2 -2
  241. package/statistics/features/supported/data-access/post-process.js +4 -4
  242. package/statistics/features/supported/defined-functions/defined-functions.d.ts +4 -4
  243. package/statistics/features/supported/defined-functions/post-process.d.ts +2 -2
  244. package/statistics/features/supported/defined-functions/post-process.js +4 -4
  245. package/statistics/features/supported/expression-list/expression-list.d.ts +2 -2
  246. package/statistics/features/supported/expression-list/post-process.d.ts +2 -2
  247. package/statistics/features/supported/expression-list/post-process.js +3 -3
  248. package/statistics/features/supported/loops/loops.d.ts +2 -2
  249. package/statistics/features/supported/loops/post-process.d.ts +2 -2
  250. package/statistics/features/supported/loops/post-process.js +3 -3
  251. package/statistics/features/supported/used-functions/post-process.d.ts +2 -2
  252. package/statistics/features/supported/used-functions/post-process.js +5 -5
  253. package/statistics/features/supported/used-functions/used-functions.d.ts +3 -3
  254. package/statistics/features/supported/used-packages/post-process.d.ts +2 -2
  255. package/statistics/features/supported/used-packages/post-process.js +5 -5
  256. package/statistics/features/supported/used-packages/used-packages.d.ts +2 -2
  257. package/statistics/features/supported/values/post-process.d.ts +2 -2
  258. package/statistics/features/supported/values/post-process.js +3 -3
  259. package/statistics/features/supported/values/values.d.ts +2 -2
  260. package/statistics/features/supported/variables/post-process.d.ts +3 -3
  261. package/statistics/features/supported/variables/post-process.js +3 -3
  262. package/statistics/features/supported/variables/variables.d.ts +2 -2
  263. package/statistics/meta-statistics.d.ts +1 -1
  264. package/statistics/output/ansi.js +1 -1
  265. package/statistics/output/print-stats.d.ts +2 -2
  266. package/statistics/output/statistics-file.d.ts +1 -1
  267. package/statistics/statistics.d.ts +4 -4
  268. package/statistics/statistics.js +7 -8
  269. package/util/args.d.ts +8 -4
  270. package/util/args.js +11 -4
  271. package/util/{cfg.d.ts → cfg/cfg.d.ts} +18 -6
  272. package/util/{cfg.js → cfg/cfg.js} +42 -37
  273. package/util/cfg/visitor.d.ts +14 -0
  274. package/util/cfg/visitor.js +64 -0
  275. package/util/diff.d.ts +1 -1
  276. package/util/files.d.ts +7 -1
  277. package/util/files.js +11 -1
  278. package/util/log.js +3 -0
  279. package/util/mermaid/ast.d.ts +1 -1
  280. package/util/mermaid/cfg.d.ts +2 -2
  281. package/util/mermaid/dfg.d.ts +3 -3
  282. package/util/objects.d.ts +1 -1
  283. package/util/quads.d.ts +2 -2
  284. package/util/summarizer/benchmark/data.d.ts +1 -1
  285. package/util/summarizer/benchmark/first-phase/input.d.ts +2 -1
  286. package/util/summarizer/benchmark/first-phase/input.js +20 -4
  287. package/util/summarizer/benchmark/first-phase/process.d.ts +4 -3
  288. package/util/summarizer/benchmark/first-phase/process.js +14 -5
  289. package/util/summarizer/benchmark/second-phase/graph.d.ts +1 -1
  290. package/util/summarizer/benchmark/second-phase/graph.js +1 -1
  291. package/util/summarizer/benchmark/second-phase/process.d.ts +3 -1
  292. package/util/summarizer/benchmark/second-phase/process.js +48 -11
  293. package/util/summarizer/benchmark/summarizer.d.ts +3 -6
  294. package/util/summarizer/benchmark/summarizer.js +16 -11
  295. package/util/summarizer/statistics/first-phase/process.js +8 -8
  296. package/util/summarizer/statistics/post-process/clusterer.d.ts +2 -2
  297. package/util/summarizer/statistics/post-process/file-based-count.d.ts +1 -1
  298. package/util/summarizer/statistics/post-process/histogram.d.ts +2 -2
  299. package/util/summarizer/statistics/post-process/post-process-output.d.ts +2 -2
  300. package/util/summarizer/statistics/post-process/post-process-output.js +4 -5
  301. package/util/summarizer/statistics/second-phase/process.d.ts +2 -2
  302. package/util/summarizer/statistics/summarizer.d.ts +3 -2
  303. package/util/summarizer/summarizer.d.ts +1 -1
  304. package/r-bridge/lang-4.x/ast/parser/xml/config.d.ts +0 -25
  305. package/r-bridge/lang-4.x/ast/parser/xml/config.js +0 -16
  306. package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.d.ts +0 -9
  307. package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.js +0 -51
  308. package/r-bridge/lang-4.x/ast/parser/xml/parser.d.ts +0 -17
  309. package/r-bridge/lang-4.x/ast/parser/xml/parser.js +0 -30
@@ -1,4 +1,4 @@
1
- import { ParserData } from '../../data';
2
- import { XmlBasedJson } from '../../input-format';
3
- import { RBreak } from '../../../../model';
1
+ import type { ParserData } from '../../data';
2
+ import type { XmlBasedJson } from '../../input-format';
3
+ import type { RBreak } from '../../../../model';
4
4
  export declare function normalizeBreak(data: ParserData, obj: XmlBasedJson): RBreak;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeBreak = void 0;
4
- const parser_1 = require("../../parser");
5
4
  const hooks_1 = require("../../hooks");
6
5
  const meta_1 = require("../meta");
6
+ const parser_1 = require("../../../json/parser");
7
7
  function normalizeBreak(data, obj) {
8
8
  parser_1.parseLog.debug(`[break] try: ${JSON.stringify(obj)}`);
9
9
  obj = (0, hooks_1.executeHook)(data.hooks.loops.onBreak.before, data, obj);
10
- const { location, content } = (0, meta_1.retrieveMetaStructure)(data.config, obj);
10
+ const { location, content } = (0, meta_1.retrieveMetaStructure)(obj);
11
11
  const result = {
12
12
  type: "RBreak" /* RType.Break */,
13
13
  location,
@@ -1,4 +1,4 @@
1
- import { NamedXmlBasedJson } from '../../input-format';
2
- import { ParserData } from '../../data';
3
- import { RForLoop } from '../../../../model';
1
+ import type { NamedXmlBasedJson } from '../../input-format';
2
+ import type { ParserData } from '../../data';
3
+ import type { RForLoop } from '../../../../model';
4
4
  export declare function tryNormalizeFor(data: ParserData, forToken: NamedXmlBasedJson, head: NamedXmlBasedJson, body: NamedXmlBasedJson): RForLoop | undefined;
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.tryNormalizeFor = void 0;
4
4
  const input_format_1 = require("../../input-format");
5
5
  const meta_1 = require("../meta");
6
- const parser_1 = require("../../parser");
7
6
  const assert_1 = require("../../../../../../../util/assert");
8
7
  const values_1 = require("../values");
9
8
  const structure_1 = require("../structure");
10
9
  const hooks_1 = require("../../hooks");
11
10
  const other_1 = require("../other");
11
+ const parser_1 = require("../../../json/parser");
12
12
  function tryNormalizeFor(data, forToken, head, body) {
13
13
  // funny, for does not use top-level parenthesis
14
14
  if (forToken.name !== "FOR" /* RawRType.For */) {
@@ -35,7 +35,7 @@ function tryNormalizeFor(data, forToken, head, body) {
35
35
  parseBody,
36
36
  ])}`);
37
37
  }
38
- const { location, content } = (0, meta_1.retrieveMetaStructure)(data.config, forToken.content);
38
+ const { location, content } = (0, meta_1.retrieveMetaStructure)(forToken.content);
39
39
  const result = {
40
40
  type: "RForLoop" /* RType.ForLoop */,
41
41
  variable: parsedVariable,
@@ -54,10 +54,7 @@ function tryNormalizeFor(data, forToken, head, body) {
54
54
  exports.tryNormalizeFor = tryNormalizeFor;
55
55
  function normalizeForHead(data, forCondition) {
56
56
  // must have a child which is `in`, a variable on the left, and a vector on the right
57
- const children = (0, input_format_1.getKeysGuarded)(forCondition, data.config.childrenName).map(content => ({
58
- name: (0, meta_1.getTokenType)(data.config.tokenMap, content),
59
- content
60
- }));
57
+ const children = (0, input_format_1.getKeysGuarded)(forCondition, input_format_1.childrenKey).map(content => ({ name: (0, meta_1.getTokenType)(content), content }));
61
58
  const { comments, others } = (0, structure_1.splitComments)(children);
62
59
  const inPosition = others.findIndex(elem => elem.name === "IN" /* RawRType.ForIn */);
63
60
  (0, assert_1.guard)(inPosition > 0 && inPosition < others.length - 1, () => `for loop searched in and found at ${inPosition}, but this is not in legal bounds for ${JSON.stringify(children)}`);
@@ -1,4 +1,4 @@
1
- import { ParserData } from '../../data';
2
- import { XmlBasedJson } from '../../input-format';
3
- import { RNext } from '../../../../model';
1
+ import type { ParserData } from '../../data';
2
+ import type { XmlBasedJson } from '../../input-format';
3
+ import type { RNext } from '../../../../model';
4
4
  export declare function normalizeNext(data: ParserData, obj: XmlBasedJson): RNext;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeNext = void 0;
4
- const parser_1 = require("../../parser");
5
4
  const hooks_1 = require("../../hooks");
6
5
  const meta_1 = require("../meta");
6
+ const parser_1 = require("../../../json/parser");
7
7
  function normalizeNext(data, obj) {
8
8
  parser_1.parseLog.debug(`[next] try: ${JSON.stringify(obj)}`);
9
9
  obj = (0, hooks_1.executeHook)(data.hooks.loops.onNext.before, data, obj);
10
- const { location, content } = (0, meta_1.retrieveMetaStructure)(data.config, obj);
10
+ const { location, content } = (0, meta_1.retrieveMetaStructure)(obj);
11
11
  const result = {
12
12
  type: "RNext" /* RType.Next */,
13
13
  location,
@@ -1,6 +1,6 @@
1
- import { NamedXmlBasedJson } from '../../input-format';
2
- import { ParserData } from '../../data';
3
- import { RRepeatLoop } from '../../../../model';
1
+ import type { NamedXmlBasedJson } from '../../input-format';
2
+ import type { ParserData } from '../../data';
3
+ import type { RRepeatLoop } from '../../../../model';
4
4
  /**
5
5
  * Try to parse the construct as a {@link RRepeatLoop}.
6
6
  *
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.tryNormalizeRepeat = void 0;
4
4
  const meta_1 = require("../meta");
5
- const parser_1 = require("../../parser");
6
5
  const structure_1 = require("../structure");
7
6
  const assert_1 = require("../../../../../../../util/assert");
8
7
  const hooks_1 = require("../../hooks");
8
+ const parser_1 = require("../../../json/parser");
9
9
  /**
10
10
  * Try to parse the construct as a {@link RRepeatLoop}.
11
11
  *
@@ -24,7 +24,7 @@ function tryNormalizeRepeat(data, repeatToken, body) {
24
24
  ({ repeatToken, body } = (0, hooks_1.executeHook)(data.hooks.loops.onRepeatLoop.before, data, { repeatToken, body }));
25
25
  const parseBody = (0, structure_1.tryNormalizeSingleNode)(data, body);
26
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);
27
+ const { location, content } = (0, meta_1.retrieveMetaStructure)(repeatToken.content);
28
28
  const result = {
29
29
  type: "RRepeatLoop" /* RType.RepeatLoop */,
30
30
  location,
@@ -1,4 +1,4 @@
1
- import { NamedXmlBasedJson } from '../../input-format';
2
- import { ParserData } from '../../data';
3
- import { RWhileLoop } from '../../../../model';
1
+ import type { NamedXmlBasedJson } from '../../input-format';
2
+ import type { ParserData } from '../../data';
3
+ import type { RWhileLoop } from '../../../../model';
4
4
  export declare function tryNormalizeWhile(data: ParserData, whileToken: NamedXmlBasedJson, leftParen: NamedXmlBasedJson, condition: NamedXmlBasedJson, rightParen: NamedXmlBasedJson, body: NamedXmlBasedJson): RWhileLoop | undefined;
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.tryNormalizeWhile = void 0;
4
4
  const input_format_1 = require("../../input-format");
5
5
  const meta_1 = require("../meta");
6
- const parser_1 = require("../../parser");
7
6
  const structure_1 = require("../structure");
8
7
  const hooks_1 = require("../../hooks");
8
+ const parser_1 = require("../../../json/parser");
9
9
  function tryNormalizeWhile(data, whileToken, leftParen, condition, rightParen, body) {
10
10
  if (whileToken.name !== "WHILE" /* RawRType.While */) {
11
11
  parser_1.parseLog.debug('encountered non-while token for supposed while-loop structure');
@@ -26,7 +26,7 @@ function tryNormalizeWhile(data, whileToken, leftParen, condition, rightParen, b
26
26
  parseBody,
27
27
  ])} for ${JSON.stringify([whileToken, condition, body])}`);
28
28
  }
29
- const { location, content } = (0, meta_1.retrieveMetaStructure)(data.config, whileToken.content);
29
+ const { location, content } = (0, meta_1.retrieveMetaStructure)(whileToken.content);
30
30
  const result = {
31
31
  type: "RWhileLoop" /* RType.WhileLoop */,
32
32
  condition: parsedCondition,
@@ -1,7 +1,6 @@
1
- import { NamedXmlBasedJson, XmlBasedJson } from '../input-format';
2
- import { SourceRange } from '../../../../../../util/range';
3
- import { XmlParserConfig } from '../config';
4
- import { RawRType, RExpressionList, RNode } from '../../../model';
1
+ import type { NamedXmlBasedJson, XmlBasedJson } from '../input-format';
2
+ import type { SourceRange } from '../../../../../../util/range';
3
+ import type { RawRType, RExpressionList, RNode } from '../../../model';
5
4
  /**
6
5
  * if the passed object is an array with only one element, remove the array wrapper
7
6
  */
@@ -14,37 +13,33 @@ export declare function extractLocation(ast: XmlBasedJson): SourceRange;
14
13
  * The json object that represents the input xml contains various meta-information.
15
14
  * This function extracts the meta-information and returns it.
16
15
  *
17
- * @param config - The configuration of the parser to use to retrieve the corresponding name fields
18
16
  * @param obj - The json object to extract the meta-information from
19
17
  */
20
- export declare function retrieveMetaStructure(config: XmlParserConfig, obj: XmlBasedJson): {
18
+ export declare function retrieveMetaStructure(obj: XmlBasedJson): {
21
19
  /** the obj passed in, but potentially without surrounding array wrappers (see {@link objectWithArrUnwrap}) */
22
20
  unwrappedObj: XmlBasedJson;
23
21
  /** location information of the corresponding R-ast element */
24
22
  location: SourceRange;
25
23
  content: string;
26
24
  };
27
- export declare function revertTokenReplacement(tokenMap: XmlParserConfig['tokenMap'], token: string): string;
28
- export declare function assureTokenType(tokenMap: XmlParserConfig['tokenMap'], obj: XmlBasedJson, expectedName: RawRType): void;
25
+ export declare function assureTokenType(obj: XmlBasedJson, expectedName: RawRType): void;
29
26
  /**
30
27
  * Extract the token-type of the given object. This is based on the knowledge, that all json objects created
31
28
  * from the R xml have a name attached.
32
29
  *
33
- * @param tokenMap - used to revert token types (i.e., revert `xmlparsedata`)
34
30
  * @param content - the json object to extract the token-type from
35
31
  */
36
- export declare function getTokenType(tokenMap: XmlParserConfig['tokenMap'], content: XmlBasedJson): RawRType;
37
- export declare function getWithTokenType(tokenMap: XmlParserConfig['tokenMap'], obj: XmlBasedJson[]): {
32
+ export declare function getTokenType(content: XmlBasedJson): RawRType;
33
+ export declare function getWithTokenType(obj: XmlBasedJson[]): {
38
34
  name: RawRType;
39
35
  content: XmlBasedJson;
40
36
  }[];
41
- export declare function retrieveOpName(config: XmlParserConfig, operator: NamedXmlBasedJson): string;
37
+ export declare function retrieveOpName(operator: NamedXmlBasedJson): string;
42
38
  /**
43
39
  * Ensure that the first child is completely before the second child.
44
40
  *
45
- * @param config - the configuration of the parser to use to retrieve the corresponding name fields
46
41
  * @param first - the first child which should be the lhs
47
42
  * @param second - the second child which should be the rhs
48
43
  */
49
- export declare function ensureChildrenAreLhsAndRhsOrdered(config: XmlParserConfig, first: XmlBasedJson, second: XmlBasedJson): void;
44
+ export declare function ensureChildrenAreLhsAndRhsOrdered(first: XmlBasedJson, second: XmlBasedJson): void;
50
45
  export declare function ensureExpressionList<Info>(node: RNode<Info>): RExpressionList<Info>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
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;
3
+ exports.ensureExpressionList = exports.ensureChildrenAreLhsAndRhsOrdered = exports.retrieveOpName = exports.getWithTokenType = exports.getTokenType = exports.assureTokenType = exports.retrieveMetaStructure = exports.extractLocation = exports.objectWithArrUnwrap = void 0;
4
4
  const input_format_1 = require("../input-format");
5
5
  const range_1 = require("../../../../../../util/range");
6
6
  const assert_1 = require("../../../../../../util/assert");
@@ -34,13 +34,12 @@ exports.extractLocation = extractLocation;
34
34
  * The json object that represents the input xml contains various meta-information.
35
35
  * This function extracts the meta-information and returns it.
36
36
  *
37
- * @param config - The configuration of the parser to use to retrieve the corresponding name fields
38
37
  * @param obj - The json object to extract the meta-information from
39
38
  */
40
- function retrieveMetaStructure(config, obj) {
39
+ function retrieveMetaStructure(obj) {
41
40
  const unwrappedObj = objectWithArrUnwrap(obj);
42
- const attributes = obj[config.attributeName];
43
- const content = obj[config.contentName] ?? '';
41
+ const attributes = obj[input_format_1.attributesKey];
42
+ const content = obj[input_format_1.contentKey] ?? '';
44
43
  (0, assert_1.guard)(attributes !== undefined, () => `expected attributes to be defined for ${JSON.stringify(obj)}`);
45
44
  const location = extractLocation(attributes);
46
45
  return {
@@ -50,13 +49,8 @@ function retrieveMetaStructure(config, obj) {
50
49
  };
51
50
  }
52
51
  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);
52
+ function assureTokenType(obj, expectedName) {
53
+ const name = getTokenType(obj);
60
54
  if (name !== expectedName) {
61
55
  throw new input_format_1.XmlParseError(`expected name to be ${expectedName}, yet received ${name} for ${JSON.stringify(obj)}`);
62
56
  }
@@ -66,37 +60,35 @@ exports.assureTokenType = assureTokenType;
66
60
  * Extract the token-type of the given object. This is based on the knowledge, that all json objects created
67
61
  * from the R xml have a name attached.
68
62
  *
69
- * @param tokenMap - used to revert token types (i.e., revert `xmlparsedata`)
70
63
  * @param content - the json object to extract the token-type from
71
64
  */
72
- function getTokenType(tokenMap, content) {
73
- return revertTokenReplacement(tokenMap, (0, input_format_1.getKeysGuarded)(content, '#name'));
65
+ function getTokenType(content) {
66
+ return (0, input_format_1.getKeysGuarded)(content, input_format_1.nameKey);
74
67
  }
75
68
  exports.getTokenType = getTokenType;
76
- function getWithTokenType(tokenMap, obj) {
69
+ function getWithTokenType(obj) {
77
70
  return obj.map((content) => ({
78
- name: getTokenType(tokenMap, content),
71
+ name: getTokenType(content),
79
72
  content
80
73
  }));
81
74
  }
82
75
  exports.getWithTokenType = getWithTokenType;
83
- function retrieveOpName(config, operator) {
76
+ function retrieveOpName(operator) {
84
77
  /*
85
78
  * only real arithmetic ops have their operation as their own name, the others identify via content
86
79
  */
87
- return operator.content[config.contentName];
80
+ return operator.content[input_format_1.contentKey];
88
81
  }
89
82
  exports.retrieveOpName = retrieveOpName;
90
83
  /**
91
84
  * Ensure that the first child is completely before the second child.
92
85
  *
93
- * @param config - the configuration of the parser to use to retrieve the corresponding name fields
94
86
  * @param first - the first child which should be the lhs
95
87
  * @param second - the second child which should be the rhs
96
88
  */
97
- function ensureChildrenAreLhsAndRhsOrdered(config, first, second) {
98
- const firstOtherLoc = extractLocation(first[config.attributeName]);
99
- const secondOtherLoc = extractLocation(second[config.attributeName]);
89
+ function ensureChildrenAreLhsAndRhsOrdered(first, second) {
90
+ const firstOtherLoc = extractLocation(first[input_format_1.attributesKey]);
91
+ const secondOtherLoc = extractLocation(second[input_format_1.attributesKey]);
100
92
  if (!(0, range_1.rangeStartsCompletelyBefore)(firstOtherLoc, secondOtherLoc)) {
101
93
  throw new input_format_1.XmlParseError(`expected the first child to be the lhs, yet received ${JSON.stringify(first)} & ${JSON.stringify(second)}`);
102
94
  }
@@ -1,6 +1,6 @@
1
- import { NamedXmlBasedJson } from '../../input-format';
2
- import { ParserData } from '../../data';
3
- import { RNode } from '../../../../model';
1
+ import type { NamedXmlBasedJson } from '../../input-format';
2
+ import type { ParserData } from '../../data';
3
+ import type { RNode } from '../../../../model';
4
4
  /**
5
5
  * Parsing binary operations includes the pipe, even though the produced PIPE construct is not a binary operation,
6
6
  * to ensure it is handled separately from the others (especially in the combination of a pipe bind)
@@ -2,13 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.tryNormalizeBinary = void 0;
4
4
  const input_format_1 = require("../../input-format");
5
- const parser_1 = require("../../parser");
6
5
  const meta_1 = require("../meta");
7
6
  const special_1 = require("./special");
8
7
  const structure_1 = require("../structure");
9
8
  const model_1 = require("../../../../model");
10
9
  const hooks_1 = require("../../hooks");
11
10
  const assert_1 = require("../../../../../../../util/assert");
11
+ const parser_1 = require("../../../json/parser");
12
12
  /**
13
13
  * Parsing binary operations includes the pipe, even though the produced PIPE construct is not a binary operation,
14
14
  * to ensure it is handled separately from the others (especially in the combination of a pipe bind)
@@ -46,18 +46,18 @@ exports.tryNormalizeBinary = tryNormalizeBinary;
46
46
  function parseBinaryOp(data, flavor, lhs, operator, rhs) {
47
47
  parser_1.parseLog.debug(`[binary op] trying to parse ${flavor}`);
48
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);
49
+ (0, meta_1.ensureChildrenAreLhsAndRhsOrdered)(lhs.content, rhs.content);
50
50
  let parsedLhs = (0, structure_1.tryNormalizeSingleNode)(data, lhs);
51
51
  let parsedRhs = (0, structure_1.tryNormalizeSingleNode)(data, rhs);
52
52
  if (parsedLhs.type === "RDelimiter" /* RType.Delimiter */ || parsedRhs.type === "RDelimiter" /* RType.Delimiter */) {
53
53
  throw new input_format_1.XmlParseError(`unexpected under-sided binary op, received ${JSON.stringify([parsedLhs, parsedRhs])} for ${JSON.stringify([lhs, operator, rhs])}`);
54
54
  }
55
- const operationName = (0, meta_1.retrieveOpName)(data.config, operator);
55
+ const operationName = (0, meta_1.retrieveOpName)(operator);
56
56
  // special support for strings in assignments
57
57
  if (flavor === 'assignment') {
58
- [parsedLhs, parsedRhs] = processLhsAndRhsForAssignment(data, operationName, parsedLhs, parsedRhs);
58
+ [parsedLhs, parsedRhs] = processLhsAndRhsForAssignment(operationName, parsedLhs, parsedRhs);
59
59
  }
60
- const { location, content } = (0, meta_1.retrieveMetaStructure)(data.config, operator.content);
60
+ const { location, content } = (0, meta_1.retrieveMetaStructure)(operator.content);
61
61
  if (flavor === 'special') {
62
62
  flavor = (0, special_1.identifySpecialOp)(content);
63
63
  }
@@ -142,7 +142,7 @@ function parseBinaryOp(data, flavor, lhs, operator, rhs) {
142
142
  }
143
143
  return (0, hooks_1.executeHook)(data.hooks.operators.onBinary.after, data, result);
144
144
  }
145
- function processLhsAndRhsForAssignment(data, opName, parsedLhs, parsedRhs) {
145
+ function processLhsAndRhsForAssignment(opName, parsedLhs, parsedRhs) {
146
146
  const isRhs = opName === '->' || opName === '->>';
147
147
  const assigned = isRhs ? parsedRhs : parsedLhs;
148
148
  if (assigned.type !== "RString" /* RType.String */) {
@@ -1,4 +1,4 @@
1
- import { BinaryOperatorFlavor } from '../../../../model';
1
+ import type { BinaryOperatorFlavor } from '../../../../model';
2
2
  /**
3
3
  * Identify the flavor of a given operator, as we do not really have a use for "special"
4
4
  * operators within our internal AST.
@@ -1,6 +1,6 @@
1
- import { NamedXmlBasedJson } from '../../input-format';
2
- import { ParserData } from '../../data';
3
- import { RNode } from '../../../../model';
1
+ import type { NamedXmlBasedJson } from '../../input-format';
2
+ import type { ParserData } from '../../data';
3
+ import type { RNode } from '../../../../model';
4
4
  /**
5
5
  * Parses the construct as a {@link RUnaryOp} (automatically identifies the flavor).
6
6
  *
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.tryNormalizeUnary = void 0;
4
4
  const meta_1 = require("../meta");
5
- const parser_1 = require("../../parser");
6
5
  const structure_1 = require("../structure");
7
6
  const assert_1 = require("../../../../../../../util/assert");
8
7
  const model_1 = require("../../../../model");
9
8
  const hooks_1 = require("../../hooks");
9
+ const parser_1 = require("../../../json/parser");
10
10
  /**
11
11
  * Parses the construct as a {@link RUnaryOp} (automatically identifies the flavor).
12
12
  *
@@ -39,8 +39,8 @@ function parseUnaryOp(data, flavor, operator, operand) {
39
39
  ({ flavor, operator, operand } = (0, hooks_1.executeHook)(data.hooks.operators.onUnary.before, data, { flavor, operator, operand }));
40
40
  const parsedOperand = (0, structure_1.tryNormalizeSingleNode)(data, operand);
41
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);
42
+ const operationName = (0, meta_1.retrieveOpName)(operator);
43
+ const { location, content } = (0, meta_1.retrieveMetaStructure)(operator.content);
44
44
  const result = {
45
45
  type: "RUnaryOp" /* RType.UnaryOp */,
46
46
  flavor,
@@ -1,6 +1,6 @@
1
- import { XmlBasedJson } from '../../input-format';
2
- import { RComment } from '../../../../model';
3
- import { ParserData } from '../../data';
1
+ import type { XmlBasedJson } from '../../input-format';
2
+ import type { RComment } from '../../../../model';
3
+ import type { ParserData } from '../../data';
4
4
  /**
5
5
  * Normalize the given object as an R comment.
6
6
  * This requires you to check the corresponding name beforehand.
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeComment = void 0;
4
- const parser_1 = require("../../parser");
5
4
  const meta_1 = require("../meta");
6
5
  const assert_1 = require("../../../../../../../util/assert");
7
6
  const hooks_1 = require("../../hooks");
7
+ const parser_1 = require("../../../json/parser");
8
8
  /**
9
9
  * Normalize the given object as an R comment.
10
10
  * This requires you to check the corresponding name beforehand.
@@ -15,7 +15,7 @@ const hooks_1 = require("../../hooks");
15
15
  function normalizeComment(data, obj) {
16
16
  parser_1.parseLog.debug('[comment]');
17
17
  obj = (0, hooks_1.executeHook)(data.hooks.other.onComment.before, data, obj);
18
- const { location, content } = (0, meta_1.retrieveMetaStructure)(data.config, obj);
18
+ const { location, content } = (0, meta_1.retrieveMetaStructure)(obj);
19
19
  (0, assert_1.guard)(content.startsWith('#'), 'comment must start with #');
20
20
  const result = {
21
21
  type: "RComment" /* RType.Comment */,
@@ -1,6 +1,6 @@
1
- import { XmlBasedJson } from '../../input-format';
2
- import { RComment, RLineDirective } from '../../../../model';
3
- import { ParserData } from '../../data';
1
+ import type { XmlBasedJson } from '../../input-format';
2
+ import type { RComment, RLineDirective } from '../../../../model';
3
+ import type { ParserData } from '../../data';
4
4
  /**
5
5
  * Normalize the given object as an R line directive (`#line <number> "<file>"`).
6
6
  * This requires you to check the corresponding name beforehand.
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeLineDirective = void 0;
4
- const parser_1 = require("../../parser");
5
4
  const meta_1 = require("../meta");
6
5
  const assert_1 = require("../../../../../../../util/assert");
7
6
  const hooks_1 = require("../../hooks");
7
+ const parser_1 = require("../../../json/parser");
8
8
  const LineDirectiveRegex = /^#line\s+(\d+)\s+"([^"]+)"\s*$/;
9
9
  /**
10
10
  * Normalize the given object as an R line directive (`#line <number> "<file>"`).
@@ -17,7 +17,7 @@ const LineDirectiveRegex = /^#line\s+(\d+)\s+"([^"]+)"\s*$/;
17
17
  function normalizeLineDirective(data, obj) {
18
18
  parser_1.parseLog.debug('[line-directive]');
19
19
  obj = (0, hooks_1.executeHook)(data.hooks.other.onLineDirective.before, data, obj);
20
- const { location, content } = (0, meta_1.retrieveMetaStructure)(data.config, obj);
20
+ const { location, content } = (0, meta_1.retrieveMetaStructure)(obj);
21
21
  (0, assert_1.guard)(content.startsWith('#line'), 'line directive must start with #line');
22
22
  const match = LineDirectiveRegex.exec(content);
23
23
  let result;
@@ -1,7 +1,7 @@
1
- import { NamedXmlBasedJson, XmlBasedJson } from '../../input-format';
2
- import { ParserData } from '../../data';
3
- import { RNode } from '../../../../model';
4
- import { RDelimiter } from '../../../../model/nodes/info';
1
+ import type { NamedXmlBasedJson, XmlBasedJson } from '../../input-format';
2
+ import type { ParserData } from '../../data';
3
+ import type { RNode } from '../../../../model';
4
+ import type { RDelimiter } from '../../../../model/nodes/info';
5
5
  export declare function splitComments(mappedWithName: NamedXmlBasedJson[]): {
6
6
  comments: NamedXmlBasedJson[];
7
7
  others: NamedXmlBasedJson[];
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseNodesWithUnknownType = exports.normalizeBasedOnType = exports.splitComments = void 0;
4
4
  const arrays_1 = require("../../../../../../../util/arrays");
5
- const parser_1 = require("../../parser");
6
5
  const meta_1 = require("../meta");
7
6
  const single_element_1 = require("./single-element");
8
7
  const values_1 = require("../values");
@@ -11,6 +10,7 @@ const loops_1 = require("../loops");
11
10
  const control_1 = require("../control");
12
11
  const log_1 = require("../../../../../../../util/log");
13
12
  const other_1 = require("../other");
13
+ const parser_1 = require("../../../json/parser");
14
14
  function normalizeMappedWithoutSemicolonBasedOnType(mappedWithName, data) {
15
15
  if (mappedWithName.length === 1) {
16
16
  return [(0, single_element_1.tryNormalizeSingleNode)(data, mappedWithName[0])];
@@ -103,14 +103,14 @@ function normalizeBasedOnType(data, obj) {
103
103
  mappedWithName = obj;
104
104
  }
105
105
  else {
106
- mappedWithName = (0, meta_1.getWithTokenType)(data.config.tokenMap, obj);
106
+ mappedWithName = (0, meta_1.getWithTokenType)(obj);
107
107
  }
108
108
  log_1.log.trace(`[parseBasedOnType] names: [${mappedWithName.map(({ name }) => name).join(', ')}]`);
109
109
  const semiColons = [];
110
110
  const splitOnSemicolon = (0, arrays_1.splitArrayOn)(mappedWithName, node => {
111
111
  const res = node.name === ";" /* RawRType.Semicolon */;
112
112
  if (res) {
113
- const { location, content } = (0, meta_1.retrieveMetaStructure)(data.config, node.content);
113
+ const { location, content } = (0, meta_1.retrieveMetaStructure)(node.content);
114
114
  semiColons.push({
115
115
  type: "RDelimiter" /* RType.Delimiter */,
116
116
  subtype: ";" /* RawRType.Semicolon */,
@@ -1,4 +1,4 @@
1
- import { XmlBasedJson } from '../../input-format';
2
- import { ParserData } from '../../data';
3
- import { RExpressionList } from '../../../../model';
1
+ import type { XmlBasedJson } from '../../input-format';
2
+ import type { ParserData } from '../../data';
3
+ import type { RExpressionList } from '../../../../model';
4
4
  export declare function parseRootObjToAst(data: ParserData, obj: XmlBasedJson): RExpressionList;
@@ -7,12 +7,11 @@ const elements_1 = require("./elements");
7
7
  const log_1 = require("../../../../../../../util/log");
8
8
  const arrays_1 = require("../../../../../../../util/arrays");
9
9
  function parseRootObjToAst(data, obj) {
10
- const config = data.config;
11
10
  const exprContent = (0, input_format_1.getKeysGuarded)(obj, "exprlist" /* RawRType.ExpressionList */);
12
- (0, meta_1.assureTokenType)(config.tokenMap, exprContent, "exprlist" /* RawRType.ExpressionList */);
11
+ (0, meta_1.assureTokenType)(exprContent, "exprlist" /* RawRType.ExpressionList */);
13
12
  let parsedChildren = [];
14
- if (config.childrenName in exprContent) {
15
- const children = (0, input_format_1.getKeysGuarded)(exprContent, config.childrenName);
13
+ if (input_format_1.childrenKey in exprContent) {
14
+ const children = (0, input_format_1.getKeysGuarded)(exprContent, input_format_1.childrenKey);
16
15
  parsedChildren = (0, elements_1.normalizeBasedOnType)(data, children);
17
16
  }
18
17
  else {
@@ -1,7 +1,7 @@
1
- import { NamedXmlBasedJson } from '../../input-format';
2
- import { ParserData } from '../../data';
3
- import { RNode } from '../../../../model';
4
- import { RDelimiter } from '../../../../model/nodes/info';
1
+ import type { NamedXmlBasedJson } from '../../input-format';
2
+ import type { ParserData } from '../../data';
3
+ import type { RNode } from '../../../../model';
4
+ import type { RDelimiter } from '../../../../model/nodes/info';
5
5
  /**
6
6
  * Parses a single structure in the ast based on its type (e.g., a string, a number, a symbol, ...)
7
7
  *
@@ -10,7 +10,7 @@ const other_1 = require("../other");
10
10
  const loops_1 = require("../loops");
11
11
  const line_directive_1 = require("../other/line-directive");
12
12
  function normalizeDelimiter(data, elem) {
13
- const { location, content } = (0, meta_1.retrieveMetaStructure)(data.config, elem.content);
13
+ const { location, content } = (0, meta_1.retrieveMetaStructure)(elem.content);
14
14
  return {
15
15
  type: "RDelimiter" /* RType.Delimiter */,
16
16
  location,
@@ -52,7 +52,7 @@ function tryNormalizeSingleNode(data, elem) {
52
52
  case "SYMBOL" /* RawRType.Symbol */:
53
53
  case "SLOT" /* RawRType.Slot */:
54
54
  case "NULL_CONST" /* RawRType.NullConst */: {
55
- const symbol = (0, values_1.tryNormalizeSymbol)(data, (0, meta_1.getWithTokenType)(data.config.tokenMap, [elem.content]));
55
+ const symbol = (0, values_1.tryNormalizeSymbol)(data, (0, meta_1.getWithTokenType)([elem.content]));
56
56
  (0, assert_1.guard)(symbol !== undefined, () => `should have been parsed to a symbol but was ${JSON.stringify(symbol)}`);
57
57
  return symbol;
58
58
  }
@@ -1,7 +1,7 @@
1
- import { XmlBasedJson } from '../../input-format';
2
- import { RNa } from '../../../../../values';
3
- import { RLogical, RSymbol, NoInfo, RNumber } from '../../../../model';
4
- import { ParserData } from '../../data';
1
+ import type { XmlBasedJson } from '../../input-format';
2
+ import type { RNa } from '../../../../../values';
3
+ import type { RLogical, RSymbol, NoInfo, RNumber } from '../../../../model';
4
+ import type { ParserData } from '../../data';
5
5
  /**
6
6
  * Normalize the given object as a R number (see {@link number2ts}), supporting booleans (see {@link boolean2ts}),
7
7
  * and special values.
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeNumber = void 0;
4
4
  const values_1 = require("../../../../../values");
5
- const parser_1 = require("../../parser");
6
5
  const meta_1 = require("../meta");
7
6
  const hooks_1 = require("../../hooks");
7
+ const parser_1 = require("../../../json/parser");
8
8
  /**
9
9
  * Normalize the given object as a R number (see {@link number2ts}), supporting booleans (see {@link boolean2ts}),
10
10
  * and special values.
@@ -16,7 +16,7 @@ const hooks_1 = require("../../hooks");
16
16
  function normalizeNumber(data, obj) {
17
17
  parser_1.parseLog.debug('[number]');
18
18
  obj = (0, hooks_1.executeHook)(data.hooks.values.onNumber.before, data, obj);
19
- const { location, content } = (0, meta_1.retrieveMetaStructure)(data.config, obj);
19
+ const { location, content } = (0, meta_1.retrieveMetaStructure)(obj);
20
20
  const common = {
21
21
  location,
22
22
  lexeme: content,
@@ -1,6 +1,6 @@
1
- import { XmlBasedJson } from '../../input-format';
2
- import { RString } from '../../../../model';
3
- import { ParserData } from '../../data';
1
+ import type { XmlBasedJson } from '../../input-format';
2
+ import type { RString } from '../../../../model';
3
+ import type { ParserData } from '../../data';
4
4
  /**
5
5
  * Normalize the given object as a R string (see {@link string2ts}).
6
6
  * This requires you to check the corresponding name beforehand.