@eagleoutice/flowr 2.15.8 → 2.15.10
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 +63 -295
- package/abstract-interpretation/absint-inference.d.ts +7 -7
- package/abstract-interpretation/absint-inference.js +44 -91
- 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 -3
- package/benchmark/slicer.js +5 -6
- 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 +29 -4
- 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 +59 -6
- package/config.js +43 -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 -24
- 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 +52 -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 +49 -10
- package/dataflow/environments/built-in-config.d.ts +9 -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 +30 -8
- package/dataflow/environments/built-in-props.js +35 -11
- package/dataflow/environments/built-in.d.ts +12 -8
- package/dataflow/environments/built-in.js +23 -21
- package/dataflow/environments/data-masking-functions.js +1 -1
- package/dataflow/environments/default-builtin-config.d.ts +606 -39
- package/dataflow/environments/default-builtin-config.js +211 -99
- package/dataflow/environments/define.d.ts +3 -2
- package/dataflow/environments/define.js +4 -3
- package/dataflow/environments/deprecation-info.d.ts +45 -0
- package/dataflow/environments/deprecation-info.js +13 -0
- package/dataflow/environments/environment.d.ts +6 -1
- package/dataflow/environments/environment.js +44 -15
- package/dataflow/environments/frame-memory.d.ts +41 -2
- package/dataflow/environments/frame-memory.js +143 -12
- package/dataflow/environments/identifier.d.ts +66 -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 +181 -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 +5 -38
- package/dataflow/fn/class-declaration.js +6 -51
- 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 +16 -16
- package/dataflow/fn/higher-order-function.js +30 -34
- package/dataflow/fn/recursive-function.js +1 -1
- package/dataflow/fn/strict-function.d.ts +8 -20
- package/dataflow/fn/strict-function.js +28 -41
- 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 +49 -7
- package/dataflow/graph/graph.js +60 -9
- package/dataflow/graph/match-args.d.ts +16 -12
- package/dataflow/graph/match-args.js +68 -26
- package/dataflow/graph/vertex.d.ts +39 -58
- 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 +27 -15
- package/dataflow/internal/linker.js +180 -37
- package/dataflow/internal/process/functions/call/built-in/built-in-access.js +6 -8
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +113 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +506 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-apply.js +17 -7
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.d.ts +19 -3
- package/dataflow/internal/process/functions/call/built-in/built-in-assignment.js +131 -55
- 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 +59 -12
- package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +189 -48
- 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 +60 -9
- package/dataflow/internal/process/functions/call/built-in/built-in-expression-list.js +71 -15
- package/dataflow/internal/process/functions/call/built-in/built-in-for-loop.js +2 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +123 -25
- 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 +25 -4
- 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 +17 -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 +9 -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.d.ts +4 -2
- package/dataflow/internal/process/functions/call/built-in/built-in-s-four.js +4 -6
- 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 +14 -15
- package/dataflow/internal/process/functions/call/built-in/built-in-s-three-dispatch.js +10 -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-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-while-loop.js +2 -0
- 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 +23 -16
- package/dataflow/internal/process/functions/call/common.d.ts +10 -2
- package/dataflow/internal/process/functions/call/common.js +38 -10
- package/dataflow/internal/process/functions/call/deferred.d.ts +7 -3
- package/dataflow/internal/process/functions/call/deferred.js +47 -16
- package/dataflow/internal/process/functions/call/known-call-handling.d.ts +4 -4
- package/dataflow/internal/process/functions/call/known-call-handling.js +18 -9
- package/dataflow/internal/process/functions/call/named-call-handling.d.ts +1 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +20 -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 +229 -62
- 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-symbol.js +6 -2
- 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 +14 -5
- package/documentation/data/interface/doc-writing-code.js +1 -2
- package/documentation/data/server/doc-data-server-messages.d.ts +2 -1
- package/documentation/data/server/doc-data-server-messages.js +9 -8
- package/documentation/doc-capabilities.d.ts +13 -7
- package/documentation/doc-capabilities.js +489 -124
- 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 -4
- package/documentation/doc-util/doc-query.js +8 -6
- 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-analyzer.js +1 -1
- package/documentation/wiki-cfg.js +5 -6
- package/documentation/wiki-core.js +11 -8
- package/documentation/wiki-create-linting-rules.js +1 -1
- package/documentation/wiki-dataflow-graph.js +29 -31
- 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-interface.js +2 -2
- package/documentation/wiki-linter.js +154 -16
- package/documentation/wiki-linting-and-testing.js +101 -8
- 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-overview.js +6 -6
- package/documentation/wiki-query.js +50 -98
- package/documentation/wiki-signature-database.js +8 -4
- 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 -49
- package/linter/rules/deprecated-functions.js +30 -39
- 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 +7 -3
- package/project/context/flowr-analyzer-files-context.js +53 -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 +5 -3
- package/project/flowr-analyzer.js +25 -4
- 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.d.ts +0 -2
- package/project/plugins/file-plugins/files/flowr-rda-file.js +18 -61
- 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/file-plugins/flowr-analyzer-file-plugin.js +2 -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 +10 -55
- package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +2 -2
- package/project/sigdb/build.js +4 -0
- package/project/sigdb/codec.d.ts +0 -4
- package/project/sigdb/codec.js +1 -8
- package/project/sigdb/manifest.d.ts +2 -2
- package/project/sigdb/manifest.js +12 -7
- package/project/sigdb/memory-source.js +2 -1
- package/project/sigdb/reader.js +26 -63
- package/project/sigdb/schema.d.ts +0 -2
- package/project/sigdb/schema.js +1 -7
- package/project/sigdb/sigdb-download.d.ts +29 -6
- package/project/sigdb/sigdb-download.js +212 -64
- 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/cascade-action.d.ts +3 -1
- package/queries/catalog/call-context-query/cascade-action.js +2 -0
- package/queries/catalog/call-context-query/identify-link-to-last-call-relation.js +5 -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 +3 -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/origin-query/origin-query-executor.d.ts +1 -1
- package/queries/catalog/origin-query/origin-query-executor.js +2 -2
- package/queries/catalog/origin-query/origin-query-format.d.ts +2 -2
- package/queries/catalog/origin-query/origin-query-format.js +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 +14 -3
- package/queries/query.js +4 -1
- package/r-bridge/data/data.d.ts +1441 -449
- package/r-bridge/data/data.js +1072 -479
- 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 +4 -4
- package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +13 -4
- 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/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 +22 -34
- package/util/files.js +38 -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 +7 -2
- 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 +3 -23
- package/util/text/playground-link.js +10 -10
- 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. A write from within a function reaches the environment it names, a read of the whole environment (\`as.list(e)\`) sees every field written, and copies of an environment variable (\`g <- e\`) share its fields.`,
|
|
132
|
+
example: (0, doc_code_1.codeBlock)('r', 'e <- new.env()\nassign("x", 3, envir = e)\nget("x", envir = e) + e$x\nf <- function() e$y <- 4\nf()\ng <- e\ng$z <- 5\nas.list(e)'),
|
|
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',
|
|
193
|
-
|
|
194
|
-
|
|
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',
|
|
288
|
+
supported: 'fully',
|
|
289
|
+
description: '_Send `local`\'s body to a specific environment._ Its writes land in that environment, also inside a function that binds the same name itself.',
|
|
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,615 @@ ${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. A call in the argument depends on the call it is handed to, so \`g(FALSE, f(4))\` keeps \`g\`.`,
|
|
370
|
+
example: (0, doc_code_1.codeBlock)('r', 'f <- function(a) a\nf(x <- 3)\nx\ng <- function(a, b) if(a) b else 0\ng(FALSE, print("never"))'),
|
|
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._ The ${LinkTo('working-directory', 'working directory')}, ${LinkTo('built-in-options', 'the options')}, and ${LinkTo('graphics-state', 'the graphics state')} are tracked, so a read links to the calls that set what it reads. Other ambient state, like environment variables or the random seed, 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.'
|
|
305
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: [
|
|
306
436
|
{
|
|
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
|
-
]
|
|
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')]
|
|
353
444
|
},
|
|
354
445
|
{
|
|
355
|
-
name: '
|
|
356
|
-
id: '
|
|
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')]
|
|
453
|
+
},
|
|
454
|
+
{
|
|
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: ['<<-'],
|
|
373
569
|
supported: 'fully',
|
|
374
|
-
description: '
|
|
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--')]
|
|
375
572
|
},
|
|
376
573
|
{
|
|
377
|
-
name: '
|
|
378
|
-
id: '
|
|
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',
|
|
584
|
+
supported: 'fully',
|
|
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)')
|
|
587
|
+
},
|
|
588
|
+
{
|
|
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')}. A delayed expression runs where the name is first read, so it sees the bindings at that point and its own writes happen there, in the \`assign.env\` given.`,
|
|
594
|
+
example: (0, doc_code_1.codeBlock)('r', 'assign("x", 3)\ndelayedAssign("y", x * 2)\nx <- 5\ny')
|
|
381
595
|
},
|
|
382
596
|
{
|
|
383
|
-
name: '
|
|
384
|
-
id: '
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
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
|
-
]
|
|
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')]
|
|
603
|
+
},
|
|
604
|
+
{
|
|
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
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
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')]
|
|
798
|
+
},
|
|
799
|
+
{
|
|
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`, `.Options`, printing, and formatting read._ Each option is tracked by name, so `getOption("digits")` reaches the last `options(digits = 3)`, `print` and `cat` reach the printing options, and an unrelated option usually stays out of a slice. `withr::with_options` and `local_options` scope a change, and `eval` of code that sets options counts as setting them. The values themselves are not interpreted, an `options(op)` restoring an unknown list may set any option, and options that change every conversion (`scipen`, `OutDec`) stay an unknown side effect. A function flowR cannot see into may read any option.',
|
|
842
|
+
example: (0, doc_code_1.codeBlock)('r', 'old <- options(digits = 3)\nprint(pi)\noptions(old)\ngetOption("digits")')
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
name: 'Graphics State',
|
|
846
|
+
id: 'graphics-state',
|
|
847
|
+
code: ['par', 'layout', 'palette', 'dev.off', 'dev.set'],
|
|
848
|
+
supported: 'partially',
|
|
849
|
+
description: '_The graphics parameters `par` and `layout` set for the active device, the `palette` all devices share, and the devices opened and closed._ A plot reads the state of the device it draws on, so it links to the `par` calls before it, a new device starts afresh, and `dev.off()` returns to the state of the device that becomes active. `withr::with_par` and the `with_<device>` functions scope a change. Within a function the open devices are unknown, so a device call only adds to what may hold, and grid-based plots like ggplot2 ignore the parameters.',
|
|
850
|
+
example: (0, doc_code_1.codeBlock)('r', 'par(mfrow = c(1, 2))\npng("a.png")\npar(mar = c(1, 1, 1, 1))\nplot(1:10)\ndev.off()\nplot(2:3)')
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
name: 'Help',
|
|
854
|
+
id: 'built-in-help',
|
|
855
|
+
code: ['help', 'help.search'],
|
|
856
|
+
supported: 'partially',
|
|
857
|
+
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.`,
|
|
858
|
+
example: (0, doc_code_1.codeBlock)('r', '?sum\nhelp("sum")')
|
|
571
859
|
},
|
|
572
860
|
{
|
|
573
|
-
name: '
|
|
574
|
-
id: '
|
|
861
|
+
name: 'Reflection / "Computing on the Language"',
|
|
862
|
+
id: 'reflection-"computing-on-the-language"',
|
|
863
|
+
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
864
|
capabilities: [
|
|
576
865
|
{
|
|
577
|
-
name: '
|
|
578
|
-
id: '
|
|
579
|
-
|
|
580
|
-
description: '_Handle `&&`, `||`, ..._'
|
|
581
|
-
},
|
|
582
|
-
{
|
|
583
|
-
name: 'Pipe and Pipe-Bind',
|
|
584
|
-
id: 'pipe-and-pipe-bind',
|
|
866
|
+
name: 'Get Function Structure',
|
|
867
|
+
id: 'get-function-structure',
|
|
868
|
+
code: ['body', 'formals', 'environment', 'args'],
|
|
585
869
|
supported: 'partially',
|
|
586
|
-
description:
|
|
870
|
+
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.`,
|
|
871
|
+
example: (0, doc_code_1.codeBlock)('r', 'f <- function(x) x + 1\nbody(f)\nformals(f)\nenvironment(f)'),
|
|
872
|
+
url: [RLang('Manipulation of functions')]
|
|
587
873
|
},
|
|
588
874
|
{
|
|
589
|
-
name: '
|
|
590
|
-
id: '
|
|
591
|
-
|
|
592
|
-
|
|
875
|
+
name: 'Modify Function Structure',
|
|
876
|
+
id: 'modify-function-structure',
|
|
877
|
+
code: ['body<-', 'formals<-', 'environment<-'],
|
|
878
|
+
supported: 'partially',
|
|
879
|
+
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.`,
|
|
880
|
+
example: (0, doc_code_1.codeBlock)('r', 'f <- function(x) x + 1\nbody(f) <- quote(x * 2)\nf(3)'),
|
|
881
|
+
url: [RLang('Manipulation of functions')]
|
|
593
882
|
},
|
|
594
883
|
{
|
|
595
|
-
name: '
|
|
596
|
-
id: 'built-in-
|
|
884
|
+
name: 'Quoting',
|
|
885
|
+
id: 'built-in-quoting',
|
|
886
|
+
code: ['quote', 'substitute', 'bquote'],
|
|
597
887
|
supported: 'partially',
|
|
598
|
-
description:
|
|
888
|
+
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.`,
|
|
889
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1\nquote(x + y)\nbquote(.(x) + y)'),
|
|
890
|
+
url: [RLang('Computing on the language'), AdvancedR('Metaprogramming', 'metaprogramming.html')]
|
|
599
891
|
},
|
|
600
892
|
{
|
|
601
|
-
name: '
|
|
602
|
-
id: 'built-in-
|
|
603
|
-
|
|
604
|
-
|
|
893
|
+
name: 'Evaluation',
|
|
894
|
+
id: 'built-in-evaluation',
|
|
895
|
+
code: ['eval', 'evalq', 'eval.parent'],
|
|
896
|
+
supported: 'partially',
|
|
897
|
+
description: `_Run an expression that is a value with \`eval\`, \`evalq\`, \`eval.parent\`, ..._ The captured code is linked where it is evaluated, also through a name bound once to \`quote\`, \`as.name\`, \`str2lang\`, or \`parse\`, but \`eval(expr, envir)\` with an ${LinkTo('dynamic-environment-resolution', 'environment')} we do not know stays an unknown side effect.`,
|
|
898
|
+
example: (0, doc_code_1.codeBlock)('r', 'e <- quote(x + 1)\nx <- 2\neval(e)\nn <- as.name("x")\neval(n)'),
|
|
899
|
+
url: [RLang('Evaluation of expressions'), AdvancedR('Evaluation', 'evaluation.html')]
|
|
605
900
|
},
|
|
606
901
|
{
|
|
607
|
-
name: '
|
|
608
|
-
id: '
|
|
902
|
+
name: 'String Templates',
|
|
903
|
+
id: 'string-templates',
|
|
904
|
+
code: ['glue', 'str_glue', 'cli_alert_info'],
|
|
609
905
|
supported: 'partially',
|
|
610
|
-
description: '
|
|
906
|
+
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.',
|
|
907
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 2\nglue::glue("x plus one is {x + 1}")')
|
|
611
908
|
},
|
|
612
909
|
{
|
|
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
|
-
]
|
|
910
|
+
name: 'Parsing',
|
|
911
|
+
id: 'built-in-parsing',
|
|
912
|
+
code: ['parse', 'str2lang', 'deparse'],
|
|
913
|
+
supported: 'partially',
|
|
914
|
+
description: `_Turn text into an expression with \`parse\` or \`str2lang\`, 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.`,
|
|
915
|
+
example: (0, doc_code_1.codeBlock)('r', 'eval(parse(text = "1 + 1"))\neval(str2lang("2 * 3"))\ndeparse(quote(x + y))'),
|
|
916
|
+
url: [RLang('The parsing process'), RLang('Deparsing')]
|
|
653
917
|
}
|
|
654
918
|
]
|
|
655
919
|
}
|
|
@@ -658,44 +922,69 @@ ${await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { simplified: true })}
|
|
|
658
922
|
{
|
|
659
923
|
name: 'Literal Values',
|
|
660
924
|
id: 'literal-values',
|
|
925
|
+
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
926
|
capabilities: [
|
|
662
927
|
{
|
|
663
928
|
name: 'Numbers',
|
|
664
929
|
id: 'numbers',
|
|
665
930
|
supported: 'fully',
|
|
666
|
-
description: '_Recognize numbers like `3`, `3.14`, `
|
|
931
|
+
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_`, ..._',
|
|
932
|
+
example: (0, doc_code_1.codeBlock)('r', '1L\n0xFF\n1e-3\n0x1p3\nNA_real_'),
|
|
933
|
+
capabilities: [
|
|
934
|
+
{
|
|
935
|
+
name: 'Complex',
|
|
936
|
+
id: 'numbers-complex',
|
|
937
|
+
supported: 'fully',
|
|
938
|
+
description: '_Recognize the imaginary literals `1i`, `4.1i`, `1e-2i`, ..._ The value survives arithmetic and is told apart from `1L` and a plain `1`.',
|
|
939
|
+
example: (0, doc_code_1.codeBlock)('r', 'z <- 1i\nz + 2i\n3 + 2i'),
|
|
940
|
+
url: [RLang('Literal constants')]
|
|
941
|
+
}
|
|
942
|
+
],
|
|
943
|
+
url: [RLang('Literal constants')]
|
|
667
944
|
},
|
|
668
945
|
{
|
|
669
946
|
name: 'Strings',
|
|
670
947
|
id: 'strings',
|
|
671
948
|
supported: 'fully',
|
|
672
|
-
description:
|
|
949
|
+
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
950
|
capabilities: [
|
|
674
951
|
{
|
|
675
952
|
name: 'Raw Strings',
|
|
676
953
|
id: 'raw-strings',
|
|
677
954
|
supported: 'fully',
|
|
678
|
-
|
|
955
|
+
minRVersion: versions_1.MIN_VERSION_RAW_STABLE,
|
|
956
|
+
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.`,
|
|
957
|
+
example: (0, doc_code_1.codeBlock)('r', 'r"(C:\\Users\\me)"\nr"[\\d+]"')
|
|
679
958
|
}
|
|
680
|
-
]
|
|
959
|
+
],
|
|
960
|
+
url: [RLang('Literal constants')]
|
|
681
961
|
},
|
|
682
962
|
{
|
|
683
963
|
name: 'Logical',
|
|
684
964
|
id: 'logical',
|
|
965
|
+
code: ['TRUE', 'FALSE'],
|
|
685
966
|
supported: 'fully',
|
|
686
|
-
description: '_Recognize the logicals `TRUE` and `FALSE`, ..._'
|
|
967
|
+
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.',
|
|
968
|
+
example: (0, doc_code_1.codeBlock)('r', 'TRUE && FALSE\nT <- FALSE\nT'),
|
|
969
|
+
url: [RLang('Constants')]
|
|
687
970
|
},
|
|
688
971
|
{
|
|
689
972
|
name: 'NULL',
|
|
690
973
|
id: 'null',
|
|
974
|
+
code: ['NULL'],
|
|
691
975
|
supported: 'fully',
|
|
692
|
-
description: '
|
|
976
|
+
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.`,
|
|
977
|
+
example: (0, doc_code_1.codeBlock)('r', 'c(1, NULL, 2)\nl <- list(a = 1)\nl$a <- NULL\nlength(l)'),
|
|
978
|
+
url: [RLang('NULL object')]
|
|
693
979
|
},
|
|
694
980
|
{
|
|
695
981
|
name: 'Inf and NaN',
|
|
696
982
|
id: 'inf-and-nan',
|
|
983
|
+
code: ['Inf', 'NaN'],
|
|
697
984
|
supported: 'fully',
|
|
698
|
-
description:
|
|
985
|
+
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')}.`,
|
|
986
|
+
example: (0, doc_code_1.codeBlock)('r', '1 / 0\n-1 / 0\n0 / 0\nis.nan(NA)'),
|
|
987
|
+
url: [RLang('Constants')]
|
|
699
988
|
}
|
|
700
989
|
]
|
|
701
990
|
}
|
|
@@ -704,239 +993,543 @@ ${await (0, doc_dfg_1.printDfGraphForCode)(parser, code, { simplified: true })}
|
|
|
704
993
|
{
|
|
705
994
|
name: 'Non-Standard Evaluations/Semantics',
|
|
706
995
|
id: 'non-standard-evaluations-semantics',
|
|
996
|
+
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
997
|
capabilities: [
|
|
708
998
|
{
|
|
709
999
|
name: 'Data Masking',
|
|
710
1000
|
id: 'data-masking',
|
|
1001
|
+
code: ['subset'],
|
|
711
1002
|
supported: 'partially',
|
|
712
|
-
description:
|
|
1003
|
+
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.`,
|
|
1004
|
+
example: (0, doc_code_1.codeBlock)('r', 'd <- data.frame(x = 1:3)\nthreshold <- 2\nsubset(d, x > threshold)'),
|
|
1005
|
+
url: [AdvancedR('Data masks', 'evaluation.html#data-masks')]
|
|
713
1006
|
},
|
|
714
1007
|
{
|
|
715
1008
|
name: 'Recycling',
|
|
716
1009
|
id: 'recycling',
|
|
717
1010
|
supported: 'not',
|
|
718
|
-
description:
|
|
1011
|
+
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.`,
|
|
1012
|
+
example: (0, doc_code_1.codeBlock)('r', 'c(1, 2, 3, 4) + c(10, 20)'),
|
|
1013
|
+
url: [RLang('Recycling rules'), AdvancedR('Vectors', 'vectors-chap.html')]
|
|
719
1014
|
},
|
|
720
1015
|
{
|
|
721
1016
|
name: 'Vectorized Operator or Functions',
|
|
722
1017
|
id: 'vectorized-operator-or-functions',
|
|
723
|
-
|
|
724
|
-
|
|
1018
|
+
code: ['ifelse'],
|
|
1019
|
+
supported: 'partially',
|
|
1020
|
+
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.`,
|
|
1021
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1:5\nx * 2\nifelse(x > 2, "big", "small")'),
|
|
1022
|
+
url: [AdvancedR('Vectorise', 'perf-improve.html#vectorise')]
|
|
725
1023
|
},
|
|
726
1024
|
{
|
|
727
1025
|
name: 'Hooks',
|
|
728
1026
|
id: 'hooks',
|
|
1027
|
+
code: ['on.exit', 'setHook'],
|
|
729
1028
|
supported: 'partially',
|
|
730
|
-
description:
|
|
1029
|
+
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.`,
|
|
1030
|
+
example: (0, doc_code_1.codeBlock)('r', 'f <- function() {\n on.exit(print("bye"))\n 1\n}\nf()'),
|
|
1031
|
+
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
1032
|
},
|
|
732
1033
|
{
|
|
733
1034
|
name: 'Precedence',
|
|
734
1035
|
id: 'precedence',
|
|
735
1036
|
supported: 'fully',
|
|
736
|
-
description: '
|
|
1037
|
+
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.`,
|
|
1038
|
+
example: (0, doc_code_1.codeBlock)('r', '-2^2\n1:3 - 1\n!TRUE == FALSE'),
|
|
1039
|
+
url: [RLang('Operator tokens')]
|
|
737
1040
|
},
|
|
738
1041
|
{
|
|
739
1042
|
name: 'Attributes',
|
|
740
1043
|
id: 'attributes',
|
|
1044
|
+
description: `The data an object carries beside its value, which is where its ${LinkTo('oop-s3', 'S3 class')} and its shape live.`,
|
|
741
1045
|
capabilities: [
|
|
742
1046
|
{
|
|
743
1047
|
name: 'User-Defined',
|
|
744
1048
|
id: 'user-defined',
|
|
745
|
-
|
|
746
|
-
|
|
1049
|
+
code: ['attr', 'attributes', 'attr<-'],
|
|
1050
|
+
supported: 'partially',
|
|
1051
|
+
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.`,
|
|
1052
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1:3\nattr(x, "unit") <- "cm"\nattributes(x)'),
|
|
1053
|
+
url: [RLang('Attributes')]
|
|
747
1054
|
},
|
|
748
1055
|
{
|
|
749
1056
|
name: 'Built-In',
|
|
750
1057
|
id: 'built-in',
|
|
751
|
-
|
|
752
|
-
|
|
1058
|
+
code: ['dim<-', 'names<-', 'class', 'dim', 'names'],
|
|
1059
|
+
supported: 'partially',
|
|
1060
|
+
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.`,
|
|
1061
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1:6\ndim(x) <- c(2, 3)\nclass(x)'),
|
|
1062
|
+
url: [RLang('Dimensional attributes')]
|
|
753
1063
|
}
|
|
754
1064
|
]
|
|
755
1065
|
}
|
|
756
1066
|
]
|
|
757
1067
|
},
|
|
758
1068
|
{
|
|
759
|
-
name: '
|
|
760
|
-
id: '
|
|
1069
|
+
name: 'Object-Oriented Programming',
|
|
1070
|
+
id: 'object-oriented-programming',
|
|
1071
|
+
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
1072
|
capabilities: [
|
|
762
1073
|
{
|
|
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',
|
|
1074
|
+
name: 'S3',
|
|
1075
|
+
id: 'oop-s3',
|
|
1076
|
+
url: [AdvancedR('S3', 's3.html'), RLang('Object-oriented programming', 'Object_002doriented-programming')],
|
|
1077
|
+
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.`,
|
|
1078
|
+
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
1079
|
capabilities: [
|
|
790
1080
|
{
|
|
791
|
-
name: '
|
|
792
|
-
id: 'oop-s3',
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
1081
|
+
name: 'Class Construction',
|
|
1082
|
+
id: 'oop-s3-construction',
|
|
1083
|
+
code: ['class<-', 'oldClass<-'],
|
|
1084
|
+
supported: 'fully',
|
|
1085
|
+
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.`,
|
|
1086
|
+
url: [RLang('Objects')]
|
|
1087
|
+
},
|
|
1088
|
+
{
|
|
1089
|
+
name: 'Dispatch',
|
|
1090
|
+
id: 'oop-s3-dispatch',
|
|
1091
|
+
code: ['UseMethod'],
|
|
796
1092
|
supported: 'partially',
|
|
797
|
-
description:
|
|
1093
|
+
description: `_Route a generic call to the method that runs._ \`UseMethod\` and a built-in generic like \`length\` or \`toString\` link 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).`,
|
|
1094
|
+
url: [RLang('UseMethod'), RLang('Method dispatching')]
|
|
798
1095
|
},
|
|
799
1096
|
{
|
|
800
|
-
name: '
|
|
801
|
-
id: 'oop-
|
|
802
|
-
|
|
803
|
-
{ name: AdvancedR('S4'), href: 'https://adv-r.hadley.nz/s4.html' }
|
|
804
|
-
],
|
|
1097
|
+
name: 'Inheritance',
|
|
1098
|
+
id: 'oop-s3-inheritance',
|
|
1099
|
+
code: ['NextMethod'],
|
|
805
1100
|
supported: 'partially',
|
|
806
|
-
description:
|
|
1101
|
+
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, and hands on the current values of the formals.`,
|
|
1102
|
+
url: [RLang('NextMethod'), RLang('Inheritance')]
|
|
1103
|
+
}
|
|
1104
|
+
]
|
|
1105
|
+
},
|
|
1106
|
+
{
|
|
1107
|
+
name: 'S4',
|
|
1108
|
+
id: 'oop-s4',
|
|
1109
|
+
url: [AdvancedR('S4', 's4.html')],
|
|
1110
|
+
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', '`@`')}.`,
|
|
1111
|
+
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))'),
|
|
1112
|
+
capabilities: [
|
|
1113
|
+
{
|
|
1114
|
+
name: 'Class Construction',
|
|
1115
|
+
id: 'oop-s4-construction',
|
|
1116
|
+
code: ['setClass'],
|
|
1117
|
+
supported: 'fully',
|
|
1118
|
+
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.`,
|
|
1119
|
+
url: [RLang('Classes')]
|
|
807
1120
|
},
|
|
808
1121
|
{
|
|
809
|
-
name: '
|
|
810
|
-
id: 'oop-
|
|
811
|
-
|
|
812
|
-
{ name: AdvancedR('R6'), href: 'https://adv-r.hadley.nz/r6.html' }
|
|
813
|
-
],
|
|
1122
|
+
name: 'Dispatch',
|
|
1123
|
+
id: 'oop-s4-dispatch',
|
|
1124
|
+
code: ['standardGeneric', 'setGeneric', 'setMethod', 'setReplaceMethod'],
|
|
814
1125
|
supported: 'partially',
|
|
815
|
-
description:
|
|
1126
|
+
description: `_Route a generic call to the method \`setMethod\` (or \`setReplaceMethod\`, for the \`<-\` generic) 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.`,
|
|
1127
|
+
url: [RLang('Method dispatching')]
|
|
816
1128
|
},
|
|
817
1129
|
{
|
|
818
|
-
name: '
|
|
819
|
-
id: 'oop-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
]
|
|
1130
|
+
name: 'Inheritance',
|
|
1131
|
+
id: 'oop-s4-inheritance',
|
|
1132
|
+
code: ['callNextMethod'],
|
|
1133
|
+
supported: 'not',
|
|
1134
|
+
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')}.`,
|
|
1135
|
+
url: [RLang('Inheritance')]
|
|
1136
|
+
}
|
|
1137
|
+
]
|
|
1138
|
+
},
|
|
1139
|
+
{
|
|
1140
|
+
name: 'RC/R5',
|
|
1141
|
+
id: 'oop-rc',
|
|
1142
|
+
code: ['setRefClass'],
|
|
1143
|
+
url: [AdvancedR('R5 / Reference classes', 'r6.html#why-r6')],
|
|
1144
|
+
supported: 'partially',
|
|
1145
|
+
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.`,
|
|
1146
|
+
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)')
|
|
1147
|
+
},
|
|
1148
|
+
{
|
|
1149
|
+
name: 'R6',
|
|
1150
|
+
id: 'oop-r6',
|
|
1151
|
+
code: ['R6Class'],
|
|
1152
|
+
url: [AdvancedR('R6', 'r6.html')],
|
|
1153
|
+
supported: 'partially',
|
|
1154
|
+
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.`,
|
|
1155
|
+
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')
|
|
1156
|
+
},
|
|
1157
|
+
{
|
|
1158
|
+
name: 'R7/S7',
|
|
1159
|
+
id: 'oop-r7-s7',
|
|
1160
|
+
code: ['new_class'],
|
|
1161
|
+
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' }],
|
|
1162
|
+
supported: 'partially',
|
|
1163
|
+
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."`,
|
|
1164
|
+
example: (0, doc_code_1.codeBlock)('r', 'Person <- S7::new_class("Person", properties = list(name = S7::class_character))\nPerson(name = "ada")@name')
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
name: 'Class-Based Dependency Attribution',
|
|
1168
|
+
id: 'oop-class-dependency-attribution',
|
|
1169
|
+
supported: 'partially',
|
|
1170
|
+
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')}.`,
|
|
1171
|
+
capabilities: [
|
|
1172
|
+
{
|
|
1173
|
+
name: 'S3 class ownership',
|
|
1174
|
+
id: 'class-owner-s3',
|
|
824
1175
|
supported: 'partially',
|
|
825
|
-
description: '
|
|
1176
|
+
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
1177
|
},
|
|
827
1178
|
{
|
|
828
|
-
name: '
|
|
829
|
-
id: '
|
|
1179
|
+
name: 'S4 class ownership',
|
|
1180
|
+
id: 'class-owner-s4',
|
|
830
1181
|
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
|
-
]
|
|
1182
|
+
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
1183
|
}
|
|
847
1184
|
]
|
|
848
1185
|
}
|
|
849
1186
|
]
|
|
850
1187
|
},
|
|
851
1188
|
{
|
|
852
|
-
name: 'Structure',
|
|
1189
|
+
name: 'R File Structure',
|
|
853
1190
|
id: 'structure',
|
|
1191
|
+
description: 'The lexical shape of a source file, down to its line endings and encoding.',
|
|
854
1192
|
capabilities: [
|
|
855
1193
|
{
|
|
856
1194
|
name: 'Comments',
|
|
857
1195
|
id: 'comments',
|
|
858
1196
|
supported: 'fully',
|
|
859
|
-
description:
|
|
1197
|
+
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.`,
|
|
1198
|
+
example: (0, doc_code_1.codeBlock)('r', '#!/usr/bin/env Rscript\n# a comment\nx <- 1 # a trailing comment'),
|
|
1199
|
+
url: [RLang('Comments')]
|
|
1200
|
+
},
|
|
1201
|
+
{
|
|
1202
|
+
name: 'Line Directive',
|
|
1203
|
+
id: 'line-directive',
|
|
1204
|
+
supported: 'partially',
|
|
1205
|
+
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.',
|
|
1206
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1\n#line 42 "other.R"\ny <- 2'),
|
|
1207
|
+
url: [{ name: 'R Definition/parse', href: 'https://stat.ethz.ch/R-manual/R-devel/library/base/html/parse.html' }]
|
|
860
1208
|
},
|
|
861
1209
|
{
|
|
862
1210
|
name: 'Semicolons',
|
|
863
1211
|
id: 'semicolons',
|
|
864
1212
|
supported: 'fully',
|
|
865
|
-
description:
|
|
1213
|
+
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.`,
|
|
1214
|
+
example: (0, doc_code_1.codeBlock)('r', 'a <- 1; b <- 2; a + b'),
|
|
1215
|
+
url: [RLang('Separators')]
|
|
866
1216
|
},
|
|
867
1217
|
{
|
|
868
1218
|
name: 'Newlines',
|
|
869
1219
|
id: 'newlines',
|
|
870
1220
|
supported: 'fully',
|
|
871
|
-
description: '_Recognize and resolve newlines like `a
|
|
1221
|
+
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.',
|
|
1222
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1 +\n 2\ny <- 1\n + 2'),
|
|
1223
|
+
url: [RLang('Separators')]
|
|
1224
|
+
},
|
|
1225
|
+
{
|
|
1226
|
+
name: 'Line Endings',
|
|
1227
|
+
id: 'line-endings',
|
|
1228
|
+
supported: 'fully',
|
|
1229
|
+
description: '_Recognize `\\n` (Unix), `\\r\\n` (Windows), and a lone `\\r` (classic Mac)._ Normalized at the r-bridge boundary, with both engines.',
|
|
1230
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1\r\ny <- x + 1')
|
|
1231
|
+
},
|
|
1232
|
+
{
|
|
1233
|
+
name: 'Source Encoding',
|
|
1234
|
+
id: 'source-encoding',
|
|
1235
|
+
supported: 'fully',
|
|
1236
|
+
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.`,
|
|
1237
|
+
example: (0, doc_code_1.codeBlock)('r', 'st\u00e4rke <- "caf\u00e9"\n`\u03b1 \u03b2` <- 2\nst\u00e4rke'),
|
|
1238
|
+
url: [RLang('Tokens')]
|
|
1239
|
+
},
|
|
1240
|
+
{
|
|
1241
|
+
name: 'Byte-Order Mark',
|
|
1242
|
+
id: 'byte-order-mark',
|
|
1243
|
+
supported: 'partially',
|
|
1244
|
+
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.'
|
|
1245
|
+
},
|
|
1246
|
+
{
|
|
1247
|
+
name: 'Syntax Errors',
|
|
1248
|
+
id: 'syntax-errors',
|
|
1249
|
+
supported: 'partially',
|
|
1250
|
+
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.`,
|
|
1251
|
+
example: (0, doc_code_1.codeBlock)('r', 'x <- 1\ny <- (\nz <- 3'),
|
|
1252
|
+
url: [RLang('The parsing process')]
|
|
1253
|
+
},
|
|
1254
|
+
{
|
|
1255
|
+
name: 'Reserved Words',
|
|
1256
|
+
id: 'reserved-words',
|
|
1257
|
+
supported: 'partially',
|
|
1258
|
+
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')}.`,
|
|
1259
|
+
example: (0, doc_code_1.codeBlock)('r', 'if <- 5'),
|
|
1260
|
+
url: [RLang('Reserved words', 'Reserved-words-1')]
|
|
1261
|
+
}
|
|
1262
|
+
]
|
|
1263
|
+
},
|
|
1264
|
+
{
|
|
1265
|
+
name: 'Project',
|
|
1266
|
+
id: 'project',
|
|
1267
|
+
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')}.`,
|
|
1268
|
+
capabilities: [
|
|
1269
|
+
{
|
|
1270
|
+
name: 'Package Metadata',
|
|
1271
|
+
id: 'project-metadata',
|
|
1272
|
+
description: 'The files that describe the package itself, what it needs, and what it offers.',
|
|
1273
|
+
capabilities: [
|
|
1274
|
+
{
|
|
1275
|
+
name: 'DESCRIPTION',
|
|
1276
|
+
id: 'project-description',
|
|
1277
|
+
supported: 'fully',
|
|
1278
|
+
description: "_Read a package's `DESCRIPTION`._ Its DCF records give the package name, version, R version, dependency fields, and `Collate` order.",
|
|
1279
|
+
url: [
|
|
1280
|
+
Plugin('src/project/plugins/file-plugins/files/flowr-description-file.ts'),
|
|
1281
|
+
{ name: 'Writing R Extensions/The DESCRIPTION file', href: 'https://cran.r-project.org/doc/manuals/r-release/R-exts.html#The-DESCRIPTION-file' }
|
|
1282
|
+
]
|
|
1283
|
+
},
|
|
1284
|
+
{
|
|
1285
|
+
name: 'NAMESPACE',
|
|
1286
|
+
id: 'project-namespace',
|
|
1287
|
+
supported: 'fully',
|
|
1288
|
+
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')}.`,
|
|
1289
|
+
url: [
|
|
1290
|
+
Plugin('src/project/plugins/file-plugins/files/flowr-namespace-file.ts'),
|
|
1291
|
+
{ name: 'Writing R Extensions/Package namespaces', href: 'https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Package-namespaces' }
|
|
1292
|
+
]
|
|
1293
|
+
},
|
|
1294
|
+
{
|
|
1295
|
+
name: 'Documentation (`.Rd`)',
|
|
1296
|
+
id: 'project-rd',
|
|
1297
|
+
supported: 'fully',
|
|
1298
|
+
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.',
|
|
1299
|
+
url: [
|
|
1300
|
+
Plugin('src/project/plugins/file-plugins/files/flowr-rd-file.ts'),
|
|
1301
|
+
{ name: 'Writing R Extensions/Rd format', href: 'https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Rd-format' }
|
|
1302
|
+
]
|
|
1303
|
+
},
|
|
1304
|
+
{
|
|
1305
|
+
name: 'NEWS',
|
|
1306
|
+
id: 'project-news',
|
|
1307
|
+
supported: 'fully',
|
|
1308
|
+
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.",
|
|
1309
|
+
url: [
|
|
1310
|
+
Plugin('src/project/plugins/file-plugins/files/flowr-news-file.ts'),
|
|
1311
|
+
{ name: 'Writing R Extensions/Package subdirectories', href: 'https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Package-subdirectories' }
|
|
1312
|
+
]
|
|
1313
|
+
},
|
|
1314
|
+
{
|
|
1315
|
+
name: 'Package Data (`sysdata.rda`)',
|
|
1316
|
+
id: 'project-sysdata',
|
|
1317
|
+
supported: 'partially',
|
|
1318
|
+
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.',
|
|
1319
|
+
url: [
|
|
1320
|
+
Plugin('src/project/plugins/file-plugins/files/flowr-sysdata-file.ts'),
|
|
1321
|
+
{ name: 'Writing R Extensions/Data in packages', href: 'https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Data-in-packages' }
|
|
1322
|
+
]
|
|
1323
|
+
}
|
|
1324
|
+
]
|
|
1325
|
+
},
|
|
1326
|
+
{
|
|
1327
|
+
name: 'Dependency Managers',
|
|
1328
|
+
id: 'project-dependency-managers',
|
|
1329
|
+
description: 'The lockfiles and manifests a version manager pins a project\'s packages with.',
|
|
1330
|
+
capabilities: [
|
|
1331
|
+
{
|
|
1332
|
+
name: 'renv',
|
|
1333
|
+
id: 'version-manager-renv',
|
|
1334
|
+
supported: 'fully',
|
|
1335
|
+
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.',
|
|
1336
|
+
url: [
|
|
1337
|
+
Plugin('src/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.ts'),
|
|
1338
|
+
{ name: 'renv', href: 'https://rstudio.github.io/renv/' }
|
|
1339
|
+
]
|
|
1340
|
+
},
|
|
1341
|
+
{
|
|
1342
|
+
name: 'packrat',
|
|
1343
|
+
id: 'version-manager-packrat',
|
|
1344
|
+
supported: 'fully',
|
|
1345
|
+
description: '_Read the configuration of [packrat](https://rstudio.github.io/packrat/), the predecessor of renv._ The `packrat/lib` library beside it is not loaded.',
|
|
1346
|
+
url: [
|
|
1347
|
+
Plugin('src/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.ts'),
|
|
1348
|
+
{ name: 'packrat', href: 'https://rstudio.github.io/packrat/' }
|
|
1349
|
+
]
|
|
1350
|
+
},
|
|
1351
|
+
{
|
|
1352
|
+
name: 'rv',
|
|
1353
|
+
id: 'version-manager-rv',
|
|
1354
|
+
supported: 'fully',
|
|
1355
|
+
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`.',
|
|
1356
|
+
url: [Plugin('src/project/plugins/file-plugins/files/flowr-manifest-files.ts'), { name: 'rv', href: 'https://a2-ai.github.io/rv-docs/' }]
|
|
1357
|
+
},
|
|
1358
|
+
{
|
|
1359
|
+
name: 'uvr',
|
|
1360
|
+
id: 'version-manager-uvr',
|
|
1361
|
+
supported: 'fully',
|
|
1362
|
+
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.',
|
|
1363
|
+
url: [Plugin('src/project/plugins/file-plugins/files/flowr-manifest-files.ts'), { name: 'uvr', href: 'https://github.com/nbafrank/uvr' }]
|
|
1364
|
+
},
|
|
1365
|
+
{
|
|
1366
|
+
name: 'Installed Library',
|
|
1367
|
+
id: 'project-library',
|
|
1368
|
+
supported: 'partially',
|
|
1369
|
+
description: '_Read the package library a project installs into (`renv/library`, `packrat/lib`, or the platform library)._ Their code is not read.',
|
|
1370
|
+
url: [Plugin('src/project/plugins/package-version-plugins/flowr-analyzer-package-versions-library-plugin.ts')]
|
|
1371
|
+
}
|
|
1372
|
+
]
|
|
1373
|
+
},
|
|
1374
|
+
{
|
|
1375
|
+
name: 'Startup and Discovery',
|
|
1376
|
+
id: 'project-startup-and-discovery',
|
|
1377
|
+
description: 'What runs before a script does and what counts as part of the project at all.',
|
|
1378
|
+
capabilities: [
|
|
1379
|
+
{
|
|
1380
|
+
name: 'Startup Files',
|
|
1381
|
+
id: 'project-startup-files',
|
|
1382
|
+
supported: 'partially',
|
|
1383
|
+
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.',
|
|
1384
|
+
url: [
|
|
1385
|
+
Plugin('src/project/plugins/file-plugins/flowr-analyzer-rprofile-file-plugin.ts'),
|
|
1386
|
+
{ name: 'R Definition/Startup', href: 'https://stat.ethz.ch/R-manual/R-devel/library/base/html/Startup.html' }
|
|
1387
|
+
]
|
|
1388
|
+
},
|
|
1389
|
+
{
|
|
1390
|
+
name: 'Ignore Files',
|
|
1391
|
+
id: 'project-ignore-files',
|
|
1392
|
+
supported: 'fully',
|
|
1393
|
+
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.',
|
|
1394
|
+
url: [
|
|
1395
|
+
Plugin('src/project/plugins/project-discovery/flowr-analyzer-ignore-file-project-discovery-plugin.ts'),
|
|
1396
|
+
{ name: 'gitignore', href: 'https://git-scm.com/docs/gitignore' }
|
|
1397
|
+
]
|
|
1398
|
+
}
|
|
1399
|
+
]
|
|
1400
|
+
},
|
|
1401
|
+
{
|
|
1402
|
+
name: 'Pre-Processors/external Tooling',
|
|
1403
|
+
id: 'pre-processors-external-tooling',
|
|
1404
|
+
description: 'The tooling around R code rather than the R in it, such as roxygen2 blocks and woven documents.',
|
|
1405
|
+
capabilities: [
|
|
1406
|
+
{
|
|
1407
|
+
name: 'roxygen2',
|
|
1408
|
+
id: 'roxygen2',
|
|
1409
|
+
supported: 'partially',
|
|
1410
|
+
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.`,
|
|
1411
|
+
example: (0, doc_code_1.codeBlock)('r', "#' @param x a number\n#' @importFrom stats median\n#' @export\nmid <- function(x) median(x)"),
|
|
1412
|
+
url: [{ name: 'roxygen2', href: 'https://roxygen2.r-lib.org/' }]
|
|
1413
|
+
},
|
|
1414
|
+
]
|
|
872
1415
|
}
|
|
873
1416
|
]
|
|
874
1417
|
},
|
|
875
1418
|
{
|
|
876
1419
|
name: 'System, I/O, FFI, and Other Files',
|
|
877
1420
|
id: 'system-i-o-ffi-and-other-files',
|
|
1421
|
+
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
1422
|
capabilities: [
|
|
879
1423
|
{
|
|
880
1424
|
name: 'Sourcing External Files',
|
|
881
1425
|
id: 'sourcing-external-files',
|
|
1426
|
+
code: ['source', 'sys.source'],
|
|
882
1427
|
supported: 'partially',
|
|
883
|
-
description: '
|
|
1428
|
+
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.`,
|
|
1429
|
+
example: (0, doc_code_1.codeBlock)('r', 'source("helpers.R")\nsys.source("setup.R", envir = environment())')
|
|
884
1430
|
},
|
|
885
1431
|
{
|
|
886
|
-
name: 'Handling Binary
|
|
1432
|
+
name: 'Handling Binary Files',
|
|
887
1433
|
id: 'handling-binary-riles',
|
|
888
|
-
|
|
889
|
-
|
|
1434
|
+
code: ['save', 'load', 'readRDS'],
|
|
1435
|
+
supported: 'partially',
|
|
1436
|
+
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.',
|
|
1437
|
+
example: (0, doc_code_1.codeBlock)('r', 'save(x, file = "x.RData")\nload("x.RData")\nreadRDS("y.rds")'),
|
|
1438
|
+
url: [{ name: 'R Definition/save', href: 'https://stat.ethz.ch/R-manual/R-devel/library/base/html/save.html' }]
|
|
890
1439
|
},
|
|
891
1440
|
{
|
|
892
1441
|
name: 'I/O',
|
|
893
1442
|
id: 'i-o',
|
|
894
|
-
|
|
895
|
-
|
|
1443
|
+
code: ['read.csv', 'write.csv'],
|
|
1444
|
+
supported: 'partially',
|
|
1445
|
+
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.`,
|
|
1446
|
+
example: (0, doc_code_1.codeBlock)('r', 'd <- read.csv("in.csv")\nwrite.csv(d, "out.csv")'),
|
|
1447
|
+
url: [RLang('Operating system access')]
|
|
896
1448
|
},
|
|
897
1449
|
{
|
|
898
1450
|
name: 'Foreign Function Interface',
|
|
899
1451
|
id: 'foreign-function-interface',
|
|
900
|
-
|
|
901
|
-
|
|
1452
|
+
code: ['.C', '.Call', '.External', '.Fortran'],
|
|
1453
|
+
supported: 'partially',
|
|
1454
|
+
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.`,
|
|
1455
|
+
example: (0, doc_code_1.codeBlock)('r', '.Call("my_c_fn", 1)\n.Fortran("my_f_sub", x = 1)')
|
|
902
1456
|
},
|
|
903
1457
|
{
|
|
904
1458
|
name: 'System Calls',
|
|
905
1459
|
id: 'system-calls',
|
|
906
|
-
|
|
907
|
-
|
|
1460
|
+
code: ['system', 'system2'],
|
|
1461
|
+
supported: 'partially',
|
|
1462
|
+
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.',
|
|
1463
|
+
example: (0, doc_code_1.codeBlock)('r', 'system("ls -la")\nsystem2("git", c("status"))'),
|
|
1464
|
+
url: [RLang('Operating system access')]
|
|
908
1465
|
},
|
|
909
1466
|
{
|
|
910
1467
|
name: 'R-Markdown files',
|
|
911
1468
|
id: 'file:rmd',
|
|
912
|
-
supported: '
|
|
913
|
-
description: 'Support R-Markdown files as R sources.'
|
|
1469
|
+
supported: 'partially',
|
|
1470
|
+
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.',
|
|
1471
|
+
url: [{ name: 'R Markdown', href: 'https://rmarkdown.rstudio.com/' }]
|
|
914
1472
|
},
|
|
915
1473
|
{
|
|
916
1474
|
name: 'Jupyter Notebook',
|
|
917
1475
|
id: 'file:ipynb',
|
|
918
1476
|
supported: 'partially',
|
|
919
|
-
description: 'Support Jupyter Notebooks as R sources.'
|
|
1477
|
+
description: 'Support Jupyter Notebooks as R sources. Cells are read in document order, not execution order, and the kernel is not checked.',
|
|
1478
|
+
url: [{ name: 'Jupyter Notebook Format', href: 'https://nbformat.readthedocs.io/en/latest/format_description.html' }]
|
|
920
1479
|
},
|
|
921
1480
|
{
|
|
922
1481
|
name: 'Quarto',
|
|
923
1482
|
id: 'file:qmd',
|
|
924
1483
|
supported: 'partially',
|
|
925
|
-
description: 'Support Quarto files as R sources.'
|
|
1484
|
+
description: 'Support Quarto files as R sources. Code chunks are extracted, but not inline `r expr` or the `params` of the YAML front matter.',
|
|
1485
|
+
url: [{ name: 'Quarto', href: 'https://quarto.org/' }]
|
|
926
1486
|
},
|
|
927
1487
|
{
|
|
928
1488
|
name: 'Sweave',
|
|
929
1489
|
id: 'file:rnw',
|
|
930
1490
|
supported: 'partially',
|
|
931
|
-
description: 'Support for Sweave files as R sources.'
|
|
1491
|
+
description: 'Support for Sweave files as R sources. Code chunks are extracted, `\\Sexpr{}` inline expressions are not.',
|
|
1492
|
+
url: [{ name: 'Sweave', href: 'https://stat.ethz.ch/R-manual/R-devel/library/utils/doc/Sweave.pdf' }]
|
|
932
1493
|
}
|
|
933
1494
|
]
|
|
934
1495
|
},
|
|
935
1496
|
{
|
|
936
|
-
name: '
|
|
937
|
-
id: '
|
|
938
|
-
|
|
939
|
-
|
|
1497
|
+
name: 'Types',
|
|
1498
|
+
id: 'types',
|
|
1499
|
+
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.`,
|
|
1500
|
+
capabilities: [
|
|
1501
|
+
{
|
|
1502
|
+
name: 'Primitive',
|
|
1503
|
+
id: 'types-primitive',
|
|
1504
|
+
code: ['typeof', 'mode'],
|
|
1505
|
+
supported: 'not',
|
|
1506
|
+
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.`,
|
|
1507
|
+
example: (0, doc_code_1.codeBlock)('r', 'typeof(1L)\nclass(1)\nmode("a")'),
|
|
1508
|
+
url: [RLang('Basic types')]
|
|
1509
|
+
},
|
|
1510
|
+
{
|
|
1511
|
+
name: 'Non-Primitive',
|
|
1512
|
+
id: 'types-non-primitive',
|
|
1513
|
+
supported: 'not',
|
|
1514
|
+
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.`,
|
|
1515
|
+
url: [RLang('Vector objects')]
|
|
1516
|
+
},
|
|
1517
|
+
{
|
|
1518
|
+
name: 'Inference',
|
|
1519
|
+
id: 'types-inference',
|
|
1520
|
+
supported: 'not',
|
|
1521
|
+
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.`
|
|
1522
|
+
},
|
|
1523
|
+
{
|
|
1524
|
+
name: 'Coercion',
|
|
1525
|
+
id: 'types-coercion',
|
|
1526
|
+
code: ['as.integer', 'as.numeric', 'as.character'],
|
|
1527
|
+
supported: 'partially',
|
|
1528
|
+
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.',
|
|
1529
|
+
example: (0, doc_code_1.codeBlock)('r', 'c(1, "a")\nTRUE + 1\nas.integer("3")'),
|
|
1530
|
+
url: [RLang('Basic types')]
|
|
1531
|
+
},
|
|
1532
|
+
]
|
|
940
1533
|
}
|
|
941
1534
|
]
|
|
942
1535
|
};
|