@eagleoutice/flowr 2.13.4 → 2.13.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/README.md +29 -29
  2. package/cli/repl/core.js +10 -2
  3. package/config.d.ts +4 -1
  4. package/config.js +10 -1
  5. package/control-flow/cfg-dead-code.js +19 -4
  6. package/control-flow/extract-cfg.js +12 -4
  7. package/dataflow/environments/built-in-config.d.ts +6 -3
  8. package/dataflow/environments/built-in-eval-name.d.ts +20 -0
  9. package/dataflow/environments/built-in-eval-name.js +25 -0
  10. package/dataflow/environments/built-in-props.d.ts +175 -0
  11. package/dataflow/environments/built-in-props.js +207 -0
  12. package/dataflow/environments/built-in.d.ts +26 -22
  13. package/dataflow/environments/built-in.js +37 -10
  14. package/dataflow/environments/default-builtin-config.d.ts +1068 -95
  15. package/dataflow/environments/default-builtin-config.js +549 -216
  16. package/dataflow/environments/identifier.d.ts +24 -1
  17. package/dataflow/environments/identifier.js +24 -2
  18. package/dataflow/environments/query-fn-props.d.ts +102 -0
  19. package/dataflow/environments/query-fn-props.js +188 -0
  20. package/dataflow/eval/resolve/alias-tracking.d.ts +6 -5
  21. package/dataflow/eval/resolve/alias-tracking.js +45 -12
  22. package/dataflow/eval/resolve/match-arguments.d.ts +15 -0
  23. package/dataflow/eval/resolve/match-arguments.js +77 -0
  24. package/dataflow/eval/resolve/resolve-numbers.d.ts +202 -0
  25. package/dataflow/eval/resolve/resolve-numbers.js +163 -0
  26. package/dataflow/eval/resolve/resolve-operators.d.ts +60 -0
  27. package/dataflow/eval/resolve/resolve-operators.js +115 -0
  28. package/dataflow/eval/resolve/resolve-strings.d.ts +98 -0
  29. package/dataflow/eval/resolve/resolve-strings.js +116 -0
  30. package/dataflow/eval/resolve/resolve.d.ts +5 -37
  31. package/dataflow/eval/resolve/resolve.js +56 -134
  32. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.d.ts +1 -1
  33. package/dataflow/internal/process/functions/call/built-in/built-in-envir-utils.js +5 -4
  34. package/dataflow/internal/process/functions/call/built-in/built-in-library.js +1 -4
  35. package/dataflow/internal/process/functions/call/built-in/built-in-source.js +1 -1
  36. package/dataflow/internal/process/functions/call/known-call-handling.d.ts +2 -1
  37. package/dataflow/internal/process/functions/call/known-call-handling.js +2 -1
  38. package/documentation/data/faq/faqs.js +11 -0
  39. package/documentation/doc-util/doc-types.js +1 -1
  40. package/documentation/wiki-analyzer.js +75 -0
  41. package/documentation/wiki-core.js +81 -16
  42. package/documentation/wiki-interface.js +3 -0
  43. package/linter/linter-rules.d.ts +10 -11
  44. package/linter/rules/deprecated-functions.js +5 -3
  45. package/linter/rules/function-finder-util.d.ts +2 -2
  46. package/linter/rules/function-finder-util.js +10 -3
  47. package/linter/rules/network-functions.d.ts +25 -5
  48. package/linter/rules/network-functions.js +51 -11
  49. package/linter/rules/problematic-inputs.d.ts +1 -1
  50. package/linter/rules/problematic-inputs.js +7 -1
  51. package/linter/rules/seeded-randomness.d.ts +5 -8
  52. package/linter/rules/seeded-randomness.js +18 -10
  53. package/linter/rules/unused-definition.js +29 -17
  54. package/package.json +4 -2
  55. package/project/cache/flowr-analyzer-cache.d.ts +4 -3
  56. package/project/cache/flowr-analyzer-cache.js +32 -13
  57. package/project/cache/flowr-cache.d.ts +39 -12
  58. package/project/cache/flowr-cache.js +5 -3
  59. package/project/context/flowr-analyzer-context.d.ts +8 -1
  60. package/project/context/flowr-analyzer-context.js +11 -1
  61. package/project/context/flowr-analyzer-dependencies-context.d.ts +8 -2
  62. package/project/context/flowr-analyzer-dependencies-context.js +43 -11
  63. package/project/context/flowr-analyzer-files-context.d.ts +8 -4
  64. package/project/context/flowr-analyzer-files-context.js +20 -1
  65. package/project/context/flowr-analyzer-incremental-analysis-context.d.ts +33 -0
  66. package/project/context/flowr-analyzer-incremental-analysis-context.js +63 -0
  67. package/project/context/flowr-analyzer-meta-context.d.ts +3 -1
  68. package/project/context/flowr-analyzer-meta-context.js +14 -0
  69. package/project/context/flowr-file.d.ts +25 -3
  70. package/project/context/flowr-file.js +24 -2
  71. package/project/dependency-version-space.d.ts +37 -0
  72. package/project/dependency-version-space.js +118 -26
  73. package/project/flowr-analyzer.d.ts +6 -0
  74. package/project/flowr-analyzer.js +6 -2
  75. package/project/incremental/incremental-parse/edit-computation.d.ts +7 -0
  76. package/project/incremental/incremental-parse/edit-computation.js +61 -0
  77. package/project/incremental/incremental-parse/incremental-parse.d.ts +12 -0
  78. package/project/incremental/incremental-parse/incremental-parse.js +37 -0
  79. package/project/plugins/file-plugins/files/flowr-jupyter-file.d.ts +1 -1
  80. package/project/plugins/file-plugins/files/flowr-manifest-files.d.ts +57 -0
  81. package/project/plugins/file-plugins/files/flowr-manifest-files.js +121 -0
  82. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.d.ts +2 -2
  83. package/project/plugins/file-plugins/files/flowr-rmarkdown-file.js +2 -2
  84. package/project/plugins/file-plugins/files/flowr-sweave-file.d.ts +1 -1
  85. package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.d.ts +33 -0
  86. package/project/plugins/file-plugins/flowr-analyzer-manifest-file-plugin.js +53 -0
  87. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.d.ts +1 -1
  88. package/project/plugins/file-plugins/flowr-analyzer-virtualenv-file-plugin.js +3 -3
  89. package/project/plugins/package-version-plugins/flowr-analyzer-meta-manifest-file-plugin.d.ts +27 -0
  90. package/project/plugins/package-version-plugins/flowr-analyzer-meta-manifest-file-plugin.js +47 -0
  91. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.d.ts +7 -0
  92. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-lockfile-plugin.js +31 -3
  93. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.d.ts +10 -4
  94. package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +17 -4
  95. package/project/plugins/plugin-registry.d.ts +4 -4
  96. package/project/plugins/plugin-registry.js +7 -4
  97. package/project/plugins/project-discovery/flowr-analyzer-project-discovery-plugin.js +4 -4
  98. package/project/sigdb/reader.d.ts +7 -0
  99. package/project/sigdb/reader.js +12 -0
  100. package/queries/catalog/dependencies-query/function-info/derived-functions.d.ts +10 -0
  101. package/queries/catalog/dependencies-query/function-info/derived-functions.js +41 -0
  102. package/queries/catalog/dependencies-query/function-info/read-functions.js +13 -12
  103. package/queries/catalog/dependencies-query/function-info/write-functions.js +16 -23
  104. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-executor.js +33 -3
  105. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.d.ts +31 -0
  106. package/queries/catalog/guess-dep-versions-query/guess-dep-versions-query-format.js +9 -2
  107. package/queries/catalog/input-sources-query/input-source-functions.d.ts +8 -10
  108. package/queries/catalog/input-sources-query/input-source-functions.js +23 -388
  109. package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +7 -0
  110. package/queries/catalog/input-sources-query/input-sources-query-format.js +27 -10
  111. package/queries/catalog/signature-query/signature-query-executor.d.ts +2 -1
  112. package/queries/catalog/signature-query/signature-query-executor.js +79 -3
  113. package/queries/catalog/signature-query/signature-query-format.d.ts +27 -0
  114. package/queries/catalog/signature-query/signature-query-render.js +21 -3
  115. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.d.ts +6 -2
  116. package/r-bridge/lang-4.x/tree-sitter/tree-sitter-executor.js +21 -2
  117. package/r-bridge/parser.d.ts +11 -1
  118. package/r-bridge/parser.js +7 -4
  119. package/r-bridge/shell-executor.d.ts +1 -0
  120. package/r-bridge/shell-executor.js +1 -0
  121. package/r-bridge/shell.d.ts +1 -0
  122. package/r-bridge/shell.js +1 -0
  123. package/search/flowr-search-filters.d.ts +1 -6
  124. package/search/flowr-search-filters.js +1 -8
  125. package/search/search-executor/search-enrichers.d.ts +2 -0
  126. package/search/search-executor/search-enrichers.js +29 -12
  127. package/util/version.js +1 -1
  128. package/project/plugins/file-plugins/files/flowr-rproject-file.d.ts +0 -31
  129. package/project/plugins/file-plugins/files/flowr-rproject-file.js +0 -66
  130. package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.d.ts +0 -22
  131. package/project/plugins/file-plugins/flowr-analyzer-rproject-file-plugin.js +0 -36
  132. package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.d.ts +0 -13
  133. package/project/plugins/package-version-plugins/flowr-analyzer-meta-rproject-file-plugin.js +0 -32
