@eagleoutice/flowr 2.0.25 → 2.1.0
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/benchmark/slicer.js +2 -1
- package/benchmark/stats/print.js +3 -4
- package/benchmark/stats/size-of.js +9 -7
- package/benchmark/summarizer/first-phase/input.d.ts +0 -1
- package/benchmark/summarizer/first-phase/input.js +2 -3
- package/benchmark/summarizer/first-phase/process.js +7 -7
- package/benchmark/summarizer/second-phase/graph.js +1 -2
- package/benchmark/summarizer/second-phase/process.d.ts +0 -1
- package/benchmark/summarizer/second-phase/process.js +4 -5
- package/benchmark/summarizer/summarizer.js +7 -1
- package/cli/benchmark-app.js +6 -1
- package/cli/common/features.js +2 -3
- package/cli/common/script.js +2 -3
- package/cli/common/scripts-info.d.ts +69 -1
- package/cli/common/scripts-info.js +6 -6
- package/cli/flowr-main-options.d.ts +4 -0
- package/cli/flowr-main-options.js +88 -0
- package/cli/flowr.d.ts +3 -3
- package/cli/flowr.js +22 -31
- package/cli/repl/commands/{cfg.d.ts → repl-cfg.d.ts} +1 -1
- package/cli/repl/commands/{cfg.js → repl-cfg.js} +3 -3
- package/cli/repl/commands/{commands.d.ts → repl-commands.d.ts} +3 -1
- package/cli/repl/commands/{commands.js → repl-commands.js} +56 -35
- package/cli/repl/commands/{dataflow.d.ts → repl-dataflow.d.ts} +1 -1
- package/cli/repl/commands/{dataflow.js → repl-dataflow.js} +2 -2
- package/cli/repl/commands/{execute.d.ts → repl-execute.d.ts} +1 -1
- package/cli/repl/commands/{execute.js → repl-execute.js} +3 -3
- package/cli/repl/commands/repl-lineage.d.ts +15 -0
- package/cli/repl/commands/{lineage.js → repl-lineage.js} +14 -12
- package/cli/repl/commands/{main.js → repl-main.js} +1 -1
- package/cli/repl/commands/{normalize.d.ts → repl-normalize.d.ts} +1 -1
- package/cli/repl/commands/{normalize.js → repl-normalize.js} +3 -3
- package/cli/repl/commands/{parse.d.ts → repl-parse.d.ts} +1 -1
- package/cli/repl/commands/{parse.js → repl-parse.js} +3 -2
- package/cli/repl/commands/repl-query.d.ts +8 -0
- package/cli/repl/commands/repl-query.js +155 -0
- package/cli/repl/commands/repl-quit.d.ts +2 -0
- package/cli/repl/commands/{quit.js → repl-quit.js} +1 -1
- package/cli/repl/commands/{version.d.ts → repl-version.d.ts} +1 -1
- package/cli/repl/commands/{version.js → repl-version.js} +4 -4
- package/cli/repl/core.d.ts +1 -2
- package/cli/repl/core.js +13 -13
- package/cli/repl/execute.d.ts +1 -2
- package/cli/repl/execute.js +2 -3
- package/cli/repl/print-version.js +3 -4
- package/cli/repl/server/connection.d.ts +1 -0
- package/cli/repl/server/connection.js +45 -12
- package/cli/repl/server/messages/{messages.d.ts → all-messages.d.ts} +8 -7
- package/cli/repl/server/messages/{messages.js → all-messages.js} +1 -1
- package/cli/repl/server/messages/{analysis.d.ts → message-analysis.d.ts} +2 -1
- package/cli/repl/server/messages/message-analysis.js +39 -0
- package/cli/repl/server/messages/{error.d.ts → message-error.d.ts} +1 -1
- package/cli/repl/server/messages/{error.js → message-error.js} +1 -1
- package/cli/repl/server/messages/{hello.d.ts → message-hello.d.ts} +4 -3
- package/cli/repl/server/messages/message-hello.js +20 -0
- package/cli/repl/server/messages/{lineage.d.ts → message-lineage.d.ts} +2 -1
- package/cli/repl/server/messages/message-lineage.js +25 -0
- package/cli/repl/server/messages/message-query.d.ts +16 -0
- package/cli/repl/server/messages/message-query.js +26 -0
- package/cli/repl/server/messages/{repl.d.ts → message-repl.d.ts} +3 -1
- package/cli/repl/server/messages/message-repl.js +53 -0
- package/cli/repl/server/messages/{slice.d.ts → message-slice.d.ts} +2 -1
- package/cli/repl/server/messages/{slice.js → message-slice.js} +14 -6
- package/cli/repl/server/net.d.ts +0 -1
- package/cli/repl/server/send.d.ts +1 -1
- package/cli/repl/server/send.js +2 -3
- package/cli/repl/server/server.js +2 -2
- package/cli/repl/server/validate.d.ts +1 -1
- package/cli/repl/server/validate.js +5 -6
- package/cli/run-script.d.ts +8 -0
- package/cli/run-script.js +18 -0
- package/cli/script-core/statistics-core.d.ts +2 -0
- package/cli/script-core/statistics-core.js +100 -0
- package/cli/script-core/statistics-helper-core.d.ts +2 -0
- package/cli/script-core/statistics-helper-core.js +81 -0
- package/cli/script-core/summarizer-core.d.ts +2 -0
- package/cli/script-core/summarizer-core.js +51 -0
- package/cli/statistics-app.js +3 -87
- package/cli/statistics-helper-app.js +3 -77
- package/cli/summarizer-app.js +2 -48
- package/config.d.ts +20 -4
- package/config.js +62 -36
- package/core/pipeline-executor.js +11 -1
- package/core/print/dataflow-printer.js +4 -5
- package/core/print/normalize-printer.js +4 -5
- package/core/print/parse-printer.js +1 -2
- package/core/print/print.js +2 -3
- package/core/print/slice-diff-ansi.js +1 -2
- package/core/steps/pipeline/create-pipeline.js +1 -2
- package/core/steps/pipeline/default-pipelines.d.ts +18 -18
- package/core/steps/pipeline/pipeline.js +1 -2
- package/dataflow/environments/append.js +1 -2
- package/dataflow/environments/built-in-config.d.ts +47 -0
- package/dataflow/environments/built-in-config.js +83 -0
- package/dataflow/environments/built-in.d.ts +49 -6
- package/dataflow/environments/built-in.js +29 -97
- package/dataflow/environments/clone.js +2 -2
- package/dataflow/environments/default-builtin-config.d.ts +5 -0
- package/dataflow/environments/default-builtin-config.js +83 -0
- package/dataflow/environments/define.js +1 -2
- package/dataflow/environments/diff.js +5 -6
- package/dataflow/environments/environment.js +8 -7
- package/dataflow/environments/identifier.d.ts +39 -8
- package/dataflow/environments/identifier.js +33 -0
- package/dataflow/environments/overwrite.d.ts +6 -5
- package/dataflow/environments/overwrite.js +16 -9
- package/dataflow/environments/resolve-by-name.d.ts +3 -1
- package/dataflow/environments/resolve-by-name.js +40 -8
- package/dataflow/environments/scoping.js +2 -3
- package/dataflow/extractor.js +25 -24
- package/dataflow/graph/dataflowgraph-builder.d.ts +139 -0
- package/dataflow/graph/dataflowgraph-builder.js +247 -0
- package/dataflow/graph/diff.js +12 -11
- package/dataflow/graph/edge.d.ts +2 -2
- package/dataflow/graph/edge.js +46 -20
- package/dataflow/graph/graph.d.ts +14 -6
- package/dataflow/graph/graph.js +25 -21
- package/dataflow/graph/quads.js +1 -2
- package/dataflow/graph/resolve-graph.d.ts +7 -0
- package/dataflow/graph/resolve-graph.js +51 -0
- package/dataflow/graph/vertex.d.ts +12 -4
- package/dataflow/graph/vertex.js +19 -11
- package/dataflow/info.d.ts +3 -7
- package/dataflow/info.js +7 -8
- package/dataflow/internal/linker.d.ts +3 -1
- package/dataflow/internal/linker.js +77 -32
- package/dataflow/internal/process/functions/call/argument/make-argument.js +5 -5
- package/dataflow/internal/process/functions/call/argument/unpack-argument.js +1 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +10 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.d.ts +5 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +27 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +40 -26
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +30 -20
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +10 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +12 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +6 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +7 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +4 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +10 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +7 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +2 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +5 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +6 -6
- package/dataflow/internal/process/functions/call/built-in/built-in-special-bin-op.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-while-loop.js +6 -5
- package/dataflow/internal/process/functions/call/common.js +30 -19
- package/dataflow/internal/process/functions/call/default-call-handling.js +1 -2
- package/dataflow/internal/process/functions/call/known-call-handling.js +8 -6
- package/dataflow/internal/process/functions/call/named-call-handling.js +7 -6
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +11 -7
- package/dataflow/internal/process/functions/process-argument.js +10 -8
- package/dataflow/internal/process/functions/process-parameter.js +8 -6
- package/dataflow/internal/process/process-named-call.js +3 -3
- package/dataflow/internal/process/process-symbol.js +5 -4
- package/dataflow/internal/process/process-uninteresting-leaf.js +1 -2
- package/dataflow/internal/process/process-value.js +5 -4
- package/dataflow/processor.js +1 -2
- package/documentation/data/dfg/doc-data-dfg-util.d.ts +20 -0
- package/documentation/data/dfg/doc-data-dfg-util.js +13 -0
- package/documentation/data/query/example-query-code.d.ts +1 -0
- package/documentation/data/query/example-query-code.js +25 -0
- package/documentation/data/server/doc-data-server-messages.d.ts +1 -0
- package/documentation/data/server/doc-data-server-messages.js +508 -0
- package/documentation/doc-util/doc-auto-gen.d.ts +7 -0
- package/documentation/doc-util/doc-auto-gen.js +9 -0
- package/documentation/doc-util/doc-cfg.d.ts +7 -0
- package/documentation/doc-util/doc-cfg.js +18 -0
- package/documentation/doc-util/doc-cli-option.d.ts +8 -0
- package/documentation/doc-util/doc-cli-option.js +36 -0
- package/documentation/doc-util/doc-code.d.ts +1 -0
- package/documentation/doc-util/doc-code.js +7 -0
- package/documentation/doc-util/doc-dfg.d.ts +21 -0
- package/documentation/doc-util/doc-dfg.js +93 -0
- package/documentation/doc-util/doc-docker.d.ts +1 -0
- package/documentation/doc-util/doc-docker.js +5 -0
- package/documentation/doc-util/doc-env.d.ts +2 -0
- package/documentation/doc-util/doc-env.js +20 -0
- package/documentation/doc-util/doc-files.d.ts +6 -0
- package/documentation/doc-util/doc-files.js +25 -0
- package/documentation/doc-util/doc-general.d.ts +2 -0
- package/documentation/doc-util/doc-general.js +16 -0
- package/documentation/doc-util/doc-hover-over.d.ts +1 -0
- package/documentation/doc-util/doc-hover-over.js +7 -0
- package/documentation/doc-util/doc-issue.d.ts +1 -0
- package/documentation/doc-util/doc-issue.js +6 -0
- package/documentation/doc-util/doc-ms.d.ts +1 -0
- package/documentation/doc-util/doc-ms.js +8 -0
- package/documentation/doc-util/doc-normalized-ast.d.ts +11 -0
- package/documentation/doc-util/doc-normalized-ast.js +71 -0
- package/documentation/doc-util/doc-query.d.ts +24 -0
- package/documentation/doc-util/doc-query.js +113 -0
- package/documentation/doc-util/doc-repl.d.ts +13 -0
- package/documentation/doc-util/doc-repl.js +79 -0
- package/documentation/doc-util/doc-server-message.d.ts +37 -0
- package/documentation/doc-util/doc-server-message.js +153 -0
- package/documentation/doc-util/doc-structure.d.ts +12 -0
- package/documentation/doc-util/doc-structure.js +21 -0
- package/documentation/doc-util/doc-types.d.ts +38 -0
- package/documentation/doc-util/doc-types.js +276 -0
- package/{r-bridge/data/print.js → documentation/print-capabilities-markdown.js} +8 -4
- package/documentation/print-dataflow-graph-wiki.d.ts +1 -0
- package/documentation/print-dataflow-graph-wiki.js +849 -0
- package/documentation/print-interface-wiki.d.ts +1 -0
- package/documentation/print-interface-wiki.js +401 -0
- package/documentation/print-normalized-ast-wiki.d.ts +1 -0
- package/documentation/print-normalized-ast-wiki.js +98 -0
- package/documentation/print-query-wiki.d.ts +1 -0
- package/documentation/print-query-wiki.js +215 -0
- package/package.json +29 -33
- package/queries/base-query-format.d.ts +11 -0
- package/{cli/repl/server/messages/hello.js → queries/base-query-format.js} +1 -1
- package/queries/call-context-query/call-context-query-executor.d.ts +11 -0
- package/queries/call-context-query/call-context-query-executor.js +255 -0
- package/queries/call-context-query/call-context-query-format.d.ts +72 -0
- package/queries/call-context-query/call-context-query-format.js +17 -0
- package/queries/query-schema.d.ts +7 -0
- package/queries/query-schema.js +31 -0
- package/queries/query.d.ts +35 -0
- package/queries/query.js +57 -0
- package/queries/two-layer-collector.d.ts +8 -0
- package/queries/two-layer-collector.js +31 -0
- package/queries/virtual-query/compound-query.d.ts +24 -0
- package/queries/virtual-query/compound-query.js +18 -0
- package/queries/virtual-query/virtual-queries.d.ts +15 -0
- package/queries/virtual-query/virtual-queries.js +8 -0
- package/r-bridge/data/data.d.ts +5 -0
- package/r-bridge/data/data.js +6 -0
- package/r-bridge/data/get.js +2 -3
- package/r-bridge/init.js +2 -2
- package/r-bridge/lang-4.x/ast/model/collect.js +1 -2
- package/r-bridge/lang-4.x/ast/model/model.d.ts +1 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +5 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +4 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +10 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +5 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -2
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +3 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/operators.js +27 -26
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +9 -9
- package/r-bridge/lang-4.x/ast/model/processing/fold.js +1 -2
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +5 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +26 -3
- package/r-bridge/lang-4.x/ast/model/processing/role.js +1 -2
- package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.js +23 -23
- package/r-bridge/lang-4.x/ast/model/processing/visitor.js +23 -23
- package/r-bridge/lang-4.x/ast/model/type.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/model/type.js +221 -12
- package/r-bridge/lang-4.x/ast/parser/json/format.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +6 -5
- package/r-bridge/lang-4.x/ast/parser/xml/input-format.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/normalize-if-then-else.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/control/normalize-if-then.js +7 -7
- package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/normalize-expression.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-argument.js +10 -10
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-call.js +18 -18
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-definition.js +8 -8
- package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/normalize-parameter.js +9 -9
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-break.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-for.js +10 -10
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-next.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-repeat.js +5 -5
- package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/normalize-while.js +7 -7
- package/r-bridge/lang-4.x/ast/parser/xml/internal/normalize-access.js +12 -12
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/normalize-binary.js +14 -14
- package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/normalize-unary.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/normalize-comment.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/other/normalize-line-directive.js +4 -4
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-delimiter.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-expressions.js +13 -13
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-root.js +6 -6
- package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/normalize-single-node.js +19 -19
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/normalize-number.js +5 -5
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/normalize-string.js +3 -3
- package/r-bridge/lang-4.x/ast/parser/xml/internal/values/normalize-symbol.js +2 -3
- package/r-bridge/lang-4.x/ast/parser/xml/normalize-meta.js +12 -12
- package/r-bridge/lang-4.x/convert-values.js +7 -7
- package/r-bridge/retriever.js +12 -11
- package/r-bridge/shell.d.ts +0 -1
- package/r-bridge/shell.js +6 -1
- package/reconstruct/auto-select/auto-select-defaults.js +1 -2
- package/reconstruct/auto-select/magic-comments.js +3 -3
- package/reconstruct/reconstruct.js +4 -3
- package/slicing/criterion/collect-all.js +1 -2
- package/slicing/criterion/parse.d.ts +1 -1
- package/slicing/criterion/parse.js +6 -5
- package/slicing/static/fingerprint.js +2 -3
- package/slicing/static/slice-call.js +9 -9
- package/slicing/static/static-slicer.js +5 -4
- package/statistics/features/common-syntax-probability.js +13 -13
- package/statistics/features/feature.d.ts +5 -9
- package/statistics/features/feature.js +2 -2
- package/statistics/features/post-processing.js +2 -3
- package/statistics/features/supported/assignments/assignments.js +3 -2
- package/statistics/features/supported/assignments/post-process.js +1 -2
- package/statistics/features/supported/comments/post-process.js +1 -2
- package/statistics/features/supported/control-flow/control-flow.js +4 -3
- package/statistics/features/supported/control-flow/post-process.js +1 -2
- package/statistics/features/supported/data-access/data-access.d.ts +2 -2
- package/statistics/features/supported/data-access/data-access.js +3 -2
- package/statistics/features/supported/data-access/post-process.js +1 -2
- package/statistics/features/supported/defined-functions/defined-functions.js +9 -7
- package/statistics/features/supported/defined-functions/post-process.d.ts +1 -1
- package/statistics/features/supported/defined-functions/post-process.js +2 -3
- package/statistics/features/supported/expression-list/post-process.js +1 -2
- package/statistics/features/supported/expression-list/{expression-list.js → statistics-expression-list.js} +4 -3
- package/statistics/features/supported/loops/loops.js +8 -7
- package/statistics/features/supported/loops/post-process.js +1 -2
- package/statistics/features/supported/used-functions/post-process.js +2 -3
- package/statistics/features/supported/used-functions/used-functions.d.ts +1 -1
- package/statistics/features/supported/used-functions/used-functions.js +4 -3
- package/statistics/features/supported/used-packages/post-process.js +1 -2
- package/statistics/features/supported/values/post-process.js +1 -2
- package/statistics/features/supported/variables/post-process.js +2 -3
- package/statistics/features/supported/variables/variables.js +2 -1
- package/statistics/meta-statistics.js +1 -2
- package/statistics/output/print-stats.js +4 -5
- package/statistics/output/statistics-file.js +5 -5
- package/statistics/statistics.js +2 -3
- package/statistics/summarizer/auto-detect.js +1 -2
- package/statistics/summarizer/post-process/clusterer.js +1 -2
- package/statistics/summarizer/post-process/file-based-count.js +2 -3
- package/statistics/summarizer/post-process/histogram.js +3 -4
- package/statistics/summarizer/post-process/post-process-output.js +2 -3
- package/statistics/summarizer/second-phase/process.d.ts +2 -0
- package/statistics/summarizer/second-phase/process.js +2 -2
- package/statistics/summarizer/summarizer.js +8 -1
- package/util/ansi.d.ts +1 -0
- package/util/ansi.js +27 -4
- package/util/args.js +2 -3
- package/util/arrays.js +8 -9
- package/util/assert.js +5 -6
- package/util/bimap.d.ts +4 -4
- package/util/cfg/cfg.d.ts +1 -0
- package/util/cfg/cfg.js +8 -5
- package/util/cfg/visitor.d.ts +8 -13
- package/util/cfg/visitor.js +22 -56
- package/util/diff.js +1 -2
- package/util/files.d.ts +0 -1
- package/util/files.js +11 -8
- package/util/json.js +2 -3
- package/util/mermaid/ast.js +7 -7
- package/util/mermaid/cfg.js +2 -3
- package/util/mermaid/dfg.d.ts +12 -4
- package/util/mermaid/dfg.js +28 -16
- package/util/mermaid/mermaid.js +5 -4
- package/util/numbers.js +1 -2
- package/util/objects.d.ts +7 -0
- package/util/objects.js +13 -3
- package/util/os.js +1 -2
- package/util/quads.js +5 -5
- package/util/random.js +2 -2
- package/util/range.js +8 -9
- package/util/schema.d.ts +11 -0
- package/util/schema.js +75 -0
- package/util/set.js +2 -3
- package/util/strings.js +3 -4
- package/util/summarizer.js +4 -4
- package/util/text.d.ts +1 -0
- package/util/text.js +20 -0
- package/util/time.js +1 -2
- package/util/version.js +2 -3
- package/cli/repl/commands/lineage.d.ts +0 -15
- package/cli/repl/commands/quit.d.ts +0 -2
- package/cli/repl/server/messages/analysis.js +0 -21
- package/cli/repl/server/messages/lineage.js +0 -17
- package/cli/repl/server/messages/repl.js +0 -37
- /package/cli/repl/commands/{main.d.ts → repl-main.d.ts} +0 -0
- /package/{r-bridge/data/print.d.ts → documentation/print-capabilities-markdown.d.ts} +0 -0
- /package/statistics/features/supported/expression-list/{expression-list.d.ts → statistics-expression-list.d.ts} +0 -0
|
@@ -1,17 +1,227 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.RType = exports.RawRType = void 0;
|
|
4
|
+
exports.isSymbol = isSymbol;
|
|
5
|
+
/**
|
|
6
|
+
* Token types as they are produced by the R parser.
|
|
7
|
+
* Not all of them are directly handled by the normalize step.
|
|
8
|
+
* Some of them are also listed as part of the {@link OperatorDatabase}.
|
|
9
|
+
*
|
|
10
|
+
* @see RType
|
|
11
|
+
*/
|
|
12
|
+
var RawRType;
|
|
13
|
+
(function (RawRType) {
|
|
14
|
+
/** T1 */
|
|
15
|
+
RawRType["NullConst"] = "NULL_CONST";
|
|
16
|
+
/** T2 */
|
|
17
|
+
RawRType["NumericConst"] = "NUM_CONST";
|
|
18
|
+
/** T3 */
|
|
19
|
+
RawRType["StringConst"] = "STR_CONST";
|
|
20
|
+
/** T4 */
|
|
21
|
+
RawRType["EqualAssign"] = "EQ_ASSIGN";
|
|
22
|
+
/** T5 */
|
|
23
|
+
RawRType["EqualFormals"] = "EQ_FORMALS";
|
|
24
|
+
/** T6 */
|
|
25
|
+
RawRType["EqualSub"] = "EQ_SUB";
|
|
26
|
+
/** T7 */
|
|
27
|
+
RawRType["LeftAssign"] = "LEFT_ASSIGN";
|
|
28
|
+
/** T8 */
|
|
29
|
+
RawRType["RightAssign"] = "RIGHT_ASSIGN";
|
|
30
|
+
/** T9 */
|
|
31
|
+
RawRType["And"] = "AND";
|
|
32
|
+
/** T10 */
|
|
33
|
+
RawRType["And2"] = "AND2";
|
|
34
|
+
/** T11 */
|
|
35
|
+
RawRType["Eq"] = "EQ";
|
|
36
|
+
/** T12 */
|
|
37
|
+
RawRType["Ge"] = "GE";
|
|
38
|
+
/** T13 */
|
|
39
|
+
RawRType["Gt"] = "GT";
|
|
40
|
+
/** T14 */
|
|
41
|
+
RawRType["Le"] = "LE";
|
|
42
|
+
/** T15 */
|
|
43
|
+
RawRType["Lt"] = "LT";
|
|
44
|
+
/** T16 */
|
|
45
|
+
RawRType["Ne"] = "NE";
|
|
46
|
+
/** T17 */
|
|
47
|
+
RawRType["Or"] = "OR";
|
|
48
|
+
/** T18 */
|
|
49
|
+
RawRType["Or2"] = "OR2";
|
|
50
|
+
/** T19 */
|
|
51
|
+
RawRType["Pipe"] = "PIPE";
|
|
52
|
+
/** T20 */
|
|
53
|
+
RawRType["Pipebind"] = "PIPEBIND";
|
|
54
|
+
/** T21 */
|
|
55
|
+
RawRType["Special"] = "SPECIAL";
|
|
56
|
+
/** T22 */
|
|
57
|
+
RawRType["Plus"] = "+";
|
|
58
|
+
/** T23 */
|
|
59
|
+
RawRType["Minus"] = "-";
|
|
60
|
+
/** T24 */
|
|
61
|
+
RawRType["Times"] = "*";
|
|
62
|
+
/** T25 */
|
|
63
|
+
RawRType["Div"] = "/";
|
|
64
|
+
/** T26 */
|
|
65
|
+
RawRType["Colon"] = ":";
|
|
66
|
+
/** T27 */
|
|
67
|
+
RawRType["Exclamation"] = "!";
|
|
68
|
+
/** T28 */
|
|
69
|
+
RawRType["Exp"] = "^";
|
|
70
|
+
/** T29 */
|
|
71
|
+
RawRType["Question"] = "?";
|
|
72
|
+
/** T30 */
|
|
73
|
+
RawRType["Tilde"] = "~";
|
|
74
|
+
/** T31 */
|
|
75
|
+
RawRType["Break"] = "BREAK";
|
|
76
|
+
/** T32 */
|
|
77
|
+
RawRType["Else"] = "ELSE";
|
|
78
|
+
/** T33 */
|
|
79
|
+
RawRType["For"] = "FOR";
|
|
80
|
+
/** T34 */
|
|
81
|
+
RawRType["ForCondition"] = "forcond";
|
|
82
|
+
/** T35 */
|
|
83
|
+
RawRType["If"] = "IF";
|
|
84
|
+
/** T36 */
|
|
85
|
+
RawRType["ForIn"] = "IN";
|
|
86
|
+
/** T37 */
|
|
87
|
+
RawRType["Next"] = "NEXT";
|
|
88
|
+
/** T38 */
|
|
89
|
+
RawRType["Repeat"] = "REPEAT";
|
|
90
|
+
/** T39 */
|
|
91
|
+
RawRType["While"] = "WHILE";
|
|
92
|
+
/** T40 */
|
|
93
|
+
RawRType["Function"] = "FUNCTION";
|
|
94
|
+
/** T41 */
|
|
95
|
+
RawRType["Lambda"] = "\\\\";
|
|
96
|
+
/** T42 */
|
|
97
|
+
RawRType["DoubleBracketLeft"] = "LBB";
|
|
98
|
+
/** T43 */
|
|
99
|
+
RawRType["Slot"] = "SLOT";
|
|
100
|
+
/** T44 */
|
|
101
|
+
RawRType["Dollar"] = "$";
|
|
102
|
+
/** T45 */
|
|
103
|
+
RawRType["At"] = "@";
|
|
104
|
+
/** T46 */
|
|
105
|
+
RawRType["BracketLeft"] = "[";
|
|
106
|
+
/** T47 */
|
|
107
|
+
RawRType["BracketRight"] = "]";
|
|
108
|
+
/** T48 */
|
|
109
|
+
RawRType["NsGet"] = "::";
|
|
110
|
+
/** T49 */
|
|
111
|
+
RawRType["NsGetInt"] = ":::";
|
|
112
|
+
/** T50 */
|
|
113
|
+
RawRType["Symbol"] = "SYMBOL";
|
|
114
|
+
/** T51 */
|
|
115
|
+
RawRType["SymbolFunctionCall"] = "SYMBOL_FUNCTION_CALL";
|
|
116
|
+
/** T52 */
|
|
117
|
+
RawRType["SymbolPackage"] = "SYMBOL_PACKAGE";
|
|
118
|
+
/** T53 */
|
|
119
|
+
RawRType["SymbolSub"] = "SYMBOL_SUB";
|
|
120
|
+
/** T54 */
|
|
121
|
+
RawRType["SymbolFormals"] = "SYMBOL_FORMALS";
|
|
122
|
+
/** T55 */
|
|
123
|
+
RawRType["Comment"] = "COMMENT";
|
|
124
|
+
/** T56 */
|
|
125
|
+
RawRType["LineDirective"] = "LINE_DIRECTIVE";
|
|
126
|
+
/** T57 */
|
|
127
|
+
RawRType["ParenLeft"] = "(";
|
|
128
|
+
/** T58 */
|
|
129
|
+
RawRType["ParenRight"] = ")";
|
|
130
|
+
/** T59 */
|
|
131
|
+
RawRType["Comma"] = ",";
|
|
132
|
+
/** T60 */
|
|
133
|
+
RawRType["Semicolon"] = ";";
|
|
134
|
+
/** T61 */
|
|
135
|
+
RawRType["BraceLeft"] = "{";
|
|
136
|
+
/** T62 */
|
|
137
|
+
RawRType["BraceRight"] = "}";
|
|
138
|
+
/** T63 */
|
|
139
|
+
RawRType["Expression"] = "expr";
|
|
140
|
+
/** T64
|
|
141
|
+
*
|
|
142
|
+
* https://github.com/REditorSupport/languageserver/issues/327
|
|
143
|
+
* https://github.com/REditorSupport/languageserver/pull/328
|
|
144
|
+
*/
|
|
145
|
+
RawRType["ExprOfAssignOrHelp"] = "expr_or_assign_or_help";
|
|
146
|
+
/**
|
|
147
|
+
* Pre-4.0 version of expr_or_assign_or_help, which was seemingly silently renamed here:
|
|
148
|
+
* https://github.com/wch/r-source/commit/84bbf385f909c0223924c310af6c7c77aa810234
|
|
149
|
+
* (Also see {@link ExprOfAssignOrHelp} documentation for more context.)
|
|
150
|
+
*/
|
|
151
|
+
RawRType["LegacyEqualAssign"] = "equal_assign";
|
|
152
|
+
/** T65 */
|
|
153
|
+
RawRType["ExpressionList"] = "exprlist";
|
|
154
|
+
})(RawRType || (exports.RawRType = RawRType = {}));
|
|
155
|
+
/**
|
|
156
|
+
* Types as we use them for our normalized AST.
|
|
157
|
+
* See {@link RNode} for a union type of all normalized AST nodes in-use.
|
|
158
|
+
* For each enum member, the respective normalized AST node should be referenced
|
|
159
|
+
* in the corresponding comment.
|
|
160
|
+
*
|
|
161
|
+
* @see RawRType
|
|
162
|
+
*/
|
|
163
|
+
var RType;
|
|
164
|
+
(function (RType) {
|
|
165
|
+
/** {@link RAccess} */
|
|
166
|
+
RType["Access"] = "RAccess";
|
|
167
|
+
/** {@link RArgument} */
|
|
168
|
+
RType["Argument"] = "RArgument";
|
|
169
|
+
/** {@link RBinaryOp} */
|
|
170
|
+
RType["BinaryOp"] = "RBinaryOp";
|
|
171
|
+
/** {@link RExpressionList} */
|
|
172
|
+
RType["ExpressionList"] = "RExpressionList";
|
|
173
|
+
/** {@link RForLoop} */
|
|
174
|
+
RType["ForLoop"] = "RForLoop";
|
|
175
|
+
/** {@link RFunctionCall} */
|
|
176
|
+
RType["FunctionCall"] = "RFunctionCall";
|
|
177
|
+
/** {@link RFunctionDefinition} */
|
|
178
|
+
RType["FunctionDefinition"] = "RFunctionDefinition";
|
|
179
|
+
/** {@link RIfThenElse} */
|
|
180
|
+
RType["IfThenElse"] = "RIfThenElse";
|
|
181
|
+
/** {@link RParameter} */
|
|
182
|
+
RType["Parameter"] = "RParameter";
|
|
183
|
+
/** {@link RPipe} */
|
|
184
|
+
RType["Pipe"] = "RPipe";
|
|
185
|
+
/** {@link RRepeatLoop} */
|
|
186
|
+
RType["RepeatLoop"] = "RRepeatLoop";
|
|
187
|
+
/** {@link RUnaryOp} */
|
|
188
|
+
RType["UnaryOp"] = "RUnaryOp";
|
|
189
|
+
/** {@link RWhileLoop} */
|
|
190
|
+
RType["WhileLoop"] = "RWhileLoop";
|
|
191
|
+
/** {@link RBreak} */
|
|
192
|
+
RType["Break"] = "RBreak";
|
|
193
|
+
/** {@link RComment} */
|
|
194
|
+
RType["Comment"] = "RComment";
|
|
195
|
+
/** {@link RLineDirective} */
|
|
196
|
+
RType["LineDirective"] = "RLineDirective";
|
|
197
|
+
/** {@link RLogical} */
|
|
198
|
+
RType["Logical"] = "RLogical";
|
|
199
|
+
/** {@link RNext} */
|
|
200
|
+
RType["Next"] = "RNext";
|
|
201
|
+
/** {@link RNumber} */
|
|
202
|
+
RType["Number"] = "RNumber";
|
|
203
|
+
/** {@link RString} */
|
|
204
|
+
RType["String"] = "RString";
|
|
205
|
+
/** {@link RSymbol} */
|
|
206
|
+
RType["Symbol"] = "RSymbol";
|
|
207
|
+
/* ------ special types ------ */
|
|
208
|
+
/** {@link RDelimiter}.
|
|
209
|
+
* Is not part of the normalized AST but can be found in
|
|
210
|
+
* {@link Source#additionalTokens}.
|
|
211
|
+
*/
|
|
212
|
+
RType["Delimiter"] = "RDelimiter";
|
|
213
|
+
})(RType || (exports.RType = RType = {}));
|
|
4
214
|
const validSymbolTypes = new Set([
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
215
|
+
RawRType.Symbol,
|
|
216
|
+
RawRType.SymbolPackage,
|
|
217
|
+
RawRType.SymbolFunctionCall,
|
|
218
|
+
RawRType.NullConst,
|
|
219
|
+
RawRType.StringConst,
|
|
220
|
+
RawRType.ParenLeft,
|
|
221
|
+
RawRType.ParenRight,
|
|
222
|
+
RawRType.BraceLeft,
|
|
223
|
+
RawRType.BraceRight,
|
|
224
|
+
RawRType.Slot,
|
|
15
225
|
]);
|
|
16
226
|
/**
|
|
17
227
|
* Validates, whether the given type can be used as a symbol in R
|
|
@@ -21,5 +231,4 @@ const validSymbolTypes = new Set([
|
|
|
21
231
|
function isSymbol(type) {
|
|
22
232
|
return validSymbolTypes.has(type);
|
|
23
233
|
}
|
|
24
|
-
exports.isSymbol = isSymbol;
|
|
25
234
|
//# sourceMappingURL=type.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.RootId = void 0;
|
|
4
|
+
exports.prepareParsedData = prepareParsedData;
|
|
4
5
|
const retriever_1 = require("../../../../retriever");
|
|
5
6
|
const assert_1 = require("../../../../../util/assert");
|
|
6
7
|
exports.RootId = 0;
|
|
@@ -35,5 +36,4 @@ function prepareParsedData(data) {
|
|
|
35
36
|
}
|
|
36
37
|
return roots;
|
|
37
38
|
}
|
|
38
|
-
exports.prepareParsedData = prepareParsedData;
|
|
39
39
|
//# sourceMappingURL=format.js.map
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.parseLog = void 0;
|
|
4
|
+
exports.normalize = normalize;
|
|
5
|
+
exports.convertPreparedParsedData = convertPreparedParsedData;
|
|
4
6
|
const format_1 = require("./format");
|
|
5
7
|
const log_1 = require("../../../../../util/log");
|
|
6
8
|
const decorate_1 = require("../../model/processing/decorate");
|
|
7
9
|
const normalize_root_1 = require("../xml/internal/structure/normalize-root");
|
|
8
10
|
const input_format_1 = require("../xml/input-format");
|
|
11
|
+
const type_1 = require("../../model/type");
|
|
9
12
|
exports.parseLog = log_1.log.getSubLogger({ name: 'ast-parser' });
|
|
10
13
|
function normalize(jsonString, getId = (0, decorate_1.deterministicCountingIdGenerator)(0)) {
|
|
11
14
|
const data = { currentRange: undefined, currentLexeme: undefined };
|
|
12
15
|
const object = convertPreparedParsedData((0, format_1.prepareParsedData)(jsonString));
|
|
13
16
|
return (0, decorate_1.decorateAst)((0, normalize_root_1.normalizeRootObjToAst)(data, object), getId);
|
|
14
17
|
}
|
|
15
|
-
exports.normalize = normalize;
|
|
16
18
|
function convertPreparedParsedData(rootEntries) {
|
|
17
19
|
return {
|
|
18
|
-
[
|
|
19
|
-
[input_format_1.nameKey]:
|
|
20
|
+
[type_1.RawRType.ExpressionList]: {
|
|
21
|
+
[input_format_1.nameKey]: type_1.RawRType.ExpressionList,
|
|
20
22
|
[input_format_1.childrenKey]: rootEntries.map(convertEntry)
|
|
21
23
|
}
|
|
22
24
|
};
|
|
23
25
|
}
|
|
24
|
-
exports.convertPreparedParsedData = convertPreparedParsedData;
|
|
25
26
|
function convertEntry(csvEntry) {
|
|
26
27
|
const xmlEntry = {
|
|
27
28
|
[input_format_1.nameKey]: csvEntry.token,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.XmlParseError = exports.nameKey = exports.contentKey = exports.childrenKey = exports.attributesKey = void 0;
|
|
4
|
+
exports.getKeyGuarded = getKeyGuarded;
|
|
5
|
+
exports.getKeysGuarded = getKeysGuarded;
|
|
4
6
|
exports.attributesKey = 'a';
|
|
5
7
|
exports.childrenKey = 'c';
|
|
6
8
|
exports.contentKey = '@';
|
|
@@ -24,7 +26,6 @@ function error(key, obj) {
|
|
|
24
26
|
function getKeyGuarded(obj, key) {
|
|
25
27
|
return (obj[key] ?? error(key, obj));
|
|
26
28
|
}
|
|
27
|
-
exports.getKeyGuarded = getKeyGuarded;
|
|
28
29
|
/**
|
|
29
30
|
* Retrieves the given keys from the converted xml. For a single key, see {@link getKeyGuarded}.
|
|
30
31
|
* Will throw an {@link XmlParseError} if at least one of the keys is not present
|
|
@@ -34,5 +35,4 @@ exports.getKeyGuarded = getKeyGuarded;
|
|
|
34
35
|
function getKeysGuarded(obj, ...keys) {
|
|
35
36
|
return Object.fromEntries(keys.map(k => [k, getKeyGuarded(obj, k)]));
|
|
36
37
|
}
|
|
37
|
-
exports.getKeysGuarded = getKeysGuarded;
|
|
38
38
|
//# sourceMappingURL=input-format.js.map
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tryNormalizeIfThenElse =
|
|
3
|
+
exports.tryNormalizeIfThenElse = tryNormalizeIfThenElse;
|
|
4
4
|
const parser_1 = require("../../../json/parser");
|
|
5
5
|
const normalize_if_then_1 = require("./normalize-if-then");
|
|
6
6
|
const assert_1 = require("../../../../../../../util/assert");
|
|
7
7
|
const normalize_meta_1 = require("../../normalize-meta");
|
|
8
8
|
const normalize_single_node_1 = require("../structure/normalize-single-node");
|
|
9
|
+
const type_1 = require("../../../../model/type");
|
|
9
10
|
/**
|
|
10
11
|
* Try to parse the construct as a {@link RIfThenElse}.
|
|
11
12
|
*/
|
|
@@ -17,13 +18,12 @@ function tryNormalizeIfThenElse(data, tokens) {
|
|
|
17
18
|
return undefined;
|
|
18
19
|
}
|
|
19
20
|
parser_1.parseLog.trace('if-then part successful, now parsing else part');
|
|
20
|
-
(0, assert_1.guard)(tokens[5].name ===
|
|
21
|
+
(0, assert_1.guard)(tokens[5].name === type_1.RawRType.Else, () => `expected else token for if-then-else but found ${JSON.stringify(tokens[5])}`);
|
|
21
22
|
const parsedElse = (0, normalize_single_node_1.normalizeSingleNode)(data, tokens[6]);
|
|
22
|
-
(0, assert_1.guard)(parsedElse.type !==
|
|
23
|
+
(0, assert_1.guard)(parsedElse.type !== type_1.RType.Delimiter, () => `unexpected missing else-part of if-then-else, received ${JSON.stringify([parsedIfThen, parsedElse])} for ${JSON.stringify(tokens)}`);
|
|
23
24
|
return {
|
|
24
25
|
...parsedIfThen,
|
|
25
26
|
otherwise: (0, normalize_meta_1.ensureExpressionList)(parsedElse)
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
|
-
exports.tryNormalizeIfThenElse = tryNormalizeIfThenElse;
|
|
29
29
|
//# sourceMappingURL=normalize-if-then-else.js.map
|
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tryNormalizeIfThen =
|
|
3
|
+
exports.tryNormalizeIfThen = tryNormalizeIfThen;
|
|
4
4
|
const input_format_1 = require("../../input-format");
|
|
5
5
|
const parser_1 = require("../../../json/parser");
|
|
6
6
|
const normalize_meta_1 = require("../../normalize-meta");
|
|
7
|
+
const type_1 = require("../../../../model/type");
|
|
7
8
|
const normalize_single_node_1 = require("../structure/normalize-single-node");
|
|
8
9
|
/**
|
|
9
10
|
* Try to parse the construct as a {@link RIfThenElse}.
|
|
10
11
|
*/
|
|
11
12
|
function tryNormalizeIfThen(data, tokens) {
|
|
12
13
|
parser_1.parseLog.trace('trying to parse if-then structure');
|
|
13
|
-
if (tokens[0].name !==
|
|
14
|
+
if (tokens[0].name !== type_1.RawRType.If) {
|
|
14
15
|
parser_1.parseLog.debug('encountered non-if token for supposed if-then structure');
|
|
15
16
|
return undefined;
|
|
16
17
|
}
|
|
17
|
-
else if (tokens[1].name !==
|
|
18
|
+
else if (tokens[1].name !== type_1.RawRType.ParenLeft) {
|
|
18
19
|
throw new input_format_1.XmlParseError(`expected left-parenthesis for if but found ${JSON.stringify(tokens[1])}`);
|
|
19
20
|
}
|
|
20
|
-
else if (tokens[3].name !==
|
|
21
|
+
else if (tokens[3].name !== type_1.RawRType.ParenRight) {
|
|
21
22
|
throw new input_format_1.XmlParseError(`expected right-parenthesis for if but found ${JSON.stringify(tokens[3])}`);
|
|
22
23
|
}
|
|
23
24
|
const parsedCondition = (0, normalize_single_node_1.normalizeSingleNode)(data, tokens[2]);
|
|
24
25
|
const parsedThen = (0, normalize_single_node_1.normalizeSingleNode)(data, tokens[4]);
|
|
25
|
-
if (parsedCondition.type ===
|
|
26
|
+
if (parsedCondition.type === type_1.RType.Delimiter || parsedThen.type === type_1.RType.Delimiter) {
|
|
26
27
|
throw new input_format_1.XmlParseError(`unexpected missing parts of if, received ${JSON.stringify([parsedCondition, parsedThen])} for ${JSON.stringify(tokens)}`);
|
|
27
28
|
}
|
|
28
29
|
const { location, content } = (0, normalize_meta_1.retrieveMetaStructure)(tokens[0].content);
|
|
29
30
|
return {
|
|
30
|
-
type:
|
|
31
|
+
type: type_1.RType.IfThenElse,
|
|
31
32
|
condition: parsedCondition,
|
|
32
33
|
then: (0, normalize_meta_1.ensureExpressionList)(parsedThen),
|
|
33
34
|
location,
|
|
@@ -39,5 +40,4 @@ function tryNormalizeIfThen(data, tokens) {
|
|
|
39
40
|
}
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
|
-
exports.tryNormalizeIfThen = tryNormalizeIfThen;
|
|
43
43
|
//# sourceMappingURL=normalize-if-then.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeExpression =
|
|
3
|
+
exports.normalizeExpression = normalizeExpression;
|
|
4
4
|
const input_format_1 = require("../../input-format");
|
|
5
5
|
const parser_1 = require("../../../json/parser");
|
|
6
6
|
const normalize_meta_1 = require("../../normalize-meta");
|
|
@@ -9,6 +9,7 @@ const arrays_1 = require("../../../../../../../util/arrays");
|
|
|
9
9
|
const normalize_expressions_1 = require("../structure/normalize-expressions");
|
|
10
10
|
const normalize_call_1 = require("../functions/normalize-call");
|
|
11
11
|
const normalize_definition_1 = require("../functions/normalize-definition");
|
|
12
|
+
const type_1 = require("../../../../model/type");
|
|
12
13
|
const normalize_comment_1 = require("../other/normalize-comment");
|
|
13
14
|
/**
|
|
14
15
|
* Returns an expression list if there are multiple children, otherwise returns the single child directly with no expr wrapper
|
|
@@ -39,7 +40,7 @@ function normalizeExpression(data, obj) {
|
|
|
39
40
|
return maybeFunctionDefinition;
|
|
40
41
|
}
|
|
41
42
|
const children = (0, normalize_expressions_1.normalizeExpressions)(childData, childrenSource);
|
|
42
|
-
const [delimiters, nodes] = (0, arrays_1.partition)(children, x => x.type ===
|
|
43
|
+
const [delimiters, nodes] = (0, arrays_1.partition)(children, x => x.type === type_1.RType.Delimiter || x.type === type_1.RType.Comment);
|
|
43
44
|
if (nodes.length === 1) {
|
|
44
45
|
const result = nodes[0];
|
|
45
46
|
result.info.additionalTokens = [...result.info.additionalTokens ?? [], ...delimiters];
|
|
@@ -47,7 +48,7 @@ function normalizeExpression(data, obj) {
|
|
|
47
48
|
}
|
|
48
49
|
else {
|
|
49
50
|
return {
|
|
50
|
-
type:
|
|
51
|
+
type: type_1.RType.ExpressionList,
|
|
51
52
|
grouping: undefined,
|
|
52
53
|
location,
|
|
53
54
|
children: nodes,
|
|
@@ -60,5 +61,4 @@ function normalizeExpression(data, obj) {
|
|
|
60
61
|
};
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
|
-
exports.normalizeExpression = normalizeExpression;
|
|
64
64
|
//# sourceMappingURL=normalize-expression.js.map
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tryToNormalizeArgument =
|
|
3
|
+
exports.tryToNormalizeArgument = tryToNormalizeArgument;
|
|
4
4
|
const parser_1 = require("../../../json/parser");
|
|
5
5
|
const normalize_meta_1 = require("../../normalize-meta");
|
|
6
6
|
const assert_1 = require("../../../../../../../util/assert");
|
|
7
|
+
const type_1 = require("../../../../model/type");
|
|
7
8
|
const normalize_single_node_1 = require("../structure/normalize-single-node");
|
|
8
9
|
/**
|
|
9
10
|
* Either parses `[expr]` or `[SYMBOL_SUB, EQ_SUB, expr]` as an argument of a function call in R.
|
|
@@ -24,15 +25,15 @@ function tryToNormalizeArgument(data, objs) {
|
|
|
24
25
|
const { location, content } = (0, normalize_meta_1.retrieveMetaStructure)(symbolOrExpr.content);
|
|
25
26
|
let parsedValue;
|
|
26
27
|
let name;
|
|
27
|
-
if (symbolOrExpr.name ===
|
|
28
|
+
if (symbolOrExpr.name === type_1.RawRType.Expression) {
|
|
28
29
|
name = undefined;
|
|
29
30
|
parsedValue = (0, normalize_single_node_1.normalizeSingleNode)(data, symbolOrExpr);
|
|
30
31
|
}
|
|
31
|
-
else if (symbolOrExpr.name ===
|
|
32
|
+
else if (symbolOrExpr.name === type_1.RawRType.SymbolSub || symbolOrExpr.name === type_1.RawRType.StringConst) {
|
|
32
33
|
name = {
|
|
33
|
-
type:
|
|
34
|
+
type: type_1.RType.Symbol,
|
|
34
35
|
location,
|
|
35
|
-
content: symbolOrExpr.name ===
|
|
36
|
+
content: symbolOrExpr.name === type_1.RawRType.StringConst ? content.slice(1, -1) : content,
|
|
36
37
|
namespace: undefined,
|
|
37
38
|
lexeme: content,
|
|
38
39
|
info: {
|
|
@@ -47,9 +48,9 @@ function tryToNormalizeArgument(data, objs) {
|
|
|
47
48
|
parser_1.parseLog.warn(`expected symbol or expr for argument, yet received ${objs.map(o => o.name).join(',')}`);
|
|
48
49
|
return undefined;
|
|
49
50
|
}
|
|
50
|
-
(0, assert_1.guard)(parsedValue !== undefined && parsedValue?.type !==
|
|
51
|
+
(0, assert_1.guard)(parsedValue !== undefined && parsedValue?.type !== type_1.RType.Delimiter, () => `[argument] parsed value must not be undefined, yet: ${JSON.stringify(objs)}`);
|
|
51
52
|
return {
|
|
52
|
-
type:
|
|
53
|
+
type: type_1.RType.Argument,
|
|
53
54
|
location,
|
|
54
55
|
lexeme: content,
|
|
55
56
|
name,
|
|
@@ -61,10 +62,9 @@ function tryToNormalizeArgument(data, objs) {
|
|
|
61
62
|
}
|
|
62
63
|
};
|
|
63
64
|
}
|
|
64
|
-
exports.tryToNormalizeArgument = tryToNormalizeArgument;
|
|
65
65
|
function parseWithValue(data, objs) {
|
|
66
|
-
(0, assert_1.guard)(objs[1].name ===
|
|
67
|
-
(0, assert_1.guard)(objs.length === 2 || objs[2].name ===
|
|
66
|
+
(0, assert_1.guard)(objs[1].name === type_1.RawRType.EqualSub, () => `[arg-default] second element of parameter must be ${type_1.RawRType.EqualFormals}, but: ${JSON.stringify(objs)}`);
|
|
67
|
+
(0, assert_1.guard)(objs.length === 2 || objs[2].name === type_1.RawRType.Expression, () => `[arg-default] third element of parameter must be an Expression or undefined (for 'x=') but: ${JSON.stringify(objs)}`);
|
|
68
68
|
return objs[2] ? (0, normalize_single_node_1.normalizeSingleNode)(data, objs[2]) : null;
|
|
69
69
|
}
|
|
70
70
|
//# sourceMappingURL=normalize-argument.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tryNormalizeFunctionCall =
|
|
3
|
+
exports.tryNormalizeFunctionCall = tryNormalizeFunctionCall;
|
|
4
4
|
const input_format_1 = require("../../input-format");
|
|
5
5
|
const parser_1 = require("../../../json/parser");
|
|
6
6
|
const normalize_meta_1 = require("../../normalize-meta");
|
|
@@ -8,6 +8,7 @@ const arrays_1 = require("../../../../../../../util/arrays");
|
|
|
8
8
|
const assert_1 = require("../../../../../../../util/assert");
|
|
9
9
|
const normalize_argument_1 = require("./normalize-argument");
|
|
10
10
|
const r_function_call_1 = require("../../../../model/nodes/r-function-call");
|
|
11
|
+
const type_1 = require("../../../../model/type");
|
|
11
12
|
const normalize_expression_1 = require("../expression/normalize-expression");
|
|
12
13
|
const normalize_string_1 = require("../values/normalize-string");
|
|
13
14
|
const normalize_symbol_1 = require("../values/normalize-symbol");
|
|
@@ -22,11 +23,11 @@ const normalize_symbol_1 = require("../values/normalize-symbol");
|
|
|
22
23
|
*/
|
|
23
24
|
function tryNormalizeFunctionCall(data, mappedWithName) {
|
|
24
25
|
const fnBase = mappedWithName[0];
|
|
25
|
-
if (fnBase.name !==
|
|
26
|
+
if (fnBase.name !== type_1.RawRType.Expression && fnBase.name !== type_1.RawRType.ExprOfAssignOrHelp && fnBase.name !== type_1.RawRType.LegacyEqualAssign) {
|
|
26
27
|
parser_1.parseLog.trace(`expected function call name to be wrapped an expression, yet received ${fnBase.name}`);
|
|
27
28
|
return undefined;
|
|
28
29
|
}
|
|
29
|
-
if (mappedWithName.length < 3 || mappedWithName[1].name !==
|
|
30
|
+
if (mappedWithName.length < 3 || mappedWithName[1].name !== type_1.RawRType.ParenLeft || mappedWithName[mappedWithName.length - 1].name !== type_1.RawRType.ParenRight) {
|
|
30
31
|
parser_1.parseLog.trace('expected function call to have parenthesis for a call, but was not');
|
|
31
32
|
return undefined;
|
|
32
33
|
}
|
|
@@ -34,12 +35,12 @@ function tryNormalizeFunctionCall(data, mappedWithName) {
|
|
|
34
35
|
const { unwrappedObj, content, location } = (0, normalize_meta_1.retrieveMetaStructure)(fnBase.content);
|
|
35
36
|
const symbolContent = (0, input_format_1.getKeyGuarded)(unwrappedObj, input_format_1.childrenKey);
|
|
36
37
|
const namedSymbolContent = (0, normalize_meta_1.getWithTokenType)(symbolContent);
|
|
37
|
-
if (namedSymbolContent.length === 1 && namedSymbolContent[0].name ===
|
|
38
|
+
if (namedSymbolContent.length === 1 && namedSymbolContent[0].name === type_1.RawRType.StringConst) {
|
|
38
39
|
// special handling when someone calls a function by string
|
|
39
40
|
return parseNamedFunctionCall(data, namedSymbolContent, mappedWithName, location, content);
|
|
40
41
|
}
|
|
41
|
-
else if (namedSymbolContent.findIndex(x => x.name ===
|
|
42
|
-
parser_1.parseLog.trace(`is not named function call, as the name is not of type ${
|
|
42
|
+
else if (namedSymbolContent.findIndex(x => x.name === type_1.RawRType.SymbolFunctionCall) < 0) {
|
|
43
|
+
parser_1.parseLog.trace(`is not named function call, as the name is not of type ${type_1.RType.FunctionCall}, but: ${namedSymbolContent.map(n => n.name).join(',')}`);
|
|
43
44
|
const mayResult = tryParseUnnamedFunctionCall(data, mappedWithName, location, content);
|
|
44
45
|
return mayResult;
|
|
45
46
|
}
|
|
@@ -47,11 +48,10 @@ function tryNormalizeFunctionCall(data, mappedWithName) {
|
|
|
47
48
|
return parseNamedFunctionCall(data, namedSymbolContent, mappedWithName, location, content);
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
|
-
exports.tryNormalizeFunctionCall = tryNormalizeFunctionCall;
|
|
51
51
|
function parseArguments(mappedWithName, data) {
|
|
52
52
|
const argContainer = mappedWithName.slice(1);
|
|
53
|
-
(0, assert_1.guard)(argContainer.length > 1 && argContainer[0].name ===
|
|
54
|
-
const splitArgumentsOnComma = (0, arrays_1.splitArrayOn)(argContainer.slice(1, argContainer.length - 1), x => x.name ===
|
|
53
|
+
(0, assert_1.guard)(argContainer.length > 1 && argContainer[0].name === type_1.RawRType.ParenLeft && argContainer[argContainer.length - 1].name === type_1.RawRType.ParenRight, 'expected args in parenthesis');
|
|
54
|
+
const splitArgumentsOnComma = (0, arrays_1.splitArrayOn)(argContainer.slice(1, argContainer.length - 1), x => x.name === type_1.RawRType.Comma);
|
|
55
55
|
return splitArgumentsOnComma.map(x => {
|
|
56
56
|
parser_1.parseLog.trace('trying to parse argument');
|
|
57
57
|
return (0, normalize_argument_1.tryToNormalizeArgument)(data, x);
|
|
@@ -69,9 +69,9 @@ function tryParseUnnamedFunctionCall(data, mappedWithName, location, content) {
|
|
|
69
69
|
const parsedArguments = parseArguments(mappedWithName, data);
|
|
70
70
|
if (parsedArguments.length === 0) {
|
|
71
71
|
// sadly, next() and break() work
|
|
72
|
-
if (calledFunction.type ===
|
|
72
|
+
if (calledFunction.type === type_1.RType.Next) {
|
|
73
73
|
return {
|
|
74
|
-
type:
|
|
74
|
+
type: type_1.RType.Next,
|
|
75
75
|
lexeme: content,
|
|
76
76
|
location,
|
|
77
77
|
info: {
|
|
@@ -81,9 +81,9 @@ function tryParseUnnamedFunctionCall(data, mappedWithName, location, content) {
|
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
-
else if (calledFunction.type ===
|
|
84
|
+
else if (calledFunction.type === type_1.RType.Break) {
|
|
85
85
|
return {
|
|
86
|
-
type:
|
|
86
|
+
type: type_1.RType.Break,
|
|
87
87
|
lexeme: content,
|
|
88
88
|
location,
|
|
89
89
|
info: {
|
|
@@ -95,7 +95,7 @@ function tryParseUnnamedFunctionCall(data, mappedWithName, location, content) {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
return {
|
|
98
|
-
type:
|
|
98
|
+
type: type_1.RType.FunctionCall,
|
|
99
99
|
named: undefined,
|
|
100
100
|
location,
|
|
101
101
|
lexeme: content,
|
|
@@ -110,10 +110,10 @@ function tryParseUnnamedFunctionCall(data, mappedWithName, location, content) {
|
|
|
110
110
|
}
|
|
111
111
|
function parseNamedFunctionCall(data, symbolContent, mappedWithName, location, content) {
|
|
112
112
|
let functionName;
|
|
113
|
-
if (symbolContent.length === 1 && symbolContent[0].name ===
|
|
113
|
+
if (symbolContent.length === 1 && symbolContent[0].name === type_1.RawRType.StringConst) {
|
|
114
114
|
const stringBase = (0, normalize_string_1.normalizeString)(data, symbolContent[0].content);
|
|
115
115
|
functionName = {
|
|
116
|
-
type:
|
|
116
|
+
type: type_1.RType.Symbol,
|
|
117
117
|
namespace: undefined,
|
|
118
118
|
lexeme: stringBase.lexeme,
|
|
119
119
|
info: stringBase.info,
|
|
@@ -125,10 +125,10 @@ function parseNamedFunctionCall(data, symbolContent, mappedWithName, location, c
|
|
|
125
125
|
functionName = (0, normalize_symbol_1.tryNormalizeSymbol)(data, symbolContent);
|
|
126
126
|
}
|
|
127
127
|
(0, assert_1.guard)(functionName !== undefined, 'expected function name to be a symbol, yet received none');
|
|
128
|
-
(0, assert_1.guard)((functionName).type ===
|
|
128
|
+
(0, assert_1.guard)((functionName).type === type_1.RType.Symbol, () => `expected function name to be a symbol, yet received ${JSON.stringify(functionName)}`);
|
|
129
129
|
const parsedArguments = parseArguments(mappedWithName, data);
|
|
130
130
|
return {
|
|
131
|
-
type:
|
|
131
|
+
type: type_1.RType.FunctionCall,
|
|
132
132
|
named: true,
|
|
133
133
|
location,
|
|
134
134
|
lexeme: content,
|