@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.
- package/README.md +3 -3
- package/abstract-interpretation/domain.d.ts +27 -0
- package/abstract-interpretation/domain.js +146 -0
- package/abstract-interpretation/handler/binop/binop.d.ts +16 -0
- package/abstract-interpretation/handler/binop/binop.js +40 -0
- package/abstract-interpretation/handler/binop/operators.d.ts +2 -0
- package/abstract-interpretation/handler/binop/operators.js +42 -0
- package/abstract-interpretation/handler/handler.d.ts +6 -0
- package/abstract-interpretation/handler/handler.js +3 -0
- package/abstract-interpretation/processor.d.ts +10 -0
- package/abstract-interpretation/processor.js +84 -0
- package/benchmark/slicer.d.ts +6 -8
- package/benchmark/slicer.js +5 -15
- package/benchmark/stats/print.d.ts +1 -1
- package/benchmark/stats/print.js +0 -2
- package/benchmark/stats/stats.d.ts +3 -4
- package/benchmark/stats/stats.js +1 -1
- package/cli/benchmark-app.d.ts +1 -0
- package/cli/benchmark-app.js +21 -6
- package/cli/benchmark-helper-app.d.ts +2 -0
- package/cli/benchmark-helper-app.js +15 -6
- package/cli/common/features.d.ts +1 -1
- package/cli/common/options.d.ts +1 -1
- package/cli/common/options.js +4 -1
- package/cli/common/script.d.ts +1 -1
- package/cli/common/scripts-info.d.ts +3 -2
- package/cli/common/scripts-info.js +15 -1
- package/cli/export-quads-app.js +1 -5
- package/cli/repl/commands/cfg.d.ts +1 -1
- package/cli/repl/commands/cfg.js +3 -3
- package/cli/repl/commands/commands.d.ts +4 -2
- package/cli/repl/commands/commands.js +67 -28
- package/cli/repl/commands/dataflow.d.ts +1 -1
- package/cli/repl/commands/dataflow.js +2 -2
- package/cli/repl/commands/execute.d.ts +2 -2
- package/cli/repl/commands/main.d.ts +2 -2
- package/cli/repl/commands/normalize.d.ts +1 -1
- package/cli/repl/commands/normalize.js +2 -2
- package/cli/repl/commands/parse.d.ts +1 -1
- package/cli/repl/commands/parse.js +12 -12
- package/cli/repl/commands/quit.d.ts +1 -1
- package/cli/repl/commands/quit.js +4 -1
- package/cli/repl/commands/version.d.ts +1 -1
- package/cli/repl/core.d.ts +5 -3
- package/cli/repl/core.js +63 -7
- package/cli/repl/execute.d.ts +1 -1
- package/cli/repl/execute.js +3 -3
- package/cli/repl/server/connection.d.ts +2 -2
- package/cli/repl/server/connection.js +4 -8
- package/cli/repl/server/messages/analysis.d.ts +3 -3
- package/cli/repl/server/messages/analysis.js +12 -32
- package/cli/repl/server/messages/error.d.ts +1 -1
- package/cli/repl/server/messages/hello.d.ts +2 -2
- package/cli/repl/server/messages/messages.d.ts +5 -5
- package/cli/repl/server/messages/repl.d.ts +1 -1
- package/cli/repl/server/messages/slice.d.ts +3 -3
- package/cli/repl/server/net.d.ts +16 -0
- package/cli/repl/server/net.js +42 -3
- package/cli/repl/server/send.d.ts +2 -2
- package/cli/repl/server/server.d.ts +2 -2
- package/cli/repl/server/validate.d.ts +3 -3
- package/cli/statistics-helper-app.js +2 -3
- package/cli/summarizer-app.js +1 -2
- package/config.d.ts +16 -0
- package/config.js +75 -0
- package/core/input.d.ts +5 -5
- package/core/output.d.ts +1 -1
- package/core/print/dataflow-printer.d.ts +3 -3
- package/core/print/normalize-printer.d.ts +2 -2
- package/core/print/parse-printer.d.ts +2 -3
- package/core/print/parse-printer.js +6 -4
- package/core/print/print.d.ts +1 -1
- package/core/print/slice-diff-ansi.d.ts +1 -1
- package/core/slicer.d.ts +5 -4
- package/core/slicer.js +2 -2
- package/core/steps.d.ts +10 -9
- package/core/steps.js +5 -4
- package/dataflow/environments/append.d.ts +1 -1
- package/dataflow/environments/environment.d.ts +4 -4
- package/dataflow/environments/environment.js +8 -0
- package/dataflow/environments/overwrite.d.ts +1 -1
- package/dataflow/environments/register.d.ts +2 -2
- package/dataflow/environments/register.js +1 -0
- package/dataflow/environments/resolve-by-name.d.ts +2 -2
- package/dataflow/environments/scoping.d.ts +1 -1
- package/dataflow/extractor.d.ts +5 -5
- package/dataflow/extractor.js +10 -2
- package/dataflow/graph/diff.d.ts +3 -3
- package/dataflow/graph/graph.d.ts +8 -7
- package/dataflow/graph/quads.d.ts +2 -2
- package/dataflow/graph/vertex.d.ts +5 -5
- package/dataflow/internal/info.d.ts +2 -2
- package/dataflow/internal/linker.d.ts +3 -3
- package/dataflow/internal/process/access.d.ts +3 -3
- package/dataflow/internal/process/expression-list.d.ts +3 -3
- package/dataflow/internal/process/expression-list.js +0 -4
- package/dataflow/internal/process/functions/argument.d.ts +4 -4
- package/dataflow/internal/process/functions/exit-points.d.ts +1 -1
- package/dataflow/internal/process/functions/function-call.d.ts +3 -3
- package/dataflow/internal/process/functions/function-call.js +7 -1
- package/dataflow/internal/process/functions/function-definition.d.ts +3 -3
- package/dataflow/internal/process/functions/parameter.d.ts +3 -3
- package/dataflow/internal/process/functions/source.d.ts +8 -0
- package/dataflow/internal/process/functions/source.js +81 -0
- package/dataflow/internal/process/if-then-else.d.ts +3 -3
- package/dataflow/internal/process/loops/for-loop.d.ts +3 -3
- package/dataflow/internal/process/loops/repeat-loop.d.ts +3 -3
- package/dataflow/internal/process/loops/while-loop.d.ts +3 -3
- package/dataflow/internal/process/operators/assignment.d.ts +3 -3
- package/dataflow/internal/process/operators/non-assignment-binary-op.d.ts +3 -3
- package/dataflow/internal/process/operators/pipe.d.ts +3 -3
- package/dataflow/internal/process/operators/unary-op.d.ts +3 -3
- package/dataflow/internal/process/symbol.d.ts +3 -3
- package/dataflow/internal/process/uninteresting-leaf.d.ts +2 -2
- package/dataflow/processor.d.ts +12 -3
- package/flowr.d.ts +5 -2
- package/flowr.js +19 -12
- package/package.json +50 -18
- package/r-bridge/lang-4.x/ast/index.d.ts +1 -0
- package/r-bridge/lang-4.x/ast/index.js +3 -0
- package/r-bridge/lang-4.x/ast/model/collect.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/model.d.ts +6 -6
- package/r-bridge/lang-4.x/ast/model/nodes/info/index.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/operators.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +4 -2
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +6 -1
- package/r-bridge/lang-4.x/ast/model/processing/fold.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/processing/role.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/model/processing/visitor.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/json/format.d.ts +14 -0
- package/r-bridge/lang-4.x/ast/parser/json/format.js +26 -0
- package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +7 -0
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +57 -0
- package/r-bridge/lang-4.x/ast/parser/xml/data.d.ts +4 -7
- package/r-bridge/lang-4.x/ast/parser/xml/hooks.d.ts +5 -5
- package/r-bridge/lang-4.x/ast/parser/xml/index.d.ts +0 -2
- package/r-bridge/lang-4.x/ast/parser/xml/index.js +0 -2
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.d.ts +6 -2
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.js +7 -10
- package/r-bridge/lang-4.x/ast/parser/xml/internal/access.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/access.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then-else.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then-else.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/expression.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/expression.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/argument.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/argument.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/call.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/call.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/definition.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/definition.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/parameter.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/parameter.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/index.d.ts +0 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/index.js +0 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/break.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/break.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/for.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/for.js +3 -6
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/next.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/next.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/repeat.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/repeat.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/while.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/while.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.d.ts +9 -14
- package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.js +15 -23
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/binary.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/binary.js +6 -6
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/special.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/unary.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/unary.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/comment.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/comment.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/line-directive.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/line-directive.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/elements.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/elements.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/root.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/root.js +3 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/single-element.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/single-element.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/number.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/number.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/string.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/string.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/symbol.d.ts +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/symbol.js +4 -4
- package/r-bridge/lang-4.x/values.d.ts +0 -1
- package/r-bridge/lang-4.x/values.js +14 -6
- package/r-bridge/retriever.d.ts +26 -22
- package/r-bridge/retriever.js +73 -23
- package/r-bridge/shell-executor.d.ts +11 -0
- package/r-bridge/shell-executor.js +50 -0
- package/r-bridge/shell.d.ts +12 -31
- package/r-bridge/shell.js +36 -94
- package/reconstruct/reconstruct.d.ts +1 -1
- package/slicing/criterion/collect-all.d.ts +3 -3
- package/slicing/criterion/filters/all-variables.d.ts +1 -1
- package/slicing/criterion/parse.d.ts +1 -1
- package/slicing/static/static-slicer.d.ts +3 -3
- package/statistics/features/common-syntax-probability.d.ts +3 -2
- package/statistics/features/common-syntax-probability.js +0 -3
- package/statistics/features/feature.d.ts +6 -6
- package/statistics/features/post-processing.d.ts +2 -2
- package/statistics/features/supported/assignments/assignments.d.ts +2 -2
- package/statistics/features/supported/assignments/post-process.d.ts +2 -2
- package/statistics/features/supported/assignments/post-process.js +6 -6
- package/statistics/features/supported/comments/comments.d.ts +2 -2
- package/statistics/features/supported/comments/post-process.d.ts +2 -2
- package/statistics/features/supported/comments/post-process.js +2 -2
- package/statistics/features/supported/control-flow/control-flow.d.ts +2 -2
- package/statistics/features/supported/control-flow/post-process.d.ts +2 -2
- package/statistics/features/supported/data-access/data-access.d.ts +3 -3
- package/statistics/features/supported/data-access/post-process.d.ts +2 -2
- package/statistics/features/supported/data-access/post-process.js +4 -4
- package/statistics/features/supported/defined-functions/defined-functions.d.ts +4 -4
- package/statistics/features/supported/defined-functions/post-process.d.ts +2 -2
- package/statistics/features/supported/defined-functions/post-process.js +4 -4
- package/statistics/features/supported/expression-list/expression-list.d.ts +2 -2
- package/statistics/features/supported/expression-list/post-process.d.ts +2 -2
- package/statistics/features/supported/expression-list/post-process.js +3 -3
- package/statistics/features/supported/loops/loops.d.ts +2 -2
- package/statistics/features/supported/loops/post-process.d.ts +2 -2
- package/statistics/features/supported/loops/post-process.js +3 -3
- package/statistics/features/supported/used-functions/post-process.d.ts +2 -2
- package/statistics/features/supported/used-functions/post-process.js +5 -5
- package/statistics/features/supported/used-functions/used-functions.d.ts +3 -3
- package/statistics/features/supported/used-packages/post-process.d.ts +2 -2
- package/statistics/features/supported/used-packages/post-process.js +5 -5
- package/statistics/features/supported/used-packages/used-packages.d.ts +2 -2
- package/statistics/features/supported/values/post-process.d.ts +2 -2
- package/statistics/features/supported/values/post-process.js +3 -3
- package/statistics/features/supported/values/values.d.ts +2 -2
- package/statistics/features/supported/variables/post-process.d.ts +3 -3
- package/statistics/features/supported/variables/post-process.js +3 -3
- package/statistics/features/supported/variables/variables.d.ts +2 -2
- package/statistics/meta-statistics.d.ts +1 -1
- package/statistics/output/ansi.js +1 -1
- package/statistics/output/print-stats.d.ts +2 -2
- package/statistics/output/statistics-file.d.ts +1 -1
- package/statistics/statistics.d.ts +4 -4
- package/statistics/statistics.js +7 -8
- package/util/args.d.ts +8 -4
- package/util/args.js +11 -4
- package/util/{cfg.d.ts → cfg/cfg.d.ts} +18 -6
- package/util/{cfg.js → cfg/cfg.js} +42 -37
- package/util/cfg/visitor.d.ts +14 -0
- package/util/cfg/visitor.js +64 -0
- package/util/diff.d.ts +1 -1
- package/util/files.d.ts +7 -1
- package/util/files.js +11 -1
- package/util/log.js +3 -0
- package/util/mermaid/ast.d.ts +1 -1
- package/util/mermaid/cfg.d.ts +2 -2
- package/util/mermaid/dfg.d.ts +3 -3
- package/util/objects.d.ts +1 -1
- package/util/quads.d.ts +2 -2
- package/util/summarizer/benchmark/data.d.ts +1 -1
- package/util/summarizer/benchmark/first-phase/input.d.ts +2 -1
- package/util/summarizer/benchmark/first-phase/input.js +20 -4
- package/util/summarizer/benchmark/first-phase/process.d.ts +4 -3
- package/util/summarizer/benchmark/first-phase/process.js +14 -5
- package/util/summarizer/benchmark/second-phase/graph.d.ts +1 -1
- package/util/summarizer/benchmark/second-phase/graph.js +1 -1
- package/util/summarizer/benchmark/second-phase/process.d.ts +3 -1
- package/util/summarizer/benchmark/second-phase/process.js +48 -11
- package/util/summarizer/benchmark/summarizer.d.ts +3 -6
- package/util/summarizer/benchmark/summarizer.js +16 -11
- package/util/summarizer/statistics/first-phase/process.js +8 -8
- package/util/summarizer/statistics/post-process/clusterer.d.ts +2 -2
- package/util/summarizer/statistics/post-process/file-based-count.d.ts +1 -1
- package/util/summarizer/statistics/post-process/histogram.d.ts +2 -2
- package/util/summarizer/statistics/post-process/post-process-output.d.ts +2 -2
- package/util/summarizer/statistics/post-process/post-process-output.js +4 -5
- package/util/summarizer/statistics/second-phase/process.d.ts +2 -2
- package/util/summarizer/statistics/summarizer.d.ts +3 -2
- package/util/summarizer/summarizer.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/xml/config.d.ts +0 -25
- package/r-bridge/lang-4.x/ast/parser/xml/config.js +0 -16
- package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.d.ts +0 -9
- package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.js +0 -51
- package/r-bridge/lang-4.x/ast/parser/xml/parser.d.ts +0 -17
- package/r-bridge/lang-4.x/ast/parser/xml/parser.js +0 -30
|
@@ -25,7 +25,10 @@ async function benchmark() {
|
|
|
25
25
|
// we do not use the limit argument to be able to pick the limit randomly
|
|
26
26
|
(0, assert_1.guard)(options.input !== undefined, 'No input file given');
|
|
27
27
|
(0, assert_1.guard)(options.output !== undefined, 'No output file given');
|
|
28
|
-
|
|
28
|
+
(0, assert_1.guard)((options['file-id'] === undefined) === (options['run-num'] === undefined), 'When giving a file-id or run-num, both have to be given');
|
|
29
|
+
// prefix for printing to console, includes file id and run number if present
|
|
30
|
+
const prefix = `[${options.input}${options['file-id'] !== undefined ? ` (file ${options['file-id']}, run ${options['run-num']})` : ''}]`;
|
|
31
|
+
console.log(`${prefix} Appending output to ${options.output}`);
|
|
29
32
|
// ensure the file exists
|
|
30
33
|
const fileStat = fs_1.default.statSync(options.input);
|
|
31
34
|
(0, assert_1.guard)(fileStat.isFile(), `File ${options.input} does not exist or is no file`);
|
|
@@ -35,21 +38,27 @@ async function benchmark() {
|
|
|
35
38
|
await slicer.init(request);
|
|
36
39
|
// ${escape}1F${escape}1G${escape}2K for line reset
|
|
37
40
|
if (options.slice === 'all') {
|
|
38
|
-
const count = await slicer.sliceForAll(slicing_1.DefaultAllVariablesFilter, (i, total, arr) => console.log(
|
|
39
|
-
console.log(
|
|
41
|
+
const count = await slicer.sliceForAll(slicing_1.DefaultAllVariablesFilter, (i, total, arr) => console.log(`${prefix} Slicing ${i + 1}/${total} [${JSON.stringify(arr[i])}]`));
|
|
42
|
+
console.log(`${prefix} Completed Slicing`);
|
|
40
43
|
(0, assert_1.guard)(count > 0, `No possible slices found for ${options.input}, skipping in count`);
|
|
41
44
|
}
|
|
42
45
|
else {
|
|
43
|
-
console.log(
|
|
46
|
+
console.log(`${prefix} Skipping Slicing due to --slice=${options.slice}`);
|
|
44
47
|
}
|
|
45
48
|
const { stats } = slicer.finish();
|
|
49
|
+
const output = {
|
|
50
|
+
filename: options.input,
|
|
51
|
+
'file-id': options['file-id'],
|
|
52
|
+
'run-num': options['run-num'],
|
|
53
|
+
stats
|
|
54
|
+
};
|
|
46
55
|
// append line by line
|
|
47
|
-
fs_1.default.appendFileSync(options.output, `${JSON.stringify(
|
|
56
|
+
fs_1.default.appendFileSync(options.output, `${JSON.stringify(output, json_1.jsonReplacer)}\n`);
|
|
48
57
|
}
|
|
49
58
|
catch (e) {
|
|
50
59
|
if (e instanceof Error) {
|
|
51
60
|
if (!e.message.includes('unable to parse R')) {
|
|
52
|
-
console.log(
|
|
61
|
+
console.log(`${prefix} Non R-Side error : ${e.message}`);
|
|
53
62
|
}
|
|
54
63
|
}
|
|
55
64
|
slicer.ensureSessionClosed(); // ensure finish
|
package/cli/common/features.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { FeatureKey } from '../../statistics';
|
|
1
|
+
import type { FeatureKey } from '../../statistics';
|
|
2
2
|
export declare function validateFeatures(features: (string[] | ['all'] | FeatureKey[])): Set<FeatureKey>;
|
|
3
3
|
export declare function retrieveArchiveName(p: string): string;
|
package/cli/common/options.d.ts
CHANGED
package/cli/common/options.js
CHANGED
|
@@ -15,15 +15,18 @@ exports.benchmarkOptions = [
|
|
|
15
15
|
{ name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging [do not use for the real benchmark as this affects the time measurements, but only to find errors]' },
|
|
16
16
|
{ name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
|
|
17
17
|
{ name: 'limit', alias: 'l', type: Number, description: 'Limit the number of files to process (if given, this will choose these files randomly and add the chosen names to the output' },
|
|
18
|
+
{ name: 'runs', alias: 'r', type: Number, description: 'The amount of benchmark runs that should be done, out of which an average will be calculated' },
|
|
18
19
|
{ name: 'input', alias: 'i', type: String, description: 'Pass a folder or file as src to read from', multiple: true, defaultOption: true, defaultValue: [], typeLabel: '{underline files/folders}' },
|
|
19
20
|
{ name: 'parallel', alias: 'p', type: String, description: 'Number of parallel executors (defaults to {italic max(cpu.count-1, 1)})', defaultValue: Math.max(os_1.default.cpus().length - 1, 1), typeLabel: '{underline number}' },
|
|
20
21
|
{ name: 'slice', alias: 's', type: String, description: 'Automatically slice for *all* variables (default) or *no* slicing and only parsing/dataflow construction', defaultValue: 'all', typeLabel: '{underline all/no}' },
|
|
21
|
-
{ name: 'output', alias: 'o', type: String, description: `
|
|
22
|
+
{ name: 'output', alias: 'o', type: String, description: `Directory to write all the measurements to in a per-file-basis (defaults to {italic benchmark-${StartTimeString}})`, defaultValue: `benchmark-${StartTimeString}`, typeLabel: '{underline file}' }
|
|
22
23
|
];
|
|
23
24
|
exports.benchmarkHelperOptions = [
|
|
24
25
|
{ name: 'verbose', alias: 'v', type: Boolean, description: 'Run with verbose logging [do not use for the real benchmark as this affects the time measurements, but only to find errors]' },
|
|
25
26
|
{ name: 'help', alias: 'h', type: Boolean, description: 'Print this usage guide' },
|
|
26
27
|
{ name: 'input', alias: 'i', type: String, description: 'Pass a single file as src to read from', multiple: false, defaultOption: true, typeLabel: '{underline file}' },
|
|
28
|
+
{ name: 'file-id', alias: 'd', type: Number, description: 'A numeric file id that can be used to match an input and run-num to a file' },
|
|
29
|
+
{ name: 'run-num', alias: 'r', type: Number, description: 'The n-th time that the file with the given file-id is being benchmarked' },
|
|
27
30
|
{ name: 'slice', alias: 's', type: String, description: 'Automatically slice for *all* variables (default) or *no* slicing and only parsing/dataflow construction', defaultValue: 'all', typeLabel: '{underline all/no}' },
|
|
28
31
|
{ name: 'output', alias: 'o', type: String, description: 'File to write the measurements to (appends a single line in JSON format)', typeLabel: '{underline file}' },
|
|
29
32
|
];
|
package/cli/common/script.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
import { scripts } from './scripts-info';
|
|
7
|
-
import { CommonOptions } from './options';
|
|
7
|
+
import type { CommonOptions } from './options';
|
|
8
8
|
/**
|
|
9
9
|
* Just a helping data structure to allow the user to provide example usages of the respective script.
|
|
10
10
|
* The subtitle will be displayed next to the title.
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import { MergeableRecord } from '../../util/objects';
|
|
7
|
-
import { OptionDefinition } from 'command-line-usage';
|
|
6
|
+
import type { MergeableRecord } from '../../util/objects';
|
|
7
|
+
import type { OptionDefinition } from 'command-line-usage';
|
|
8
8
|
interface BaseScriptInformation extends MergeableRecord {
|
|
9
9
|
toolName: string;
|
|
10
10
|
target: string;
|
|
@@ -21,4 +21,5 @@ export interface HelperScriptInformation extends BaseScriptInformation {
|
|
|
21
21
|
}
|
|
22
22
|
export type ScriptInformation = MasterScriptInformation | HelperScriptInformation;
|
|
23
23
|
export declare const scripts: Record<"slicer" | "benchmark" | "stats" | "summarizer" | "export-quads" | "stats-helper" | "benchmark-helper", ScriptInformation>;
|
|
24
|
+
export declare function getValidOptionsForCompletion(options: readonly OptionDefinition[], prevArgs: readonly string[]): string[];
|
|
24
25
|
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.scripts = void 0;
|
|
3
|
+
exports.getValidOptionsForCompletion = exports.scripts = void 0;
|
|
4
4
|
const options_1 = require("./options");
|
|
5
|
+
const commands_1 = require("../repl/commands");
|
|
5
6
|
/**
|
|
6
7
|
* We hold `_scripts` internally, as the modifiable variant and export the readonly scripts
|
|
7
8
|
*/
|
|
@@ -66,4 +67,17 @@ const _scripts = {
|
|
|
66
67
|
}
|
|
67
68
|
};
|
|
68
69
|
exports.scripts = _scripts;
|
|
70
|
+
function getValidOptionsForCompletion(options, prevArgs) {
|
|
71
|
+
return options.filter(o => canAddOption(o, prevArgs)).flatMap(o => {
|
|
72
|
+
const args = [(0, commands_1.asOptionName)(o.name)];
|
|
73
|
+
if (o.alias) {
|
|
74
|
+
args.push((0, commands_1.asOptionName)(o.alias));
|
|
75
|
+
}
|
|
76
|
+
return args;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
exports.getValidOptionsForCompletion = getValidOptionsForCompletion;
|
|
80
|
+
function canAddOption(option, prevArgs) {
|
|
81
|
+
return option.multiple || !prevArgs.includes((0, commands_1.asOptionName)(option.name)) && (!option.alias || !prevArgs.includes((0, commands_1.asOptionName)(option.alias)));
|
|
82
|
+
}
|
|
69
83
|
//# sourceMappingURL=scripts-info.js.map
|
package/cli/export-quads-app.js
CHANGED
|
@@ -17,12 +17,8 @@ const options = (0, common_1.processCommandLineArgs)('export-quads', [], {
|
|
|
17
17
|
]
|
|
18
18
|
});
|
|
19
19
|
const shell = new r_bridge_1.RShell();
|
|
20
|
-
shell.tryToInjectHomeLibPath();
|
|
21
20
|
async function writeQuadForSingleFile(request, output) {
|
|
22
|
-
const normalized = await (0, r_bridge_1.retrieveNormalizedAstFromRCode)(
|
|
23
|
-
...request,
|
|
24
|
-
ensurePackageInstalled: true
|
|
25
|
-
}, shell);
|
|
21
|
+
const normalized = await (0, r_bridge_1.retrieveNormalizedAstFromRCode)(request, shell);
|
|
26
22
|
const serialized = (0, quads_1.serialize2quads)(normalized.ast, { context: request.content });
|
|
27
23
|
log_1.log.info(`Appending quads to ${output}`);
|
|
28
24
|
fs_1.default.appendFileSync(output, serialized);
|
package/cli/repl/commands/cfg.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.controlflowStarCommand = exports.controlflowCommand = void 0;
|
|
4
4
|
const core_1 = require("../../../core");
|
|
5
5
|
const r_bridge_1 = require("../../../r-bridge");
|
|
6
|
-
const cfg_1 = require("../../../util/cfg");
|
|
6
|
+
const cfg_1 = require("../../../util/cfg/cfg");
|
|
7
7
|
const mermaid_1 = require("../../../util/mermaid");
|
|
8
8
|
async function controlflow(shell, remainingLine) {
|
|
9
9
|
return await new core_1.SteppingSlicer({
|
|
@@ -13,7 +13,7 @@ async function controlflow(shell, remainingLine) {
|
|
|
13
13
|
}).allRemainingSteps();
|
|
14
14
|
}
|
|
15
15
|
exports.controlflowCommand = {
|
|
16
|
-
description:
|
|
16
|
+
description: `Get mermaid code for the control-flow graph of R code, start with '${r_bridge_1.fileProtocol}' to indicate a file`,
|
|
17
17
|
usageExample: ':controlflow',
|
|
18
18
|
aliases: ['cfg', 'cf'],
|
|
19
19
|
script: false,
|
|
@@ -24,7 +24,7 @@ exports.controlflowCommand = {
|
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
exports.controlflowStarCommand = {
|
|
27
|
-
description:
|
|
27
|
+
description: `Get a mermaid url of the control-flow graph of R code, start with '${r_bridge_1.fileProtocol}' to indicate a file`,
|
|
28
28
|
usageExample: ':controlflow',
|
|
29
29
|
aliases: ['cfg*', 'cf*'],
|
|
30
30
|
script: false,
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { ReplCommand } from './main';
|
|
1
|
+
import type { ReplCommand } from './main';
|
|
2
2
|
export declare const helpCommand: ReplCommand;
|
|
3
3
|
/**
|
|
4
4
|
* The names of all commands including their aliases (but without the leading `:`)
|
|
5
5
|
*/
|
|
6
|
-
export declare
|
|
6
|
+
export declare function getCommandNames(): string[];
|
|
7
7
|
/**
|
|
8
8
|
* Get the command for a given command name or alias.
|
|
9
9
|
* @param command - The name of the command (without the leading `:`)
|
|
10
10
|
*/
|
|
11
11
|
export declare function getCommand(command: string): ReplCommand | undefined;
|
|
12
|
+
export declare function asOptionName(argument: string): string;
|
|
13
|
+
export declare function longestCommandName(): number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCommand = exports.
|
|
3
|
+
exports.longestCommandName = exports.asOptionName = exports.getCommand = exports.getCommandNames = exports.helpCommand = void 0;
|
|
4
4
|
const quit_1 = require("./quit");
|
|
5
5
|
const common_1 = require("../../common");
|
|
6
6
|
const execute_1 = require("../execute");
|
|
@@ -28,16 +28,17 @@ exports.helpCommand = {
|
|
|
28
28
|
usageExample: ':help',
|
|
29
29
|
aliases: ['h', '?'],
|
|
30
30
|
fn: output => {
|
|
31
|
+
initCommandMapping();
|
|
31
32
|
output.stdout(`
|
|
32
33
|
You can always just enter R expressions which get evaluated right away:
|
|
33
34
|
${prompt_1.rawPrompt} ${(0, statistics_1.bold)('1 + 1', output.formatter)}
|
|
34
35
|
${(0, statistics_1.italic)('[1] 2', output.formatter)}
|
|
35
36
|
|
|
36
37
|
Besides that, you can use the following commands. The scripts ${(0, statistics_1.italic)('can', output.formatter)} accept further arguments. There are the following basic commands:
|
|
37
|
-
${Array.from(Object.entries(commands)).filter(([, { script }]) => !script).map(c => printHelpForScript(c, output.formatter)).join('\n')}
|
|
38
|
+
${Array.from(Object.entries(commands())).filter(([, { script }]) => !script).map(c => printHelpForScript(c, output.formatter)).join('\n')}
|
|
38
39
|
|
|
39
40
|
Furthermore, you can directly call the following scripts which accept arguments. If you are unsure, try to add ${(0, statistics_1.italic)('--help', output.formatter)} after the command.
|
|
40
|
-
${Array.from(Object.entries(commands)).filter(([, { script }]) => script).map(([command, { description }]) => ` ${(0, statistics_1.bold)(padCmd(':' + command), output.formatter)}${description}`).join('\n')}
|
|
41
|
+
${Array.from(Object.entries(commands())).filter(([, { script }]) => script).map(([command, { description }]) => ` ${(0, statistics_1.bold)(padCmd(':' + command), output.formatter)}${description}`).join('\n')}
|
|
41
42
|
|
|
42
43
|
You can combine commands by separating them with a semicolon ${(0, statistics_1.bold)(';', output.formatter)}.
|
|
43
44
|
`);
|
|
@@ -46,7 +47,7 @@ You can combine commands by separating them with a semicolon ${(0, statistics_1.
|
|
|
46
47
|
/**
|
|
47
48
|
* All commands that should be available in the REPL.
|
|
48
49
|
*/
|
|
49
|
-
const
|
|
50
|
+
const _commands = {
|
|
50
51
|
'help': exports.helpCommand,
|
|
51
52
|
'quit': quit_1.quitCommand,
|
|
52
53
|
'version': version_1.versionCommand,
|
|
@@ -59,45 +60,83 @@ const commands = {
|
|
|
59
60
|
'controlflow': cfg_1.controlflowCommand,
|
|
60
61
|
'controlflow*': cfg_1.controlflowStarCommand
|
|
61
62
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
aliases: [],
|
|
67
|
-
script: true,
|
|
68
|
-
usageExample: `:${script} --help`,
|
|
69
|
-
fn: async (output, _s, remainingLine) => {
|
|
70
|
-
await (0, execute_1.waitOnScript)(`${__dirname}/../../${target}`, (0, args_1.splitAtEscapeSensitive)(remainingLine), stdio => (0, execute_1.stdioCaptureProcessor)(stdio, msg => output.stdout(msg), msg => output.stderr(msg)));
|
|
71
|
-
}
|
|
72
|
-
};
|
|
63
|
+
let commandsInitialized = false;
|
|
64
|
+
function commands() {
|
|
65
|
+
if (commandsInitialized) {
|
|
66
|
+
return _commands;
|
|
73
67
|
}
|
|
68
|
+
commandsInitialized = true;
|
|
69
|
+
for (const [script, { target, description, type }] of Object.entries(common_1.scripts)) {
|
|
70
|
+
if (type === 'master script') {
|
|
71
|
+
_commands[script] = {
|
|
72
|
+
description,
|
|
73
|
+
aliases: [],
|
|
74
|
+
script: true,
|
|
75
|
+
usageExample: `:${script} --help`,
|
|
76
|
+
fn: async (output, _s, remainingLine) => {
|
|
77
|
+
await (0, execute_1.waitOnScript)(`${__dirname}/../../${target}`, (0, args_1.splitAtEscapeSensitive)(remainingLine), stdio => (0, execute_1.stdioCaptureProcessor)(stdio, msg => output.stdout(msg), msg => output.stderr(msg)));
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return _commands;
|
|
74
83
|
}
|
|
75
84
|
/**
|
|
76
85
|
* The names of all commands including their aliases (but without the leading `:`)
|
|
77
86
|
*/
|
|
78
|
-
|
|
87
|
+
function getCommandNames() {
|
|
88
|
+
if (commandNames === undefined) {
|
|
89
|
+
initCommandMapping();
|
|
90
|
+
}
|
|
91
|
+
return commandNames;
|
|
92
|
+
}
|
|
93
|
+
exports.getCommandNames = getCommandNames;
|
|
94
|
+
let commandNames = undefined;
|
|
79
95
|
// maps command names or aliases to the actual command name
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
for (const
|
|
85
|
-
(0, assert_1.guard)(commandMapping[
|
|
86
|
-
commandMapping[
|
|
96
|
+
let commandMapping = undefined;
|
|
97
|
+
function initCommandMapping() {
|
|
98
|
+
commandMapping = {};
|
|
99
|
+
commandNames = [];
|
|
100
|
+
for (const [command, { aliases }] of Object.entries(commands())) {
|
|
101
|
+
(0, assert_1.guard)(commandMapping[command] === undefined, `Command ${command} is already registered!`);
|
|
102
|
+
commandMapping[command] = command;
|
|
103
|
+
for (const alias of aliases) {
|
|
104
|
+
(0, assert_1.guard)(commandMapping[alias] === undefined, `Command (alias) ${alias} is already registered!`);
|
|
105
|
+
commandMapping[alias] = command;
|
|
106
|
+
}
|
|
107
|
+
commandNames.push(command);
|
|
108
|
+
commandNames.push(...aliases);
|
|
87
109
|
}
|
|
88
|
-
exports.commandNames.push(command);
|
|
89
|
-
exports.commandNames.push(...aliases);
|
|
90
110
|
}
|
|
91
111
|
/**
|
|
92
112
|
* Get the command for a given command name or alias.
|
|
93
113
|
* @param command - The name of the command (without the leading `:`)
|
|
94
114
|
*/
|
|
95
115
|
function getCommand(command) {
|
|
96
|
-
|
|
116
|
+
if (commandMapping === undefined) {
|
|
117
|
+
initCommandMapping();
|
|
118
|
+
}
|
|
119
|
+
return commands()[commandMapping[command]];
|
|
97
120
|
}
|
|
98
121
|
exports.getCommand = getCommand;
|
|
99
|
-
|
|
122
|
+
function asOptionName(argument) {
|
|
123
|
+
if (argument.length == 1) {
|
|
124
|
+
return `-${argument}`;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
return `--${argument}`;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.asOptionName = asOptionName;
|
|
131
|
+
let _longestCommandName = undefined;
|
|
132
|
+
function longestCommandName() {
|
|
133
|
+
if (_longestCommandName === undefined) {
|
|
134
|
+
_longestCommandName = Array.from(Object.keys(commands()), k => k.length).reduce((p, n) => Math.max(p, n), 0);
|
|
135
|
+
}
|
|
136
|
+
return _longestCommandName;
|
|
137
|
+
}
|
|
138
|
+
exports.longestCommandName = longestCommandName;
|
|
100
139
|
function padCmd(string) {
|
|
101
|
-
return String(string).padEnd(
|
|
140
|
+
return String(string).padEnd(longestCommandName() + 2, ' ');
|
|
102
141
|
}
|
|
103
142
|
//# sourceMappingURL=commands.js.map
|
|
@@ -12,7 +12,7 @@ async function dataflow(shell, remainingLine) {
|
|
|
12
12
|
}).allRemainingSteps();
|
|
13
13
|
}
|
|
14
14
|
exports.dataflowCommand = {
|
|
15
|
-
description:
|
|
15
|
+
description: `Get mermaid code for the dataflow graph of R code, start with '${r_bridge_1.fileProtocol}' to indicate a file`,
|
|
16
16
|
usageExample: ':dataflow',
|
|
17
17
|
aliases: ['d', 'df'],
|
|
18
18
|
script: false,
|
|
@@ -22,7 +22,7 @@ exports.dataflowCommand = {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
exports.dataflowStarCommand = {
|
|
25
|
-
description:
|
|
25
|
+
description: `Get a mermaid url of the dataflow graph of R code, start with '${r_bridge_1.fileProtocol}' to indicate a file`,
|
|
26
26
|
usageExample: ':dataflow*',
|
|
27
27
|
aliases: ['d*', 'df*'],
|
|
28
28
|
script: false,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RShell } from '../../../r-bridge';
|
|
2
|
-
import { ReplCommand, ReplOutput } from './main';
|
|
1
|
+
import type { RShell } from '../../../r-bridge';
|
|
2
|
+
import type { ReplCommand, ReplOutput } from './main';
|
|
3
3
|
export declare function executeRShellCommand(output: ReplOutput, shell: RShell, statement: string): Promise<void>;
|
|
4
4
|
export declare const executeCommand: ReplCommand;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RShell } from '../../../r-bridge';
|
|
2
|
-
import { OutputFormatter } from '../../../statistics';
|
|
1
|
+
import type { RShell } from '../../../r-bridge';
|
|
2
|
+
import type { OutputFormatter } from '../../../statistics';
|
|
3
3
|
/**
|
|
4
4
|
* Defines the main interface for output of the repl.
|
|
5
5
|
* This allows us to redirect it (e.g., in the case of a server connection or tests).
|
|
@@ -12,7 +12,7 @@ async function normalize(shell, remainingLine) {
|
|
|
12
12
|
}).allRemainingSteps();
|
|
13
13
|
}
|
|
14
14
|
exports.normalizeCommand = {
|
|
15
|
-
description:
|
|
15
|
+
description: `Get mermaid code for the normalized AST of R code, start with '${r_bridge_1.fileProtocol}' to indicate a file`,
|
|
16
16
|
usageExample: ':normalize',
|
|
17
17
|
aliases: ['n'],
|
|
18
18
|
script: false,
|
|
@@ -22,7 +22,7 @@ exports.normalizeCommand = {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
exports.normalizeStarCommand = {
|
|
25
|
-
description:
|
|
25
|
+
description: `Get a mermaid url of the normalized AST of R code, start with '${r_bridge_1.fileProtocol}' to indicate a file`,
|
|
26
26
|
usageExample: ':normalize',
|
|
27
27
|
aliases: ['n*'],
|
|
28
28
|
script: false,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ReplCommand } from './main';
|
|
1
|
+
import type { ReplCommand } from './main';
|
|
2
2
|
export declare const parseCommand: ReplCommand;
|
|
@@ -4,8 +4,9 @@ exports.parseCommand = void 0;
|
|
|
4
4
|
const r_bridge_1 = require("../../../r-bridge");
|
|
5
5
|
const internal_1 = require("../../../r-bridge/lang-4.x/ast/parser/xml/internal");
|
|
6
6
|
const core_1 = require("../../../core");
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
const format_1 = require("../../../r-bridge/lang-4.x/ast/parser/json/format");
|
|
8
|
+
const parser_1 = require("../../../r-bridge/lang-4.x/ast/parser/json/parser");
|
|
9
|
+
function toDepthMap(xml) {
|
|
9
10
|
const root = (0, r_bridge_1.getKeysGuarded)(xml, "exprlist" /* RawRType.ExpressionList */);
|
|
10
11
|
const visit = [{ depth: 0, node: root }];
|
|
11
12
|
const result = [];
|
|
@@ -14,7 +15,7 @@ function toDepthMap(xml, config) {
|
|
|
14
15
|
if (current === undefined) {
|
|
15
16
|
continue;
|
|
16
17
|
}
|
|
17
|
-
const children = current.node[
|
|
18
|
+
const children = current.node[r_bridge_1.childrenKey] ?? [];
|
|
18
19
|
result.push({ ...current, leaf: children.length === 0 });
|
|
19
20
|
children.reverse();
|
|
20
21
|
const nextDepth = current.depth + 1;
|
|
@@ -62,7 +63,7 @@ function retrieveLocationString(locationRaw) {
|
|
|
62
63
|
return ` (${extracted.start.line}:${extracted.start.column}─${extracted.end.line}:${extracted.end.column})`;
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
|
-
function depthListToTextTree(list,
|
|
66
|
+
function depthListToTextTree(list, f) {
|
|
66
67
|
let result = '';
|
|
67
68
|
const deadDepths = new Set();
|
|
68
69
|
let i = 0;
|
|
@@ -72,13 +73,13 @@ function depthListToTextTree(list, config, f) {
|
|
|
72
73
|
result += initialIndentation(i, depth, deadDepths, nextDepth, list, f);
|
|
73
74
|
result += f.reset();
|
|
74
75
|
const raw = (0, internal_1.objectWithArrUnwrap)(node);
|
|
75
|
-
const content = raw[
|
|
76
|
-
const locationRaw = raw[
|
|
76
|
+
const content = raw[r_bridge_1.contentKey];
|
|
77
|
+
const locationRaw = raw[r_bridge_1.attributesKey];
|
|
77
78
|
let location = '';
|
|
78
79
|
if (locationRaw !== undefined) {
|
|
79
80
|
location = retrieveLocationString(locationRaw);
|
|
80
81
|
}
|
|
81
|
-
const type = (0, internal_1.getTokenType)(
|
|
82
|
+
const type = (0, internal_1.getTokenType)(node);
|
|
82
83
|
if (leaf) {
|
|
83
84
|
const suffix = `${f.format(content ? JSON.stringify(content) : '', { style: 1 /* FontStyles.Bold */ })}${f.format(location, { style: 3 /* FontStyles.Italic */ })}`;
|
|
84
85
|
result += `${type} ${suffix}`;
|
|
@@ -91,7 +92,7 @@ function depthListToTextTree(list, config, f) {
|
|
|
91
92
|
return result;
|
|
92
93
|
}
|
|
93
94
|
exports.parseCommand = {
|
|
94
|
-
description:
|
|
95
|
+
description: `Prints ASCII Art of the parsed, unmodified AST, start with '${r_bridge_1.fileProtocol}' to indicate a file`,
|
|
95
96
|
usageExample: ':parse',
|
|
96
97
|
aliases: ['p'],
|
|
97
98
|
script: false,
|
|
@@ -99,11 +100,10 @@ exports.parseCommand = {
|
|
|
99
100
|
const result = await new core_1.SteppingSlicer({
|
|
100
101
|
stepOfInterest: 'parse',
|
|
101
102
|
shell,
|
|
102
|
-
request: (0, r_bridge_1.requestFromInput)(remainingLine.trim())
|
|
103
|
+
request: (0, r_bridge_1.requestFromInput)((0, r_bridge_1.removeRQuotes)(remainingLine.trim()))
|
|
103
104
|
}).allRemainingSteps();
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
output.stdout(depthListToTextTree(toDepthMap(object, config), config, output.formatter));
|
|
105
|
+
const object = (0, parser_1.convertPreparedParsedData)((0, format_1.prepareParsedData)(result.parse));
|
|
106
|
+
output.stdout(depthListToTextTree(toDepthMap(object), output.formatter));
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
//# sourceMappingURL=parse.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ReplCommand } from './main';
|
|
1
|
+
import type { ReplCommand } from './main';
|
|
2
2
|
export declare const quitCommand: ReplCommand;
|
package/cli/repl/core.d.ts
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* @module
|
|
6
6
|
*/
|
|
7
7
|
import { RShell } from '../../r-bridge';
|
|
8
|
-
import { ReplOutput } from './commands';
|
|
9
|
-
import * as readline from '
|
|
8
|
+
import type { ReplOutput } from './commands';
|
|
9
|
+
import * as readline from 'readline';
|
|
10
10
|
/**
|
|
11
11
|
* Used by the repl to provide automatic completions for a given (partial) input line
|
|
12
12
|
*/
|
|
@@ -32,8 +32,10 @@ export declare function replProcessAnswer(output: ReplOutput, expr: string, shel
|
|
|
32
32
|
* If you want to provide a custom one but use the same `completer`, refer to {@link replCompleter}.
|
|
33
33
|
* For the default arguments, see {@link DEFAULT_REPL_READLINE_CONFIGURATION}.
|
|
34
34
|
* @param output - Defines two methods that every function in the repl uses to output its data.
|
|
35
|
+
* @param historyFile - The file to use for persisting the repl's history. Passing undefined causes history not to be saved.
|
|
35
36
|
*
|
|
36
37
|
* For the execution, this function makes use of {@link replProcessAnswer}
|
|
37
38
|
*
|
|
38
39
|
*/
|
|
39
|
-
export declare function repl(shell?: RShell, rl?: readline.Interface, output?: ReplOutput): Promise<void>;
|
|
40
|
+
export declare function repl(shell?: RShell, rl?: readline.Interface, output?: ReplOutput, historyFile?: string | undefined): Promise<void>;
|
|
41
|
+
export declare function loadReplHistory(historyFile: string): string[] | undefined;
|