@@ -0,0 +1,175 @@
1
+ import type { DecodedFunction } from '../../project/sigdb/decode';
2
+ /**
3
+ * What a single argument of a call is used for, as a bitmask.
4
+ * @see {@link BuiltInFnInfo#sig}
5
+ */
6
+ export declare enum ArgProp {
7
+ /** the result is this argument, handed back unchanged, like `x` in `identity(x)`; this is what draws the `Returns` edge */
8
+ Alias = 1,
9
+ /** the result is computed from the argument's value, like `x` in `sum(x)` */
10
+ Value = 2,
11
+ /** only the shape is used (length, dimensions, names, other attributes), like `x` in `nrow(x)` */
12
+ Shape = 4,
13
+ /** selects a behavior instead of carrying data, like `na.rm` in `sum(x, na.rm = TRUE)` */
14
+ Flag = 8,
15
+ /** names the resource the call reads or writes, like `file` in `write.csv(x, file)` */
16
+ Resource = 16,
17
+ /** what it refers to may be modified, like `envir` in `assign(x, v, envir = e)` */
18
+ Written = 32,
19
+ /** evaluated whenever the call happens, even if the result goes unused, like `x` in `force(x)` */
20
+ Forced = 64,
21
+ /** quoted or evaluated in another frame, like `expr` in `quote(expr)` */
22
+ Nse = 128,
23
+ /** called as a function, like `FUN` in `lapply(x, FUN)` */
24
+ Callee = 256,
25
+ /** only whether it was supplied matters, as with `missing()` */
26
+ Presence = 512,
27
+ /**
28
+ * the result is one of this argument's values, like `choices` in `match.arg(arg, choices)`. The bounding
29
+ * argument of a {@link CallProp.Narrows} call; without one such a call yields a value of its own making.
30
+ */
31
+ Bounds = 1024
32
+ }
33
+ /**
34
+ * What the call as a whole does, as a bitmask. The resource bits ({@link CallProp.File} and its neighbors)
35
+ * say where the call gets its data from, which is what {@link InputProps} collects.
36
+ * @see {@link BuiltInFnInfo#props}
37
+ */
38
+ export declare enum CallProp {
39
+ /** computes a result and nothing else, the positive counterpart of `hasUnknownSideEffects` (excludes {@link ImpureProps}) */
40
+ Pure = 1,
41
+ /**
42
+ * pure on its own, but it runs code it is handed, so whatever that code does happens too.
43
+ * The parameter it runs is marked {@link ArgProp.Callee} or {@link ArgProp.Nse}, as with `lapply(x, f)`.
44
+ */
45
+ MayPure = 2,
46
+ /** may signal an error, like `stop()` (see {@link SigDbInferable}) */
47
+ Throws = 4,
48
+ /** returns invisibly, so the result is not auto-printed */
49
+ Invisible = 8,
50
+ /** dispatches on the class of an argument (S3, S4, or S7), a group generic like `+` on either operand */
51
+ Generic = 16,
52
+ /** a method that is reached by dispatch, like `print.foo` (see {@link SigDbInferable}) */
53
+ Method = 32,
54
+ /** binds, rebinds, or removes names outside of its own frame, like `assign` or `library` */
55
+ Scope = 64,
56
+ /** the result may differ between two identical calls for a reason neither `Random` nor `Ambient` covers (see {@link SigDbInferable}) */
57
+ NonDet = 128,
58
+ /** draws from the random number generator, or sets its state (stated instead of `NonDet`) */
59
+ Random = 256,
60
+ /** depends on ambient state like the clock, the locale, environment variables, or global options (stated instead of `NonDet`) */
61
+ Ambient = 512,
62
+ /** touches the file system */
63
+ File = 1024,
64
+ /** produces a temporary path; on its own this touches no file system, so a call that also does states `File` too */
65
+ TempFile = 2048,
66
+ /**
67
+ * always reaches the network, like `curl::curl_download`. Calls that only do so for some arguments, like
68
+ * `read.csv` of a URL, are left to the `network-functions` rule, which decides that per call site.
69
+ */
70
+ Network = 4096,
71
+ /** runs a system command */
72
+ Process = 8192,
73
+ /** calls native code through the foreign function interface, like `.Call` */
74
+ Ffi = 16384,
75
+ /** produces a language object, like `quote` or `deparse` */
76
+ Lang = 32768,
77
+ /** asks the user, like `readline` or a file chooser */
78
+ User = 65536,
79
+ /** draws on a graphics device */
80
+ Graphics = 131072,
81
+ /** talks to a database */
82
+ Database = 262144,
83
+ /** reads the resource its `Resource` arguments name */
84
+ Reads = 524288,
85
+ /** writes the resource its `Resource` arguments name */
86
+ Writes = 1048576,
87
+ /** may emit to standard output, like `print` or a `cat` without a `file`, and follows a `sink` when one is active */
88
+ Prints = 2097152,
89
+ /**
90
+ * the result is bounded no matter what flows in: a count, an index, a logical, or one of the values of the
91
+ * argument marked {@link ArgProp.Bounds}. So nothing an argument carries reaches the result, which is what
92
+ * lets the input-sources query stop tracing at `length(x)` or `match.arg(arg, choices)`.
93
+ */
94
+ Narrows = 4194304
95
+ }
96
+ /**
97
+ * The {@link CallProp} bits that state an effect beyond computing a result, so no {@link CallProp.Pure}
98
+ * definition may carry any of them.
99
+ */
100
+ export declare const ImpureProps: number;
101
+ /**
102
+ * Which {@link CallProp} bits rule each other out, as `[bit, everything stating it forbids]`. A definition
103
+ * that carries the left bit must carry none of the right ones; a test checks the {@link DefaultBuiltinConfig}
104
+ * (and any configured built-ins) against this. Every other pair of bits combines freely.
105
+ */
106
+ export declare const ExclusiveCallProps: readonly (readonly [bit: CallProp, forbidden: CallProps])[];
107
+ /**
108
+ * The {@link CallProp} bits of calls that bring in data of their own. A function that states its props and
109
+ * carries none of these derives its result from its arguments, which is what {@link BuiltInIndex#without}
110
+ * looks for.
111
+ */
112
+ export declare const InputProps: number;
113
+ /**
114
+ * The {@link CallProp} bits the signature database states itself, so {@link fnInfoFromSignature} can read them
115
+ * off any package function without anyone writing them down.
116
+ */
117
+ export declare const SigDbInferable: number;
118
+ /**
119
+ * The {@link CallProp} bits that say a call takes its data from a file, as {@link CallProp.File} alone also
120
+ * covers the calls that only write one.
121
+ */
122
+ export declare const FileInputProps: number;
123
+ /**
124
+ * The {@link CallProp} bits that carry over from a callee to its caller: what the called function does, the
125
+ * calling one does too. Purity does not travel this way, which is why it is not in here.
126
+ */
127
+ export declare const PropagatedProps: number;
128
+ /** a bitfield of {@link ArgProp} */
129
+ export type ArgProps = number;
130
+ /** a bitfield of {@link CallProp} */
131
+ export type CallProps = number;
132
+ /**
133
+ * The formals of a built-in, in the order they are declared in, each with what its argument is used for.
134
+ * A `...` entry stands for every argument from the position it appears at, and the entries behind it are matched
135
+ * by their full name only.
136
+ */
137
+ export type FnSig = [name: string, props: ArgProps][];
138
+ /**
139
+ * Semantics of a built-in that hold no matter which processor handles the call. The remaining facts already
140
+ * have a home: the exit behavior in `cfg`, whether flowR can fold the call in the `evalHandler` of the
141
+ * definition, and the fallback for everything unmodelled in `hasUnknownSideEffects`.
142
+ */
143
+ export interface BuiltInFnInfo {
144
+ /** the parameters and what each of their arguments is used for */
145
+ readonly sig?: FnSig;
146
+ /** bitfield of {@link CallProp} */
147
+ readonly props?: CallProps;
148
+ }
149
+ /** A {@link FnSig} in the form the call processors use it, see {@link sigLayout}. */
150
+ export interface SigLayout {
151
+ /** the props of each declared parameter, in order */
152
+ readonly props: readonly ArgProps[];
153
+ /** the position of the `...` parameter, `-1` if there is none */
154
+ readonly rest: number;
155
+ /** every bit some parameter carries, so a call can skip the bits nobody uses */
156
+ readonly any: ArgProps;
157
+ /** the position of the {@link ArgProp.Alias} argument, handed back as the result, `-1` if there is none */
158
+ readonly alias: number;
159
+ }
160
+ /**
161
+ * The positional view of a {@link FnSig}, computed on first use and cached per signature object,
162
+ * so declaring a signature costs nothing until a call actually needs it.
163
+ */
164
+ export declare function sigLayout(sig: FnSig): SigLayout;
165
+ /** The {@link ArgProp} bits of the argument at `index`, with `...` covering every position from where it appears. */
166
+ export declare function argProp({ props, rest }: SigLayout, index: number): ArgProps;
167
+ /** The positions of the first `count` arguments that carry any of `prop`. */
168
+ export declare function argsWith(layout: SigLayout, count: number, prop: ArgProps): number[];
169
+ /**
170
+ * The part of a {@link BuiltInFnInfo} that the signature database already knows: the parameter names in order
171
+ * (`...` included) with the ones R always forces, plus the properties listed in {@link SigDbProps}. Everything
172
+ * else the database records (`higher-order`, `deprecated`, `recursive`, ...) has no counterpart here and is
173
+ * dropped, and anything it cannot see (purity, resources, what an argument is used for) stays unset.
174
+ */
175
+ export declare function fnInfoFromSignature(fn: DecodedFunction): BuiltInFnInfo;
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PropagatedProps = exports.FileInputProps = exports.SigDbInferable = exports.InputProps = exports.ExclusiveCallProps = exports.ImpureProps = exports.CallProp = exports.ArgProp = void 0;
4
+ exports.sigLayout = sigLayout;
5
+ exports.argProp = argProp;
6
+ exports.argsWith = argsWith;
7
+ exports.fnInfoFromSignature = fnInfoFromSignature;
8
+ /**
9
+ * What a single argument of a call is used for, as a bitmask.
10
+ * @see {@link BuiltInFnInfo#sig}
11
+ */
12
+ var ArgProp;
13
+ (function (ArgProp) {
14
+ /** the result is this argument, handed back unchanged, like `x` in `identity(x)`; this is what draws the `Returns` edge */
15
+ ArgProp[ArgProp["Alias"] = 1] = "Alias";
16
+ /** the result is computed from the argument's value, like `x` in `sum(x)` */
17
+ ArgProp[ArgProp["Value"] = 2] = "Value";
18
+ /** only the shape is used (length, dimensions, names, other attributes), like `x` in `nrow(x)` */
19
+ ArgProp[ArgProp["Shape"] = 4] = "Shape";
20
+ /** selects a behavior instead of carrying data, like `na.rm` in `sum(x, na.rm = TRUE)` */
21
+ ArgProp[ArgProp["Flag"] = 8] = "Flag";
22
+ /** names the resource the call reads or writes, like `file` in `write.csv(x, file)` */
23
+ ArgProp[ArgProp["Resource"] = 16] = "Resource";
24
+ /** what it refers to may be modified, like `envir` in `assign(x, v, envir = e)` */
25
+ ArgProp[ArgProp["Written"] = 32] = "Written";
26
+ /** evaluated whenever the call happens, even if the result goes unused, like `x` in `force(x)` */
27
+ ArgProp[ArgProp["Forced"] = 64] = "Forced";
28
+ /** quoted or evaluated in another frame, like `expr` in `quote(expr)` */
29
+ ArgProp[ArgProp["Nse"] = 128] = "Nse";
30
+ /** called as a function, like `FUN` in `lapply(x, FUN)` */
31
+ ArgProp[ArgProp["Callee"] = 256] = "Callee";
32
+ /** only whether it was supplied matters, as with `missing()` */
33
+ ArgProp[ArgProp["Presence"] = 512] = "Presence";
34
+ /**
35
+ * the result is one of this argument's values, like `choices` in `match.arg(arg, choices)`. The bounding
36
+ * argument of a {@link CallProp.Narrows} call; without one such a call yields a value of its own making.
37
+ */
38
+ ArgProp[ArgProp["Bounds"] = 1024] = "Bounds";
39
+ })(ArgProp || (exports.ArgProp = ArgProp = {}));
40
+ /**
41
+ * What the call as a whole does, as a bitmask. The resource bits ({@link CallProp.File} and its neighbors)
42
+ * say where the call gets its data from, which is what {@link InputProps} collects.
43
+ * @see {@link BuiltInFnInfo#props}
44
+ */
45
+ var CallProp;
46
+ (function (CallProp) {
47
+ /** computes a result and nothing else, the positive counterpart of `hasUnknownSideEffects` (excludes {@link ImpureProps}) */
48
+ CallProp[CallProp["Pure"] = 1] = "Pure";
49
+ /**
50
+ * pure on its own, but it runs code it is handed, so whatever that code does happens too.
51
+ * The parameter it runs is marked {@link ArgProp.Callee} or {@link ArgProp.Nse}, as with `lapply(x, f)`.
52
+ */
53
+ CallProp[CallProp["MayPure"] = 2] = "MayPure";
54
+ /** may signal an error, like `stop()` (see {@link SigDbInferable}) */
55
+ CallProp[CallProp["Throws"] = 4] = "Throws";
56
+ /** returns invisibly, so the result is not auto-printed */
57
+ CallProp[CallProp["Invisible"] = 8] = "Invisible";
58
+ /** dispatches on the class of an argument (S3, S4, or S7), a group generic like `+` on either operand */
59
+ CallProp[CallProp["Generic"] = 16] = "Generic";
60
+ /** a method that is reached by dispatch, like `print.foo` (see {@link SigDbInferable}) */
61
+ CallProp[CallProp["Method"] = 32] = "Method";
62
+ /** binds, rebinds, or removes names outside of its own frame, like `assign` or `library` */
63
+ CallProp[CallProp["Scope"] = 64] = "Scope";
64
+ /** the result may differ between two identical calls for a reason neither `Random` nor `Ambient` covers (see {@link SigDbInferable}) */
65
+ CallProp[CallProp["NonDet"] = 128] = "NonDet";
66
+ /** draws from the random number generator, or sets its state (stated instead of `NonDet`) */
67
+ CallProp[CallProp["Random"] = 256] = "Random";
68
+ /** depends on ambient state like the clock, the locale, environment variables, or global options (stated instead of `NonDet`) */
69
+ CallProp[CallProp["Ambient"] = 512] = "Ambient";
70
+ /** touches the file system */
71
+ CallProp[CallProp["File"] = 1024] = "File";
72
+ /** produces a temporary path; on its own this touches no file system, so a call that also does states `File` too */
73
+ CallProp[CallProp["TempFile"] = 2048] = "TempFile";
74
+ /**
75
+ * always reaches the network, like `curl::curl_download`. Calls that only do so for some arguments, like
76
+ * `read.csv` of a URL, are left to the `network-functions` rule, which decides that per call site.
77
+ */
78
+ CallProp[CallProp["Network"] = 4096] = "Network";
79
+ /** runs a system command */
80
+ CallProp[CallProp["Process"] = 8192] = "Process";
81
+ /** calls native code through the foreign function interface, like `.Call` */
82
+ CallProp[CallProp["Ffi"] = 16384] = "Ffi";
83
+ /** produces a language object, like `quote` or `deparse` */
84
+ CallProp[CallProp["Lang"] = 32768] = "Lang";
85
+ /** asks the user, like `readline` or a file chooser */
86
+ CallProp[CallProp["User"] = 65536] = "User";
87
+ /** draws on a graphics device */
88
+ CallProp[CallProp["Graphics"] = 131072] = "Graphics";
89
+ /** talks to a database */
90
+ CallProp[CallProp["Database"] = 262144] = "Database";
91
+ /** reads the resource its `Resource` arguments name */
92
+ CallProp[CallProp["Reads"] = 524288] = "Reads";
93
+ /** writes the resource its `Resource` arguments name */
94
+ CallProp[CallProp["Writes"] = 1048576] = "Writes";
95
+ /** may emit to standard output, like `print` or a `cat` without a `file`, and follows a `sink` when one is active */
96
+ CallProp[CallProp["Prints"] = 2097152] = "Prints";
97
+ /**
98
+ * the result is bounded no matter what flows in: a count, an index, a logical, or one of the values of the
99
+ * argument marked {@link ArgProp.Bounds}. So nothing an argument carries reaches the result, which is what
100
+ * lets the input-sources query stop tracing at `length(x)` or `match.arg(arg, choices)`.
101
+ */
102
+ CallProp[CallProp["Narrows"] = 4194304] = "Narrows";
103
+ })(CallProp || (exports.CallProp = CallProp = {}));
104
+ /**
105
+ * The {@link CallProp} bits that state an effect beyond computing a result, so no {@link CallProp.Pure}
106
+ * definition may carry any of them.
107
+ */
108
+ exports.ImpureProps = CallProp.MayPure | CallProp.Scope | CallProp.NonDet | CallProp.Random | CallProp.Ambient
109
+ | CallProp.File | CallProp.TempFile | CallProp.Network | CallProp.Process | CallProp.Ffi | CallProp.Lang
110
+ | CallProp.User | CallProp.Graphics | CallProp.Database | CallProp.Reads | CallProp.Writes | CallProp.Prints;
111
+ /**
112
+ * Which {@link CallProp} bits rule each other out, as `[bit, everything stating it forbids]`. A definition
113
+ * that carries the left bit must carry none of the right ones; a test checks the {@link DefaultBuiltinConfig}
114
+ * (and any configured built-ins) against this. Every other pair of bits combines freely.
115
+ */
116
+ exports.ExclusiveCallProps = [
117
+ [CallProp.Pure, exports.ImpureProps],
118
+ [CallProp.NonDet, CallProp.Random | CallProp.Ambient],
119
+ [CallProp.Random, CallProp.Ambient]
120
+ ];
121
+ /**
122
+ * The {@link CallProp} bits of calls that bring in data of their own. A function that states its props and
123
+ * carries none of these derives its result from its arguments, which is what {@link BuiltInIndex#without}
124
+ * looks for.
125
+ */
126
+ exports.InputProps = CallProp.NonDet | CallProp.Random | CallProp.Ambient | CallProp.File
127
+ | CallProp.TempFile | CallProp.Network | CallProp.Process | CallProp.Ffi | CallProp.Lang | CallProp.User;
128
+ /**
129
+ * The {@link CallProp} bits the signature database states itself, so {@link fnInfoFromSignature} can read them
130
+ * off any package function without anyone writing them down.
131
+ */
132
+ exports.SigDbInferable = CallProp.Throws | CallProp.NonDet | CallProp.Method | CallProp.Generic;
133
+ /**
134
+ * The {@link CallProp} bits that say a call takes its data from a file, as {@link CallProp.File} alone also
135
+ * covers the calls that only write one.
136
+ */
137
+ exports.FileInputProps = CallProp.File | CallProp.Reads;
138
+ /**
139
+ * The {@link CallProp} bits that carry over from a callee to its caller: what the called function does, the
140
+ * calling one does too. Purity does not travel this way, which is why it is not in here.
141
+ */
142
+ exports.PropagatedProps = CallProp.Throws | CallProp.Scope | CallProp.NonDet | CallProp.Prints
143
+ | CallProp.Random | CallProp.Ambient | CallProp.File | CallProp.TempFile | CallProp.Network | CallProp.Process
144
+ | CallProp.Ffi | CallProp.Lang | CallProp.User | CallProp.Graphics | CallProp.Database | CallProp.Reads | CallProp.Writes;
145
+ const layouts = new WeakMap();
146
+ /**
147
+ * The positional view of a {@link FnSig}, computed on first use and cached per signature object,
148
+ * so declaring a signature costs nothing until a call actually needs it.
149
+ */
150
+ function sigLayout(sig) {
151
+ let layout = layouts.get(sig);
152
+ if (layout === undefined) {
153
+ const props = sig.map(p => p[1]);
154
+ layout = {
155
+ props,
156
+ rest: sig.findIndex(p => p[0] === '...'),
157
+ any: props.reduce((acc, p) => acc | p, 0),
158
+ alias: props.findIndex(p => (p & ArgProp.Alias) !== 0)
159
+ };
160
+ layouts.set(sig, layout);
161
+ }
162
+ return layout;
163
+ }
164
+ /** The {@link ArgProp} bits of the argument at `index`, with `...` covering every position from where it appears. */
165
+ function argProp({ props, rest }, index) {
166
+ return (rest >= 0 && index >= rest ? props[rest] : props[index]) ?? 0;
167
+ }
168
+ /** The positions of the first `count` arguments that carry any of `prop`. */
169
+ function argsWith(layout, count, prop) {
170
+ const found = [];
171
+ for (let i = 0; i < count; i++) {
172
+ if ((argProp(layout, i) & prop) !== 0) {
173
+ found.push(i);
174
+ }
175
+ }
176
+ return found;
177
+ }
178
+ /** the {@link DecodedFunction#props} names that have a {@link CallProp} counterpart, together {@link SigDbInferable} */
179
+ const SigDbProps = {
180
+ 'can-throw': CallProp.Throws,
181
+ 'non-deterministic': CallProp.NonDet,
182
+ 's3-method': CallProp.Method
183
+ };
184
+ /** the callees that make the calling function itself a generic ({@link CallProp.Generic}) */
185
+ const DispatchCallees = new Set(['UseMethod', 'standardGeneric', 'S7_dispatch']);
186
+ /**
187
+ * The part of a {@link BuiltInFnInfo} that the signature database already knows: the parameter names in order
188
+ * (`...` included) with the ones R always forces, plus the properties listed in {@link SigDbProps}. Everything
189
+ * else the database records (`higher-order`, `deprecated`, `recursive`, ...) has no counterpart here and is
190
+ * dropped, and anything it cannot see (purity, resources, what an argument is used for) stays unset.
191
+ */
192
+ function fnInfoFromSignature(fn) {
193
+ let props = 0;
194
+ for (const name of fn.props) {
195
+ props |= SigDbProps[name] ?? 0;
196
+ }
197
+ /* a function whose own body dispatches is the generic, which no property of the database states */
198
+ if (fn.callees.some(c => DispatchCallees.has(c))) {
199
+ props |= CallProp.Generic;
200
+ }
201
+ return {
202
+ sig: fn.signature.map(p => [p.name,
203
+ (p.forced ? ArgProp.Forced : 0) | (p.default === 'TRUE' || p.default === 'FALSE' ? ArgProp.Flag : 0)]),
204
+ props
205
+ };
206
+ }
207
+ //# sourceMappingURL=built-in-props.js.map
@@ -15,7 +15,7 @@ import { processQuote } from '../internal/process/functions/call/built-in/built-
15
15
  import { processFunctionDefinition } from '../internal/process/functions/call/built-in/built-in-function-definition';
