@eagleoutice/flowr 2.15.5 → 2.15.9
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 +39 -280
- package/abstract-interpretation/absint-inference.d.ts +5 -5
- package/abstract-interpretation/absint-inference.js +12 -12
- package/abstract-interpretation/abstract-semantics.d.ts +10 -10
- package/abstract-interpretation/data-frame/arguments.d.ts +9 -9
- package/abstract-interpretation/data-frame/arguments.js +11 -11
- package/abstract-interpretation/data-frame/dataframe-semantics.d.ts +1 -1
- package/abstract-interpretation/data-frame/dataframe-semantics.js +14 -14
- package/abstract-interpretation/unsupported-functions.d.ts +0 -1
- package/abstract-interpretation/unsupported-functions.js +1 -2
- package/abstract-interpretation/value-semantics.d.ts +1 -1
- package/abstract-interpretation/value-semantics.js +2 -3
- package/benchmark/calibration.d.ts +0 -2
- package/benchmark/calibration.js +0 -5
- package/benchmark/slicer.d.ts +2 -2
- package/benchmark/slicer.js +4 -4
- package/benchmark/stats/size-of.d.ts +1 -1
- package/benchmark/stats/size-of.js +2 -2
- package/benchmark/summarizer/first-phase/process.d.ts +1 -1
- package/benchmark/summarizer/first-phase/process.js +1 -1
- package/benchmark/summarizer/second-phase/graph.d.ts +1 -1
- package/benchmark/summarizer/second-phase/graph.js +1 -1
- package/cli/benchmark-app.js +3 -3
- package/cli/common/options.d.ts +0 -16
- package/cli/common/options.js +0 -3
- package/cli/common/scripts-info.d.ts +0 -16
- package/cli/compile-cache.d.ts +1 -0
- package/cli/compile-cache.js +19 -0
- package/cli/flowr-main-options.d.ts +5 -0
- package/cli/flowr-main-options.js +6 -0
- package/cli/flowr.d.ts +13 -0
- package/cli/flowr.js +27 -2
- package/cli/repl/commands/repl-clipboard.d.ts +4 -1
- package/cli/repl/commands/repl-clipboard.js +4 -1
- package/cli/repl/commands/repl-main.d.ts +0 -2
- package/cli/repl/commands/repl-main.js +0 -5
- package/cli/repl/commands/repl-normalize.js +3 -0
- package/cli/repl/commands/repl-parse.js +27 -0
- package/cli/repl/commands/repl-signature.js +17 -1
- package/cli/script-core/summarizer-core.js +0 -9
- package/cli/summarizer-app.d.ts +0 -3
- package/cli/wiki.d.ts +2 -2
- package/cli/wiki.js +18 -2
- package/config.d.ts +54 -5
- package/config.js +44 -8
- package/control-flow/cfg-dead-code.js +5 -4
- package/control-flow/cfg-properties.d.ts +2 -2
- package/control-flow/cfg-properties.js +2 -2
- package/control-flow/control-flow-graph.d.ts +32 -10
- package/control-flow/control-flow-graph.js +22 -10
- package/control-flow/diff-cfg.js +3 -2
- package/control-flow/happens-before.d.ts +6 -0
- package/control-flow/happens-before.js +42 -0
- package/control-flow/semantic-cfg-guided-visitor.d.ts +1 -1
- package/control-flow/semantic-cfg-guided-visitor.js +5 -2
- package/control-flow/simple-visitor.d.ts +2 -7
- package/control-flow/simple-visitor.js +2 -6
- package/control-flow/useless-loop.d.ts +2 -2
- package/control-flow/useless-loop.js +11 -8
- package/core/pipeline-executor.d.ts +2 -2
- package/core/pipeline-executor.js +2 -2
- package/core/steps/all/core/20-dataflow.d.ts +2 -2
- package/core/steps/all/static-slicing/00-slice.d.ts +1 -1
- package/core/steps/all/static-slicing/00-slice.js +1 -1
- package/core/steps/all/static-slicing/10-reconstruct.js +1 -1
- package/core/steps/pipeline/default-pipelines.d.ts +16 -16
- package/core/steps/pipeline/pipeline.d.ts +1 -6
- package/data/r-base-packages.generated.d.ts +2 -2
- package/data/r-base-packages.generated.js +4 -4
- package/dataflow/cluster.js +1 -1
- package/dataflow/environments/apply-kill.d.ts +4 -0
- package/dataflow/environments/apply-kill.js +43 -8
- package/dataflow/environments/built-in-config.d.ts +7 -2
- package/dataflow/environments/built-in-config.js +7 -5
- package/dataflow/environments/built-in-eval-name.d.ts +4 -2
- package/dataflow/environments/built-in-eval-name.js +3 -1
- package/dataflow/environments/built-in-proc-name.d.ts +2 -0
- package/dataflow/environments/built-in-proc-name.js +2 -0
- package/dataflow/environments/built-in-props.d.ts +23 -7
- package/dataflow/environments/built-in-props.js +27 -10
- package/dataflow/environments/built-in.d.ts +5 -6
- package/dataflow/environments/built-in.js +12 -16
- package/dataflow/environments/data-masking-functions.js +1 -1
- package/dataflow/environments/default-builtin-config.d.ts +278 -32
- package/dataflow/environments/default-builtin-config.js +139 -85
- package/dataflow/environments/environment.d.ts +16 -19
- package/dataflow/environments/environment.js +54 -48
- package/dataflow/environments/frame-memory.d.ts +54 -69
- package/dataflow/environments/frame-memory.js +146 -190
- package/dataflow/environments/identifier.d.ts +69 -9
- package/dataflow/environments/identifier.js +99 -13
- package/dataflow/environments/query-fn-props.d.ts +8 -2
- package/dataflow/environments/query-fn-props.js +20 -12
- package/dataflow/environments/reference-to-maybe.js +1 -1
- package/dataflow/environments/removal-marker.d.ts +7 -0
- package/dataflow/environments/removal-marker.js +20 -0
- package/dataflow/environments/resolve-by-name.d.ts +8 -8
- package/dataflow/environments/resolve-by-name.js +15 -12
- package/dataflow/environments/resolve-helper.d.ts +26 -4
- package/dataflow/environments/resolve-helper.js +27 -4
- package/dataflow/eval/resolve/alias-tracking.d.ts +17 -17
- package/dataflow/eval/resolve/alias-tracking.js +57 -32
- package/dataflow/eval/resolve/node-value.d.ts +15 -28
- package/dataflow/eval/resolve/node-value.js +26 -45
- package/dataflow/eval/resolve/resolve-argument.js +21 -2
- package/dataflow/eval/resolve/resolve-get.d.ts +28 -0
- package/dataflow/eval/resolve/resolve-get.js +49 -0
- package/dataflow/eval/resolve/resolve-numbers.d.ts +4 -2
- package/dataflow/eval/resolve/resolve-numbers.js +4 -2
- package/dataflow/eval/resolve/resolve-operators.d.ts +4 -1
- package/dataflow/eval/resolve/resolve-operators.js +7 -3
- package/dataflow/eval/resolve/resolve-strings.d.ts +6 -3
- package/dataflow/eval/resolve/resolve-strings.js +29 -5
- package/dataflow/eval/resolve/resolve-working-directory.js +2 -8
- package/dataflow/eval/resolve/resolve.js +27 -15
- package/dataflow/eval/values/general.js +13 -12
- package/dataflow/eval/values/intervals/interval-constants.d.ts +10 -2
- package/dataflow/eval/values/intervals/interval-constants.js +10 -2
- package/dataflow/eval/values/logical/logical-constants.d.ts +1 -8
- package/dataflow/eval/values/logical/logical-constants.js +1 -23
- package/dataflow/eval/values/r-value.d.ts +8 -9
- package/dataflow/eval/values/r-value.js +8 -8
- package/dataflow/eval/values/scalar/scalar-constants.d.ts +1 -12
- package/dataflow/eval/values/scalar/scalar-constants.js +0 -14
- package/dataflow/eval/values/sets/set-constants.d.ts +1 -4
- package/dataflow/eval/values/sets/set-constants.js +0 -11
- package/dataflow/eval/values/string/string-constants.d.ts +4 -18
- package/dataflow/eval/values/string/string-constants.js +3 -18
- package/dataflow/eval/values/vectors/vector-constants.d.ts +1 -1
- package/dataflow/eval/values/vectors/vector-constants.js +1 -1
- package/dataflow/extractor.js +176 -13
- package/dataflow/fn/argument-roles.d.ts +10 -12
- package/dataflow/fn/argument-roles.js +16 -22
- package/dataflow/fn/class-declaration.d.ts +8 -30
- package/dataflow/fn/class-declaration.js +12 -37
- package/dataflow/fn/exceptions-of-function.d.ts +3 -16
- package/dataflow/fn/exceptions-of-function.js +5 -21
- package/dataflow/fn/frame-reflection.d.ts +5 -19
- package/dataflow/fn/frame-reflection.js +14 -29
- package/dataflow/fn/function-props.d.ts +9 -10
- package/dataflow/fn/function-props.js +16 -20
- package/dataflow/fn/function-semantics.d.ts +130 -0
- package/dataflow/fn/function-semantics.js +89 -0
- package/dataflow/fn/higher-order-function.d.ts +8 -16
- package/dataflow/fn/higher-order-function.js +17 -28
- package/dataflow/fn/recursive-function.js +1 -1
- package/dataflow/fn/strict-function.d.ts +8 -20
- package/dataflow/fn/strict-function.js +20 -38
- package/dataflow/graph/call-graph.d.ts +9 -0
- package/dataflow/graph/call-graph.js +15 -14
- package/dataflow/graph/dataflowgraph-builder.d.ts +18 -23
- package/dataflow/graph/dataflowgraph-builder.js +18 -29
- package/dataflow/graph/df-helper.d.ts +22 -109
- package/dataflow/graph/df-helper.js +20 -64
- package/dataflow/graph/diff-dataflow-graph.d.ts +5 -0
- package/dataflow/graph/diff-dataflow-graph.js +12 -7
- package/dataflow/graph/edge.d.ts +1 -0
- package/dataflow/graph/edge.js +1 -0
- package/dataflow/graph/graph-helper.d.ts +26 -1
- package/dataflow/graph/graph-helper.js +53 -2
- package/dataflow/graph/graph.d.ts +42 -7
- package/dataflow/graph/graph.js +43 -9
- package/dataflow/graph/match-args.d.ts +16 -12
- package/dataflow/graph/match-args.js +68 -26
- package/dataflow/graph/vertex.d.ts +38 -57
- package/dataflow/graph/vertex.js +38 -66
- package/dataflow/info.d.ts +5 -2
- package/dataflow/info.js +3 -1
- package/dataflow/internal/control-flow.d.ts +13 -12
- package/dataflow/internal/control-flow.js +13 -12
- package/dataflow/internal/linker.d.ts +24 -15
- package/dataflow/internal/linker.js +115 -33
- package/dataflow/internal/process/functions/call/argument/make-argument.d.ts +1 -1
- package/dataflow/internal/process/functions/call/argument/make-argument.js +17 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +6 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +8 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +17 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +112 -39
- package/dataflow/internal/process/functions/call/built-in/built-in-class-generator.js +10 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-class-relation.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-env-contents.d.ts +21 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-env-contents.js +99 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +56 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +179 -45
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.d.ts +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-eval.js +46 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +49 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +119 -22
- package/dataflow/internal/process/functions/call/built-in/built-in-get.d.ts +5 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-get.js +62 -28
- package/dataflow/internal/process/functions/call/built-in/built-in-if-then-else.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-library.js +7 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-list.d.ts +9 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-list.js +26 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-load.js +3 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-local.js +13 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-new-env.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-pipe.js +36 -22
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +7 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-quote.js +3 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-recall.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-register-hook.js +7 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.d.ts +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-repeat-loop.js +7 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.d.ts +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-replacement.js +28 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-rm.js +5 -5
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-dispatch.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.d.ts +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-seven-new-generic.js +12 -14
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +2 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-source.js +3 -4
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.d.ts +8 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-stack-env.js +21 -13
- package/dataflow/internal/process/functions/call/built-in/built-in-string-template.js +12 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.d.ts +1 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +29 -11
- package/dataflow/internal/process/functions/call/built-in/built-in-with.d.ts +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-with.js +15 -12
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.d.ts +5 -5
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +28 -35
- package/dataflow/internal/process/functions/call/common.d.ts +7 -1
- package/dataflow/internal/process/functions/call/common.js +17 -7
- package/dataflow/internal/process/functions/call/deferred.d.ts +1 -3
- package/dataflow/internal/process/functions/call/deferred.js +20 -10
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +4 -4
- package/dataflow/internal/process/functions/call/known-call-handling.js +17 -8
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +5 -4
- package/dataflow/internal/process/functions/call/nse.d.ts +1 -2
- package/dataflow/internal/process/functions/call/nse.js +13 -15
- package/dataflow/internal/process/functions/call/quoted.d.ts +3 -4
- package/dataflow/internal/process/functions/call/quoted.js +96 -42
- package/dataflow/internal/process/functions/call/unnamed-call-handling.js +2 -2
- package/dataflow/internal/process/functions/process-parameter.d.ts +4 -1
- package/dataflow/internal/process/functions/process-parameter.js +4 -1
- package/dataflow/internal/process/process-named-call.d.ts +2 -2
- package/dataflow/internal/process/process-named-call.js +3 -3
- package/dataflow/origin/dfg-get-origin.d.ts +1 -1
- package/dataflow/origin/dfg-get-origin.js +17 -10
- package/dataflow/origin/dfg-get-symbol-refs.d.ts +2 -2
- package/dataflow/origin/dfg-get-symbol-refs.js +2 -2
- package/dataflow/processor.d.ts +10 -0
- package/documentation/data/dfg/doc-data-dfg-util.d.ts +2 -2
- package/documentation/data/dfg/doc-data-dfg-util.js +2 -2
- package/documentation/data/faq/faqs.d.ts +2 -1
- package/documentation/data/faq/faqs.js +12 -3
- package/documentation/data/server/doc-data-server-messages.d.ts +2 -1
- package/documentation/data/server/doc-data-server-messages.js +2 -1
- package/documentation/doc-capabilities.d.ts +13 -7
- package/documentation/doc-capabilities.js +445 -126
- package/documentation/doc-util/doc-auto-gen.d.ts +4 -2
- package/documentation/doc-util/doc-auto-gen.js +22 -4
- package/documentation/doc-util/doc-cfg.js +2 -2
- package/documentation/doc-util/doc-code.d.ts +8 -2
- package/documentation/doc-util/doc-code.js +36 -7
- package/documentation/doc-util/doc-dfg.d.ts +2 -0
- package/documentation/doc-util/doc-dfg.js +4 -3
- package/documentation/doc-util/doc-env.d.ts +2 -1
- package/documentation/doc-util/doc-env.js +2 -1
- package/documentation/doc-util/doc-escape.d.ts +2 -2
- package/documentation/doc-util/doc-escape.js +2 -2
- package/documentation/doc-util/doc-files.d.ts +0 -2
- package/documentation/doc-util/doc-files.js +2 -3
- package/documentation/doc-util/doc-normalized-ast.js +2 -2
- package/documentation/doc-util/doc-query.d.ts +2 -1
- package/documentation/doc-util/doc-query.js +4 -3
- package/documentation/doc-util/doc-repl.d.ts +1 -1
- package/documentation/doc-util/doc-repl.js +1 -1
- package/documentation/doc-util/doc-search.js +2 -2
- package/documentation/doc-util/doc-server-message.js +2 -2
- package/documentation/doc-util/doc-sigdb.js +1 -1
- package/documentation/doc-util/doc-structure.d.ts +10 -3
- package/documentation/doc-util/doc-structure.js +10 -3
- package/documentation/doc-util/doc-timings.d.ts +19 -0
- package/documentation/doc-util/doc-timings.js +44 -0
- package/documentation/doc-util/doc-types.d.ts +8 -6
- package/documentation/doc-util/doc-types.js +11 -8
- package/documentation/index.d.ts +1 -0
- package/documentation/index.js +1 -0
- package/documentation/wiki-core.js +3 -0
- package/documentation/wiki-create-linting-rules.js +1 -1
- package/documentation/wiki-dataflow-graph.js +19 -20
- package/documentation/wiki-engine.js +13 -2
- package/documentation/wiki-helper-objects.d.ts +9 -0
- package/documentation/wiki-helper-objects.js +102 -0
- package/documentation/wiki-linter.js +154 -16
- package/documentation/wiki-linting-and-testing.js +99 -6
- package/documentation/wiki-mk/doc-context.d.ts +33 -29
- package/documentation/wiki-mk/doc-context.js +1 -0
- package/documentation/wiki-mk/doc-maker.d.ts +1 -1
- package/documentation/wiki-mk/doc-maker.js +18 -2
- package/documentation/wiki-query.js +44 -0
- package/documentation/wiki-setup.js +28 -3
- package/documentation/wiki-signature-database.js +7 -3
- package/gas.d.ts +3 -2
- package/index.d.ts +18 -3
- package/index.js +29 -3
- package/linter/linter-executor.js +2 -2
- package/linter/linter-format.d.ts +9 -3
- package/linter/linter-format.js +2 -0
- package/linter/linter-rules.d.ts +118 -98
- package/linter/linter-rules.js +3 -1
- package/linter/rules/absolute-path.d.ts +10 -10
- package/linter/rules/absolute-path.js +9 -12
- package/linter/rules/dataframe-access-validation.d.ts +2 -2
- package/linter/rules/dataframe-access-validation.js +17 -4
- package/linter/rules/dead-code.d.ts +2 -2
- package/linter/rules/dead-code.js +1 -1
- package/linter/rules/deprecated-functions.d.ts +5 -5
- package/linter/rules/deprecated-functions.js +8 -8
- package/linter/rules/file-path-validity.d.ts +7 -7
- package/linter/rules/file-path-validity.js +4 -4
- package/linter/rules/function-finder-util.d.ts +0 -6
- package/linter/rules/function-finder-util.js +7 -2
- package/linter/rules/namespace-access.d.ts +42 -0
- package/linter/rules/namespace-access.js +78 -0
- package/linter/rules/naming-convention.d.ts +3 -3
- package/linter/rules/naming-convention.js +7 -3
- package/linter/rules/network-functions.d.ts +5 -5
- package/linter/rules/network-functions.js +5 -6
- package/linter/rules/no-leaked-credentials.d.ts +3 -3
- package/linter/rules/no-leaked-credentials.js +4 -5
- package/linter/rules/problematic-inputs.d.ts +5 -5
- package/linter/rules/problematic-inputs.js +13 -21
- package/linter/rules/roxygen-arguments.d.ts +1 -1
- package/linter/rules/roxygen-arguments.js +4 -3
- package/linter/rules/seeded-randomness.d.ts +6 -5
- package/linter/rules/seeded-randomness.js +15 -13
- package/linter/rules/software-has-license.d.ts +2 -2
- package/linter/rules/software-has-license.js +2 -2
- package/linter/rules/software-has-tests.d.ts +3 -3
- package/linter/rules/software-has-tests.js +2 -2
- package/linter/rules/stop-with-call-arg.d.ts +1 -1
- package/linter/rules/stop-with-call-arg.js +16 -3
- package/linter/rules/syntactically-valid.d.ts +3 -3
- package/linter/rules/syntactically-valid.js +2 -2
- package/linter/rules/unclosed-connection.d.ts +3 -3
- package/linter/rules/unclosed-connection.js +23 -12
- package/linter/rules/undefined-symbol-util.d.ts +3 -1
- package/linter/rules/undefined-symbol-util.js +9 -7
- package/linter/rules/undefined-symbol.d.ts +4 -4
- package/linter/rules/undefined-symbol.js +4 -4
- package/linter/rules/unescaped-arguments.d.ts +37 -37
- package/linter/rules/unescaped-arguments.js +20 -21
- package/linter/rules/unused-definition.d.ts +3 -3
- package/linter/rules/unused-definition.js +63 -26
- package/linter/rules/unused-import.d.ts +4 -4
- package/linter/rules/unused-import.js +14 -5
- package/linter/rules/useless-loop.d.ts +3 -3
- package/linter/rules/useless-loop.js +3 -3
- package/package.json +6 -4
- package/project/context/flowr-analyzer-context.d.ts +5 -0
- package/project/context/flowr-analyzer-context.js +5 -0
- package/project/context/flowr-analyzer-dependencies-context.d.ts +3 -3
- package/project/context/flowr-analyzer-environment-context.d.ts +20 -1
- package/project/context/flowr-analyzer-environment-context.js +24 -1
- package/project/context/flowr-analyzer-files-context.d.ts +9 -5
- package/project/context/flowr-analyzer-files-context.js +56 -22
- package/project/context/flowr-analyzer-functions-context.d.ts +1 -6
- package/project/context/flowr-analyzer-functions-context.js +1 -7
- package/project/context/flowr-analyzer-gas-context.d.ts +7 -0
- package/project/context/flowr-analyzer-gas-context.js +6 -1
- package/project/dependency-version-space.d.ts +7 -0
- package/project/dependency-version-space.js +2 -2
- package/project/flowr-analyzer-builder.d.ts +14 -4
- package/project/flowr-analyzer-builder.js +3 -1
- package/project/flowr-analyzer.d.ts +3 -3
- package/project/flowr-analyzer.js +1 -3
- package/project/plugins/file-plugins/files/flowr-description-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-description-file.js +2 -2
- package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +1 -1
- package/project/plugins/file-plugins/files/flowr-namespace-file.js +1 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.js +8 -6
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +3 -3
- package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +33 -10
- package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +2 -2
- package/project/plugins/file-plugins/files/flowr-sweave-file.js +2 -2
- package/project/plugins/file-plugins/files/r-fun-tab.d.ts +4 -67
- package/project/plugins/file-plugins/files/r-fun-tab.js +6 -653
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.d.ts +4 -1
- package/project/plugins/file-plugins/flowr-analyzer-description-file-plugin.js +4 -1
- package/project/plugins/flowr-analyzer-plugin.d.ts +1 -1
- package/project/plugins/flowr-analyzer-plugin.js +1 -1
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +0 -19
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +4 -51
- package/project/sigdb/codec.d.ts +0 -4
- package/project/sigdb/codec.js +1 -8
- package/project/sigdb/decode.d.ts +5 -4
- package/project/sigdb/decode.js +13 -18
- package/project/sigdb/dict.d.ts +35 -0
- package/project/sigdb/dict.js +97 -0
- package/project/sigdb/hash.d.ts +7 -2
- package/project/sigdb/manifest.d.ts +0 -2
- package/project/sigdb/manifest.js +2 -6
- package/project/sigdb/memory-source.js +2 -1
- package/project/sigdb/reader.d.ts +5 -4
- package/project/sigdb/reader.js +34 -26
- package/project/sigdb/schema.d.ts +0 -2
- package/project/sigdb/schema.js +1 -7
- package/project/sigdb/signature-db.d.ts +9 -1
- package/project/sigdb/signature-db.js +8 -0
- package/queries/catalog/call-context-query/call-context-query-executor.d.ts +1 -1
- package/queries/catalog/call-context-query/call-context-query-executor.js +5 -4
- package/queries/catalog/call-context-query/call-context-query-format.d.ts +1 -1
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +2 -2
- package/queries/catalog/call-context-query/identify-link-to-nested-call-relation.js +1 -1
- package/queries/catalog/dependencies-query/dependencies-query-executor.js +40 -6
- package/queries/catalog/dependencies-query/dependencies-query-format.d.ts +33 -54
- package/queries/catalog/dependencies-query/dependencies-query-format.js +37 -13
- package/queries/catalog/dependencies-query/function-info/derived-functions.d.ts +3 -2
- package/queries/catalog/dependencies-query/function-info/derived-functions.js +5 -5
- package/queries/catalog/dependencies-query/function-info/read-functions.d.ts +6 -1
- package/queries/catalog/dependencies-query/function-info/read-functions.js +12 -9
- package/queries/catalog/dependencies-query/function-info/statistics-functions.d.ts +2 -2
- package/queries/catalog/dependencies-query/function-info/statistics-functions.js +1 -2
- package/queries/catalog/dependencies-query/function-info/write-functions.d.ts +9 -1
- package/queries/catalog/dependencies-query/function-info/write-functions.js +17 -6
- package/queries/catalog/dependencies-query/implicit-echo.js +28 -5
- package/queries/catalog/dependencies-query/link-devices.js +23 -10
- package/queries/catalog/dice-query/dice-query-executor.js +2 -14
- package/queries/catalog/does-call-query/does-call-query-executor.js +1 -2
- package/queries/catalog/files-query/files-query-format.d.ts +1 -1
- package/queries/catalog/function-info-query/function-info-query-executor.d.ts +7 -0
- package/queries/catalog/function-info-query/function-info-query-executor.js +38 -0
- package/queries/catalog/function-info-query/function-info-query-format.d.ts +48 -0
- package/queries/catalog/function-info-query/function-info-query-format.js +54 -0
- package/queries/catalog/function-info-query/function-origin.d.ts +22 -0
- package/queries/catalog/function-info-query/function-origin.js +46 -0
- package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +2 -1
- package/queries/catalog/happens-before-query/happens-before-query-format.d.ts +1 -0
- package/queries/catalog/happens-before-query/happens-before-query-format.js +1 -0
- package/queries/catalog/input-sources-query/input-source-functions.d.ts +2 -2
- package/queries/catalog/input-sources-query/input-source-functions.js +1 -2
- package/queries/catalog/input-sources-query/input-sources-query-executor.js +2 -2
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +4 -2
- package/queries/catalog/input-sources-query/input-sources-query-format.js +24 -24
- package/queries/catalog/input-sources-query/input-types.d.ts +2 -2
- package/queries/catalog/input-sources-query/input-types.js +2 -2
- package/queries/catalog/input-sources-query/simple-input-classifier.js +6 -6
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-executor.js +2 -2
- package/queries/catalog/inspect-exceptions-query/inspect-exception-query-format.d.ts +1 -1
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-executor.js +6 -7
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.d.ts +4 -4
- package/queries/catalog/inspect-fn-props-query/inspect-fn-props-query-format.js +8 -7
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-executor.js +2 -2
- package/queries/catalog/inspect-higher-order-query/inspect-higher-order-query-format.d.ts +1 -1
- package/queries/catalog/inspect-recursion-query/inspect-recursion-query-format.d.ts +1 -1
- package/queries/catalog/linter-query/linter-query-format.d.ts +1 -1
- package/queries/catalog/signature-query/signature-query-executor.d.ts +2 -11
- package/queries/catalog/signature-query/signature-query-executor.js +124 -63
- package/queries/catalog/signature-query/signature-query-format.d.ts +21 -0
- package/queries/catalog/signature-query/signature-query-format.js +5 -1
- package/queries/catalog/signature-query/signature-query-render.js +28 -3
- package/queries/catalog/slice-query-options.d.ts +19 -2
- package/queries/catalog/slice-query-options.js +19 -3
- package/queries/catalog/static-slice-query/static-slice-query-executor.d.ts +2 -2
- package/queries/catalog/static-slice-query/static-slice-query-executor.js +4 -17
- package/queries/query-function-filter.d.ts +1 -0
- package/queries/query-function-filter.js +1 -0
- package/queries/query.d.ts +13 -2
- package/queries/query.js +4 -1
- package/r-bridge/data/data.d.ts +1435 -450
- package/r-bridge/data/data.js +1063 -478
- package/r-bridge/data/get.d.ts +1 -6
- package/r-bridge/data/get.js +0 -32
- package/r-bridge/data/types.d.ts +3 -0
- package/r-bridge/init.d.ts +7 -2
- package/r-bridge/init.js +10 -5
- package/r-bridge/lang-4.x/ast/model/model.d.ts +10 -8
- package/r-bridge/lang-4.x/ast/model/model.js +9 -10
- package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +5 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-argument.js +1 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +4 -4
- 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 +6 -6
- package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.js +2 -2
- 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 +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +5 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.js +1 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +6 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.js +4 -0
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.d.ts +4 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-project.js +4 -3
- package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +5 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-string.js +1 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +5 -5
- package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.js +1 -1
- package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +4 -4
- package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +4 -20
- package/r-bridge/lang-4.x/ast/model/processing/decorate.js +4 -43
- package/r-bridge/lang-4.x/ast/model/processing/node-id.d.ts +11 -0
- package/r-bridge/lang-4.x/ast/model/processing/node-id.js +18 -3
- package/r-bridge/lang-4.x/ast/model/processing/role.d.ts +0 -5
- package/r-bridge/lang-4.x/ast/model/processing/role.js +0 -13
- package/r-bridge/lang-4.x/ast/model/versions.d.ts +2 -0
- package/r-bridge/lang-4.x/ast/model/versions.js +3 -1
- package/r-bridge/lang-4.x/ast/parser/json/parser.js +3 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/expression/normalize-expression.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-argument.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-call.js +10 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-definition.js +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/functions/normalize-parameter.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-break.d.ts +3 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-break.js +3 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-for.d.ts +5 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-for.js +5 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-next.d.ts +3 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-next.js +3 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/loops/normalize-repeat.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/normalize-access.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-binary.js +39 -2
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/operators/normalize-unary.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-single-node.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/structure/normalize-single-node.js +2 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.d.ts +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/internal/values/normalize-symbol.js +1 -1
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.d.ts +2 -2
- package/r-bridge/lang-4.x/ast/parser/main/normalize-meta.js +2 -2
- package/r-bridge/lang-4.x/convert-values.d.ts +6 -0
- package/r-bridge/lang-4.x/convert-values.js +6 -0
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +2 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +2 -2
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.d.ts +1 -1
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-normalize.js +15 -2
- package/r-bridge/parser.d.ts +1 -1
- package/r-bridge/parser.js +1 -1
- package/r-bridge/retriever.d.ts +0 -21
- package/r-bridge/retriever.js +5 -63
- package/r-bridge/roxygen2/documentation-provider.d.ts +2 -2
- package/r-bridge/roxygen2/documentation-provider.js +2 -2
- package/r-bridge/shell-executor.js +1 -1
- package/r-bridge/shell.d.ts +4 -4
- package/r-bridge/shell.js +58 -35
- package/reconstruct/inline/source-inline-map.d.ts +15 -22
- package/reconstruct/inline/source-inline-map.js +63 -70
- package/reconstruct/reconstruct.d.ts +1 -1
- package/reconstruct/reconstruct.js +5 -2
- package/search/flowr-search-builder.d.ts +17 -16
- package/search/flowr-search-builder.js +9 -8
- package/search/flowr-search-filters.d.ts +1 -13
- package/search/flowr-search-filters.js +4 -13
- package/search/search-executor/search-enrichers.d.ts +2 -2
- package/search/search-executor/search-enrichers.js +3 -3
- package/search/search-executor/search-generators.d.ts +0 -3
- package/search/search-executor/search-transformer.d.ts +0 -3
- package/slicing/criterion/parse.d.ts +24 -20
- package/slicing/criterion/parse.js +34 -24
- package/slicing/static/fingerprint.js +6 -12
- package/slicing/static/slice-call.d.ts +1 -1
- package/slicing/static/slice-call.js +28 -9
- package/slicing/static/static-slicer.js +3 -4
- package/slicing/static/visiting-queue.d.ts +3 -1
- package/slicing/static/visiting-queue.js +25 -14
- package/util/accessor.d.ts +22 -0
- package/util/accessor.js +3 -0
- package/util/assert.d.ts +14 -8
- package/util/assert.js +25 -8
- package/util/collections/arrays.d.ts +11 -7
- package/util/collections/arrays.js +14 -14
- package/util/collections/defaultmap.d.ts +5 -0
- package/util/collections/defaultmap.js +14 -0
- package/util/diff-graph.d.ts +1 -2
- package/util/diff-graph.js +0 -1
- package/util/files.d.ts +20 -34
- package/util/files.js +36 -51
- package/util/glob.js +1 -1
- package/util/json.d.ts +0 -7
- package/util/json.js +0 -15
- package/util/logic.d.ts +5 -0
- package/util/logic.js +6 -1
- package/util/mermaid/dfg.d.ts +2 -1
- package/util/mermaid/dfg.js +7 -6
- package/util/mermaid/mermaid.d.ts +1 -0
- package/util/mermaid/mermaid.js +1 -0
- package/util/numbers.d.ts +0 -5
- package/util/numbers.js +0 -9
- package/util/objects.d.ts +3 -3
- package/util/objects.js +3 -3
- package/util/quads.d.ts +2 -2
- package/util/quads.js +1 -1
- package/util/r-base-packages.d.ts +14 -1
- package/util/r-base-packages.js +21 -1
- package/util/r-package-urls.d.ts +33 -0
- package/util/r-package-urls.js +79 -0
- package/util/r-version.d.ts +8 -2
- package/util/r-version.js +8 -2
- package/util/range.d.ts +173 -54
- package/util/range.js +221 -75
- package/util/record.d.ts +7 -6
- package/util/record.js +7 -6
- package/util/simple-df/dfg-ascii.js +6 -6
- package/util/summarizer.d.ts +2 -15
- package/util/summarizer.js +0 -15
- package/util/text/args.d.ts +2 -2
- package/util/text/args.js +2 -2
- package/util/text/playground-link.d.ts +17 -28
- package/util/text/playground-link.js +42 -18
- package/util/text/r-highlight.d.ts +20 -0
- package/util/text/r-highlight.js +171 -0
- package/util/text/strings.d.ts +6 -0
- package/util/text/strings.js +11 -2
- package/util/version.js +2 -2
- package/cli/run-script.d.ts +0 -7
- package/cli/run-script.js +0 -17
- package/project/sigdb/signature-match.d.ts +0 -18
- package/project/sigdb/signature-match.js +0 -32
- package/util/text/text.d.ts +0 -5
- package/util/text/text.js +0 -24
package/r-bridge/data/data.js
CHANGED
|
@@ -4,11 +4,13 @@ exports.flowrCapabilities = void 0;
|
|
|
4
4
|
const doc_files_1 = require("../../documentation/doc-util/doc-files");
|
|
5
5
|
const doc_code_1 = require("../../documentation/doc-util/doc-code");
|
|
6
6
|
const doc_dfg_1 = require("../../documentation/doc-util/doc-dfg");
|
|
7
|
+
const versions_1 = require("../lang-4.x/ast/model/versions");
|
|
7
8
|
const Joiner = '/';
|
|
8
|
-
const AdvancedR = (subname) => 'Advanced R' + Joiner + subname;
|
|
9
|
-
const RLang = (subname) => 'R Definition' + Joiner + subname;
|
|
10
|
-
const Issue = (num) => `${doc_files_1.FlowrGithubBaseRef}/flowr/issues/${num}`;
|
|
9
|
+
const AdvancedR = (subname, page) => ({ name: 'Advanced R' + Joiner + subname, href: 'https://adv-r.hadley.nz/' + page });
|
|
10
|
+
const RLang = (subname, anchor = subname.replaceAll(' ', '-')) => ({ name: 'R Definition' + Joiner + subname, href: 'https://cran.r-project.org/doc/manuals/r-release/R-lang.html#' + anchor });
|
|
11
11
|
const LinkTo = (id, label = id) => `[${label}](#${id})`;
|
|
12
|
+
const Wiki = (page, label) => `[${label}](${doc_files_1.FlowrWikiBaseRef}/${page.replaceAll(' ', '-')})`;
|
|
13
|
+
const Plugin = (path) => ({ name: `plugin/${path.replace(/^.*\//, '').replace(/\.ts$/, '').replace(/^flowr-/, '').replace(/-plugin$/, '')}`, href: (0, doc_files_1.flowrSourceFileUrl)(path) });
|
|
12
14
|
exports.flowrCapabilities = {
|
|
13
15
|
name: 'Capabilities of flowR',
|
|
14
16
|
description: 'This is an evolving representation of what started with #636 to formulate capabilities in a structured format.',
|
|
@@ -17,7 +19,7 @@ exports.flowrCapabilities = {
|
|
|
17
19
|
{
|
|
18
20
|
name: 'Names and Identifiers',
|
|
19
21
|
id: 'names-and-identifiers',
|
|
20
|
-
description:
|
|
22
|
+
description: `Every name an R program writes down, the ${LinkTo('form', 'form')} it is written in, and the ${LinkTo('resolution', 'binding')} it resolves to.`,
|
|
21
23
|
example: async (parser) => {
|
|
22
24
|
const code = '"f" <- function(x) { get("x") } \n`y x` <- 2\nprint(`y x` + f(3))';
|
|
23
25
|
return `
|
|
@@ -32,172 +34,269 @@ Identifiers of interest are:
|
|
|
32
34
|
|
|
33
35
|
Besides the parameter \`x\`, which is resolved in its ${LinkTo('lexicographic-scope')}, the other identifiers are resolved in the ${LinkTo('global-scope')}.
|
|
34
36
|
|
|
35
|
-
${await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { simplified: true })}
|
|
37
|
+
${await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { simplified: true, timeless: true })}
|
|
36
38
|
`;
|
|
37
39
|
},
|
|
38
40
|
capabilities: [
|
|
39
41
|
{
|
|
40
42
|
name: 'Form',
|
|
41
43
|
id: 'form',
|
|
44
|
+
description: `A name is written plainly, ${LinkTo('name-quoted', 'as a string')}, ${LinkTo('name-escaped', 'in backticks')}, or ${LinkTo('name-created', 'as the argument of a call')} that reads it as one.`,
|
|
42
45
|
capabilities: [
|
|
43
46
|
{
|
|
44
47
|
name: 'Normal',
|
|
45
48
|
id: 'name-normal',
|
|
46
49
|
supported: 'fully',
|
|
47
|
-
description: '
|
|
48
|
-
url: [
|
|
49
|
-
{ name: AdvancedR('Bindings'), href: 'https://adv-r.hadley.nz/names-values.html#binding-basics' },
|
|
50
|
-
{ name: RLang('Identifiers'), href: 'https://cran.r-project.org/doc/manuals/r-release/R-lang.html#Identifiers-1' }
|
|
51
|
-
]
|
|
50
|
+
description: `_A name written as R's grammar allows it, like \`a\` or \`plot\`._ Every other form ends up as one of these, and a ${LinkTo('resolution', 'lookup')} links it to the definitions that may reach it.`,
|
|
51
|
+
url: [AdvancedR('Bindings', 'names-values.html#binding-basics'), RLang('Identifiers', 'Identifiers-1')]
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
name: 'Quoted',
|
|
55
55
|
id: 'name-quoted',
|
|
56
56
|
supported: 'fully',
|
|
57
|
-
description:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
]
|
|
57
|
+
description: `_A name given as a string, like \`"a"\` or \`'plot'\`._ Such a name may hold spaces, but R accepts the quotes only where it is defined, so reading it back needs ${LinkTo('name-escaped', 'backticks')} or a ${LinkTo('name-created', 'name-creating call')}.`,
|
|
58
|
+
example: (0, doc_code_1.codeBlock)('r', '"my fn" <- function(x) x\n`my fn`(3)\nget("my fn")(3)'),
|
|
59
|
+
url: [AdvancedR('Non-Syntactic Names', 'names-values.html#non-syntactic')]
|
|
61
60
|
},
|
|
62
61
|
{
|
|
63
62
|
name: 'Escaped',
|
|
64
63
|
id: 'name-escaped',
|
|
65
64
|
supported: 'fully',
|
|
66
|
-
description:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
]
|
|
65
|
+
description: `_A name escaped in backticks, like \`\` \`a\` \`\` or \`\` \`my var\` \`\`._ It binds and resolves like a ${LinkTo('name-normal', 'normal name')}, the syntax only lifts the grammar's restriction on the characters it may hold.`,
|
|
66
|
+
example: (0, doc_code_1.codeBlock)('r', '`my var` <- 1\n`my var` + 1'),
|
|
67
|
+
url: [AdvancedR('Non-Syntactic Names', 'names-values.html#non-syntactic')]
|
|
70
68
|
},
|
|
71
69
|
{
|
|
72
70
|
name: 'Created',
|
|
73
71
|
id: 'name-created',
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
]
|
|
72
|
+
code: ['get', 'get0', 'mget', 'exists', 'match.fun'],
|
|
73
|
+
supported: 'fully',
|
|
74
|
+
description: `_A call that reads a string argument as the name it spells, such as \`get\`, \`get0\`, \`mget\`, \`exists\`, \`match.fun\`, and \`assign\`._ The string counts as a use of that name, or for \`assign\` as a ${LinkTo('assignment-functions', 'definition')}. A name only known at runtime (\`get(Sys.getenv("V"))\`) is not linked.`,
|
|
75
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1\nr <- get("x")\nprint(r)'),
|
|
76
|
+
url: [RLang('Identifiers', 'Identifiers-1')]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'Resolved Name',
|
|
80
|
+
id: 'name-created-resolved',
|
|
81
|
+
code: ['paste0', 'paste', 'file.path'],
|
|
82
|
+
supported: 'fully',
|
|
83
|
+
description: `_A ${LinkTo('name-created', 'created name')} whose string argument is not a literal but folds to one._ Covers ${LinkTo('strings', 'string literals')}, variables holding one, and \`paste0\`/\`paste\`/\`file.path\` over constants, each followed like a written-out name.`,
|
|
84
|
+
example: (0, doc_code_1.codeBlock)('r', 'nm <- paste0("x", 1)\nassign(nm, 42)\nget(nm)'),
|
|
85
|
+
url: [RLang('Identifiers', 'Identifiers-1')]
|
|
79
86
|
}
|
|
80
87
|
]
|
|
81
88
|
},
|
|
82
89
|
{
|
|
83
90
|
name: 'Resolution',
|
|
84
91
|
id: 'resolution',
|
|
92
|
+
description: `Which definitions a name may reach, through the ${LinkTo('lexicographic-scope', 'scopes')} around it, the ${LinkTo('dynamic-environment-resolution', 'environments')} a program builds, and the ${LinkTo('search-path', 'packages')} below them.`,
|
|
85
93
|
capabilities: [
|
|
86
94
|
{
|
|
87
95
|
name: 'Global Scope',
|
|
88
96
|
id: 'global-scope',
|
|
97
|
+
code: ['globalenv'],
|
|
89
98
|
supported: 'fully',
|
|
90
|
-
description: '
|
|
99
|
+
description: `_Resolve a name against the bindings of the global environment, whenever no enclosing ${LinkTo('function-definitions', 'function definition')} binds it._ Every top-level definition that may still be active is linked, so a use after an \`if\` reaches both branches' definitions.`,
|
|
100
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1\nf <- function() x\nf()'),
|
|
101
|
+
url: [RLang('Global environment')]
|
|
91
102
|
},
|
|
92
103
|
{
|
|
93
104
|
name: 'Lexicographic Scope',
|
|
94
105
|
id: 'lexicographic-scope',
|
|
95
106
|
supported: 'fully',
|
|
96
|
-
description:
|
|
107
|
+
description: `_Resolve a name to the innermost enclosing definition, and only to the ${LinkTo('global-scope', 'global scope')} when no enclosing one binds it._ Where a ${LinkTo('function-definitions', 'function')} is written decides what its body sees, not where it is called.`,
|
|
108
|
+
example: (0, doc_code_1.codeBlock)('r', 'f <- function() {\n y <- 1\n g <- function() y\n g()\n}\nf()'),
|
|
109
|
+
url: [RLang('Lexical environment'), AdvancedR('Lexical scoping', 'functions.html#lexical-scoping')]
|
|
97
110
|
},
|
|
98
111
|
{
|
|
99
112
|
name: 'Closures',
|
|
100
113
|
id: 'closures',
|
|
101
114
|
supported: 'partially',
|
|
102
|
-
description:
|
|
115
|
+
description: `_Two closures from the same factory keep independent state in R, as every call of the factory makes an environment of its own._ We keep one environment per ${LinkTo('function-definitions', 'definition')} instead, so a \`<<-\` in one closure is read as reaching the binding the other captured.`,
|
|
116
|
+
example: (0, doc_code_1.codeBlock)('r', 'counter <- function() {\n i <- 0\n function() {\n i <<- i + 1\n i\n }\n}\nc1 <- counter()\nc2 <- counter()\nc1()\nc1()\nr <- c2()\nprint(r)'),
|
|
117
|
+
url: [AdvancedR('Function factories', 'function-factories.html'), RLang('Scope of variables')]
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'Closure Capture',
|
|
121
|
+
id: 'closure-capture',
|
|
122
|
+
supported: 'fully',
|
|
123
|
+
description: '_A function captures the environment it was defined in, not the values that were in it._ So it sees a write made to that environment after its definition, a sibling closure\'s `<<-` included.',
|
|
124
|
+
example: (0, doc_code_1.codeBlock)('r', 'make <- function() {\n x <- 1\n list(get = function() x, set = function(v) x <<- v)\n}\no <- make()\no$set(5)\nr <- o$get()\nprint(r)'),
|
|
125
|
+
url: [AdvancedR('Function factories', 'function-factories.html'), RLang('Scope of variables')]
|
|
103
126
|
},
|
|
104
127
|
{
|
|
105
128
|
name: 'Dynamic Environment Resolution',
|
|
106
129
|
id: 'dynamic-environment-resolution',
|
|
107
|
-
|
|
108
|
-
description:
|
|
130
|
+
code: ['new.env'],
|
|
131
|
+
description: `_An environment a program builds and names itself, rather than one a ${LinkTo('function-definitions', 'definition')} opens._ Covers \`new.env\`, \`assign\`/\`get\`/\`local\` with \`envir=\`, \`e$x\`, \`attach\`, \`with\`, and aliasing such an environment through a variable.`,
|
|
132
|
+
example: (0, doc_code_1.codeBlock)('r', 'e <- new.env()\nassign("x", 3, envir = e)\nget("x", envir = e) + e$x'),
|
|
109
133
|
capabilities: [
|
|
110
134
|
{
|
|
111
|
-
name: 'Environment in
|
|
112
|
-
id: 'environment-in-
|
|
113
|
-
supported: '
|
|
114
|
-
description: '
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: 'Environment in Loops',
|
|
118
|
-
id: 'environment-in-loops',
|
|
119
|
-
supported: 'partially',
|
|
120
|
-
description: '_Tracking environment assignments inside loop constructs (for, while, repeat). The env variable is correctly attributed in each iteration body, but dynamic key generation (e.g., `paste0`) prevents static name resolution._'
|
|
135
|
+
name: 'Environment in Control Flow',
|
|
136
|
+
id: 'environment-in-control-flow',
|
|
137
|
+
supported: 'fully',
|
|
138
|
+
description: '_Track environment assignments and reads across branches and loop bodies, a key built at run time such as `paste0("k", i)` included._'
|
|
121
139
|
},
|
|
122
140
|
{
|
|
123
141
|
name: 'Environment Parent',
|
|
124
142
|
id: 'environment-parent',
|
|
125
143
|
supported: 'partially',
|
|
126
|
-
description: '_Specifying a parent for a newly-created environment
|
|
144
|
+
description: '_Specifying a parent for a newly-created environment from a dynamic or unknown expression (`new.env(parent = f())`)._ Such a parent falls back to the default (`parent.frame()`) instead of resolving.',
|
|
145
|
+
url: [AdvancedR('Parents', 'environments.html#parents')]
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'Environment Parent (Tracked)',
|
|
149
|
+
id: 'environment-parent-tracked',
|
|
150
|
+
supported: 'fully',
|
|
151
|
+
description: '_Specifying a parent for a newly-created environment from a tracked environment variable or a constant (`new.env(parent = e)`, `new.env(parent = emptyenv())`)._',
|
|
152
|
+
url: [AdvancedR('Parents', 'environments.html#parents')]
|
|
127
153
|
},
|
|
128
154
|
{
|
|
129
155
|
name: 'Environment Alias',
|
|
130
156
|
id: 'environment-alias',
|
|
131
157
|
supported: 'partially',
|
|
132
|
-
description:
|
|
158
|
+
description: `_Aliasing a tracked environment variable (\`alias <- e\`), which binds a second name to the same environment rather than a copy._ A write to the original made after the alias is not reflected through it, unlike a ${LinkTo('environment-alias-read', 'read')}.`
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: 'Environment Alias Read',
|
|
162
|
+
id: 'environment-alias-read',
|
|
163
|
+
supported: 'fully',
|
|
164
|
+
description: '_Reading through an aliased tracked environment variable (`alias <- e`)._ Every assign made up to the alias is visible through it.'
|
|
133
165
|
},
|
|
134
166
|
{
|
|
135
|
-
name: 'With
|
|
167
|
+
name: 'With',
|
|
136
168
|
id: 'environment-with',
|
|
169
|
+
code: ['with'],
|
|
170
|
+
supported: 'fully',
|
|
171
|
+
description: '_Evaluating an expression inside a named environment with `with(data, expr)`._ Reads of names the tracked env defines resolve, including through a computed `data` argument or a nested call.'
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: 'Parent Frame',
|
|
175
|
+
id: 'parent-frame',
|
|
176
|
+
code: ['parent.frame'],
|
|
137
177
|
supported: 'partially',
|
|
138
|
-
description: '
|
|
178
|
+
description: '_Reading via `parent.frame()$name`, and a write escaping through `eval.parent(quote(name <- value))`._ Works only one call away, and storing the frame first drops the binding.',
|
|
179
|
+
url: [AdvancedR('Call stacks', 'environments.html#call-stack')]
|
|
139
180
|
},
|
|
140
181
|
{
|
|
141
182
|
name: 'Dynamic Variable Removal',
|
|
142
183
|
id: 'dynamic-variable-removal',
|
|
184
|
+
code: ['rm', 'sys.frame'],
|
|
143
185
|
supported: 'partially',
|
|
144
186
|
description: '_Support for `rm(list=..., envir=sys.frame(N))` removing variables from a specific call frame. Currently handles negative and zero offsets from within depth-1 functions._'
|
|
145
187
|
}
|
|
146
|
-
]
|
|
188
|
+
],
|
|
189
|
+
url: [RLang('Environment objects')]
|
|
147
190
|
},
|
|
148
191
|
{
|
|
149
192
|
name: 'Environment Sharing',
|
|
150
193
|
id: 'environment-sharing',
|
|
151
|
-
supported: '
|
|
152
|
-
description:
|
|
194
|
+
supported: 'partially',
|
|
195
|
+
description: `_Handling side-effects through environments, which act as reference types and are not copied when modified._ A write through a parameter is kept as an unknown side effect of the call (see ${LinkTo('environment-alias')} and ${LinkTo('side-effects-in-function-call')}).`,
|
|
196
|
+
example: (0, doc_code_1.codeBlock)('r', 'e <- new.env()\nassign("x", 42, envir = e)\nprint(get("x", envir = e))'),
|
|
197
|
+
url: [RLang('Environment objects'), AdvancedR('Environments', 'environments.html')]
|
|
153
198
|
},
|
|
154
199
|
{
|
|
155
200
|
name: 'Search Type',
|
|
156
201
|
id: 'search-type',
|
|
157
202
|
supported: 'fully',
|
|
158
|
-
description:
|
|
203
|
+
description: `_Resolve a name in call position only against function definitions, a name in value position against every binding._ This is why the \`c <- 1\` below does not shadow the ${LinkTo('call-normal', 'call')} to \`c\`.`,
|
|
204
|
+
example: (0, doc_code_1.codeBlock)('r', 'c <- 1\nc(c, 2)'),
|
|
205
|
+
url: [AdvancedR('Functions versus variables', 'functions.html#functions-versus-variables')]
|
|
159
206
|
},
|
|
160
207
|
{
|
|
161
208
|
name: 'Search Path',
|
|
162
209
|
id: 'search-path',
|
|
163
|
-
|
|
164
|
-
|
|
210
|
+
code: ['attach'],
|
|
211
|
+
supported: 'fully',
|
|
212
|
+
description: `_Resolve a name against the packages [the search path](https://cran.r-project.org/doc/manuals/r-release/R-lang.html#Search-path) holds, whenever no scope in the script binds it._ Attached packages sit below \`.GlobalEnv\`, so a ${LinkTo('global-scope', 'global binding')} shadows an export.`,
|
|
213
|
+
example: (0, doc_code_1.codeBlock)('r', 'library(dplyr)\nfilter <- function(...) "mine"\nfilter(1)'),
|
|
214
|
+
url: [RLang('Search path'), AdvancedR('Search path', 'environments.html#search-path')]
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: 'Dynamic Search Path',
|
|
218
|
+
id: 'dynamic-search-path',
|
|
219
|
+
code: ['search', 'searchpaths'],
|
|
220
|
+
supported: 'not',
|
|
221
|
+
description: '_Programmatically inspecting or mutating the search path with `search()`, `searchpaths()`, or detaching by position._ None of this is modelled, and `search()` reads as an unknown call.',
|
|
222
|
+
example: (0, doc_code_1.codeBlock)('r', 'library(stats)\nn <- search()\nprint(n[2])'),
|
|
223
|
+
url: [RLang('Search path')]
|
|
165
224
|
},
|
|
166
225
|
{
|
|
167
226
|
name: 'Namespaces',
|
|
168
227
|
id: 'namespaces',
|
|
169
228
|
supported: 'partially',
|
|
170
|
-
description:
|
|
229
|
+
description: `_Separate what a package's namespace holds from what attaching it puts on the ${LinkTo('search-path', 'search path')}._ The imports environment a package carries for itself is not modelled.`,
|
|
230
|
+
url: [AdvancedR('Namespaces', 'environments.html#namespaces')]
|
|
171
231
|
},
|
|
172
232
|
{
|
|
173
233
|
name: 'Accessing Exported Names',
|
|
174
234
|
id: 'accessing-exported-names',
|
|
175
|
-
|
|
176
|
-
|
|
235
|
+
code: ['::'],
|
|
236
|
+
supported: 'fully',
|
|
237
|
+
description: `_Resolve a name written \`pkg::name\` to the export it names, no matter what the script binds._ This depends on what the ${Wiki('Signature Database', 'signature database')} knows, and an unresolved name stays unresolved rather than reported.`,
|
|
238
|
+
example: (0, doc_code_1.codeBlock)('r', 'median <- function(x) 0\nmedian(1:3)\nstats::median(1:3)'),
|
|
239
|
+
url: [AdvancedR('Namespaces', 'environments.html#namespaces')]
|
|
177
240
|
},
|
|
178
241
|
{
|
|
179
242
|
name: 'Accessing Internal Names',
|
|
180
243
|
id: 'accessing-internal-names',
|
|
181
|
-
|
|
182
|
-
|
|
244
|
+
code: [':::'],
|
|
245
|
+
supported: 'fully',
|
|
246
|
+
description: `_Resolve a name written \`pkg:::name\`, which reaches what the namespace keeps to itself._ Whether the name is genuinely internal rather than exported is not checked (see ${LinkTo('namespace-exports')}).`,
|
|
247
|
+
example: (0, doc_code_1.codeBlock)('r', '"C_cor" %in% getNamespaceExports("stats")\nstats:::C_cor$name'),
|
|
248
|
+
url: [AdvancedR('Namespaces', 'environments.html#namespaces')]
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
name: 'Namespace Exports',
|
|
252
|
+
id: 'namespace-exports',
|
|
253
|
+
code: ['getNamespaceExports'],
|
|
254
|
+
supported: 'fully',
|
|
255
|
+
description: `_Know which names a package's namespace declares exported versus keeps internal._ The ${Wiki('Linter', '`namespace-access` rule')} checks a \`::\`/\`:::\` choice against what the ${Wiki('Signature Database', 'signature database')} records, which omits most internal names to stay small.`,
|
|
256
|
+
example: (0, doc_code_1.codeBlock)('r', 'stats::median(1:3)\nstats:::C_cor'),
|
|
257
|
+
url: [{ name: 'Writing R Extensions/Package namespaces', href: 'https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Package-namespaces' }]
|
|
183
258
|
},
|
|
184
259
|
{
|
|
185
260
|
name: 'Library Loading',
|
|
186
261
|
id: 'library-loading',
|
|
187
|
-
|
|
188
|
-
|
|
262
|
+
code: ['library', 'require', 'attachNamespace', 'loadNamespace'],
|
|
263
|
+
supported: 'fully',
|
|
264
|
+
description: `_Attach a package named by \`library\`, \`require\`, \`attachNamespace\`, ... to the ${LinkTo('search-path', 'search path')}._ From that point on an unbound name may resolve to one of its exports, while a binding in the script still shadows it.`,
|
|
265
|
+
example: (0, doc_code_1.codeBlock)('r', 'library(stats)\nrequire(utils)\nattachNamespace("tools")'),
|
|
266
|
+
url: [RLang('Search path'), AdvancedR('Search path', 'environments.html#search-path')]
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
name: 'Library Unloading',
|
|
270
|
+
id: 'library-unloading',
|
|
271
|
+
code: ['detach', 'unloadNamespace'],
|
|
272
|
+
supported: 'not',
|
|
273
|
+
description: `_Undo a ${LinkTo('library-loading', 'library attach')} with \`detach\`, \`unloadNamespace\`, ..._ Neither is modelled, so a name used after \`detach\` still resolves to the package's export.`,
|
|
274
|
+
example: (0, doc_code_1.codeBlock)('r', 'library(stats)\nmedian(1:3)\ndetach("package:stats")\nmedian(1:3)'),
|
|
275
|
+
url: [RLang('Search path')]
|
|
189
276
|
},
|
|
190
277
|
{
|
|
191
278
|
name: 'Dynamic Scope Changes',
|
|
192
279
|
id: 'dynamic-scope-changes',
|
|
280
|
+
code: ['local'],
|
|
281
|
+
supported: 'fully',
|
|
282
|
+
description: `_Open a scope of its own with a plain [\`local\`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/local) block._ A name it binds is invisible outside, while a ${LinkTo('super-left-assignment', 'super assignment')} from within reaches the enclosing scope.`,
|
|
283
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1\nlocal({\n x <- 2\n x\n})\nx')
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
name: 'Local with Explicit Environment',
|
|
287
|
+
id: 'local-envir-argument',
|
|
193
288
|
supported: 'partially',
|
|
194
|
-
description: '
|
|
289
|
+
description: '_Send `local`\'s body to a specific environment._ `new.env()` and `globalenv()` work, but inside a function that already binds the name the write lands in that frame instead.',
|
|
290
|
+
example: (0, doc_code_1.codeBlock)('r', 'e <- new.env()\nlocal(y <- 2, envir = e)\nget("y", envir = e)'),
|
|
291
|
+
url: [{ name: '`local`', href: 'https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/local' }]
|
|
195
292
|
},
|
|
196
293
|
{
|
|
197
294
|
name: 'Anonymous Bindings',
|
|
198
295
|
id: 'anonymous-bindings',
|
|
296
|
+
code: ['Recall'],
|
|
199
297
|
supported: 'fully',
|
|
200
|
-
description:
|
|
298
|
+
description: `_Resolve a call that does not name the function it runs, as [\`Recall\`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/Recall) does._ It is linked to the enclosing ${LinkTo('function-definitions', 'function definition')}, the same way a call through the function's own name ${LinkTo('recursion', 'is')}.`,
|
|
299
|
+
example: (0, doc_code_1.codeBlock)('r', 'fact <- function(n) if(n <= 1) 1 else n * Recall(n - 1)\nfact(5)')
|
|
201
300
|
}
|
|
202
301
|
]
|
|
203
302
|
}
|
|
@@ -206,450 +305,607 @@ ${await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { simplified: true })}
|
|
|
206
305
|
{
|
|
207
306
|
name: 'Expressions',
|
|
208
307
|
id: 'expressions',
|
|
308
|
+
description: `The ${LinkTo('function-calls', 'calls')}, ${LinkTo('operators', 'operators')}, ${LinkTo('control-flow', 'control flow')}, and ${LinkTo('function-definitions', 'function definitions')} an R program is built from.`,
|
|
209
309
|
capabilities: [
|
|
210
310
|
{
|
|
211
|
-
name: '
|
|
311
|
+
name: 'Calls',
|
|
212
312
|
id: 'function-calls',
|
|
313
|
+
description: `Everything that is a call in R, from \`f(x)\` over ${LinkTo('infix-calls', 'an operator')} to a ${LinkTo('grouping', 'group')}, with the ${LinkTo('resolve-arguments', 'arguments')} it binds and the ${LinkTo('side-effects-in-function-call', 'side effects')} it may have.`,
|
|
213
314
|
capabilities: [
|
|
214
315
|
{
|
|
215
316
|
name: 'Grouping',
|
|
216
317
|
id: 'grouping',
|
|
217
318
|
supported: 'fully',
|
|
218
|
-
description:
|
|
319
|
+
description: `_Read \`(\` and \`{\` as the calls they are, mapped to their primitive implementations._ A group hands on the value of its last expression, so \`x <- { 1; 2 }\` binds \`x\` to \`2\`, and ${LinkTo('redefinition-of-built-in-functions-primitives', 'redefining')} \`\` \`{\` \`\` replaces that meaning.`,
|
|
320
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- {\n 1\n 2\n}\ny <- (3)'),
|
|
321
|
+
url: [RLang('Grouping')]
|
|
219
322
|
},
|
|
220
323
|
{
|
|
221
324
|
name: 'Normal Call',
|
|
222
325
|
id: 'call-normal',
|
|
223
326
|
supported: 'fully',
|
|
224
|
-
description:
|
|
327
|
+
description: `_Link a call like \`f(x)\` or \`foo::bar(x, y)\` to the ${LinkTo('function-definitions', 'definitions')} its name may resolve to, and its arguments to the formals they bind._ Every definition that may be active is linked, which over-approximates rather than picking one.`,
|
|
225
328
|
capabilities: [
|
|
226
329
|
{
|
|
227
330
|
name: 'Unnamed Arguments',
|
|
228
331
|
id: 'unnamed-arguments',
|
|
229
332
|
supported: 'fully',
|
|
230
|
-
description:
|
|
333
|
+
description: `_An argument given without a name, like \`f(3)\`, which binds to a formal by position._ It is matched after every ${LinkTo('named-arguments', 'named argument')} has taken its formal.`,
|
|
334
|
+
url: [RLang('Arguments')]
|
|
231
335
|
},
|
|
232
336
|
{
|
|
233
337
|
name: 'Empty Arguments',
|
|
234
338
|
id: 'empty-arguments',
|
|
235
339
|
supported: 'fully',
|
|
236
|
-
description:
|
|
340
|
+
description: `_An argument left out entirely, as the second one in \`foo::bar(3, ,42)\`._ It still takes a position, which is what makes \`m[1, ]\` an ${LinkTo('index-access', 'index access')} on one dimension.`,
|
|
341
|
+
example: (0, doc_code_1.codeBlock)('r', 'm <- matrix(1:6, nrow = 2)\nm[1, ]\nm[, 2]'),
|
|
342
|
+
url: [RLang('Arguments')]
|
|
237
343
|
},
|
|
238
344
|
{
|
|
239
345
|
name: 'Named Arguments',
|
|
240
346
|
id: 'named-arguments',
|
|
241
347
|
supported: 'fully',
|
|
242
|
-
description:
|
|
348
|
+
description: `_An argument given with a name, like \`f(x = 3)\`, which binds to the formal of that name._ Inside a call \`=\` names an argument rather than ${LinkTo('local-equal-assignment', 'binding a name')}.`,
|
|
349
|
+
url: [RLang('Argument matching')]
|
|
243
350
|
},
|
|
244
351
|
{
|
|
245
352
|
name: 'String Arguments',
|
|
246
353
|
id: 'string-arguments',
|
|
247
354
|
supported: 'fully',
|
|
248
|
-
description:
|
|
355
|
+
description: `_An argument whose name is written as a string, like \`f('x' = 3)\`._ It binds the same formal a ${LinkTo('named-arguments', 'named argument')} would, the way a ${LinkTo('name-quoted', 'quoted name')} binds an ordinary one.`
|
|
249
356
|
},
|
|
250
357
|
{
|
|
251
358
|
name: 'Resolve Arguments',
|
|
252
359
|
id: 'resolve-arguments',
|
|
253
360
|
supported: 'fully',
|
|
254
|
-
description:
|
|
361
|
+
description: `_Match every argument of a call to the formal it binds, exact names first, then unique prefixes ([\`pmatch\`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/pmatch)), then ${LinkTo('unnamed-arguments', 'position')}._ A formal behind ${LinkTo('formals-dot-dot-dot', '`...`')} matches only exactly, and an ambiguous prefix binds nothing.`,
|
|
362
|
+
example: (0, doc_code_1.codeBlock)('r', 'f <- function(verbose = FALSE, value = 0) c(verbose, value)\nf(TRUE, val = 3)\nf(verb = TRUE)'),
|
|
363
|
+
url: [RLang('Argument matching')]
|
|
255
364
|
},
|
|
256
365
|
{
|
|
257
366
|
name: 'Side-Effects in Argument',
|
|
258
367
|
id: 'side-effects-in-argument',
|
|
259
368
|
supported: 'partially',
|
|
260
|
-
description:
|
|
369
|
+
description: `_An argument that binds a name while it is evaluated, as \`f(x <- 3)\` does._ Whether the argument is ever forced is not modelled (see ${LinkTo('formals-promises', 'promises')}), so \`f <- function(a) 1; f(x <- 3)\` still believes \`x\` is 3.`,
|
|
370
|
+
example: (0, doc_code_1.codeBlock)('r', 'f <- function(a) a\nf(x <- 3)\nx'),
|
|
371
|
+
url: [RLang('Argument evaluation')]
|
|
261
372
|
},
|
|
262
373
|
{
|
|
263
374
|
name: 'Side-Effects in Function Call',
|
|
264
375
|
id: 'side-effects-in-function-call',
|
|
265
376
|
supported: 'partially',
|
|
266
|
-
description:
|
|
377
|
+
description: `_A call that binds a name outside itself, as \`setXTo(3)\` does with a ${LinkTo('super-left-assignment', 'super assignment')}._ Such a write reaches the caller through several call levels, but one through a ${LinkTo('environment-sharing', 'shared environment')} is missed.`,
|
|
378
|
+
example: (0, doc_code_1.codeBlock)('r', 'set_x <- function(v) x <<- v\nset_x(3)\nx'),
|
|
379
|
+
url: [AdvancedR('Super assignment', 'environments.html#super-assignment--')]
|
|
267
380
|
}
|
|
268
|
-
]
|
|
381
|
+
],
|
|
382
|
+
url: [RLang('Function calls')]
|
|
269
383
|
},
|
|
270
384
|
{
|
|
271
385
|
name: 'Recursion',
|
|
272
386
|
id: 'recursion',
|
|
273
387
|
supported: 'fully',
|
|
274
|
-
description:
|
|
388
|
+
description: `_A call to \`f\` inside the ${LinkTo('function-definitions', 'definition')} of \`f\`._ The name resolves to the definition it sits in, so the call links back to it rather than staying unresolved.`,
|
|
389
|
+
example: (0, doc_code_1.codeBlock)('r', 'fib <- function(n) if(n < 2) n else fib(n - 1) + fib(n - 2)\nfib(10)')
|
|
275
390
|
},
|
|
276
391
|
{
|
|
277
392
|
name: 'Anonymous Calls',
|
|
278
393
|
id: 'call-anonymous',
|
|
279
394
|
supported: 'fully',
|
|
280
|
-
description:
|
|
395
|
+
description: `_A call whose target is an expression rather than a name, like \`(function(x) x)(3)\` or \`factory(0)()\`._ It links to the ${LinkTo('function-definitions', 'definition')} that expression yields, without a name being involved.`,
|
|
396
|
+
example: (0, doc_code_1.codeBlock)('r', '(function(x) x + 1)(3)\nfactory <- function() function() 42\nfactory()()'),
|
|
397
|
+
url: [AdvancedR('First-class functions', 'functions.html#first-class-functions')]
|
|
281
398
|
},
|
|
282
399
|
{
|
|
283
400
|
name: 'Infix Calls',
|
|
284
401
|
id: 'infix-calls',
|
|
285
402
|
supported: 'fully',
|
|
286
|
-
description:
|
|
403
|
+
description: `_An operator written between its arguments, like \`x + y\` or \`x %>% f(y)\`._ It is the same ${LinkTo('call-normal', 'call')} as \`\` \`+\`(x, y) \`\`, which is why ${LinkTo('redefinition-of-built-in-functions-primitives', 'redefining the operator')} changes what it does.`,
|
|
404
|
+
example: (0, doc_code_1.codeBlock)('r', 'identical(1 + 2, `+`(1, 2))'),
|
|
405
|
+
url: [RLang('Infix and prefix operators')]
|
|
287
406
|
},
|
|
288
407
|
{
|
|
289
408
|
name: 'Redefinition of Built-In Functions/primitives',
|
|
290
409
|
id: 'redefinition-of-built-in-functions-primitives',
|
|
291
|
-
supported: '
|
|
292
|
-
description:
|
|
410
|
+
supported: 'fully',
|
|
411
|
+
description: `_A name that R defines being bound in the program, as in \`print <- function(x) x\` or \`\` \`for\` <- function(a,b,c) a \`\`._ The redefinition wins wherever the built-in would have been used, respecting ${LinkTo('lexicographic-scope', 'scope')} and order. Only ${LinkTo('accessing-exported-names', '`::`/`:::`')} are exempt.`,
|
|
412
|
+
example: (0, doc_code_1.codeBlock)('r', '`+` <- function(a, b) a * b\n2 + 3'),
|
|
413
|
+
url: [RLang('Builtin objects and special forms')]
|
|
293
414
|
},
|
|
294
415
|
{
|
|
295
416
|
name: 'Functions with global side effects',
|
|
296
417
|
id: 'functions-with-global-side-effects',
|
|
297
418
|
supported: 'partially',
|
|
298
|
-
description:
|
|
419
|
+
description: `_A call that changes state the rest of the program reads without naming it, as \`setwd\` changes where a path points._ Only the ${LinkTo('working-directory', 'working directory')} is interpreted, while other ambient state such as ${LinkTo('built-in-options', 'the options')} stays an unknown side effect.`,
|
|
420
|
+
example: (0, doc_code_1.codeBlock)('r', 'setwd("/tmp")\nread.csv("data.csv")')
|
|
299
421
|
},
|
|
300
422
|
{
|
|
301
423
|
name: 'Working Directory',
|
|
302
424
|
id: 'working-directory',
|
|
425
|
+
code: ['setwd', 'getwd'],
|
|
303
426
|
supported: 'partially',
|
|
304
|
-
description: '_Track the effective working directory across `setwd
|
|
427
|
+
description: '_Track the effective working directory across `setwd`, control-flow- and location-sensitive._ Interprocedural, sourced, and loop cases are treated as unbounded.'
|
|
428
|
+
},
|
|
429
|
+
]
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
name: 'Index Access',
|
|
433
|
+
id: 'index-access',
|
|
434
|
+
description: 'The bracket, double-bracket, dollar, and slot forms for picking an element out of a container, with names, empty positions, and multiple indices.',
|
|
435
|
+
capabilities: [
|
|
436
|
+
{
|
|
437
|
+
name: 'Single Bracket Access',
|
|
438
|
+
id: 'single-bracket-access',
|
|
439
|
+
code: ['['],
|
|
440
|
+
supported: 'fully',
|
|
441
|
+
description: `_The \`[\` call, as in \`x[i]\`, \`x[i, ,b]\`, or \`x[3][y]\`._ The container is read as a whole without separating the cell an index picks, and writing through it is a ${LinkTo('replacement-functions', 'replacement call')}.`,
|
|
442
|
+
example: (0, doc_code_1.codeBlock)('r', 'l <- list(a = 1, b = 2)\nl["a"]\nl[c("a", "b")]'),
|
|
443
|
+
url: [RLang('Indexing'), AdvancedR('Selecting multiple elements', 'subsetting.html#subset-multiple')]
|
|
305
444
|
},
|
|
306
445
|
{
|
|
307
|
-
name: '
|
|
308
|
-
id: '
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
description: '_Detect calls like `x[i]`, `x[i, ,b]`, `x[3][y]`, ... This does not include the real separation of cells, which is handled extra._'
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
name: 'Double Bracket Access',
|
|
318
|
-
id: 'double-bracket-access',
|
|
319
|
-
supported: 'fully',
|
|
320
|
-
description: '_Detect calls like `x[[i]]`, `x[[i, b]]`, ... Similar to single bracket._'
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
name: 'Dollar Access',
|
|
324
|
-
id: 'dollar-access',
|
|
325
|
-
supported: 'fully',
|
|
326
|
-
description: '_Detect calls like `x$y`, `x$"y"`, `x$y$z`, ..._'
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
name: 'Slot Access',
|
|
330
|
-
id: 'slot-access',
|
|
331
|
-
supported: 'fully',
|
|
332
|
-
description: '_Detect calls like `x@y`, `x@y@z`, ..._'
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
name: 'Access with Argument-Names',
|
|
336
|
-
id: 'access-with-argument-names',
|
|
337
|
-
supported: 'fully',
|
|
338
|
-
description: '_Detect calls like `x[i = 3]`, `x[[i=]]`, ..._'
|
|
339
|
-
},
|
|
340
|
-
{
|
|
341
|
-
name: 'Access with Empty',
|
|
342
|
-
id: 'access-with-empty',
|
|
343
|
-
supported: 'fully',
|
|
344
|
-
description: '_Detect calls like `x[]`, `x[2,,42]`, ..._'
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
name: 'Subsetting (Multiple Indices)',
|
|
348
|
-
id: 'subsetting-multiple',
|
|
349
|
-
supported: 'fully',
|
|
350
|
-
description: '_Detect calls like `x[i > 3]`, `x[c(1,3)]`, ..._'
|
|
351
|
-
}
|
|
352
|
-
]
|
|
446
|
+
name: 'Double Bracket Access',
|
|
447
|
+
id: 'double-bracket-access',
|
|
448
|
+
code: ['[['],
|
|
449
|
+
supported: 'fully',
|
|
450
|
+
description: `_The \`[[\` call, as in \`x[[i]]\` or \`x[[i, b]]\`._ Read like ${LinkTo('single-bracket-access', 'single-bracket access')}, without modelling the difference in what R returns.`,
|
|
451
|
+
example: (0, doc_code_1.codeBlock)('r', 'l <- list(a = 1, b = 2)\nl[["a"]]\nl[[2]]'),
|
|
452
|
+
url: [RLang('Indexing'), AdvancedR('Selecting a single element', 'subsetting.html#subset-single')]
|
|
353
453
|
},
|
|
354
454
|
{
|
|
355
|
-
name: '
|
|
356
|
-
id: '
|
|
455
|
+
name: 'Dollar Access',
|
|
456
|
+
id: 'dollar-access',
|
|
457
|
+
code: ['$'],
|
|
458
|
+
supported: 'fully',
|
|
459
|
+
description: '_The `$` call, as in `x$y`, `x$"y"`, or `x$y$z`, whose right side is a name rather than a value._ On a list `$` matches that name partially, so `l$al` reaches an element named `alpha`.',
|
|
460
|
+
example: (0, doc_code_1.codeBlock)('r', 'l <- list(alpha = 1)\nl$alpha\nl$al'),
|
|
461
|
+
url: [RLang('Operators')]
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
name: 'Slot Access',
|
|
465
|
+
id: 'slot-access',
|
|
466
|
+
code: ['@'],
|
|
467
|
+
supported: 'fully',
|
|
468
|
+
description: `_The \`@\` call, which reads a slot of an ${LinkTo('oop-s4', 'S4')} object._ The slot name is read like any other access, without checking it against the class \`setClass\` declared.`,
|
|
469
|
+
example: (0, doc_code_1.codeBlock)('r', 'setClass("P", representation(x = "numeric"))\np <- new("P", x = 1)\np@x'),
|
|
470
|
+
url: [RLang('Classes')]
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
name: 'Access with Argument-Names',
|
|
474
|
+
id: 'access-with-argument-names',
|
|
475
|
+
supported: 'fully',
|
|
476
|
+
description: `_An index given with a name, as in \`x[i = 3]\` or \`x[[i=]]\`._ It is matched like any other ${LinkTo('named-arguments', 'named argument')} of the underlying \`[\` call.`
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
name: 'Access with Empty',
|
|
480
|
+
id: 'access-with-empty',
|
|
481
|
+
supported: 'fully',
|
|
482
|
+
description: `_An index left out, as in \`x[]\` or \`x[2,,42]\`._ The gap is an ${LinkTo('empty-arguments', 'empty argument')} and still counts as a position.`
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
name: 'Subsetting (Multiple Indices)',
|
|
486
|
+
id: 'subsetting-multiple',
|
|
487
|
+
supported: 'fully',
|
|
488
|
+
description: `_An index that is a vector or a condition, as in \`x[i > 3]\` or \`x[c(1,3)]\`._ The index expression is read, but which elements it selects stays unknown, as ${LinkTo('vectorized-operator-or-functions', 'vectorized operations')} are not evaluated.`,
|
|
489
|
+
example: (0, doc_code_1.codeBlock)('r', 'v <- c(a = 1, b = 2, c = 3)\nv[c(1, 3)]\nv[v > 1]'),
|
|
490
|
+
url: [RLang('Indexing by vectors'), AdvancedR('Selecting multiple elements', 'subsetting.html#subset-multiple')]
|
|
491
|
+
}
|
|
492
|
+
]
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
name: 'Operators',
|
|
496
|
+
id: 'operators',
|
|
497
|
+
description: "R's unary, binary, and special operators, the model formula, and every way a name can be bound to a value.",
|
|
498
|
+
capabilities: [
|
|
499
|
+
{
|
|
500
|
+
name: 'Unary Operator',
|
|
501
|
+
id: 'unary-operator',
|
|
502
|
+
supported: 'fully',
|
|
503
|
+
description: `_An operator written before its single argument, like \`+3\` or \`-3\`._ It is a ${LinkTo('call-normal', 'call')} of the operator's name with one argument.`,
|
|
504
|
+
url: [RLang('Operators')]
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
name: 'Binary Operator',
|
|
508
|
+
id: 'binary-operator',
|
|
509
|
+
supported: 'fully',
|
|
510
|
+
description: `_An operator written between its two arguments, like \`3 + 4\` or \`3 * 4\`._ It is a ${LinkTo('call-normal', 'call')} of the operator's name with both arguments, in the order ${LinkTo('precedence', 'R gives them')}.`,
|
|
357
511
|
capabilities: [
|
|
358
512
|
{
|
|
359
|
-
name: '
|
|
360
|
-
id: '
|
|
513
|
+
name: 'Special Operator',
|
|
514
|
+
id: 'special-operator',
|
|
515
|
+
code: ['%%'],
|
|
361
516
|
supported: 'fully',
|
|
362
|
-
description:
|
|
517
|
+
description: `_An operator whose name is spelled between percent signs, like \`3 %in% 4\` or \`3 %*% 4\`._ The name binds like any other, so a program may define \`%between%\` itself and the ${LinkTo('infix-calls', 'infix call')} resolves to it.`,
|
|
518
|
+
example: (0, doc_code_1.codeBlock)('r', '`%between%` <- function(x, r) x >= r[1] & x <= r[2]\n5 %between% c(1, 10)'),
|
|
519
|
+
url: [RLang('Operator tokens')]
|
|
363
520
|
},
|
|
364
521
|
{
|
|
365
|
-
name: '
|
|
366
|
-
id: '
|
|
367
|
-
|
|
368
|
-
|
|
522
|
+
name: 'Model Formula',
|
|
523
|
+
id: 'model-formula',
|
|
524
|
+
code: ['~'],
|
|
525
|
+
supported: 'partially',
|
|
526
|
+
description: `_A formula written with \`~\`, like \`y ~ x\` or \`y ~ x + z\`._ Its operands are ${LinkTo('non-standard-evaluations-semantics', 'non-standard evaluation')}: a bare \`y ~ x\` names columns rather than variables, so neither name is read.`,
|
|
527
|
+
example: (0, doc_code_1.codeBlock)('r', 'k <- 2\nf <- y ~ poly(x, k)\nall.vars(f)')
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
name: 'Assignments and Bindings',
|
|
531
|
+
id: 'assignments-and-bindings',
|
|
532
|
+
description: `Every way to bind a name to a value, with the ${LinkTo('local-left-assignment', 'local')} and ${LinkTo('super-left-assignment', 'super')} operators, the ${LinkTo('assignment-functions', 'calls doing the same')}, or a write through a ${LinkTo('replacement-functions', 'replacement function')}.`,
|
|
369
533
|
capabilities: [
|
|
370
534
|
{
|
|
371
|
-
name: '
|
|
372
|
-
id: '
|
|
535
|
+
name: 'Local Left Assignment',
|
|
536
|
+
id: 'local-left-assignment',
|
|
537
|
+
code: ['<-'],
|
|
538
|
+
supported: 'fully',
|
|
539
|
+
description: `_Bind a name in the current scope with \`<-\`, as in \`x <- 3\`._ A target that is an ${LinkTo('index-access', 'access')} (\`x$y <- 3\`) rebinds the whole container through a ${LinkTo('replacement-functions', 'replacement function')}.`,
|
|
540
|
+
url: [AdvancedR('Binding basics', 'names-values.html#binding-basics')]
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
name: 'Local Right Assignment',
|
|
544
|
+
id: 'local-right-assignment',
|
|
545
|
+
code: ['->'],
|
|
546
|
+
supported: 'fully',
|
|
547
|
+
description: `_Bind a name with \`->\`, as in \`3 -> x\`._ Identical to ${LinkTo('local-left-assignment', 'left assignment')} with the sides swapped.`,
|
|
548
|
+
url: [AdvancedR('Binding basics', 'names-values.html#binding-basics')]
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
name: 'Local Equal Assignment',
|
|
552
|
+
id: 'local-equal-assignment',
|
|
553
|
+
supported: 'fully',
|
|
554
|
+
description: `_Bind a name with \`=\`, as in \`x = 3\`._ This holds only at the start of an expression, as inside a call the same token gives a ${LinkTo('named-arguments', 'named argument')} (\`f(a = 3)\`).`,
|
|
555
|
+
example: (0, doc_code_1.codeBlock)('r', 'x = 3\nf <- function(a) a\nf(a = x)'),
|
|
556
|
+
url: [AdvancedR('Binding basics', 'names-values.html#binding-basics')]
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
name: 'Local Table Assignment',
|
|
560
|
+
id: 'local-table-assignment',
|
|
561
|
+
code: [':='],
|
|
562
|
+
supported: 'fully',
|
|
563
|
+
description: `_Bind a column in place with data.table's \`:=\`, as in \`x[,a:=3,]\`._ It is read as a write to the table, not to a name, and which columns exist stays unknown (see ${LinkTo('data-masking', 'data masking')}).`
|
|
564
|
+
},
|
|
565
|
+
{
|
|
566
|
+
name: 'Super Left Assignment',
|
|
567
|
+
id: 'super-left-assignment',
|
|
568
|
+
code: ['<<-'],
|
|
569
|
+
supported: 'fully',
|
|
570
|
+
description: `_Bind a name in an enclosing scope with \`<<-\`, as in \`x <<- 42\`._ The write leaves the ${LinkTo('function-definitions', 'function')} it sits in, which is what makes it a ${LinkTo('side-effects-in-function-call', 'side effect of the call')}.`,
|
|
571
|
+
url: [AdvancedR('Super assignment', 'environments.html#super-assignment--')]
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
name: 'Super Right Assignment',
|
|
575
|
+
id: 'super-right-assignment',
|
|
576
|
+
code: ['->>'],
|
|
577
|
+
supported: 'fully',
|
|
578
|
+
description: `_Bind a name in an enclosing scope with \`->>\`, as in \`42 ->> x\`._ Identical to ${LinkTo('super-left-assignment', 'super left assignment')} with the sides swapped.`,
|
|
579
|
+
url: [AdvancedR('Super assignment', 'environments.html#super-assignment--')]
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
name: 'Return Value of Assignments',
|
|
583
|
+
id: 'return-value-of-assignments',
|
|
373
584
|
supported: 'fully',
|
|
374
|
-
description: '
|
|
585
|
+
description: '_An assignment is itself an expression that hands on the value it bound._ This is what makes `x <- y <- 3` bind both names and `print(x <- 4)` print `4`.',
|
|
586
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- y <- 3\nprint(x <- 4)')
|
|
375
587
|
},
|
|
376
588
|
{
|
|
377
|
-
name: '
|
|
378
|
-
id: '
|
|
589
|
+
name: 'Assignment Functions',
|
|
590
|
+
id: 'assignment-functions',
|
|
591
|
+
code: ['assign', 'delayedAssign'],
|
|
379
592
|
supported: 'partially',
|
|
380
|
-
description:
|
|
593
|
+
description: `_Bind a name given as a string, with \`assign\`, \`delayedAssign\`, ..._ The name has to be a ${LinkTo('name-created-resolved', 'resolvable string')}, and what a delayed assignment does when forced is not modelled.`,
|
|
594
|
+
example: (0, doc_code_1.codeBlock)('r', 'assign("x", 3)\ndelayedAssign("y", x * 2)\ny')
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
name: 'Range Assignment',
|
|
598
|
+
id: 'range-assignment',
|
|
599
|
+
supported: 'fully',
|
|
600
|
+
description: `_Write to a range of a container, as in \`x[1:3] <- 3\`._ Like every ${LinkTo('replacement-functions', 'replacement call')} it rebinds the whole container, as which cells the range covers is not tracked.`,
|
|
601
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1:5\nx[2:3] <- 0\nx'),
|
|
602
|
+
url: [RLang('Subset assignment'), AdvancedR('Subassignment', 'subsetting.html#subassignment')]
|
|
381
603
|
},
|
|
382
604
|
{
|
|
383
|
-
name: '
|
|
384
|
-
id: '
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
{
|
|
399
|
-
name: 'Local Equal Assignment',
|
|
400
|
-
id: 'local-equal-assignment',
|
|
401
|
-
supported: 'fully',
|
|
402
|
-
description: '_Handle `x = 3`, `x$y := 3`, ..._'
|
|
403
|
-
},
|
|
404
|
-
{
|
|
405
|
-
name: 'Local Table Assignment',
|
|
406
|
-
id: 'local-table-assignment',
|
|
407
|
-
supported: 'fully',
|
|
408
|
-
description: '_Handle `x[,a:=3,]`, ..._'
|
|
409
|
-
},
|
|
410
|
-
{
|
|
411
|
-
name: 'Super Left Assignment',
|
|
412
|
-
id: 'super-left-assignment',
|
|
413
|
-
supported: 'fully',
|
|
414
|
-
description: '_Handle `x <<- 42`, `x$y <<- 42`, ..._'
|
|
415
|
-
},
|
|
416
|
-
{
|
|
417
|
-
name: 'Super Right Assignment',
|
|
418
|
-
id: 'super-right-assignment',
|
|
419
|
-
supported: 'fully',
|
|
420
|
-
description: '_Handle `42 ->> x`, `42 ->> x$y`, ..._'
|
|
421
|
-
},
|
|
422
|
-
{
|
|
423
|
-
name: 'Return Value of Assignments',
|
|
424
|
-
id: 'return-value-of-assignments',
|
|
425
|
-
supported: 'fully',
|
|
426
|
-
description: '_Handle `x <- 3` returning `3`, e.g., in `x <- y <- 3`_'
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
name: 'Assignment Functions',
|
|
430
|
-
id: 'assignment-functions',
|
|
431
|
-
supported: 'partially',
|
|
432
|
-
description: '_Handle `assign(x, 3)`, `delayedAssign(x, 3)`, ..._ Currently we can not handle all of them and tests are rare.'
|
|
433
|
-
},
|
|
434
|
-
{
|
|
435
|
-
name: 'Range Assignment',
|
|
436
|
-
id: 'range-assignment',
|
|
437
|
-
supported: 'fully',
|
|
438
|
-
description: '_Handle `x[1:3] <- 3`, `x$y[1:3] <- 3`, ..._'
|
|
439
|
-
},
|
|
440
|
-
{
|
|
441
|
-
name: 'Replacement Functions',
|
|
442
|
-
id: 'replacement-functions',
|
|
443
|
-
supported: 'partially',
|
|
444
|
-
description: '_Handle `x[i] <- 3`, `x$y <- 3`, ... as `` `[<-`(x, 3) ``, ..._ Currently work in progress as part of the desugaring but still untested.'
|
|
445
|
-
},
|
|
446
|
-
{
|
|
447
|
-
name: 'Locked Bindings',
|
|
448
|
-
id: 'locked-bindings',
|
|
449
|
-
supported: 'not',
|
|
450
|
-
description: '_Handle `lockBinding(x, 3)`, ..._'
|
|
451
|
-
}
|
|
452
|
-
]
|
|
605
|
+
name: 'Replacement Functions',
|
|
606
|
+
id: 'replacement-functions',
|
|
607
|
+
supported: 'partially',
|
|
608
|
+
description: `_Read a write to a call, like \`x[i] <- 3\` or \`x$y <- 3\`, as the \`\` \`[<-\`(x, 3) \`\` R runs for it._ The name in front is both read and rebound. A ${LinkTo('named-arguments', 'named argument')} in such a call (\`g(v, k = 2) <- 3\`) leaves its argument edge dangling.`,
|
|
609
|
+
example: (0, doc_code_1.codeBlock)('r', '`second<-` <- function(x, value) {\n x[2] <- value\n x\n}\nv <- 1:3\nsecond(v) <- 9\nv'),
|
|
610
|
+
url: [AdvancedR('Replacement functions', 'functions.html#replacement-functions'), RLang('Subset assignment')]
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
name: 'Locked Bindings',
|
|
614
|
+
id: 'locked-bindings',
|
|
615
|
+
code: ['lockEnvironment', 'lockBinding'],
|
|
616
|
+
supported: 'not',
|
|
617
|
+
description: `_A binding \`lockBinding\` (or \`lockEnvironment\`) makes constant._ Neither is recognized as a built-in, so the ${LinkTo('local-left-assignment', 'assignment')} R would have rejected is read as an ordinary rebinding.`,
|
|
618
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1\nlockBinding("x", environment())\nx <- 2'),
|
|
619
|
+
url: [RLang('Environment objects')]
|
|
453
620
|
}
|
|
454
621
|
]
|
|
455
622
|
}
|
|
456
|
-
]
|
|
623
|
+
],
|
|
624
|
+
url: [RLang('Operators')]
|
|
625
|
+
}
|
|
626
|
+
]
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
name: 'Control-Flow',
|
|
630
|
+
id: 'control-flow',
|
|
631
|
+
description: 'Conditionals, the three loop forms, their jumps, and how an error leaves a computation.',
|
|
632
|
+
capabilities: [
|
|
633
|
+
{
|
|
634
|
+
name: 'if',
|
|
635
|
+
id: 'if',
|
|
636
|
+
code: ['if'],
|
|
637
|
+
supported: 'fully',
|
|
638
|
+
description: `_The conditional \`if (x) y else z\`, and \`if (x) y\` without an alternative._ Both branches stay possible, so a name bound in either reaches a use below, and a missing \`else\` yields ${LinkTo('null', '`NULL`')}.`,
|
|
639
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- if(TRUE) 1 else 2\ny <- if(FALSE) 3\ny'),
|
|
640
|
+
url: [RLang('if')]
|
|
641
|
+
},
|
|
642
|
+
{
|
|
643
|
+
name: 'for loop',
|
|
644
|
+
id: 'for-loop',
|
|
645
|
+
code: ['for'],
|
|
646
|
+
supported: 'fully',
|
|
647
|
+
description: '_The loop `for (i in 1:3) print(i)`, which binds its variable in the surrounding scope._ The body is analyzed once for any number of iterations, so a name it binds also reaches its own next read, and `i` stays bound after the loop.',
|
|
648
|
+
example: (0, doc_code_1.codeBlock)('r', 'for(i in 1:3) print(i)\ni'),
|
|
649
|
+
url: [RLang('Looping')]
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
name: 'while loop',
|
|
653
|
+
id: 'while-loop',
|
|
654
|
+
code: ['while'],
|
|
655
|
+
supported: 'fully',
|
|
656
|
+
description: '_The loop `while (x) b`, whose condition is read before every iteration._ Whether the body ever runs is unknown, so a name it binds and the one bound before it both reach a use below.',
|
|
657
|
+
example: (0, doc_code_1.codeBlock)('r', 'i <- 0\nwhile(i < 3) i <- i + 1\ni'),
|
|
658
|
+
url: [RLang('while')]
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
name: 'repeat loop',
|
|
662
|
+
id: 'repeat-loop',
|
|
663
|
+
code: ['repeat'],
|
|
664
|
+
supported: 'fully',
|
|
665
|
+
description: `_The loop \`repeat {b; if (x) break}\`, which only a ${LinkTo('break', '`break`')} or a ${LinkTo('return', '`return`')} leaves._ Like every loop the body is analyzed once, for any number of iterations.`,
|
|
666
|
+
example: (0, doc_code_1.codeBlock)('r', 'i <- 0\nrepeat {\n i <- i + 1\n if(i > 2) break\n}\ni'),
|
|
667
|
+
url: [RLang('repeat')]
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
name: 'break',
|
|
671
|
+
id: 'break',
|
|
672
|
+
code: ['break'],
|
|
673
|
+
supported: 'fully',
|
|
674
|
+
description: '_Leave the innermost enclosing loop with `break` (`break()` included)._ The rest of the body becomes unreachable on that path, so what it would have bound does not reach a use after the loop.',
|
|
675
|
+
example: (0, doc_code_1.codeBlock)('r', 'for(i in 1:5) {\n if(i == 4) break\n print(i)\n}'),
|
|
676
|
+
url: [RLang('Control structures')]
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
name: 'next',
|
|
680
|
+
id: 'next',
|
|
681
|
+
code: ['next'],
|
|
682
|
+
supported: 'fully',
|
|
683
|
+
description: '_Start the next iteration of the innermost enclosing loop with `next` (`next()` included)._ The rest of the body is skipped on that path, while the loop itself continues.',
|
|
684
|
+
example: (0, doc_code_1.codeBlock)('r', 'for(i in 1:5) {\n if(i %% 2 == 0) next\n print(i)\n}'),
|
|
685
|
+
url: [RLang('Control structures')]
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
name: 'switch',
|
|
689
|
+
id: 'switch',
|
|
690
|
+
code: ['switch'],
|
|
691
|
+
supported: 'fully',
|
|
692
|
+
description: '_Pick a branch by name or position with `switch`._ A branch left empty falls through to the next one, and every branch stays possible, as the selector does not narrow which of them runs.',
|
|
693
|
+
example: (0, doc_code_1.codeBlock)('r', 'switch("b", a = , b = "ab", c = "c")\nswitch(2, "one", "two")'),
|
|
694
|
+
url: [RLang('Control structures')]
|
|
695
|
+
},
|
|
696
|
+
{
|
|
697
|
+
name: 'return',
|
|
698
|
+
id: 'return',
|
|
699
|
+
code: ['return'],
|
|
700
|
+
supported: 'fully',
|
|
701
|
+
description: `_Leave the enclosing ${LinkTo('function-definitions', 'function')} with \`return(3)\`._ Its argument becomes a value of the call, next to the ${LinkTo('implicit-return', 'implicit return')} of whatever path does not return early.`,
|
|
702
|
+
example: (0, doc_code_1.codeBlock)('r', 'f <- function(x) {\n if(x > 0) return("pos")\n "non-pos"\n}\nf(1)'),
|
|
703
|
+
url: [AdvancedR('Exiting a function', 'functions.html#exiting-a-function')]
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
name: 'Exceptions and Errors',
|
|
707
|
+
id: 'exceptions-and-errors',
|
|
708
|
+
code: ['stop', 'try', 'tryCatch', 'warning'],
|
|
709
|
+
supported: 'partially',
|
|
710
|
+
description: `_A condition raised with \`stop\`/\`warning\` and caught with \`try\`/\`tryCatch\`._ The path on which a call throws before a write is not kept open, so \`tryCatch({ risky(); x <- 2 }, ...)\` loses \`x\`. A handler is read as an ordinary ${LinkTo('function-definitions', 'function definition')}.`,
|
|
711
|
+
example: (0, doc_code_1.codeBlock)('r', 'tryCatch(\n stop("boom"),\n error = function(e) conditionMessage(e),\n finally = print("done")\n)'),
|
|
712
|
+
url: [RLang('Exception handling'), AdvancedR('Conditions', 'conditions.html')]
|
|
713
|
+
}
|
|
714
|
+
]
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
name: 'Function Definitions',
|
|
718
|
+
id: 'function-definitions',
|
|
719
|
+
description: `The ${LinkTo('formals', 'parameters')} a function binds, their defaults, \`...\`, promises, and the value the call hands back.`,
|
|
720
|
+
capabilities: [
|
|
721
|
+
{
|
|
722
|
+
name: 'Normal',
|
|
723
|
+
id: 'normal-definition',
|
|
724
|
+
code: ['function'],
|
|
725
|
+
supported: 'fully',
|
|
726
|
+
description: `_A function written with \`function(x) x\`._ It opens a scope of its own, so its body resolves names in its ${LinkTo('lexicographic-scope', 'lexicographic scope')} rather than where the call happens.`,
|
|
727
|
+
url: [RLang('Function definitions')]
|
|
457
728
|
},
|
|
458
729
|
{
|
|
459
|
-
name: '
|
|
460
|
-
id: '
|
|
730
|
+
name: 'Formals',
|
|
731
|
+
id: 'formals',
|
|
732
|
+
description: `The parameters a definition declares, with their ${LinkTo('formals-named', 'names')}, ${LinkTo('formals-default', 'defaults')}, ${LinkTo('formals-dot-dot-dot', '`...`')}, and the ${LinkTo('formals-promises', 'promise')} each is bound to.`,
|
|
461
733
|
capabilities: [
|
|
462
734
|
{
|
|
463
|
-
name: '
|
|
464
|
-
id: '
|
|
735
|
+
name: 'Named',
|
|
736
|
+
id: 'formals-named',
|
|
465
737
|
supported: 'fully',
|
|
466
|
-
description: '
|
|
738
|
+
description: '_A parameter written as a name, as `x` in `function(x) x`._ It binds that name in the body, where it shadows an enclosing binding of the same name.',
|
|
739
|
+
url: [RLang('Arguments')]
|
|
467
740
|
},
|
|
468
741
|
{
|
|
469
|
-
name: '
|
|
470
|
-
id: '
|
|
742
|
+
name: 'Default',
|
|
743
|
+
id: 'formals-default',
|
|
471
744
|
supported: 'fully',
|
|
472
|
-
description: '
|
|
745
|
+
description: '_A parameter with a default, as in `function(x = 3) x`._ The default is evaluated in the function\'s own scope, so it may read another parameter (`function(x, y = x * 2)`).',
|
|
746
|
+
example: (0, doc_code_1.codeBlock)('r', 'f <- function(x, y = x * 2) y\nf(3)'),
|
|
747
|
+
url: [AdvancedR('Default arguments', 'functions.html#default-arguments')]
|
|
473
748
|
},
|
|
474
749
|
{
|
|
475
|
-
name: '
|
|
476
|
-
id: '
|
|
750
|
+
name: 'Dot-Dot-Dot',
|
|
751
|
+
id: 'formals-dot-dot-dot',
|
|
477
752
|
supported: 'fully',
|
|
478
|
-
description:
|
|
753
|
+
description: `_The variadic parameter \`...\`, which collects every argument no other formal took._ Passing it on keeps those arguments together, while a formal behind it is only matched by ${LinkTo('named-arguments', 'its exact name')}.`,
|
|
754
|
+
example: (0, doc_code_1.codeBlock)('r', 'f <- function(...) sum(...)\ng <- function(...) f(..., 1)\ng(2, 3)'),
|
|
755
|
+
url: [RLang('Dot-dot-dot', 'Dot_002ddot_002ddot')]
|
|
479
756
|
},
|
|
480
757
|
{
|
|
481
|
-
name: '
|
|
482
|
-
id: '
|
|
483
|
-
supported: 'fully',
|
|
484
|
-
description: '_Handle `repeat {b; if (x) break}`, ..._'
|
|
485
|
-
},
|
|
486
|
-
{
|
|
487
|
-
name: 'break',
|
|
488
|
-
id: 'break',
|
|
489
|
-
supported: 'fully',
|
|
490
|
-
description: '_Handle `break` (including `break()`) ..._'
|
|
491
|
-
},
|
|
492
|
-
{
|
|
493
|
-
name: 'next',
|
|
494
|
-
id: 'next',
|
|
495
|
-
supported: 'fully',
|
|
496
|
-
description: '_Handle `next` (including `next()`) ..._'
|
|
497
|
-
},
|
|
498
|
-
{
|
|
499
|
-
name: 'switch',
|
|
500
|
-
id: 'switch',
|
|
501
|
-
supported: 'fully',
|
|
502
|
-
description: '_Handle `switch(3, "a", "b", "c")`, ..._'
|
|
503
|
-
},
|
|
504
|
-
{
|
|
505
|
-
name: 'return',
|
|
506
|
-
id: 'return',
|
|
507
|
-
supported: 'fully',
|
|
508
|
-
description: '_Handle `return(3)`, ... in function definitions_'
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
name: 'Exceptions and Errors',
|
|
512
|
-
id: 'exceptions-and-errors',
|
|
758
|
+
name: 'Promises',
|
|
759
|
+
id: 'formals-promises',
|
|
513
760
|
supported: 'partially',
|
|
514
|
-
description:
|
|
761
|
+
description: `_An argument is a promise, evaluated where it was written but only when the body first reads it._ When that happens is not modelled, nor are the ${LinkTo('side-effects-in-argument', 'writes that forcing it performs')}, so \`function(x = y) { y <- 3; x }\` does not tell us where \`y\` is read.`,
|
|
762
|
+
example: (0, doc_code_1.codeBlock)('r', 'f <- function(x = y) {\n y <- 3\n x\n}\nf()'),
|
|
763
|
+
url: [RLang('Promise objects'), AdvancedR('Lazy evaluation', 'functions.html')]
|
|
515
764
|
}
|
|
516
765
|
]
|
|
517
766
|
},
|
|
518
767
|
{
|
|
519
|
-
name: '
|
|
520
|
-
id: '
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
},
|
|
550
|
-
{
|
|
551
|
-
name: 'Promises',
|
|
552
|
-
id: 'formals-promises',
|
|
553
|
-
supported: 'partially',
|
|
554
|
-
description: '_Handle `function(x = y) { y <- 3; x }`, `function(x = { x <- 3; x}) { x * x }`, ..._ A default argument resolves in the function\'s own environment and an argument passed in resolves in the caller\'s, both as R does it. We do not model _when_ a promise is forced: a `delayedAssign`ed expression is linked to every binding it may be forced against, which never misses the one that feeds it but may name others as well. What forcing _does_ is not modelled either, so the writes a promise performs when it is forced (`delayedAssign("x", { x <- 99; 2 })`, where reading `x` yields `2` and leaves `x` at `99`) do not reach the reads that follow.'
|
|
555
|
-
}
|
|
556
|
-
]
|
|
557
|
-
},
|
|
558
|
-
{
|
|
559
|
-
name: 'Implicit Return',
|
|
560
|
-
id: 'implicit-return',
|
|
561
|
-
supported: 'fully',
|
|
562
|
-
description: '_Handle the return of `function() 3`, ..._'
|
|
563
|
-
},
|
|
564
|
-
{
|
|
565
|
-
name: 'Lambda Syntax',
|
|
566
|
-
id: 'lambda-syntax',
|
|
567
|
-
supported: 'fully',
|
|
568
|
-
description: '_Support `\\(x) x`, ..._'
|
|
569
|
-
}
|
|
570
|
-
]
|
|
768
|
+
name: 'Implicit Return',
|
|
769
|
+
id: 'implicit-return',
|
|
770
|
+
supported: 'fully',
|
|
771
|
+
description: `_A function hands back the value of the last expression it evaluates, without a ${LinkTo('return', '`return`')}._ Every path's last expression is such a value of the call.`,
|
|
772
|
+
url: [RLang('Function definitions')]
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
name: 'Lambda Syntax',
|
|
776
|
+
id: 'lambda-syntax',
|
|
777
|
+
code: ['\\('],
|
|
778
|
+
supported: 'fully',
|
|
779
|
+
minRVersion: versions_1.MIN_VERSION_LAMBDA,
|
|
780
|
+
description: `_The short form \`\\(x) x\` of a ${LinkTo('normal-definition', 'function definition')}._ It is purely syntax and binds its ${LinkTo('formals', 'parameters')} and scopes its body exactly like the long form.`,
|
|
781
|
+
example: (0, doc_code_1.codeBlock)('r', 'sapply(1:3, \\(x) x^2)')
|
|
782
|
+
}
|
|
783
|
+
]
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
name: 'Important Built-Ins',
|
|
787
|
+
id: 'important-built-ins',
|
|
788
|
+
description: 'The base-R functions we give a meaning of their own rather than treating as opaque calls, the ones that compute on the language included.',
|
|
789
|
+
capabilities: [
|
|
790
|
+
{
|
|
791
|
+
name: 'Non-Strict Logical Operators',
|
|
792
|
+
id: 'non-strict-logical-operators',
|
|
793
|
+
code: ['&&', '||'],
|
|
794
|
+
supported: 'fully',
|
|
795
|
+
description: '_The operators `&&` and `||`, which evaluate their right side only if the left one does not decide the result._ The right side is read as a path that may not run, unlike the vectorized `&`/`|`.',
|
|
796
|
+
example: (0, doc_code_1.codeBlock)('r', 'FALSE && stop("never evaluated")\nTRUE || stop("never evaluated")'),
|
|
797
|
+
url: [RLang('Operators')]
|
|
571
798
|
},
|
|
572
799
|
{
|
|
573
|
-
name: '
|
|
574
|
-
id: '
|
|
800
|
+
name: 'Pipe',
|
|
801
|
+
id: 'pipe-and-pipe-bind',
|
|
802
|
+
code: ['|>'],
|
|
803
|
+
supported: 'fully',
|
|
804
|
+
minRVersion: versions_1.MIN_VERSION_PIPE,
|
|
805
|
+
description: `_The [native pipe](https://www.r-bloggers.com/2021/05/the-new-r-pipe/) \`|>\`, which is syntax rather than a ${LinkTo('call-normal', 'call')}: the parser rewrites it._ The left-hand side becomes the first argument or fills the \`_\` placeholder.`,
|
|
806
|
+
example: (0, doc_code_1.codeBlock)('r', 'c(1, 2, 3) |> sum() |> sqrt()\nmtcars |> subset(cyl == 4)'),
|
|
807
|
+
url: [RLang('Function calls')]
|
|
808
|
+
},
|
|
809
|
+
{
|
|
810
|
+
name: 'Pipe-Bind',
|
|
811
|
+
id: 'pipe-bind',
|
|
812
|
+
code: ['=>'],
|
|
813
|
+
supported: 'partially',
|
|
814
|
+
minRVersion: versions_1.MIN_VERSION_PIPE_BIND,
|
|
815
|
+
description: `_The experimental pipe-bind \`=>\`, which names what the ${LinkTo('pipe-and-pipe-bind', 'pipe')} hands on and which R only enables under \`_R_USE_PIPEBIND_\`._ It is off by default and needs \`engine.r-shell.pipeBind\`. Tree-sitter's grammar has no production for it.`,
|
|
816
|
+
example: (0, doc_code_1.codeBlock)('r', 'mtcars |> df => lm(mpg ~ cyl, data = df)'),
|
|
817
|
+
url: [RLang('Function calls')]
|
|
818
|
+
},
|
|
819
|
+
{
|
|
820
|
+
name: 'Sequencing',
|
|
821
|
+
id: 'built-in-sequencing',
|
|
822
|
+
code: [':', 'seq', 'seq_len', 'seq_along', 'rep'],
|
|
823
|
+
supported: 'partially',
|
|
824
|
+
description: `_Give \`:\`, \`seq\`, ... the sequence they produce, gathered by abstract interpretation._ That value lets us reason about a ${LinkTo('for-loop', 'loop')} bound or an ${LinkTo('index-access', 'index')}, but \`seq\`, \`seq_len\`, \`seq_along\`, and \`rep\` are not folded even for literal arguments.`,
|
|
825
|
+
example: (0, doc_code_1.codeBlock)('r', 'n <- 0\n1:n\nseq_len(n)')
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
name: 'Internal and Primitive Functions',
|
|
829
|
+
id: 'built-in-internal-and-primitive-functions',
|
|
830
|
+
code: ['.Internal', '.Primitive'],
|
|
831
|
+
supported: 'partially',
|
|
832
|
+
description: `_The \`.Internal\` and \`.Primitive\` calls a base function reaches its C implementation through._ The call is kept and its arguments read, but the name \`.Primitive("sum")\` spells is not resolved the way a ${LinkTo('name-created', 'created name')} would be.`,
|
|
833
|
+
example: (0, doc_code_1.codeBlock)('r', '.Primitive("+")(1, 2)\n.Internal(inspect(1))'),
|
|
834
|
+
url: [RLang('.Internal and .Primitive', 'g_t_002eInternal-and-_002ePrimitive')]
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
name: 'Options',
|
|
838
|
+
id: 'built-in-options',
|
|
839
|
+
code: ['options', 'getOption'],
|
|
840
|
+
supported: 'partially',
|
|
841
|
+
description: `_The global options \`options\` sets and \`getOption\` reads._ Option values are not tracked, so \`getOption("digits")\` does not reach a preceding \`options(digits = 3)\`. Unlike the ${LinkTo('working-directory', 'working directory')} they are not interpreted at all.`,
|
|
842
|
+
example: (0, doc_code_1.codeBlock)('r', 'old <- options(digits = 3)\ngetOption("digits")\noptions(old)')
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
name: 'Help',
|
|
846
|
+
id: 'built-in-help',
|
|
847
|
+
code: ['help', 'help.search'],
|
|
848
|
+
supported: 'partially',
|
|
849
|
+
description: `_The help calls \`?\`, \`??\`, \`help\`, ..._ \`?\` and \`??\` are recognized, but their topic is read as an ordinary ${LinkTo('name-normal', 'name')} where R only looks it up, and \`help\`/\`help.search\` are not known at all.`,
|
|
850
|
+
example: (0, doc_code_1.codeBlock)('r', '?sum\nhelp("sum")')
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
name: 'Reflection / "Computing on the Language"',
|
|
854
|
+
id: 'reflection-"computing-on-the-language"',
|
|
855
|
+
description: `Code that reads or builds code, by ${LinkTo('built-in-quoting', 'quoting')} an expression, ${LinkTo('built-in-evaluation', 'evaluating')} it elsewhere, ${LinkTo('built-in-parsing', 'parsing')} it from a string, or ${LinkTo('modify-function-structure', 'rewriting a function')}.`,
|
|
575
856
|
capabilities: [
|
|
576
857
|
{
|
|
577
|
-
name: '
|
|
578
|
-
id: '
|
|
579
|
-
|
|
580
|
-
description: '_Handle `&&`, `||`, ..._'
|
|
581
|
-
},
|
|
582
|
-
{
|
|
583
|
-
name: 'Pipe and Pipe-Bind',
|
|
584
|
-
id: 'pipe-and-pipe-bind',
|
|
858
|
+
name: 'Get Function Structure',
|
|
859
|
+
id: 'get-function-structure',
|
|
860
|
+
code: ['body', 'formals', 'environment', 'args'],
|
|
585
861
|
supported: 'partially',
|
|
586
|
-
description:
|
|
862
|
+
description: `_Read a part of a ${LinkTo('function-definitions', 'function')} with \`body\`, \`formals\`, \`args\`, or \`environment\`._ What comes back is opaque, and the whole function is read, so asking only for \`formals(f)\` keeps all of \`f\`'s body in a slice.`,
|
|
863
|
+
example: (0, doc_code_1.codeBlock)('r', 'f <- function(x) x + 1\nbody(f)\nformals(f)\nenvironment(f)'),
|
|
864
|
+
url: [RLang('Manipulation of functions')]
|
|
587
865
|
},
|
|
588
866
|
{
|
|
589
|
-
name: '
|
|
590
|
-
id: '
|
|
591
|
-
|
|
592
|
-
|
|
867
|
+
name: 'Modify Function Structure',
|
|
868
|
+
id: 'modify-function-structure',
|
|
869
|
+
code: ['body<-', 'formals<-', 'environment<-'],
|
|
870
|
+
supported: 'partially',
|
|
871
|
+
description: `_Rewrite a part of a function with \`body<-\`, \`formals<-\`, or \`environment<-\`._ Like every ${LinkTo('replacement-functions', 'replacement function')} it rebinds the name, so a later ${LinkTo('call-normal', 'call')} reaches the new part as well as the original one.`,
|
|
872
|
+
example: (0, doc_code_1.codeBlock)('r', 'f <- function(x) x + 1\nbody(f) <- quote(x * 2)\nf(3)'),
|
|
873
|
+
url: [RLang('Manipulation of functions')]
|
|
593
874
|
},
|
|
594
875
|
{
|
|
595
|
-
name: '
|
|
596
|
-
id: 'built-in-
|
|
876
|
+
name: 'Quoting',
|
|
877
|
+
id: 'built-in-quoting',
|
|
878
|
+
code: ['quote', 'substitute', 'bquote'],
|
|
597
879
|
supported: 'partially',
|
|
598
|
-
description:
|
|
880
|
+
description: `_Take an expression as a value with \`quote\`, \`substitute\`, \`bquote\`, ..._ A quoted argument is ${LinkTo('non-standard-evaluations-semantics', 'non-standard evaluation')}: the names in it are not read, and \`substitute\` does not reach the caller's expression.`,
|
|
881
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1\nquote(x + y)\nbquote(.(x) + y)'),
|
|
882
|
+
url: [RLang('Computing on the language'), AdvancedR('Metaprogramming', 'metaprogramming.html')]
|
|
599
883
|
},
|
|
600
884
|
{
|
|
601
|
-
name: '
|
|
602
|
-
id: 'built-in-
|
|
603
|
-
|
|
604
|
-
|
|
885
|
+
name: 'Evaluation',
|
|
886
|
+
id: 'built-in-evaluation',
|
|
887
|
+
code: ['eval', 'evalq', 'eval.parent'],
|
|
888
|
+
supported: 'partially',
|
|
889
|
+
description: `_Run an expression that is a value with \`eval\`, \`evalq\`, \`eval.parent\`, ..._ \`eval(expr, envir)\` runs in an ${LinkTo('dynamic-environment-resolution', 'environment')} we may not know, so it is marked an unknown side effect.`,
|
|
890
|
+
example: (0, doc_code_1.codeBlock)('r', 'e <- quote(x + 1)\nx <- 2\neval(e)'),
|
|
891
|
+
url: [RLang('Evaluation of expressions'), AdvancedR('Evaluation', 'evaluation.html')]
|
|
605
892
|
},
|
|
606
893
|
{
|
|
607
|
-
name: '
|
|
608
|
-
id: '
|
|
894
|
+
name: 'String Templates',
|
|
895
|
+
id: 'string-templates',
|
|
896
|
+
code: ['glue', 'str_glue', 'cli_alert_info'],
|
|
609
897
|
supported: 'partially',
|
|
610
|
-
description: '
|
|
898
|
+
description: '_A string that reads the names inside it, as `glue::glue("{x}")`, `cli::cli_alert_info("{.val {x}}")`, or `stringr::str_glue` do._ Those names resolve in the scope of the template, and one aimed at another scope (`.envir`, `.con`, `glue_data`) becomes an unknown side effect.',
|
|
899
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 2\nglue::glue("x plus one is {x + 1}")')
|
|
611
900
|
},
|
|
612
901
|
{
|
|
613
|
-
name: '
|
|
614
|
-
id: '
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
description: '_Handle `body`, `formals`, `environment` to access the respective parts of a function._ We do not support the functions at all.'
|
|
621
|
-
},
|
|
622
|
-
{
|
|
623
|
-
name: 'Modify Function Structure',
|
|
624
|
-
id: 'modify-function-structure',
|
|
625
|
-
supported: 'not',
|
|
626
|
-
description: '_Handle `body<-`, `formals<-`, `environment<-` to modify the respective parts of a function._ We do not support the functions at all.'
|
|
627
|
-
},
|
|
628
|
-
{
|
|
629
|
-
name: 'Quoting',
|
|
630
|
-
id: 'built-in-quoting',
|
|
631
|
-
supported: 'partially',
|
|
632
|
-
description: '_Handle `quote`, `substitute`, `bquote`, ..._ A quoted argument is marked as [non-standard evaluation](https://github.com/flowr-analysis/flowr/wiki/Dataflow-Graph#non-standard-evaluation) as a whole, so nothing within it counts as read. We model the escapes back to standard evaluation that a quoting function offers: rlang\'s `!!`/`!!!` (in `expr`, `quo`, `enquo`, ... and in data-masking arguments) and `bquote`\'s `.()`. Base `quote`/`substitute` have no such escape, and `substitute` does not reach the caller\'s expression when used on a function argument.'
|
|
633
|
-
},
|
|
634
|
-
{
|
|
635
|
-
name: 'Evaluation',
|
|
636
|
-
id: 'built-in-evaluation',
|
|
637
|
-
supported: 'partially',
|
|
638
|
-
description: '_Handle `eval`, `evalq`, `eval.parent`, ..._ `eval` of a string we can resolve is analyzed as if it were written in its place. A language object reaches the `eval` that forces it even across assignments, branches, loop iterations, and function calls, and its names resolve in the scope evaluating it, as R does. `eval(expr, envir)` runs elsewhere, so we mark the call as an unknown side effect instead of guessing. `evalq` quotes its first argument and we do not follow it into the given environment.'
|
|
639
|
-
},
|
|
640
|
-
{
|
|
641
|
-
name: 'String Templates',
|
|
642
|
-
id: 'string-templates',
|
|
643
|
-
supported: 'partially',
|
|
644
|
-
description: '_Handle `glue::glue("{x}")`, `cli::cli_alert_info("{.val {x}}")`, `stringr::str_glue`/`str_interp`, ..._ The `{...}` of a template carries R code that runs where the call is, so we analyze it as if it were written there: it reads, it writes, and its side effects land in the calling scope. Doubled delimiters escape, `.open`/`.close` are honored when they are literal, and cli markup (`{.cls ...}`) contributes only the interpolations nested in it. A template aimed at another scope (`.envir`, `.con`, `glue_data`) is marked as an unknown side effect instead.'
|
|
645
|
-
},
|
|
646
|
-
{
|
|
647
|
-
name: 'Parsing',
|
|
648
|
-
id: 'built-in-parsing',
|
|
649
|
-
supported: 'not',
|
|
650
|
-
description: '_Handle `parse`, `deparse`, ..._ We handle them as unknown function calls, but not specifically besides that.'
|
|
651
|
-
}
|
|
652
|
-
]
|
|
902
|
+
name: 'Parsing',
|
|
903
|
+
id: 'built-in-parsing',
|
|
904
|
+
code: ['parse', 'deparse'],
|
|
905
|
+
supported: 'partially',
|
|
906
|
+
description: `_Turn text into an expression with \`parse\`, and an expression back into text with \`deparse\`._ What \`parse\` produces is only reached through ${LinkTo('built-in-evaluation', 'evaluation')}, and \`deparse\` is not modelled beyond reading its argument.`,
|
|
907
|
+
example: (0, doc_code_1.codeBlock)('r', 'eval(parse(text = "1 + 1"))\ndeparse(quote(x + y))'),
|
|
908
|
+
url: [RLang('The parsing process'), RLang('Deparsing')]
|
|
653
909
|
}
|
|
654
910
|
]
|
|
655
911
|
}
|
|
@@ -658,44 +914,69 @@ ${await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { simplified: true })}
|
|
|
658
914
|
{
|
|
659
915
|
name: 'Literal Values',
|
|
660
916
|
id: 'literal-values',
|
|
917
|
+
description: `The values written into the source itself, which is what a ${LinkTo('name-created-resolved', 'resolved name')} and an ${LinkTo('oop-s3-construction', 'S3 class')} are read from.`,
|
|
661
918
|
capabilities: [
|
|
662
919
|
{
|
|
663
920
|
name: 'Numbers',
|
|
664
921
|
id: 'numbers',
|
|
665
922
|
supported: 'fully',
|
|
666
|
-
description: '_Recognize numbers like `3`, `3.14`, `
|
|
923
|
+
description: '_Recognize numbers like `3`, `3.14`, the integer `3L`, hexadecimals such as `0xFF` and `0x1p3`, as well as the typed missings `NA_integer_`/`NA_real_`, ..._',
|
|
924
|
+
example: (0, doc_code_1.codeBlock)('r', '1L\n0xFF\n1e-3\n0x1p3\nNA_real_'),
|
|
925
|
+
capabilities: [
|
|
926
|
+
{
|
|
927
|
+
name: 'Complex',
|
|
928
|
+
id: 'numbers-complex',
|
|
929
|
+
supported: 'fully',
|
|
930
|
+
description: '_Recognize the imaginary literals `1i`, `4.1i`, `1e-2i`, ..._ The value survives arithmetic and is told apart from `1L` and a plain `1`.',
|
|
931
|
+
example: (0, doc_code_1.codeBlock)('r', 'z <- 1i\nz + 2i\n3 + 2i'),
|
|
932
|
+
url: [RLang('Literal constants')]
|
|
933
|
+
}
|
|
934
|
+
],
|
|
935
|
+
url: [RLang('Literal constants')]
|
|
667
936
|
},
|
|
668
937
|
{
|
|
669
938
|
name: 'Strings',
|
|
670
939
|
id: 'strings',
|
|
671
940
|
supported: 'fully',
|
|
672
|
-
description:
|
|
941
|
+
description: `_A string literal like \`"a"\` or \`'b'\`._ Its value is kept, which is what lets it stand for a ${LinkTo('name-quoted', 'name')} or fold into a ${LinkTo('name-created-resolved', 'resolved one')}.`,
|
|
673
942
|
capabilities: [
|
|
674
943
|
{
|
|
675
944
|
name: 'Raw Strings',
|
|
676
945
|
id: 'raw-strings',
|
|
677
946
|
supported: 'fully',
|
|
678
|
-
|
|
947
|
+
minRVersion: versions_1.MIN_VERSION_RAW_STABLE,
|
|
948
|
+
description: `_A raw string like \`r"(a)"\`, in which a backslash is no escape._ Its value is the same ${LinkTo('strings', 'string')} the quoted form would give.`,
|
|
949
|
+
example: (0, doc_code_1.codeBlock)('r', 'r"(C:\\Users\\me)"\nr"[\\d+]"')
|
|
679
950
|
}
|
|
680
|
-
]
|
|
951
|
+
],
|
|
952
|
+
url: [RLang('Literal constants')]
|
|
681
953
|
},
|
|
682
954
|
{
|
|
683
955
|
name: 'Logical',
|
|
684
956
|
id: 'logical',
|
|
957
|
+
code: ['TRUE', 'FALSE'],
|
|
685
958
|
supported: 'fully',
|
|
686
|
-
description: '_Recognize the logicals `TRUE` and `FALSE`, ..._'
|
|
959
|
+
description: '_Recognize the logicals `TRUE` and `FALSE`, ..._ Their short forms `T` and `F` are ordinary bindings and can be reassigned, while `TRUE` and `FALSE` are reserved.',
|
|
960
|
+
example: (0, doc_code_1.codeBlock)('r', 'TRUE && FALSE\nT <- FALSE\nT'),
|
|
961
|
+
url: [RLang('Constants')]
|
|
687
962
|
},
|
|
688
963
|
{
|
|
689
964
|
name: 'NULL',
|
|
690
965
|
id: 'null',
|
|
966
|
+
code: ['NULL'],
|
|
691
967
|
supported: 'fully',
|
|
692
|
-
description: '
|
|
968
|
+
description: `_The \`NULL\` object, R's empty value._ It is what an \`if\` without an ${LinkTo('if', 'else branch')} yields, and assigning it to a list element removes that element.`,
|
|
969
|
+
example: (0, doc_code_1.codeBlock)('r', 'c(1, NULL, 2)\nl <- list(a = 1)\nl$a <- NULL\nlength(l)'),
|
|
970
|
+
url: [RLang('NULL object')]
|
|
693
971
|
},
|
|
694
972
|
{
|
|
695
973
|
name: 'Inf and NaN',
|
|
696
974
|
id: 'inf-and-nan',
|
|
975
|
+
code: ['Inf', 'NaN'],
|
|
697
976
|
supported: 'fully',
|
|
698
|
-
description:
|
|
977
|
+
description: `_The constants \`Inf\` and \`NaN\`, which arithmetic produces rather than errors on._ They are ordinary values here, and the predicates asking for them are not evaluated, as ${LinkTo('types-inference', 'no type is inferred')}.`,
|
|
978
|
+
example: (0, doc_code_1.codeBlock)('r', '1 / 0\n-1 / 0\n0 / 0\nis.nan(NA)'),
|
|
979
|
+
url: [RLang('Constants')]
|
|
699
980
|
}
|
|
700
981
|
]
|
|
701
982
|
}
|
|
@@ -704,239 +985,543 @@ ${await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { simplified: true })}
|
|
|
704
985
|
{
|
|
705
986
|
name: 'Non-Standard Evaluations/Semantics',
|
|
706
987
|
id: 'non-standard-evaluations-semantics',
|
|
988
|
+
description: `The places where R does not evaluate an expression the way it is written, so a ${LinkTo('name-normal', 'name')} in it may mean something other than the binding it seems to read.`,
|
|
707
989
|
capabilities: [
|
|
708
990
|
{
|
|
709
991
|
name: 'Data Masking',
|
|
710
992
|
id: 'data-masking',
|
|
993
|
+
code: ['subset'],
|
|
711
994
|
supported: 'partially',
|
|
712
|
-
description:
|
|
995
|
+
description: `_A call that evaluates its arguments against the columns of a data frame first, as \`subset(d, col > 1)\`, the dplyr verbs, \`ggplot2::aes\`, and data.table's ${LinkTo('local-table-assignment', '`:=`')} do._ Which columns exist is unknown to us, so a column shadowing a variable still resolves to the variable.`,
|
|
996
|
+
example: (0, doc_code_1.codeBlock)('r', 'd <- data.frame(x = 1:3)\nthreshold <- 2\nsubset(d, x > threshold)'),
|
|
997
|
+
url: [AdvancedR('Data masks', 'evaluation.html#data-masks')]
|
|
713
998
|
},
|
|
714
999
|
{
|
|
715
1000
|
name: 'Recycling',
|
|
716
1001
|
id: 'recycling',
|
|
717
1002
|
supported: 'not',
|
|
718
|
-
description:
|
|
1003
|
+
description: `_A shorter operand is repeated to the length of the longer one._ This is not modelled, so the operands are read but the length of what an ${LinkTo('binary-operator', 'operator')} produces is not derived from them.`,
|
|
1004
|
+
example: (0, doc_code_1.codeBlock)('r', 'c(1, 2, 3, 4) + c(10, 20)'),
|
|
1005
|
+
url: [RLang('Recycling rules'), AdvancedR('Vectors', 'vectors-chap.html')]
|
|
719
1006
|
},
|
|
720
1007
|
{
|
|
721
1008
|
name: 'Vectorized Operator or Functions',
|
|
722
1009
|
id: 'vectorized-operator-or-functions',
|
|
723
|
-
|
|
724
|
-
|
|
1010
|
+
code: ['ifelse'],
|
|
1011
|
+
supported: 'partially',
|
|
1012
|
+
description: `_An operation applied to every element of a vector at once._ Comparisons, the reducing functions, and \`ifelse\` widen to the unknown value, so an ${LinkTo('subsetting-multiple', 'index built from one')} selects an unknown set of elements.`,
|
|
1013
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1:5\nx * 2\nifelse(x > 2, "big", "small")'),
|
|
1014
|
+
url: [AdvancedR('Vectorise', 'perf-improve.html#vectorise')]
|
|
725
1015
|
},
|
|
726
1016
|
{
|
|
727
1017
|
name: 'Hooks',
|
|
728
1018
|
id: 'hooks',
|
|
1019
|
+
code: ['on.exit', 'setHook'],
|
|
729
1020
|
supported: 'partially',
|
|
730
|
-
description:
|
|
1021
|
+
description: `_Code registered to run at a point the program does not write out, with \`on.exit\` or \`userhooks\`._ An \`on.exit\` body runs when the ${LinkTo('function-definitions', 'function')} it sits in ends, while \`setHook\` is not modelled.`,
|
|
1022
|
+
example: (0, doc_code_1.codeBlock)('r', 'f <- function() {\n on.exit(print("bye"))\n 1\n}\nf()'),
|
|
1023
|
+
url: [AdvancedR('on.exit', 'functions.html#on-exit'), { name: 'R Definition/userhooks', href: 'https://stat.ethz.ch/R-manual/R-devel/library/base/html/userhooks.html' }]
|
|
731
1024
|
},
|
|
732
1025
|
{
|
|
733
1026
|
name: 'Precedence',
|
|
734
1027
|
id: 'precedence',
|
|
735
1028
|
supported: 'fully',
|
|
736
|
-
description: '
|
|
1029
|
+
description: `_Which ${LinkTo('operators', 'operator')} binds tighter, as the [documentation](https://rdrr.io/r/base/Syntax.html) lays it out._ It decides the shape of the tree the parser hands us, so \`-2^2\` is \`-(2^2)\` before anything else looks at it.`,
|
|
1030
|
+
example: (0, doc_code_1.codeBlock)('r', '-2^2\n1:3 - 1\n!TRUE == FALSE'),
|
|
1031
|
+
url: [RLang('Operator tokens')]
|
|
737
1032
|
},
|
|
738
1033
|
{
|
|
739
1034
|
name: 'Attributes',
|
|
740
1035
|
id: 'attributes',
|
|
1036
|
+
description: `The data an object carries beside its value, which is where its ${LinkTo('oop-s3', 'S3 class')} and its shape live.`,
|
|
741
1037
|
capabilities: [
|
|
742
1038
|
{
|
|
743
1039
|
name: 'User-Defined',
|
|
744
1040
|
id: 'user-defined',
|
|
745
|
-
|
|
746
|
-
|
|
1041
|
+
code: ['attr', 'attributes', 'attr<-'],
|
|
1042
|
+
supported: 'partially',
|
|
1043
|
+
description: `_An [attribute](https://cran.r-project.org/doc/manuals/r-release/R-lang.html#Attributes) a program sets itself, with \`attr\` or \`attributes\`._ Which attributes an object carries is not part of the value we track, so only the ${LinkTo('replacement-functions', 'rebinding')} of the object itself is seen.`,
|
|
1044
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1:3\nattr(x, "unit") <- "cm"\nattributes(x)'),
|
|
1045
|
+
url: [RLang('Attributes')]
|
|
747
1046
|
},
|
|
748
1047
|
{
|
|
749
1048
|
name: 'Built-In',
|
|
750
1049
|
id: 'built-in',
|
|
751
|
-
|
|
752
|
-
|
|
1050
|
+
code: ['dim<-', 'names<-', 'class', 'dim', 'names'],
|
|
1051
|
+
supported: 'partially',
|
|
1052
|
+
description: `_An attribute R gives a meaning of its own, such as \`dim\`, \`names\`, or the \`class\` that ${LinkTo('oop-s3', 'dispatch')} reads._ \`dim<-\`, \`names<-\`, and \`class<-\` track shape only on a data frame.`,
|
|
1053
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1:6\ndim(x) <- c(2, 3)\nclass(x)'),
|
|
1054
|
+
url: [RLang('Dimensional attributes')]
|
|
753
1055
|
}
|
|
754
1056
|
]
|
|
755
1057
|
}
|
|
756
1058
|
]
|
|
757
1059
|
},
|
|
758
1060
|
{
|
|
759
|
-
name: '
|
|
760
|
-
id: '
|
|
1061
|
+
name: 'Object-Oriented Programming',
|
|
1062
|
+
id: 'object-oriented-programming',
|
|
1063
|
+
description: `R's object systems, the class an object carries, and the ${LinkTo('oop-s3-dispatch', 'dispatch')} that decides which function body a generic call runs.`,
|
|
761
1064
|
capabilities: [
|
|
762
1065
|
{
|
|
763
|
-
name: '
|
|
764
|
-
id: '
|
|
765
|
-
|
|
766
|
-
description:
|
|
767
|
-
|
|
768
|
-
{
|
|
769
|
-
name: 'Non-Primitive',
|
|
770
|
-
id: 'types-non-primitive',
|
|
771
|
-
supported: 'not',
|
|
772
|
-
description: '_Recognize and resolve non-primitive/composite types._ We do not support typing currently.'
|
|
773
|
-
},
|
|
774
|
-
{
|
|
775
|
-
name: 'Inference',
|
|
776
|
-
id: 'types-inference',
|
|
777
|
-
supported: 'not',
|
|
778
|
-
description: '_Infer types from the code._ We do not support typing currently.'
|
|
779
|
-
},
|
|
780
|
-
{
|
|
781
|
-
name: 'Coercion',
|
|
782
|
-
id: 'types-coercion',
|
|
783
|
-
supported: 'not',
|
|
784
|
-
description: '_Handle coercion of types._ We do not support typing currently.'
|
|
785
|
-
},
|
|
786
|
-
{
|
|
787
|
-
name: 'Object-Oriented Programming',
|
|
788
|
-
id: 'object-oriented-programming',
|
|
1066
|
+
name: 'S3',
|
|
1067
|
+
id: 'oop-s3',
|
|
1068
|
+
url: [AdvancedR('S3', 's3.html'), RLang('Object-oriented programming', 'Object_002doriented-programming')],
|
|
1069
|
+
description: `_Classes and methods built on the ${LinkTo('built-in', '`class` attribute')} and \`UseMethod\` dispatch._ A class is a string an object carries rather than a declaration, so what a call runs follows from the ${LinkTo('name-normal', 'names')} \`generic.class\` in scope.`,
|
|
1070
|
+
example: (0, doc_code_1.codeBlock)('r', 'p <- structure(list(n = "ada"), class = "pt")\nprint.pt <- function(x, ...) cat("pt", x$n, "\\n")\np'),
|
|
789
1071
|
capabilities: [
|
|
790
1072
|
{
|
|
791
|
-
name: '
|
|
792
|
-
id: 'oop-s3',
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
1073
|
+
name: 'Class Construction',
|
|
1074
|
+
id: 'oop-s3-construction',
|
|
1075
|
+
code: ['class<-', 'oldClass<-'],
|
|
1076
|
+
supported: 'fully',
|
|
1077
|
+
description: `_Give an object its class with \`structure(..., class =)\`, \`class<-\`, or \`oldClass<-\`._ A class written as a ${LinkTo('strings', 'string literal')} is tracked and reaches the ${LinkTo('oop-s3-dispatch', 'dispatch')} that follows it.`,
|
|
1078
|
+
url: [RLang('Objects')]
|
|
1079
|
+
},
|
|
1080
|
+
{
|
|
1081
|
+
name: 'Dispatch',
|
|
1082
|
+
id: 'oop-s3-dispatch',
|
|
1083
|
+
code: ['UseMethod'],
|
|
796
1084
|
supported: 'partially',
|
|
797
|
-
description:
|
|
1085
|
+
description: `_Route a generic call to the method that runs._ \`UseMethod\` links to every ${LinkTo('function-definitions', 'definition')} named \`generic.class\` in scope, so the ${LinkTo('oop-s3-construction', 'class')} an object carries narrows the target only where it is known (heavily over-approximating).`,
|
|
1086
|
+
url: [RLang('UseMethod'), RLang('Method dispatching')]
|
|
798
1087
|
},
|
|
799
1088
|
{
|
|
800
|
-
name: '
|
|
801
|
-
id: 'oop-
|
|
802
|
-
|
|
803
|
-
{ name: AdvancedR('S4'), href: 'https://adv-r.hadley.nz/s4.html' }
|
|
804
|
-
],
|
|
1089
|
+
name: 'Inheritance',
|
|
1090
|
+
id: 'oop-s3-inheritance',
|
|
1091
|
+
code: ['NextMethod'],
|
|
805
1092
|
supported: 'partially',
|
|
806
|
-
description:
|
|
1093
|
+
description: `_Walk the class vector with \`NextMethod\`._ It reaches the generic's ${LinkTo('oop-s3-dispatch', 'methods')}, the one it stands in included, rather than only the next class in the vector.`,
|
|
1094
|
+
url: [RLang('NextMethod'), RLang('Inheritance')]
|
|
1095
|
+
}
|
|
1096
|
+
]
|
|
1097
|
+
},
|
|
1098
|
+
{
|
|
1099
|
+
name: 'S4',
|
|
1100
|
+
id: 'oop-s4',
|
|
1101
|
+
url: [AdvancedR('S4', 's4.html')],
|
|
1102
|
+
description: `_Formal classes and methods declared with \`setClass\`, \`setGeneric\`, and \`setMethod\`._ Unlike ${LinkTo('oop-s3', 'S3')} the class is declared, with named slots read through ${LinkTo('slot-access', '`@`')}.`,
|
|
1103
|
+
example: (0, doc_code_1.codeBlock)('r', 'setClass("P", representation(x = "numeric"))\nsetGeneric("desc", function(o) standardGeneric("desc"))\nsetMethod("desc", "P", function(o) o@x)\ndesc(new("P", x = 1))'),
|
|
1104
|
+
capabilities: [
|
|
1105
|
+
{
|
|
1106
|
+
name: 'Class Construction',
|
|
1107
|
+
id: 'oop-s4-construction',
|
|
1108
|
+
code: ['setClass'],
|
|
1109
|
+
supported: 'fully',
|
|
1110
|
+
description: `_Declare a class with \`setClass\` and build one with \`new\`._ The \`new\` call is linked to the \`setClass\` that declared the class, and a slot is read through ${LinkTo('slot-access', '`@`')} like any other access.`,
|
|
1111
|
+
url: [RLang('Classes')]
|
|
807
1112
|
},
|
|
808
1113
|
{
|
|
809
|
-
name: '
|
|
810
|
-
id: 'oop-
|
|
811
|
-
|
|
812
|
-
{ name: AdvancedR('R6'), href: 'https://adv-r.hadley.nz/r6.html' }
|
|
813
|
-
],
|
|
1114
|
+
name: 'Dispatch',
|
|
1115
|
+
id: 'oop-s4-dispatch',
|
|
1116
|
+
code: ['standardGeneric', 'setGeneric', 'setMethod'],
|
|
814
1117
|
supported: 'partially',
|
|
815
|
-
description:
|
|
1118
|
+
description: `_Route a generic call to the method \`setMethod\` registered._ The generic reaches its methods through the chain they register in, but the signature does not narrow which of them runs, as ${LinkTo('types-inference', 'no type is inferred')} for the argument.`,
|
|
1119
|
+
url: [RLang('Method dispatching')]
|
|
816
1120
|
},
|
|
817
1121
|
{
|
|
818
|
-
name: '
|
|
819
|
-
id: 'oop-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
]
|
|
1122
|
+
name: 'Inheritance',
|
|
1123
|
+
id: 'oop-s4-inheritance',
|
|
1124
|
+
code: ['callNextMethod'],
|
|
1125
|
+
supported: 'not',
|
|
1126
|
+
description: `_Reach a parent method with \`callNextMethod\`, and inherit through \`contains\`._ \`callNextMethod\` is left unresolved, so nothing links it to the ${LinkTo('oop-s4-dispatch', 'method')} it would call, unlike ${LinkTo('oop-s3-inheritance', 'S3 inheritance')}.`,
|
|
1127
|
+
url: [RLang('Inheritance')]
|
|
1128
|
+
}
|
|
1129
|
+
]
|
|
1130
|
+
},
|
|
1131
|
+
{
|
|
1132
|
+
name: 'RC/R5',
|
|
1133
|
+
id: 'oop-rc',
|
|
1134
|
+
code: ['setRefClass'],
|
|
1135
|
+
url: [AdvancedR('R5 / Reference classes', 'r6.html#why-r6')],
|
|
1136
|
+
supported: 'partially',
|
|
1137
|
+
description: `_Reference classes made with \`setRefClass\`, whose objects are mutable and thus behave like the ${LinkTo('environment-sharing', 'shared environments')} they are built on._ \`$new()\` and \`$method()\` on an instance are unknown side effects, and no call links to the body it runs.`,
|
|
1138
|
+
example: (0, doc_code_1.codeBlock)('r', 'Acc <- setRefClass("Acc",\n fields = list(bal = "numeric"),\n methods = list(dep = function(v) bal <<- bal + v))\na <- Acc$new(bal = 0)\na$dep(5)')
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
name: 'R6',
|
|
1142
|
+
id: 'oop-r6',
|
|
1143
|
+
code: ['R6Class'],
|
|
1144
|
+
url: [AdvancedR('R6', 'r6.html')],
|
|
1145
|
+
supported: 'partially',
|
|
1146
|
+
description: `_Classes made with \`R6::R6Class\`, read as one unit rather than as the environment behind them._ Like ${LinkTo('oop-rc', 'RC')} an R6 object is mutable, and typing, inheritance, private/active bindings, and handling objects fully "as units" are not supported.`,
|
|
1147
|
+
example: (0, doc_code_1.codeBlock)('r', 'Counter <- R6::R6Class("Counter", public = list(\n i = 0,\n add = function() {\n self$i <- self$i + 1\n invisible(self)\n }\n))\nCounter$new()$add()$i')
|
|
1148
|
+
},
|
|
1149
|
+
{
|
|
1150
|
+
name: 'R7/S7',
|
|
1151
|
+
id: 'oop-r7-s7',
|
|
1152
|
+
code: ['new_class'],
|
|
1153
|
+
url: [{ name: 'R7', href: 'https://www.r-bloggers.com/2022/12/what-is-r7-a-new-oop-system-for-r/' }, { name: 'S7', href: 'https://cran.r-project.org/web/packages/S7/index.html' }],
|
|
1154
|
+
supported: 'partially',
|
|
1155
|
+
description: `_Classes made with \`S7::new_class\`, read as one unit, dispatch and inheritance included._ ${LinkTo('types-inference', 'Typing')} is not supported, nor are objects handled fully "as units."`,
|
|
1156
|
+
example: (0, doc_code_1.codeBlock)('r', 'Person <- S7::new_class("Person", properties = list(name = S7::class_character))\nPerson(name = "ada")@name')
|
|
1157
|
+
},
|
|
1158
|
+
{
|
|
1159
|
+
name: 'Class-Based Dependency Attribution',
|
|
1160
|
+
id: 'oop-class-dependency-attribution',
|
|
1161
|
+
supported: 'partially',
|
|
1162
|
+
description: `_Attribute the use of a class to the package that owns it, so a class use implies a dependency for library detection and version guessing._ It is the class counterpart of resolving a ${LinkTo('accessing-exported-names', 'name to its package')}.`,
|
|
1163
|
+
capabilities: [
|
|
1164
|
+
{
|
|
1165
|
+
name: 'S3 class ownership',
|
|
1166
|
+
id: 'class-owner-s3',
|
|
824
1167
|
supported: 'partially',
|
|
825
|
-
description: '
|
|
1168
|
+
description: `_Attribute an ${LinkTo('oop-s3', 'S3')} class to the package that owns it._ Only a class written as a ${LinkTo('strings', 'string literal')} is attributed, not one from a variable or a \`c(...)\` vector.`
|
|
826
1169
|
},
|
|
827
1170
|
{
|
|
828
|
-
name: '
|
|
829
|
-
id: '
|
|
1171
|
+
name: 'S4 class ownership',
|
|
1172
|
+
id: 'class-owner-s4',
|
|
830
1173
|
supported: 'partially',
|
|
831
|
-
description:
|
|
832
|
-
capabilities: [
|
|
833
|
-
{
|
|
834
|
-
name: 'S3 class ownership',
|
|
835
|
-
id: 'class-owner-s3',
|
|
836
|
-
supported: 'partially',
|
|
837
|
-
description: '_The signature database records which package owns each S3 class. A class use is attributed to the owning package -- both from a project\'s NAMESPACE `S3method(generic, class)` registrations (e.g. `S3method("as.irts","zoo")` marks `zoo` used) and from class-name string literals in plain code (`inherits(x, "zoo")`, `methods::is`, `new`, `structure(..., class=)`), marking the owner used and bounding its version below by the same-named constructor\'s export history. Class names that come from a variable or a `c(...)` vector, and method-definition names like `print.zoo`, are not yet resolved._'
|
|
838
|
-
},
|
|
839
|
-
{
|
|
840
|
-
name: 'S4 class ownership',
|
|
841
|
-
id: 'class-owner-s4',
|
|
842
|
-
supported: 'partially',
|
|
843
|
-
description: '_A project\'s `importClassesFrom`/`importMethodsFrom` NAMESPACE directives are tracked, so the source package is attached and marked used like a plain `importFrom`. S4 class ownership itself (`exportClasses`, `setClass`) is not yet recorded in the signature database, so a bare S4 class use is not attributed to its owning package._'
|
|
844
|
-
}
|
|
845
|
-
]
|
|
1174
|
+
description: `_Attribute an ${LinkTo('oop-s4', 'S4')} class to the package that owns it._ S4 ownership is not in the ${Wiki('Signature Database', 'signature database')}, so a bare class use is not attributed.`
|
|
846
1175
|
}
|
|
847
1176
|
]
|
|
848
1177
|
}
|
|
849
1178
|
]
|
|
850
1179
|
},
|
|
851
1180
|
{
|
|
852
|
-
name: 'Structure',
|
|
1181
|
+
name: 'R File Structure',
|
|
853
1182
|
id: 'structure',
|
|
1183
|
+
description: 'The lexical shape of a source file, down to its line endings and encoding.',
|
|
854
1184
|
capabilities: [
|
|
855
1185
|
{
|
|
856
1186
|
name: 'Comments',
|
|
857
1187
|
id: 'comments',
|
|
858
1188
|
supported: 'fully',
|
|
859
|
-
description:
|
|
1189
|
+
description: `_A comment like \`# this is a comment\`, a shebang line included._ It is never read as code, so no ${LinkTo('name-normal', 'name')} in it resolves.`,
|
|
1190
|
+
example: (0, doc_code_1.codeBlock)('r', '#!/usr/bin/env Rscript\n# a comment\nx <- 1 # a trailing comment'),
|
|
1191
|
+
url: [RLang('Comments')]
|
|
1192
|
+
},
|
|
1193
|
+
{
|
|
1194
|
+
name: 'Line Directive',
|
|
1195
|
+
id: 'line-directive',
|
|
1196
|
+
supported: 'partially',
|
|
1197
|
+
description: '_Recognize `#line n "file"` as its own node (r-shell only)._ It is parsed but never retargets a location, and tree-sitter reads it as a comment.',
|
|
1198
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1\n#line 42 "other.R"\ny <- 2'),
|
|
1199
|
+
url: [{ name: 'R Definition/parse', href: 'https://stat.ethz.ch/R-manual/R-devel/library/base/html/parse.html' }]
|
|
860
1200
|
},
|
|
861
1201
|
{
|
|
862
1202
|
name: 'Semicolons',
|
|
863
1203
|
id: 'semicolons',
|
|
864
1204
|
supported: 'fully',
|
|
865
|
-
description:
|
|
1205
|
+
description: `_A semicolon separating two expressions on one line, as in \`a; b; c\`._ It says the same as a ${LinkTo('newlines', 'newline')}: the expressions run in the order they are written.`,
|
|
1206
|
+
example: (0, doc_code_1.codeBlock)('r', 'a <- 1; b <- 2; a + b'),
|
|
1207
|
+
url: [RLang('Separators')]
|
|
866
1208
|
},
|
|
867
1209
|
{
|
|
868
1210
|
name: 'Newlines',
|
|
869
1211
|
id: 'newlines',
|
|
870
1212
|
supported: 'fully',
|
|
871
|
-
description: '_Recognize and resolve newlines like `a
|
|
1213
|
+
description: '_Recognize and resolve newlines like `a\\nb\\nc`, where a newline ends an expression unless it is still incomplete._ A trailing operator or an unclosed bracket continues on the next line.',
|
|
1214
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1 +\n 2\ny <- 1\n + 2'),
|
|
1215
|
+
url: [RLang('Separators')]
|
|
1216
|
+
},
|
|
1217
|
+
{
|
|
1218
|
+
name: 'Line Endings',
|
|
1219
|
+
id: 'line-endings',
|
|
1220
|
+
supported: 'fully',
|
|
1221
|
+
description: '_Recognize `\\n` (Unix), `\\r\\n` (Windows), and a lone `\\r` (classic Mac)._ Normalized at the r-bridge boundary, with both engines.',
|
|
1222
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1\r\ny <- x + 1')
|
|
1223
|
+
},
|
|
1224
|
+
{
|
|
1225
|
+
name: 'Source Encoding',
|
|
1226
|
+
id: 'source-encoding',
|
|
1227
|
+
supported: 'fully',
|
|
1228
|
+
description: `_UTF-8 beyond ASCII in ${LinkTo('strings', 'string literals')}, in a ${LinkTo('comments', 'comment')}, and in names (plain as well as ${LinkTo('name-escaped', 'backtick-escaped')})._ Such names bind and resolve like any other, with both engines.`,
|
|
1229
|
+
example: (0, doc_code_1.codeBlock)('r', 'st\u00e4rke <- "caf\u00e9"\n`\u03b1 \u03b2` <- 2\nst\u00e4rke'),
|
|
1230
|
+
url: [RLang('Tokens')]
|
|
1231
|
+
},
|
|
1232
|
+
{
|
|
1233
|
+
name: 'Byte-Order Mark',
|
|
1234
|
+
id: 'byte-order-mark',
|
|
1235
|
+
supported: 'partially',
|
|
1236
|
+
description: '_Recognize a UTF-8 byte-order mark at the start of a file._ The tree-sitter engine reads past it, the r-shell engine rejects the same input as unparsable.'
|
|
1237
|
+
},
|
|
1238
|
+
{
|
|
1239
|
+
name: 'Syntax Errors',
|
|
1240
|
+
id: 'syntax-errors',
|
|
1241
|
+
supported: 'partially',
|
|
1242
|
+
description: `_Handle source that does not parse._ The ${Wiki('Linter', '`syntactically-valid` rule')} locates the region and offers a fix. The strict parser rejects the file, while tree-sitter's lax mode (off by default) drops the region.`,
|
|
1243
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1\ny <- (\nz <- 3'),
|
|
1244
|
+
url: [RLang('The parsing process')]
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
name: 'Reserved Words',
|
|
1248
|
+
id: 'reserved-words',
|
|
1249
|
+
supported: 'partially',
|
|
1250
|
+
description: `_Reject a syntactic keyword like \`\` \`if\` \`\` or \`\` \`function\` \`\` where R's grammar requires an expression._ The r-shell engine rejects \`\` if <- 5\`\`, while tree-sitter's grammar parses it as an ordinary ${LinkTo('local-left-assignment', 'assignment')}.`,
|
|
1251
|
+
example: (0, doc_code_1.codeBlock)('r', 'if <- 5'),
|
|
1252
|
+
url: [RLang('Reserved words', 'Reserved-words-1')]
|
|
1253
|
+
}
|
|
1254
|
+
]
|
|
1255
|
+
},
|
|
1256
|
+
{
|
|
1257
|
+
name: 'Project',
|
|
1258
|
+
id: 'project',
|
|
1259
|
+
description: `The files around the R code, from the ${LinkTo('project-metadata', 'package metadata')} and the packages a ${LinkTo('project-dependency-managers', 'version manager')} pins to what runs ${LinkTo('project-startup-files', 'before a script does')}.`,
|
|
1260
|
+
capabilities: [
|
|
1261
|
+
{
|
|
1262
|
+
name: 'Package Metadata',
|
|
1263
|
+
id: 'project-metadata',
|
|
1264
|
+
description: 'The files that describe the package itself, what it needs, and what it offers.',
|
|
1265
|
+
capabilities: [
|
|
1266
|
+
{
|
|
1267
|
+
name: 'DESCRIPTION',
|
|
1268
|
+
id: 'project-description',
|
|
1269
|
+
supported: 'fully',
|
|
1270
|
+
description: "_Read a package's `DESCRIPTION`._ Its DCF records give the package name, version, R version, dependency fields, and `Collate` order.",
|
|
1271
|
+
url: [
|
|
1272
|
+
Plugin('src/project/plugins/file-plugins/files/flowr-description-file.ts'),
|
|
1273
|
+
{ name: 'Writing R Extensions/The DESCRIPTION file', href: 'https://cran.r-project.org/doc/manuals/r-release/R-exts.html#The-DESCRIPTION-file' }
|
|
1274
|
+
]
|
|
1275
|
+
},
|
|
1276
|
+
{
|
|
1277
|
+
name: 'NAMESPACE',
|
|
1278
|
+
id: 'project-namespace',
|
|
1279
|
+
supported: 'fully',
|
|
1280
|
+
description: `_Read a package's \`NAMESPACE\`._ Acts on \`import\`/\`importFrom\`, \`importClassesFrom\`/\`importMethodsFrom\` for ${LinkTo('oop-s4', 'S4')}, and \`export\`/\`S3method\`, which is what says whether a name is ${LinkTo('namespace-exports', 'exported or internal')}.`,
|
|
1281
|
+
url: [
|
|
1282
|
+
Plugin('src/project/plugins/file-plugins/files/flowr-namespace-file.ts'),
|
|
1283
|
+
{ name: 'Writing R Extensions/Package namespaces', href: 'https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Package-namespaces' }
|
|
1284
|
+
]
|
|
1285
|
+
},
|
|
1286
|
+
{
|
|
1287
|
+
name: 'Documentation (`.Rd`)',
|
|
1288
|
+
id: 'project-rd',
|
|
1289
|
+
supported: 'fully',
|
|
1290
|
+
description: '_Read the `.Rd` pages under `man/`, their macros, and the indices beside them._ A documented name is tied back to the page that documents it.',
|
|
1291
|
+
url: [
|
|
1292
|
+
Plugin('src/project/plugins/file-plugins/files/flowr-rd-file.ts'),
|
|
1293
|
+
{ name: 'Writing R Extensions/Rd format', href: 'https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Rd-format' }
|
|
1294
|
+
]
|
|
1295
|
+
},
|
|
1296
|
+
{
|
|
1297
|
+
name: 'NEWS',
|
|
1298
|
+
id: 'project-news',
|
|
1299
|
+
supported: 'fully',
|
|
1300
|
+
description: "_Read a package's `NEWS`/`NEWS.md`._ We parse the versions it announces and what each changed, which is what a version guess is checked against.",
|
|
1301
|
+
url: [
|
|
1302
|
+
Plugin('src/project/plugins/file-plugins/files/flowr-news-file.ts'),
|
|
1303
|
+
{ name: 'Writing R Extensions/Package subdirectories', href: 'https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Package-subdirectories' }
|
|
1304
|
+
]
|
|
1305
|
+
},
|
|
1306
|
+
{
|
|
1307
|
+
name: 'Package Data (`sysdata.rda`)',
|
|
1308
|
+
id: 'project-sysdata',
|
|
1309
|
+
supported: 'partially',
|
|
1310
|
+
description: '_Read the `R/sysdata.rda` a package keeps its internal data in, and the `data/` files it exports._ What those bindings hold is not reconstructed.',
|
|
1311
|
+
url: [
|
|
1312
|
+
Plugin('src/project/plugins/file-plugins/files/flowr-sysdata-file.ts'),
|
|
1313
|
+
{ name: 'Writing R Extensions/Data in packages', href: 'https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Data-in-packages' }
|
|
1314
|
+
]
|
|
1315
|
+
}
|
|
1316
|
+
]
|
|
1317
|
+
},
|
|
1318
|
+
{
|
|
1319
|
+
name: 'Dependency Managers',
|
|
1320
|
+
id: 'project-dependency-managers',
|
|
1321
|
+
description: 'The lockfiles and manifests a version manager pins a project\'s packages with.',
|
|
1322
|
+
capabilities: [
|
|
1323
|
+
{
|
|
1324
|
+
name: 'renv',
|
|
1325
|
+
id: 'version-manager-renv',
|
|
1326
|
+
supported: 'fully',
|
|
1327
|
+
description: '_Read the configuration of [renv](https://rstudio.github.io/renv/), the most widespread R project-library manager._ The library it points at is neither installed nor restored.',
|
|
1328
|
+
url: [
|
|
1329
|
+
Plugin('src/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.ts'),
|
|
1330
|
+
{ name: 'renv', href: 'https://rstudio.github.io/renv/' }
|
|
1331
|
+
]
|
|
1332
|
+
},
|
|
1333
|
+
{
|
|
1334
|
+
name: 'packrat',
|
|
1335
|
+
id: 'version-manager-packrat',
|
|
1336
|
+
supported: 'fully',
|
|
1337
|
+
description: '_Read the configuration of [packrat](https://rstudio.github.io/packrat/), the predecessor of renv._ The `packrat/lib` library beside it is not loaded.',
|
|
1338
|
+
url: [
|
|
1339
|
+
Plugin('src/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.ts'),
|
|
1340
|
+
{ name: 'packrat', href: 'https://rstudio.github.io/packrat/' }
|
|
1341
|
+
]
|
|
1342
|
+
},
|
|
1343
|
+
{
|
|
1344
|
+
name: 'rv',
|
|
1345
|
+
id: 'version-manager-rv',
|
|
1346
|
+
supported: 'fully',
|
|
1347
|
+
description: '_Read the configuration of [rv](https://a2-ai.github.io/rv-docs/), a declarative project manager in the style of cargo._ Parses `rproject.toml` and the resolved `rv.lock`.',
|
|
1348
|
+
url: [Plugin('src/project/plugins/file-plugins/files/flowr-manifest-files.ts'), { name: 'rv', href: 'https://a2-ai.github.io/rv-docs/' }]
|
|
1349
|
+
},
|
|
1350
|
+
{
|
|
1351
|
+
name: 'uvr',
|
|
1352
|
+
id: 'version-manager-uvr',
|
|
1353
|
+
supported: 'fully',
|
|
1354
|
+
description: '_Read the configuration of [uvr](https://github.com/nbafrank/uvr), an R project manager modelled on uv._ Parses `uvr.toml` and the `uvr.lock` beside it.',
|
|
1355
|
+
url: [Plugin('src/project/plugins/file-plugins/files/flowr-manifest-files.ts'), { name: 'uvr', href: 'https://github.com/nbafrank/uvr' }]
|
|
1356
|
+
},
|
|
1357
|
+
{
|
|
1358
|
+
name: 'Installed Library',
|
|
1359
|
+
id: 'project-library',
|
|
1360
|
+
supported: 'partially',
|
|
1361
|
+
description: '_Read the package library a project installs into (`renv/library`, `packrat/lib`, or the platform library)._ Their code is not read.',
|
|
1362
|
+
url: [Plugin('src/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.ts')]
|
|
1363
|
+
}
|
|
1364
|
+
]
|
|
1365
|
+
},
|
|
1366
|
+
{
|
|
1367
|
+
name: 'Startup and Discovery',
|
|
1368
|
+
id: 'project-startup-and-discovery',
|
|
1369
|
+
description: 'What runs before a script does and what counts as part of the project at all.',
|
|
1370
|
+
capabilities: [
|
|
1371
|
+
{
|
|
1372
|
+
name: 'Startup Files',
|
|
1373
|
+
id: 'project-startup-files',
|
|
1374
|
+
supported: 'partially',
|
|
1375
|
+
description: '_Read the files R runs or reads before a script (`.Rprofile`, `Rprofile.site`, `.Renviron`, `Renviron.site`)._ An `.Rprofile` is read as R code whose bindings precede the script, but variables set by an environment file are not interpreted.',
|
|
1376
|
+
url: [
|
|
1377
|
+
Plugin('src/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.ts'),
|
|
1378
|
+
{ name: 'R Definition/Startup', href: 'https://stat.ethz.ch/R-manual/R-devel/library/base/html/Startup.html' }
|
|
1379
|
+
]
|
|
1380
|
+
},
|
|
1381
|
+
{
|
|
1382
|
+
name: 'Ignore Files',
|
|
1383
|
+
id: 'project-ignore-files',
|
|
1384
|
+
supported: 'fully',
|
|
1385
|
+
description: '_Read the `.gitignore` and `.Rbuildignore` that say which files are not part of the project._ Follows gitignore globs and the regular expressions `R CMD build` uses.',
|
|
1386
|
+
url: [
|
|
1387
|
+
Plugin('src/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.ts'),
|
|
1388
|
+
{ name: 'gitignore', href: 'https://git-scm.com/docs/gitignore' }
|
|
1389
|
+
]
|
|
1390
|
+
}
|
|
1391
|
+
]
|
|
1392
|
+
},
|
|
1393
|
+
{
|
|
1394
|
+
name: 'Pre-Processors/external Tooling',
|
|
1395
|
+
id: 'pre-processors-external-tooling',
|
|
1396
|
+
description: 'The tooling around R code rather than the R in it, such as roxygen2 blocks and woven documents.',
|
|
1397
|
+
capabilities: [
|
|
1398
|
+
{
|
|
1399
|
+
name: 'roxygen2',
|
|
1400
|
+
id: 'roxygen2',
|
|
1401
|
+
supported: 'partially',
|
|
1402
|
+
description: `_Handle the roxygen2 blocks that precede a definition._ They are read as a ${LinkTo('comments', 'comment')} and what a tag states does not reach ${LinkTo('resolution', 'how a name resolves')}, so an \`importFrom\` tag leaves the name below it unqualified.`,
|
|
1403
|
+
example: (0, doc_code_1.codeBlock)('r', "#' @param x a number\n#' @importFrom stats median\n#' @export\nmid <- function(x) median(x)"),
|
|
1404
|
+
url: [{ name: 'roxygen2', href: 'https://roxygen2.r-lib.org/' }]
|
|
1405
|
+
},
|
|
1406
|
+
]
|
|
872
1407
|
}
|
|
873
1408
|
]
|
|
874
1409
|
},
|
|
875
1410
|
{
|
|
876
1411
|
name: 'System, I/O, FFI, and Other Files',
|
|
877
1412
|
id: 'system-i-o-ffi-and-other-files',
|
|
1413
|
+
description: `Everything a program reaches for beyond its own code, from ${LinkTo('sourcing-external-files', 'files it sources')} to calls it makes out of R.`,
|
|
878
1414
|
capabilities: [
|
|
879
1415
|
{
|
|
880
1416
|
name: 'Sourcing External Files',
|
|
881
1417
|
id: 'sourcing-external-files',
|
|
1418
|
+
code: ['source', 'sys.source'],
|
|
882
1419
|
supported: 'partially',
|
|
883
|
-
description: '
|
|
1420
|
+
description: `_Pull another file's code into the analysis with \`source\`, \`sys.source\`, ..._ A sourced file's ${LinkTo('global-scope', 'top-level bindings')} become visible to the code below the call. Only \`source\` is handled so far, and only where its path resolves.`,
|
|
1421
|
+
example: (0, doc_code_1.codeBlock)('r', 'source("helpers.R")\nsys.source("setup.R", envir = environment())')
|
|
884
1422
|
},
|
|
885
1423
|
{
|
|
886
|
-
name: 'Handling Binary
|
|
1424
|
+
name: 'Handling Binary Files',
|
|
887
1425
|
id: 'handling-binary-riles',
|
|
888
|
-
|
|
889
|
-
|
|
1426
|
+
code: ['save', 'load', 'readRDS'],
|
|
1427
|
+
supported: 'partially',
|
|
1428
|
+
description: '_Files a program writes objects to and reads them back from, with [`save`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/save), `load`, `readRDS`, ..._ A `load` binds names we cannot know, so neither the names nor the values behind them are reconstructed.',
|
|
1429
|
+
example: (0, doc_code_1.codeBlock)('r', 'save(x, file = "x.RData")\nload("x.RData")\nreadRDS("y.rds")'),
|
|
1430
|
+
url: [{ name: 'R Definition/save', href: 'https://stat.ethz.ch/R-manual/R-devel/library/base/html/save.html' }]
|
|
890
1431
|
},
|
|
891
1432
|
{
|
|
892
1433
|
name: 'I/O',
|
|
893
1434
|
id: 'i-o',
|
|
894
|
-
|
|
895
|
-
|
|
1435
|
+
code: ['read.csv', 'write.csv'],
|
|
1436
|
+
supported: 'partially',
|
|
1437
|
+
description: `_Reading and writing data files with \`read.csv\`, \`write.csv\`, ..._ What a file contains does not enter the analysis, which is also why ${LinkTo('data-masking', 'the columns of a data frame')} stay unknown.`,
|
|
1438
|
+
example: (0, doc_code_1.codeBlock)('r', 'd <- read.csv("in.csv")\nwrite.csv(d, "out.csv")'),
|
|
1439
|
+
url: [RLang('Operating system access')]
|
|
896
1440
|
},
|
|
897
1441
|
{
|
|
898
1442
|
name: 'Foreign Function Interface',
|
|
899
1443
|
id: 'foreign-function-interface',
|
|
900
|
-
|
|
901
|
-
|
|
1444
|
+
code: ['.C', '.Call', '.External', '.Fortran'],
|
|
1445
|
+
supported: 'partially',
|
|
1446
|
+
description: `_Calling out to compiled code with \`.C\`, \`.Call\`, \`.External\`, \`.Fortran\`, ..._ The call carries an unknown side effect, like a write through a ${LinkTo('environment-sharing', 'shared environment')}, and the foreign code itself is not analyzed.`,
|
|
1447
|
+
example: (0, doc_code_1.codeBlock)('r', '.Call("my_c_fn", 1)\n.Fortran("my_f_sub", x = 1)')
|
|
902
1448
|
},
|
|
903
1449
|
{
|
|
904
1450
|
name: 'System Calls',
|
|
905
1451
|
id: 'system-calls',
|
|
906
|
-
|
|
907
|
-
|
|
1452
|
+
code: ['system', 'system2'],
|
|
1453
|
+
supported: 'partially',
|
|
1454
|
+
description: '_Handle [`system`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/system), `system.*`, ..._ An injectable command built from user input is flagged by the `problematic-inputs` and `unescaped-arguments` rules.',
|
|
1455
|
+
example: (0, doc_code_1.codeBlock)('r', 'system("ls -la")\nsystem2("git", c("status"))'),
|
|
1456
|
+
url: [RLang('Operating system access')]
|
|
908
1457
|
},
|
|
909
1458
|
{
|
|
910
1459
|
name: 'R-Markdown files',
|
|
911
1460
|
id: 'file:rmd',
|
|
912
|
-
supported: '
|
|
913
|
-
description: 'Support R-Markdown files as R sources.'
|
|
1461
|
+
supported: 'partially',
|
|
1462
|
+
description: 'Support R-Markdown files as R sources. Code chunks are extracted, but not inline `r expr` or the `params` of the YAML front matter.',
|
|
1463
|
+
url: [{ name: 'R Markdown', href: 'https://rmarkdown.rstudio.com/' }]
|
|
914
1464
|
},
|
|
915
1465
|
{
|
|
916
1466
|
name: 'Jupyter Notebook',
|
|
917
1467
|
id: 'file:ipynb',
|
|
918
1468
|
supported: 'partially',
|
|
919
|
-
description: 'Support Jupyter Notebooks as R sources.'
|
|
1469
|
+
description: 'Support Jupyter Notebooks as R sources. Cells are read in document order, not execution order, and the kernel is not checked.',
|
|
1470
|
+
url: [{ name: 'Jupyter Notebook Format', href: 'https://nbformat.readthedocs.io/en/latest/format_description.html' }]
|
|
920
1471
|
},
|
|
921
1472
|
{
|
|
922
1473
|
name: 'Quarto',
|
|
923
1474
|
id: 'file:qmd',
|
|
924
1475
|
supported: 'partially',
|
|
925
|
-
description: 'Support Quarto files as R sources.'
|
|
1476
|
+
description: 'Support Quarto files as R sources. Code chunks are extracted, but not inline `r expr` or the `params` of the YAML front matter.',
|
|
1477
|
+
url: [{ name: 'Quarto', href: 'https://quarto.org/' }]
|
|
926
1478
|
},
|
|
927
1479
|
{
|
|
928
1480
|
name: 'Sweave',
|
|
929
1481
|
id: 'file:rnw',
|
|
930
1482
|
supported: 'partially',
|
|
931
|
-
description: 'Support for Sweave files as R sources.'
|
|
1483
|
+
description: 'Support for Sweave files as R sources. Code chunks are extracted, `\\Sexpr{}` inline expressions are not.',
|
|
1484
|
+
url: [{ name: 'Sweave', href: 'https://stat.ethz.ch/R-manual/R-devel/library/utils/doc/Sweave.pdf' }]
|
|
932
1485
|
}
|
|
933
1486
|
]
|
|
934
1487
|
},
|
|
935
1488
|
{
|
|
936
|
-
name: '
|
|
937
|
-
id: '
|
|
938
|
-
|
|
939
|
-
|
|
1489
|
+
name: 'Types',
|
|
1490
|
+
id: 'types',
|
|
1491
|
+
description: `What a value is, how we ${LinkTo('types-inference', 'infer it')} from the code, and the ${LinkTo('types-coercion', 'coercions')} R applies between types.`,
|
|
1492
|
+
capabilities: [
|
|
1493
|
+
{
|
|
1494
|
+
name: 'Primitive',
|
|
1495
|
+
id: 'types-primitive',
|
|
1496
|
+
code: ['typeof', 'mode'],
|
|
1497
|
+
supported: 'not',
|
|
1498
|
+
description: `_The atomic types \`numeric\`, \`character\`, \`logical\`, ..._ \`typeof\`, \`class\`, and \`mode\` are not evaluated and resolve to the unknown top value, so not even a ${LinkTo('literal-values', 'literal')} yields its type.`,
|
|
1499
|
+
example: (0, doc_code_1.codeBlock)('r', 'typeof(1L)\nclass(1)\nmode("a")'),
|
|
1500
|
+
url: [RLang('Basic types')]
|
|
1501
|
+
},
|
|
1502
|
+
{
|
|
1503
|
+
name: 'Non-Primitive',
|
|
1504
|
+
id: 'types-non-primitive',
|
|
1505
|
+
supported: 'not',
|
|
1506
|
+
description: `_The composite types a list, a data frame, or an ${LinkTo('object-oriented-programming', 'object')} has._ None of them is tracked, so \`class(list(1, 2))\` resolves to the unknown top value.`,
|
|
1507
|
+
url: [RLang('Vector objects')]
|
|
1508
|
+
},
|
|
1509
|
+
{
|
|
1510
|
+
name: 'Inference',
|
|
1511
|
+
id: 'types-inference',
|
|
1512
|
+
supported: 'not',
|
|
1513
|
+
description: `_Derive the type of an expression from the code that produces it._ A type predicate never narrows a ${LinkTo('if', 'branch')}, so \`if(is.numeric(1)) y <- 1 else y <- "a"\` still leaves \`y\` as both alternatives.`
|
|
1514
|
+
},
|
|
1515
|
+
{
|
|
1516
|
+
name: 'Coercion',
|
|
1517
|
+
id: 'types-coercion',
|
|
1518
|
+
code: ['as.integer', 'as.numeric', 'as.character'],
|
|
1519
|
+
supported: 'partially',
|
|
1520
|
+
description: '_The type R silently converts a value to, as `c(1, "a")` or `TRUE + 1` do._ A vector is not unified, so `c(1, "a")` keeps a number beside a string, and the `as.*` converters are not evaluated.',
|
|
1521
|
+
example: (0, doc_code_1.codeBlock)('r', 'c(1, "a")\nTRUE + 1\nas.integer("3")'),
|
|
1522
|
+
url: [RLang('Basic types')]
|
|
1523
|
+
},
|
|
1524
|
+
]
|
|
940
1525
|
}
|
|
941
1526
|
]
|
|
942
1527
|
};
|