16
16
  import { processExpressionList } from '../internal/process/functions/call/built-in/built-in-expression-list';
17
17
  import { processGet } from '../internal/process/functions/call/built-in/built-in-get';
18
- import type { AstIdMap, ParentInformation, RNodeWithParent } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
18
+ import type { ParentInformation, RNodeWithParent } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
19
19
  import { type PotentiallyEmptyRArgument } from '../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
20
20
  import { RSymbol } from '../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
21
21
  import { type BuiltIn, NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
@@ -28,13 +28,14 @@ import { processList } from '../internal/process/functions/call/built-in/built-i
28
28
  import { processVector } from '../internal/process/functions/call/built-in/built-in-vector';
29
29
  import { processRm } from '../internal/process/functions/call/built-in/built-in-rm';
30
30
  import { processEvalCall } from '../internal/process/functions/call/built-in/built-in-eval';
31
- import type { REnvironmentInformation } from './environment';
32
31
  import type { Value } from '../eval/values/r-value';
33
- import { resolveAsMinus, resolveAsPaste, resolveAsPlus, resolveAsSeq, resolveAsVector } from '../eval/resolve/resolve';
34
- import type { DataflowGraph } from '../graph/graph';
32
+ import type { ResolveInfo } from '../eval/resolve/alias-tracking';
33
+ import { resolveAsSeq, resolveAsVector } from '../eval/resolve/resolve';
34
+ import { resolveAsStringFn } from '../eval/resolve/resolve-strings';
35
+ import { resolveAsComparison, resolveAsGroup, resolveAsLogical } from '../eval/resolve/resolve-operators';
36
+ import { resolveAsNumeric } from '../eval/resolve/resolve-numbers';
35
37
  import type { VariableResolve } from '../../config';
36
38
  import type { BuiltInConstantDefinition, BuiltInDefinition, BuiltInFunctionDefinition, BuiltInReplacementDefinition } from './built-in-config';
37
- import type { ReadOnlyFlowrAnalyzerContext } from '../../project/context/flowr-analyzer-context';
38
39
  import { processStopIfNot } from '../internal/process/functions/call/built-in/built-in-stop-if-not';
39
40
  import { processTryCatch } from '../internal/process/functions/call/built-in/built-in-try-catch';
40
41
  import { processRegisterHook } from '../internal/process/functions/call/built-in/built-in-register-hook';
@@ -52,6 +53,7 @@ import { processAttach } from '../internal/process/functions/call/built-in/built
52
53
  import { processWithEnv } from '../internal/process/functions/call/built-in/built-in-with';
53
54
  import { processNamespaceAccess } from '../internal/process/functions/call/built-in/built-in-namespace-access';
54
55
  import { processLoadCall } from '../internal/process/functions/call/built-in/built-in-load';
56
+ import { type BuiltInFnInfo } from './built-in-props';
55
57
  export type BuiltInIdentifierProcessor = <OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>) => DataflowInformation;
56
58
  export type BuiltInIdentifierProcessorWithConfig<Config> = <OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: Config) => DataflowInformation;
57
59
  export interface BuiltInIdentifierDefinition extends IdentifierReference {
@@ -61,14 +63,15 @@ export interface BuiltInIdentifierDefinition extends IdentifierReference {
61
63
  config?: ConfigOfBuiltInMappingName<keyof typeof BuiltInProcessorMapper> & {
62
64
  libFn?: boolean;
63
65
  };
66
+ /** folds a call to this function to a constant, see {@link BuiltInEvalHandlerMapper} */
67
+ evalHandler?: BuiltInEvalHandler;
64
68
  }
65
69
  export interface BuiltInIdentifierConstant<T = unknown> extends IdentifierReference {
66
70
  type: ReferenceType.BuiltInConstant;
67
71
  definedAt: BuiltIn;
68
72
  value: T;
69
73
  }
70
- export interface DefaultBuiltInProcessorConfiguration extends ForceArguments {
71
- readonly returnsNthArgument?: number | 'last';
74
+ export interface DefaultBuiltInProcessorConfiguration extends ForceArguments, BuiltInFnInfo {
72
75
  readonly cfg?: ExitPointType;
73
76
  readonly readAllArguments?: boolean;
74
77
  /**
@@ -80,24 +83,20 @@ export interface DefaultBuiltInProcessorConfiguration extends ForceArguments {
80
83
  /** record mapping the actual function name called to the arguments that should be treated as function calls */
81
84
  readonly treatAsFnCall?: Record<string, readonly string[]>;
82
85
  /** Mark the given arguments as {@link EdgeType.NonStandardEvaluation|non-standard-evaluated}, like `quote`. */
83
- readonly markArgsAsNSE?: NseArguments;
86
+ readonly markArgsAsNSE?: NseArguments | readonly number[];
84
87
  /**
85
88
  * Name that should be used for the origin (useful when needing to differentiate between
86
89
  * functions like 'return' that use the default builtin processor)
87
90
  */
88
91
  readonly useAsProcessor?: BuiltInProcName;
89
92
  }
90
- export interface BuiltInEvalHandlerArgs {
93
+ /** the {@link ResolveInfo} a handler continues to resolve with, plus the node it is asked to fold */
94
+ export interface BuiltInEvalHandlerArgs extends ResolveInfo {
91
95
  resolve: VariableResolve;
92
96
  node: RNodeWithParent;
93
- ctx: ReadOnlyFlowrAnalyzerContext;
94
- environment?: REnvironmentInformation;
95
- graph?: DataflowGraph;
96
- idMap?: AstIdMap;
97
- blocked?: Set<NodeId>;
98
97
  }
99
98
  export type BuiltInEvalHandler = (args: BuiltInEvalHandlerArgs) => Value;
100
- declare function defaultBuiltInProcessor<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { returnsNthArgument, useAsProcessor, forceArgs, readAllArguments, cfg, hasUnknownSideEffects, treatAsFnCall, markArgsAsNSE: nse, keepArgumentOut }: DefaultBuiltInProcessorConfiguration): DataflowInformation;
99
+ declare function defaultBuiltInProcessor<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { useAsProcessor, forceArgs, readAllArguments, cfg, hasUnknownSideEffects, treatAsFnCall, markArgsAsNSE: nse, keepArgumentOut, sig }: DefaultBuiltInProcessorConfiguration): DataflowInformation;
101
100
  declare function defaultBuiltInProcessorReadallArgs<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, { useAsProcessor, forceArgs, markArgsAsNSE: nse }: Pick<DefaultBuiltInProcessorConfiguration, 'useAsProcessor' | 'forceArgs' | 'markArgsAsNSE'>): DataflowInformation;
102
101
  export declare const BuiltInProcessorMapper: {
103
102
  readonly "builtin:acc": typeof processAccess;
@@ -142,13 +141,18 @@ export declare const BuiltInProcessorMapper: {
142
141
  readonly "builtin:vector": typeof processVector;
143
142
  readonly "builtin:wl": typeof processWhileLoop;
144
143
  };
144
+ /**
145
+ * The value-solver function behind every {@link BuiltInEvalName}, the counterpart of the {@link BuiltInProcessorMapper}.
146
+ * A built-in picks one of these by name with its serializable {@link BuiltInFunctionDefinition#evalHandler}.
147
+ */
145
148
  export declare const BuiltInEvalHandlerMapper: {
146
- readonly 'built-in:c': typeof resolveAsVector;
147
- readonly 'built-in::': typeof resolveAsSeq;
148
- readonly 'built-in:+': typeof resolveAsPlus;
149
- readonly 'built-in:-': typeof resolveAsMinus;
150
- readonly 'built-in:paste': typeof resolveAsPaste;
151
- readonly 'built-in:paste0': typeof resolveAsPaste;
149
+ readonly "eval:vector": typeof resolveAsVector;
150
+ readonly "eval:seq": typeof resolveAsSeq;
151
+ readonly "eval:numeric": typeof resolveAsNumeric;
152
+ readonly "eval:cmp": typeof resolveAsComparison;
153
+ readonly "eval:logical": typeof resolveAsLogical;
154
+ readonly "eval:string-fn": typeof resolveAsStringFn;
155
+ readonly "eval:group": typeof resolveAsGroup;
152
156
  };
153
157
  export type ConfigOfBuiltInMappingName<N extends keyof typeof BuiltInProcessorMapper> = Parameters<typeof BuiltInProcessorMapper[N]>[4];
154
158
  export type BuiltInMemory = Map<BrandedIdentifier, IdentifierDefinition[]>;
@@ -160,7 +164,7 @@ export declare class BuiltIns {
160
164
  /**
161
165
  * Register a built-in function (like `print` or `c`) to the given {@link BuiltIns}
162
166
  */
163
- registerBuiltInFunctions<BuiltInProcessor extends keyof typeof BuiltInProcessorMapper>({ names, processor, config, assumePrimitive }: BuiltInFunctionDefinition<BuiltInProcessor>): void;
167
+ registerBuiltInFunctions<BuiltInProcessor extends keyof typeof BuiltInProcessorMapper>({ names, processor, config, assumePrimitive, evalHandler }: BuiltInFunctionDefinition<BuiltInProcessor>): void;
164
168
  /**
165
169
  * Registers all combinations of replacements
166
170
  */
@@ -31,6 +31,10 @@ const built_in_eval_1 = require("../internal/process/functions/call/built-in/bui
31
31
  const vertex_1 = require("../graph/vertex");
32
32
  const unknown_side_effect_1 = require("../graph/unknown-side-effect");
33
33
  const resolve_1 = require("../eval/resolve/resolve");
34
+ const resolve_strings_1 = require("../eval/resolve/resolve-strings");
35
+ const resolve_operators_1 = require("../eval/resolve/resolve-operators");
36
+ const resolve_numbers_1 = require("../eval/resolve/resolve-numbers");
37
+ const built_in_eval_name_1 = require("./built-in-eval-name");
34
38
  const built_in_stop_if_not_1 = require("../internal/process/functions/call/built-in/built-in-stop-if-not");
35
39
  const built_in_try_catch_1 = require("../internal/process/functions/call/built-in/built-in-try-catch");
36
40
  const built_in_register_hook_1 = require("../internal/process/functions/call/built-in/built-in-register-hook");
@@ -49,7 +53,14 @@ const built_in_attach_1 = require("../internal/process/functions/call/built-in/b
49
53
  const built_in_with_1 = require("../internal/process/functions/call/built-in/built-in-with");
50
54
  const built_in_namespace_access_1 = require("../internal/process/functions/call/built-in/built-in-namespace-access");
51
55
  const built_in_load_1 = require("../internal/process/functions/call/built-in/built-in-load");
52
- function defaultBuiltInProcessor(name, args, rootId, data, { returnsNthArgument, useAsProcessor = built_in_proc_name_1.BuiltInProcName.Default, forceArgs, readAllArguments, cfg, hasUnknownSideEffects, treatAsFnCall, markArgsAsNSE: nse, keepArgumentOut }) {
56
+ const built_in_props_1 = require("./built-in-props");
57
+ function defaultBuiltInProcessor(name, args, rootId, data, { useAsProcessor = built_in_proc_name_1.BuiltInProcName.Default, forceArgs, readAllArguments, cfg, hasUnknownSideEffects, treatAsFnCall, markArgsAsNSE: nse, keepArgumentOut, sig }) {
58
+ /* a signature states per argument what the individual options state for all of them at once */
59
+ const layout = sig !== undefined ? (0, built_in_props_1.sigLayout)(sig) : undefined;
60
+ if (layout !== undefined) {
61
+ forceArgs ??= (layout.any & built_in_props_1.ArgProp.Forced) !== 0 ? args.map((_, i) => ((0, built_in_props_1.argProp)(layout, i) & built_in_props_1.ArgProp.Forced) !== 0) : undefined;
62
+ nse ??= (layout.any & built_in_props_1.ArgProp.Nse) !== 0 ? (0, built_in_props_1.argsWith)(layout, args.length, built_in_props_1.ArgProp.Nse) : undefined;
63
+ }
53
64
  const { information: res, processedArguments } = (0, known_call_handling_1.processKnownFunctionCall)({ name, args, rootId, data, forceArgs, origin: useAsProcessor });
54
65
  if (nse !== undefined) {
55
66
  (0, known_call_handling_1.markArgumentsAsNonStandardEvaluation)(res.graph, rootId, processedArguments, nse);
@@ -57,8 +68,8 @@ function defaultBuiltInProcessor(name, args, rootId, data, { returnsNthArgument,
57
68
  if (keepArgumentOut) {
58
69
  res.out = [...res.out, ...processedArguments.flatMap(arg => arg?.out ?? [])];
59
70
  }
60
- if (returnsNthArgument !== undefined) {
61
- const arg = returnsNthArgument === 'last' ? processedArguments.at(-1) : processedArguments[returnsNthArgument];
71
+ if (layout !== undefined && layout.alias >= 0) {
72
+ const arg = processedArguments[layout.alias];
62
73
  if (arg !== undefined) {
63
74
  res.graph.addEdge(rootId, arg.entryPoint, edge_1.EdgeType.Returns);
64
75
  }
@@ -70,6 +81,14 @@ function defaultBuiltInProcessor(name, args, rootId, data, { returnsNthArgument,
70
81
  }
71
82
  }
72
83
  }
84
+ else if (layout !== undefined && (layout.any & (built_in_props_1.ArgProp.Value | built_in_props_1.ArgProp.Shape)) !== 0) {
85
+ for (const i of (0, built_in_props_1.argsWith)(layout, processedArguments.length, built_in_props_1.ArgProp.Value | built_in_props_1.ArgProp.Shape)) {
86
+ const arg = processedArguments[i];
87
+ if (arg) {
88
+ res.graph.addEdge(rootId, arg.entryPoint, edge_1.EdgeType.Reads);
89
+ }
90
+ }
91
+ }
73
92
  if (hasUnknownSideEffects) {
74
93
  if (typeof hasUnknownSideEffects === 'boolean') {
75
94
  (0, unknown_side_effect_1.handleUnknownSideEffect)(res.graph, res.environment, rootId);
@@ -170,13 +189,18 @@ exports.BuiltInProcessorMapper = {
170
189
  [built_in_proc_name_1.BuiltInProcName.Vector]: built_in_vector_1.processVector,
171
190
  [built_in_proc_name_1.BuiltInProcName.WhileLoop]: built_in_while_loop_1.processWhileLoop,
172
191
  };
192
+ /**
193
+ * The value-solver function behind every {@link BuiltInEvalName}, the counterpart of the {@link BuiltInProcessorMapper}.
194
+ * A built-in picks one of these by name with its serializable {@link BuiltInFunctionDefinition#evalHandler}.
195
+ */
173
196
  exports.BuiltInEvalHandlerMapper = {
174
- 'built-in:c': resolve_1.resolveAsVector,
175
- 'built-in::': resolve_1.resolveAsSeq,
176
- 'built-in:+': resolve_1.resolveAsPlus,
177
- 'built-in:-': resolve_1.resolveAsMinus,
178
- 'built-in:paste': resolve_1.resolveAsPaste,
179
- 'built-in:paste0': resolve_1.resolveAsPaste
197
+ [built_in_eval_name_1.BuiltInEvalName.Vector]: resolve_1.resolveAsVector,
198
+ [built_in_eval_name_1.BuiltInEvalName.Seq]: resolve_1.resolveAsSeq,
199
+ [built_in_eval_name_1.BuiltInEvalName.Numeric]: resolve_numbers_1.resolveAsNumeric,
200
+ [built_in_eval_name_1.BuiltInEvalName.Comparison]: resolve_operators_1.resolveAsComparison,
201
+ [built_in_eval_name_1.BuiltInEvalName.Logical]: resolve_operators_1.resolveAsLogical,
202
+ [built_in_eval_name_1.BuiltInEvalName.StringFn]: resolve_strings_1.resolveAsStringFn,
203
+ [built_in_eval_name_1.BuiltInEvalName.Group]: resolve_operators_1.resolveAsGroup
180
204
  };
181
205
  class BuiltIns {
182
206
  /**
@@ -200,10 +224,12 @@ class BuiltIns {
200
224
  /**
201
225
  * Register a built-in function (like `print` or `c`) to the given {@link BuiltIns}
202
226
  */
203
- registerBuiltInFunctions({ names, processor, config, assumePrimitive }) {
227
+ registerBuiltInFunctions({ names, processor, config, assumePrimitive, evalHandler }) {
204
228
  (0, assert_1.guard)(processor !== undefined, () => `Processor for ${JSON.stringify(names)} is undefined, maybe you have an import loop? You may run 'npm run detect-circular-deps' - although by far not all are bad`);
205
229
  const mappedProcessor = exports.BuiltInProcessorMapper[processor];
206
230
  (0, assert_1.guard)(mappedProcessor !== undefined, () => `Processor for ${processor} is undefined! Please pass a valid builtin name ${JSON.stringify(Object.keys(exports.BuiltInProcessorMapper))}!`);
231
+ const mappedEval = evalHandler === undefined ? undefined : exports.BuiltInEvalHandlerMapper[evalHandler];
232
+ (0, assert_1.guard)(evalHandler === undefined || mappedEval !== undefined, () => `Eval handler ${evalHandler} is unknown! Please pass a valid one of ${JSON.stringify(Object.keys(exports.BuiltInEvalHandlerMapper))}!`);
207
233
  for (const name of names) {
208
234
  const n = identifier_1.Identifier.getName(name);
209
235
  const id = node_id_1.NodeId.toBuiltIn(n);
@@ -214,6 +240,7 @@ class BuiltIns {
214
240
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-argument */
215
241
  processor: (name, args, rootId, data) => mappedProcessor(name, args, rootId, data, config),
216
242
  config,
243
+ evalHandler: mappedEval,
217
244
  name,
218
245
  nodeId: id
219
246
  }];