sh-ast 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +165 -133
- package/dist/analyze/ansi-c-escapes.d.ts +1 -1
- package/dist/analyze/ansi-c-escapes.js +1 -1
- package/dist/analyze/enumerate-commands.d.ts +11 -16
- package/dist/analyze/enumerate-commands.d.ts.map +1 -1
- package/dist/analyze/enumerate-commands.js +82 -92
- package/dist/analyze/enumerate-commands.js.map +1 -1
- package/dist/analyze/index.d.ts +3 -2
- package/dist/analyze/index.d.ts.map +1 -1
- package/dist/analyze/index.js +1 -1
- package/dist/analyze/node-helpers.d.ts +10 -21
- package/dist/analyze/node-helpers.d.ts.map +1 -1
- package/dist/analyze/node-helpers.js +16 -27
- package/dist/analyze/node-helpers.js.map +1 -1
- package/dist/analyze/resolve-argv0.d.ts +6 -6
- package/dist/analyze/resolve-argv0.js +6 -6
- package/dist/analyze/resolve-word.d.ts +7 -10
- package/dist/analyze/resolve-word.d.ts.map +1 -1
- package/dist/analyze/resolve-word.js +39 -22
- package/dist/analyze/resolve-word.js.map +1 -1
- package/dist/analyze.d.ts +3780 -397
- package/dist/errors.d.ts +6 -79
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +5 -64
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +16 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -4
- package/dist/index.js.map +1 -1
- package/dist/sh-ast.d.ts +3503 -1027
- package/dist/syntax-errors.d.ts +56 -0
- package/dist/syntax-errors.d.ts.map +1 -0
- package/dist/syntax-errors.js +80 -0
- package/dist/syntax-errors.js.map +1 -0
- package/dist/syntax-snapshot.d.ts +47 -0
- package/dist/syntax-snapshot.d.ts.map +1 -0
- package/dist/syntax-snapshot.js +121 -0
- package/dist/syntax-snapshot.js.map +1 -0
- package/dist/syntax-wire.d.ts +31 -0
- package/dist/syntax-wire.d.ts.map +1 -0
- package/dist/syntax-wire.js +202 -0
- package/dist/syntax-wire.js.map +1 -0
- package/dist/syntax.d.ts +65 -0
- package/dist/syntax.d.ts.map +1 -0
- package/dist/syntax.js +152 -0
- package/dist/syntax.js.map +1 -0
- package/dist/wasm-instance.d.ts +5 -8
- package/dist/wasm-instance.d.ts.map +1 -1
- package/dist/wasm-instance.js +44 -47
- package/dist/wasm-instance.js.map +1 -1
- package/generated/syntax-constants.d.ts +1652 -0
- package/generated/syntax-constants.js +1384 -0
- package/generated/syntax-schema.d.ts +60 -0
- package/generated/syntax-schema.js +1740 -0
- package/generated/syntax-types.d.ts +1977 -0
- package/package.json +2 -2
- package/shim/sh-ast.wasm +0 -0
- package/dist/normalize.d.ts +0 -52
- package/dist/normalize.d.ts.map +0 -1
- package/dist/normalize.js +0 -260
- package/dist/normalize.js.map +0 -1
- package/dist/parse.d.ts +0 -50
- package/dist/parse.d.ts.map +0 -1
- package/dist/parse.js +0 -125
- package/dist/parse.js.map +0 -1
- package/dist/types.d.ts +0 -74
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/visitor-keys.d.ts +0 -21
- package/dist/visitor-keys.d.ts.map +0 -1
- package/dist/visitor-keys.js +0 -23
- package/dist/visitor-keys.js.map +0 -1
- package/dist/walk.d.ts +0 -18
- package/dist/walk.d.ts.map +0 -1
- package/dist/walk.js +0 -40
- package/dist/walk.js.map +0 -1
- package/generated/child-type-schema.d.ts +0 -14
- package/generated/child-type-schema.js +0 -188
- package/generated/node-types.d.ts +0 -1002
- package/generated/position-fields.d.ts +0 -21
- package/generated/position-fields.js +0 -50
- package/generated/visitor-keys.d.ts +0 -11
- package/generated/visitor-keys.js +0 -50
package/dist/analyze.d.ts
CHANGED
|
@@ -1,3 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Upstream BinAritOperator constant Add. Its numeric value is preserved exactly.
|
|
3
|
+
*
|
|
4
|
+
* +
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
declare const Add: 81;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Upstream BinAritOperator constant AddAssgn. Its numeric value is preserved exactly.
|
|
12
|
+
*
|
|
13
|
+
* +=
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
declare const AddAssgn: 49;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Upstream ParExpOperator constant AlternateUnset. Its numeric value is preserved exactly.
|
|
21
|
+
*
|
|
22
|
+
* +
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
declare const AlternateUnset: 81;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Upstream ParExpOperator constant AlternateUnsetOrNull. Its numeric value is preserved exactly.
|
|
30
|
+
*
|
|
31
|
+
* :+
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
declare const AlternateUnsetOrNull: 82;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Upstream BinAritOperator constant And. Its numeric value is preserved exactly.
|
|
39
|
+
*
|
|
40
|
+
* &
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
*/
|
|
44
|
+
declare const And: 10;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Upstream BinAritOperator constant AndArit. Its numeric value is preserved exactly.
|
|
48
|
+
*
|
|
49
|
+
* &&
|
|
50
|
+
*
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
declare const AndArit: 11;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Upstream BinAritOperator constant AndAssgn. Its numeric value is preserved exactly.
|
|
57
|
+
*
|
|
58
|
+
* &=
|
|
59
|
+
*
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
declare const AndAssgn: 54;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Upstream BinAritOperator constant AndBoolAssgn. Its numeric value is preserved exactly.
|
|
66
|
+
*
|
|
67
|
+
* &&=
|
|
68
|
+
*
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
declare const AndBoolAssgn: 59;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Upstream BinCmdOperator constant AndStmt. Its numeric value is preserved exactly.
|
|
75
|
+
*
|
|
76
|
+
* &&
|
|
77
|
+
*
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
declare const AndStmt: 11;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Upstream BinTestOperator constant AndTest. Its numeric value is preserved exactly.
|
|
84
|
+
*
|
|
85
|
+
* &&
|
|
86
|
+
*
|
|
87
|
+
* @public
|
|
88
|
+
*/
|
|
89
|
+
declare const AndTest: 11;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Upstream RedirOperator constant AppAll. Its numeric value is preserved exactly.
|
|
93
|
+
*
|
|
94
|
+
* &\>\>
|
|
95
|
+
*
|
|
96
|
+
* @public
|
|
97
|
+
*/
|
|
98
|
+
declare const AppAll: 76;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Upstream RedirOperator constant AppAllClob. Its numeric value is preserved exactly.
|
|
102
|
+
*
|
|
103
|
+
* &\>\>| with `LangZsh`
|
|
104
|
+
*
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
107
|
+
declare const AppAllClob: 77;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Upstream RedirOperator constant AppClob. Its numeric value is preserved exactly.
|
|
111
|
+
*
|
|
112
|
+
* \>\>| with `LangZsh`
|
|
113
|
+
*
|
|
114
|
+
* @public
|
|
115
|
+
*/
|
|
116
|
+
declare const AppClob: 70;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Upstream RedirOperator constant AppOut. Its numeric value is preserved exactly.
|
|
120
|
+
*
|
|
121
|
+
* \>\>
|
|
122
|
+
*
|
|
123
|
+
* @public
|
|
124
|
+
*/
|
|
125
|
+
declare const AppOut: 64;
|
|
126
|
+
|
|
1
127
|
/**
|
|
2
128
|
* The result of statically resolving one position in an
|
|
3
129
|
* {@link Argv0Resolution.chain}: either an ordinary {@link WordResolution}
|
|
@@ -43,11 +169,11 @@ export declare interface Argv0Resolution {
|
|
|
43
169
|
readonly effective: Argv0ChainWord;
|
|
44
170
|
/**
|
|
45
171
|
* The number of `VAR=val` shell-assignment prefixes on the `CallExpr`
|
|
46
|
-
* itself (`CommandSite.node.
|
|
172
|
+
* itself (`CommandSite.node.Assigns`, e.g. the `FOO=bar` in
|
|
47
173
|
* `FOO=bar rm x`) that were skipped to reach argv0. This is a distinct
|
|
48
174
|
* mechanism from a wrapper's own `VAR=val` *operands* (e.g. `env`'s or
|
|
49
175
|
* `sudo`'s, see {@link WrapperSpec.skipAssignmentOperands}) — always
|
|
50
|
-
* exactly `CommandSite.node.
|
|
176
|
+
* exactly `CommandSite.node.Assigns`'s length, independent of the
|
|
51
177
|
* wrapper chain found afterward.
|
|
52
178
|
*/
|
|
53
179
|
readonly assignmentsSkipped: number;
|
|
@@ -96,479 +222,3699 @@ export declare interface Argv0UnresolvedWord {
|
|
|
96
222
|
}
|
|
97
223
|
|
|
98
224
|
/**
|
|
99
|
-
*
|
|
100
|
-
* {@link CommandSite}, describing *how* the command is reached — never
|
|
101
|
-
* whether it is safe to run. `CommandSite.context` is an ordered stack of
|
|
102
|
-
* these, outermost frame first:
|
|
103
|
-
*
|
|
104
|
-
* - `'and'`/`'or'` (`side: 'right'`) — the right-hand operand of a
|
|
105
|
-
* `BinaryCmd` (mvdan/sh's node for both `&&` and `||`); only the right
|
|
106
|
-
* side is tagged; the left side inherits the surrounding context
|
|
107
|
-
* unchanged, since it runs unconditionally relative to this operator.
|
|
108
|
-
* - `'pipeline'` (`stage: n`) — one stage of a `|`/`|&` chain (also a
|
|
109
|
-
* `BinaryCmd`, left-associatively nested by mvdan/sh); every stage is
|
|
110
|
-
* tagged, 0-indexed left to right, regardless of whether the chain mixes
|
|
111
|
-
* `|` and `|&`.
|
|
112
|
-
* - `'subshell'` — inside a `Subshell` (`( ... )`).
|
|
113
|
-
* - `'cmdSubst'`/`'procSubst'` — inside a `CmdSubst` (`$(...)`/backticks) or
|
|
114
|
-
* `ProcSubst` (`<(...)`/`>(...)`) reached from *any* word-bearing
|
|
115
|
-
* position (an argument, a redirection target, a case subject, a loop's
|
|
116
|
-
* word list, an assignment value, a test/arithmetic operand, …) — not
|
|
117
|
-
* only from `CallExpr.args`.
|
|
118
|
-
* - `'if'` (`branch: 'cond' | 'then' | 'else'`) — inside an `IfClause`'s
|
|
119
|
-
* condition, then-branch, or else-branch (mvdan/sh nests `elif` chains as
|
|
120
|
-
* `IfClause.else` pointing to another `IfClause`, so an `elif`'s own
|
|
121
|
-
* condition/then are reached through an `{kind:'if',branch:'else'}` frame
|
|
122
|
-
* first, then their own `'cond'`/`'then'` frame — reflecting the real
|
|
123
|
-
* nesting rather than collapsing it).
|
|
124
|
-
* - `'case'` — inside one `CaseClause` branch's statement list (not the
|
|
125
|
-
* case subject word or the patterns).
|
|
126
|
-
* - `'loop'` (`role` is `'body'` or `'cond'`) — inside a `ForClause`'s
|
|
127
|
-
* statement list (`role: 'body'` only — a `for` loop has no
|
|
128
|
-
* statement-list condition) or a `WhileClause`'s (`role: 'cond'` for the
|
|
129
|
-
* condition, `role: 'body'` for the loop body).
|
|
130
|
-
* - `'function'` (`name`) — inside a `FuncDecl`'s body; `name` is the
|
|
131
|
-
* function's literal name text.
|
|
132
|
-
* - `'background'`/`'negated'` — the enclosing `Stmt` has mvdan/sh's
|
|
133
|
-
* Background/Negated flag set (`cmd &`, `! cmd`).
|
|
134
|
-
* - `'coproc'` — inside a `CoprocClause`'s statement (a `coproc` block,
|
|
135
|
-
* optionally named).
|
|
225
|
+
* ArithmCmd represents an arithmetic command.
|
|
136
226
|
*
|
|
137
|
-
*
|
|
138
|
-
* deliberately transparent — grouping and timing a command doesn't change
|
|
139
|
-
* how it's reached, so no frame is added for either.
|
|
227
|
+
* This node will only appear with `LangBash` and `LangMirBSDKorn`.
|
|
140
228
|
*
|
|
141
|
-
*
|
|
142
|
-
* construct this module starts modeling can add a new `kind` variant
|
|
143
|
-
* without that being a breaking change (mirroring
|
|
144
|
-
* {@link WordResolutionReason}'s semver policy in `resolve-word.ts`). It is
|
|
145
|
-
* deliberately not sealed against extension elsewhere in the codebase.
|
|
146
|
-
* Every existing variant's shape (its extra fields, if any) is stable —
|
|
147
|
-
* only new variants are ever added — so an exhaustive compile-time
|
|
148
|
-
* `switch` over `.kind` should still include a `default` case to stay
|
|
149
|
-
* forward-compatible.
|
|
229
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
150
230
|
*
|
|
151
231
|
* @public
|
|
152
232
|
*/
|
|
153
|
-
export declare
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
readonly kind: 'function';
|
|
178
|
-
readonly name: string;
|
|
179
|
-
} | {
|
|
180
|
-
readonly kind: 'background';
|
|
181
|
-
} | {
|
|
182
|
-
readonly kind: 'negated';
|
|
183
|
-
} | {
|
|
184
|
-
readonly kind: 'coproc';
|
|
185
|
-
};
|
|
233
|
+
export declare interface ArithmCmd {
|
|
234
|
+
/**
|
|
235
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
236
|
+
*/
|
|
237
|
+
Type: 'ArithmCmd';
|
|
238
|
+
/**
|
|
239
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
240
|
+
*/
|
|
241
|
+
Left: SyntaxPos;
|
|
242
|
+
/**
|
|
243
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
244
|
+
*/
|
|
245
|
+
Right: SyntaxPos;
|
|
246
|
+
/**
|
|
247
|
+
* mksh's ((# expr))
|
|
248
|
+
*
|
|
249
|
+
* False is an explicit upstream value and is never omitted.
|
|
250
|
+
*/
|
|
251
|
+
Unsigned: boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Null preserves the upstream absence of this component.
|
|
254
|
+
*/
|
|
255
|
+
X: ArithmExpr | null;
|
|
256
|
+
}
|
|
186
257
|
|
|
187
258
|
/**
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
* hardcoded command/wrapper list. A dynamic (`static: false`) `argv0` is a
|
|
192
|
-
* normal, expected result — not an error and not itself reported as
|
|
193
|
-
* "unknown"/"unsafe".
|
|
259
|
+
* ArithmExp represents an arithmetic expansion.
|
|
260
|
+
*
|
|
261
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
194
262
|
*
|
|
195
263
|
* @public
|
|
196
264
|
*/
|
|
197
|
-
export declare interface
|
|
198
|
-
/** The `CallExpr` node this site was found at. */
|
|
199
|
-
readonly node: ShNode;
|
|
265
|
+
export declare interface ArithmExp {
|
|
200
266
|
/**
|
|
201
|
-
*
|
|
202
|
-
* `{ context: 'command-argument' }` — every `CallExpr` word is an
|
|
203
|
-
* ordinary command-argument position, never an assignment value, so
|
|
204
|
-
* only a word-initial unquoted `~` triggers tilde expansion (an
|
|
205
|
-
* unquoted `~` after a `:`, e.g. `a:~/b`, is literal text here — see
|
|
206
|
-
* `ResolveWordOptions.context`'s doc comment).
|
|
267
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
207
268
|
*/
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
269
|
+
Type: 'ArithmExp';
|
|
270
|
+
/**
|
|
271
|
+
* deprecated $`expr` form
|
|
272
|
+
*
|
|
273
|
+
* False is an explicit upstream value and is never omitted.
|
|
274
|
+
*/
|
|
275
|
+
Bracket: boolean;
|
|
276
|
+
/**
|
|
277
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
278
|
+
*/
|
|
279
|
+
Left: SyntaxPos;
|
|
280
|
+
/**
|
|
281
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
282
|
+
*/
|
|
283
|
+
Right: SyntaxPos;
|
|
284
|
+
/**
|
|
285
|
+
* mksh's $((# expr))
|
|
286
|
+
*
|
|
287
|
+
* False is an explicit upstream value and is never omitted.
|
|
288
|
+
*/
|
|
289
|
+
Unsigned: boolean;
|
|
290
|
+
/**
|
|
291
|
+
* Null preserves the upstream absence of this component.
|
|
292
|
+
*/
|
|
293
|
+
X: ArithmExpr | null;
|
|
213
294
|
}
|
|
214
295
|
|
|
215
296
|
/**
|
|
216
|
-
*
|
|
217
|
-
* flag/operand handling is hand-derived from that wrapper's own manual
|
|
218
|
-
* page (or, for shell builtins, the Bash Reference Manual/POSIX Shell &
|
|
219
|
-
* Utilities volume), cited per entry below, and cross-checked empirically
|
|
220
|
-
* against the real utility where one was locally available (GNU coreutils
|
|
221
|
-
* `env`/`nice` directly; `sudo` via `sudo -h`'s usage/option summary only
|
|
222
|
-
* — never executed, per this package's "facts only" posture and basic
|
|
223
|
-
* safety hygiene). This table is *data*, not policy: it names no
|
|
224
|
-
* "dangerous" commands, makes no safety judgment, and a caller can freely
|
|
225
|
-
* replace or extend it via {@link ResolveArgv0Options.transparentWrappers}
|
|
226
|
-
* (see {@link resolveArgv0}'s criterion-4-style configurability guarantee).
|
|
227
|
-
*
|
|
228
|
-
* Frozen (including each entry object and its own array/regexp fields) so
|
|
229
|
-
* immutability of this shared, module-scoped table is a contract, not just
|
|
230
|
-
* a convention any importer happens to honor — mirrors `visitorKeys`'s and
|
|
231
|
-
* `CHILD_TYPE_SCHEMA`'s freezing in `visitor-keys.ts`/`normalize.ts`.
|
|
232
|
-
*
|
|
233
|
-
* `xargs` is deliberately **excluded**: unlike every entry here, `xargs`
|
|
234
|
-
* doesn't simply re-exec a single wrapped command word it can point to
|
|
235
|
-
* statically — it invokes `command [initial-arguments]` once per *batch*
|
|
236
|
-
* of additional arguments assembled from its own stdin at run time
|
|
237
|
-
* (batched per `-n`/`-L`/line-splitting rules, GNU xargs(1)). Treating it
|
|
238
|
-
* as transparent would misrepresent what's actually invoked: the "wrapped
|
|
239
|
-
* command" is only ever a syntactic *prefix* of the real, stdin-dependent
|
|
240
|
-
* argv, and that prefix can itself be entirely absent (bare `xargs` reruns
|
|
241
|
-
* each stdin-derived line as its own command). No `WrapperSpec` shape here
|
|
242
|
-
* can honestly express that, so `xargs` is left for a caller to model
|
|
243
|
-
* explicitly if their use case calls for it, rather than shipped as a
|
|
244
|
-
* silently-wrong default.
|
|
297
|
+
* The concrete records and typed nil pointers accepted by upstream syntax.ArithmExpr. Typed nil kinds are limited to this interface's actual implementers; auxiliary records are excluded.
|
|
245
298
|
*
|
|
246
|
-
* @see https://www.gnu.org/software/bash/manual/bash.html#Bourne-Shell-Builtins — `command`, `exec` (Bash Reference Manual §4.1)
|
|
247
|
-
* @see https://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html — POSIX `command`
|
|
248
|
-
* @see https://www.gnu.org/software/coreutils/manual/html_node/env-invocation.html — GNU coreutils `env`
|
|
249
|
-
* @see https://pubs.opengroup.org/onlinepubs/9699919799/utilities/env.html — POSIX `env`
|
|
250
|
-
* @see https://pubs.opengroup.org/onlinepubs/9699919799/utilities/nohup.html — POSIX `nohup`
|
|
251
|
-
* @see https://www.gnu.org/software/coreutils/manual/html_node/nice-invocation.html — GNU coreutils `nice`
|
|
252
|
-
* @see https://pubs.opengroup.org/onlinepubs/9699919799/utilities/nice.html — POSIX `nice`
|
|
253
|
-
* @see https://pubs.opengroup.org/onlinepubs/9699919799/utilities/time.html — POSIX `time` utility (distinct from the bash `time` *reserved word*, which mvdan/sh models as a transparent `TimeClause` — see {@link WrapperSpec}'s `time` entry below)
|
|
254
|
-
* @see https://www.gnu.org/software/coreutils/manual/html_node/timeout-invocation.html — GNU coreutils `timeout`
|
|
255
|
-
* @see https://www.sudo.ws/docs/man/sudo.man/ — `sudo(8)`
|
|
256
|
-
* @see https://www.gnu.org/software/findutils/manual/html_node/find_html/xargs-options.html — GNU `xargs` (why it's excluded, above)
|
|
257
299
|
* @public
|
|
258
300
|
*/
|
|
259
|
-
export declare
|
|
301
|
+
export declare type ArithmExpr =
|
|
302
|
+
| BinaryArithm
|
|
303
|
+
| FlagsArithm
|
|
304
|
+
| ParenArithm
|
|
305
|
+
| UnaryArithm
|
|
306
|
+
| Word
|
|
307
|
+
| TypedNil<'BinaryArithm' | 'FlagsArithm' | 'ParenArithm' | 'UnaryArithm' | 'Word'>;
|
|
260
308
|
|
|
261
309
|
/**
|
|
262
|
-
*
|
|
263
|
-
* with its resolved words ({@link resolveWord}) and the path used to reach
|
|
264
|
-
* it ({@link CommandContext}). Descends everywhere a command can occur:
|
|
265
|
-
* statement lists, both sides of `&&`/`||`/pipelines, subshells/blocks,
|
|
266
|
-
* if/case branches *and* conditions, loop bodies *and* conditions, function
|
|
267
|
-
* bodies, background/negated/coproc statements, and — critically —
|
|
268
|
-
* `CmdSubst`/`ProcSubst` nested inside words, wherever those words occur
|
|
269
|
-
* (arguments, redirection targets, case subjects/patterns, loop word
|
|
270
|
-
* lists, assignment values, test/arithmetic operands, …), not only inside
|
|
271
|
-
* `CallExpr.args`.
|
|
310
|
+
* ArrayElem represents a Bash array element.
|
|
272
311
|
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
* its assigned value (`FOO=$(sub)`) is still found and reported.
|
|
312
|
+
* Index can be nil; for example, declare -a x=(value).
|
|
313
|
+
* Value can be nil; for example, declare -A x=(`index`=).
|
|
314
|
+
* Finally, neither can be nil; for example, declare -A x=(`index`=value)
|
|
277
315
|
*
|
|
278
|
-
*
|
|
279
|
-
* command substitutions and out-of-structural-order redirection targets
|
|
280
|
-
* still come back in source order regardless of traversal order.
|
|
316
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
281
317
|
*
|
|
282
|
-
*
|
|
283
|
-
|
|
284
|
-
|
|
318
|
+
* @public
|
|
319
|
+
*/
|
|
320
|
+
export declare interface ArrayElem {
|
|
321
|
+
/**
|
|
322
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
323
|
+
*/
|
|
324
|
+
Type: 'ArrayElem';
|
|
325
|
+
/**
|
|
326
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array.
|
|
327
|
+
*/
|
|
328
|
+
Comments: Comment_2[] | null;
|
|
329
|
+
/**
|
|
330
|
+
* Null preserves the upstream absence of this component.
|
|
331
|
+
*/
|
|
332
|
+
Index: ArithmExpr | null;
|
|
333
|
+
/**
|
|
334
|
+
* Null preserves the upstream absence of this component.
|
|
335
|
+
*/
|
|
336
|
+
Value: Word | null;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Upstream ParExpOperator constant ArrayExclude. Its numeric value is preserved exactly.
|
|
285
341
|
*
|
|
286
|
-
*
|
|
287
|
-
* traversed iteratively and never risks a stack overflow or trips the
|
|
288
|
-
* nesting-depth guard below, regardless of how many stages/links it has.
|
|
342
|
+
* :| with `LangZsh`
|
|
289
343
|
*
|
|
290
|
-
* @
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
*
|
|
344
|
+
* @public
|
|
345
|
+
*/
|
|
346
|
+
declare const ArrayExclude: 94;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* ArrayExpr represents a Bash array expression.
|
|
350
|
+
*
|
|
351
|
+
* This node will only appear with `LangBash`.
|
|
352
|
+
*
|
|
353
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
354
|
+
*
|
|
355
|
+
* @public
|
|
356
|
+
*/
|
|
357
|
+
export declare interface ArrayExpr {
|
|
358
|
+
/**
|
|
359
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
360
|
+
*/
|
|
361
|
+
Type: 'ArrayExpr';
|
|
362
|
+
/**
|
|
363
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
364
|
+
*/
|
|
365
|
+
Elems: (ArrayElem | null)[] | null;
|
|
366
|
+
/**
|
|
367
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array.
|
|
368
|
+
*/
|
|
369
|
+
Last: Comment_2[] | null;
|
|
370
|
+
/**
|
|
371
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
372
|
+
*/
|
|
373
|
+
Lparen: SyntaxPos;
|
|
374
|
+
/**
|
|
375
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
306
376
|
*/
|
|
307
|
-
|
|
377
|
+
Rparen: SyntaxPos;
|
|
378
|
+
}
|
|
308
379
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
readonly column: number;
|
|
318
|
-
}
|
|
380
|
+
/**
|
|
381
|
+
* Upstream ParExpOperator constant ArrayIntersect. Its numeric value is preserved exactly.
|
|
382
|
+
*
|
|
383
|
+
* :* with `LangZsh`
|
|
384
|
+
*
|
|
385
|
+
* @public
|
|
386
|
+
*/
|
|
387
|
+
declare const ArrayIntersect: 95;
|
|
319
388
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
389
|
+
/**
|
|
390
|
+
* Upstream BinAritOperator constant Assgn. Its numeric value is preserved exactly.
|
|
391
|
+
*
|
|
392
|
+
* =
|
|
393
|
+
*
|
|
394
|
+
* @public
|
|
395
|
+
*/
|
|
396
|
+
declare const Assgn: 87;
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Assign represents an assignment to a variable.
|
|
400
|
+
*
|
|
401
|
+
* Here and elsewhere, Index can mean either an index expression into an indexed
|
|
402
|
+
* array, or a string key into an associative array.
|
|
403
|
+
*
|
|
404
|
+
* If Index is non-nil, the value will be a word and not an array as nested
|
|
405
|
+
* arrays are not allowed.
|
|
406
|
+
*
|
|
407
|
+
* If Naked is true and Name is nil, the assignment is part of a `DeclClause` and
|
|
408
|
+
* the argument (in the Value field) will be evaluated at run-time. This
|
|
409
|
+
* includes parameter expansions, which may expand to assignments or options.
|
|
410
|
+
*
|
|
411
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
412
|
+
*
|
|
413
|
+
* @public
|
|
414
|
+
*/
|
|
415
|
+
export declare interface Assign {
|
|
416
|
+
/**
|
|
417
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
418
|
+
*/
|
|
419
|
+
Type: 'Assign';
|
|
420
|
+
/**
|
|
421
|
+
* +=
|
|
422
|
+
*
|
|
423
|
+
* False is an explicit upstream value and is never omitted.
|
|
424
|
+
*/
|
|
425
|
+
Append: boolean;
|
|
426
|
+
/**
|
|
427
|
+
* =(arr)
|
|
428
|
+
*
|
|
429
|
+
* Null preserves the upstream absence of this component.
|
|
430
|
+
*/
|
|
431
|
+
Array: ArrayExpr | null;
|
|
432
|
+
/**
|
|
433
|
+
* `i`, ["k"]
|
|
434
|
+
*
|
|
435
|
+
* Null preserves the upstream absence of this component.
|
|
436
|
+
*/
|
|
437
|
+
Index: ArithmExpr | null;
|
|
438
|
+
/**
|
|
439
|
+
* without '='
|
|
440
|
+
*
|
|
441
|
+
* False is an explicit upstream value and is never omitted.
|
|
442
|
+
*/
|
|
443
|
+
Naked: boolean;
|
|
444
|
+
/**
|
|
445
|
+
* must be a valid name
|
|
446
|
+
*
|
|
447
|
+
* Null preserves the upstream absence of this component.
|
|
448
|
+
*/
|
|
449
|
+
Name: Lit | null;
|
|
450
|
+
/**
|
|
451
|
+
* =val
|
|
452
|
+
*
|
|
453
|
+
* Null preserves the upstream absence of this component.
|
|
454
|
+
*/
|
|
455
|
+
Value: Word | null;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Upstream ParExpOperator constant AssignUnset. Its numeric value is preserved exactly.
|
|
460
|
+
*
|
|
461
|
+
* =
|
|
462
|
+
*
|
|
463
|
+
* @public
|
|
464
|
+
*/
|
|
465
|
+
declare const AssignUnset: 87;
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Upstream ParExpOperator constant AssignUnsetOrNull. Its numeric value is preserved exactly.
|
|
469
|
+
*
|
|
470
|
+
* :=
|
|
471
|
+
*
|
|
472
|
+
* @public
|
|
473
|
+
*/
|
|
474
|
+
declare const AssignUnsetOrNull: 88;
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* The upstream BinAritOperator domain: exact named tokens, the Go zero value, and explicitly validated unnamed uint32 values. Constants shared by upstream families retain their shared numeric identity.
|
|
478
|
+
*
|
|
479
|
+
* @public
|
|
480
|
+
*/
|
|
481
|
+
export declare type BinAritOperator =
|
|
482
|
+
| 0
|
|
483
|
+
| typeof Add
|
|
484
|
+
| typeof AddAssgn
|
|
485
|
+
| typeof And
|
|
486
|
+
| typeof AndArit
|
|
487
|
+
| typeof AndAssgn
|
|
488
|
+
| typeof AndBoolAssgn
|
|
489
|
+
| typeof Assgn
|
|
490
|
+
| typeof Comma
|
|
491
|
+
| typeof Eql
|
|
492
|
+
| typeof Geq
|
|
493
|
+
| typeof Gtr
|
|
494
|
+
| typeof Leq
|
|
495
|
+
| typeof Lss
|
|
496
|
+
| typeof Mul
|
|
497
|
+
| typeof MulAssgn
|
|
498
|
+
| typeof Neq
|
|
499
|
+
| typeof Or
|
|
500
|
+
| typeof OrArit
|
|
501
|
+
| typeof OrAssgn
|
|
502
|
+
| typeof OrBoolAssgn
|
|
503
|
+
| typeof Pow
|
|
504
|
+
| typeof PowAssgn
|
|
505
|
+
| typeof Quo
|
|
506
|
+
| typeof QuoAssgn
|
|
507
|
+
| typeof Rem
|
|
508
|
+
| typeof RemAssgn
|
|
509
|
+
| typeof Shl
|
|
510
|
+
| typeof ShlAssgn
|
|
511
|
+
| typeof Shr
|
|
512
|
+
| typeof ShrAssgn
|
|
513
|
+
| typeof Sub
|
|
514
|
+
| typeof SubAssgn
|
|
515
|
+
| typeof TernColon
|
|
516
|
+
| typeof TernQuest
|
|
517
|
+
| typeof Xor
|
|
518
|
+
| typeof XorAssgn
|
|
519
|
+
| typeof XorBool
|
|
520
|
+
| typeof XorBoolAssgn
|
|
521
|
+
| RawOperator<'BinAritOperator'>;
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* BinaryArithm represents a binary arithmetic expression.
|
|
525
|
+
*
|
|
526
|
+
* If Op is any assign operator, X will be a word with a single `Lit` whose value
|
|
527
|
+
* is a valid name.
|
|
528
|
+
*
|
|
529
|
+
* Ternary operators like "a ? b : c" are fit into this structure. Thus, if
|
|
530
|
+
* Op==`TernQuest`, Y will be a `BinaryArithm` with Op==`TernColon`.
|
|
531
|
+
* `TernColon` does not appear in any other scenario.
|
|
532
|
+
*
|
|
533
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
534
|
+
*
|
|
535
|
+
* @public
|
|
536
|
+
*/
|
|
537
|
+
export declare interface BinaryArithm {
|
|
538
|
+
/**
|
|
539
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
540
|
+
*/
|
|
541
|
+
Type: 'BinaryArithm';
|
|
542
|
+
/**
|
|
543
|
+
* Upstream operator value, preserving named tokens, zero, and explicitly represented raw uint32 values.
|
|
544
|
+
*/
|
|
545
|
+
Op: BinAritOperator;
|
|
546
|
+
/**
|
|
547
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
548
|
+
*/
|
|
549
|
+
OpPos: SyntaxPos;
|
|
550
|
+
/**
|
|
551
|
+
* Null preserves the upstream absence of this component.
|
|
552
|
+
*/
|
|
553
|
+
X: ArithmExpr | null;
|
|
554
|
+
/**
|
|
555
|
+
* Null preserves the upstream absence of this component.
|
|
556
|
+
*/
|
|
557
|
+
Y: ArithmExpr | null;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* BinaryCmd represents a binary expression between two statements.
|
|
562
|
+
*
|
|
563
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
564
|
+
*
|
|
565
|
+
* @public
|
|
566
|
+
*/
|
|
567
|
+
export declare interface BinaryCmd {
|
|
568
|
+
/**
|
|
569
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
570
|
+
*/
|
|
571
|
+
Type: 'BinaryCmd';
|
|
572
|
+
/**
|
|
573
|
+
* Upstream operator value, preserving named tokens, zero, and explicitly represented raw uint32 values.
|
|
574
|
+
*/
|
|
575
|
+
Op: BinCmdOperator;
|
|
576
|
+
/**
|
|
577
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
578
|
+
*/
|
|
579
|
+
OpPos: SyntaxPos;
|
|
580
|
+
/**
|
|
581
|
+
* Null preserves the upstream absence of this component.
|
|
582
|
+
*/
|
|
583
|
+
X: Stmt | null;
|
|
584
|
+
/**
|
|
585
|
+
* Null preserves the upstream absence of this component.
|
|
586
|
+
*/
|
|
587
|
+
Y: Stmt | null;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* BinaryTest represents a binary test expression.
|
|
592
|
+
*
|
|
593
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
594
|
+
*
|
|
595
|
+
* @public
|
|
596
|
+
*/
|
|
597
|
+
export declare interface BinaryTest {
|
|
598
|
+
/**
|
|
599
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
600
|
+
*/
|
|
601
|
+
Type: 'BinaryTest';
|
|
602
|
+
/**
|
|
603
|
+
* Upstream operator value, preserving named tokens, zero, and explicitly represented raw uint32 values.
|
|
604
|
+
*/
|
|
605
|
+
Op: BinTestOperator;
|
|
606
|
+
/**
|
|
607
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
608
|
+
*/
|
|
609
|
+
OpPos: SyntaxPos;
|
|
610
|
+
/**
|
|
611
|
+
* Null preserves the upstream absence of this component.
|
|
612
|
+
*/
|
|
613
|
+
X: TestExpr | null;
|
|
614
|
+
/**
|
|
615
|
+
* Null preserves the upstream absence of this component.
|
|
616
|
+
*/
|
|
617
|
+
Y: TestExpr | null;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* The upstream BinCmdOperator domain: exact named tokens, the Go zero value, and explicitly validated unnamed uint32 values. Constants shared by upstream families retain their shared numeric identity.
|
|
622
|
+
*
|
|
623
|
+
* @public
|
|
624
|
+
*/
|
|
625
|
+
export declare type BinCmdOperator =
|
|
626
|
+
0 | typeof AndStmt | typeof OrStmt | typeof Pipe | typeof PipeAll | RawOperator<'BinCmdOperator'>;
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* The upstream BinTestOperator domain: exact named tokens, the Go zero value, and explicitly validated unnamed uint32 values. Constants shared by upstream families retain their shared numeric identity.
|
|
630
|
+
*
|
|
631
|
+
* @public
|
|
632
|
+
*/
|
|
633
|
+
export declare type BinTestOperator =
|
|
634
|
+
| 0
|
|
635
|
+
| typeof AndTest
|
|
636
|
+
| typeof OrTest
|
|
637
|
+
| typeof TsAfter
|
|
638
|
+
| typeof TsBefore
|
|
639
|
+
| typeof TsDevIno
|
|
640
|
+
| typeof TsEql
|
|
641
|
+
| typeof TsGeq
|
|
642
|
+
| typeof TsGtr
|
|
643
|
+
| typeof TsLeq
|
|
644
|
+
| typeof TsLss
|
|
645
|
+
| typeof TsMatch
|
|
646
|
+
| typeof TsMatchShort
|
|
647
|
+
| typeof TsNeq
|
|
648
|
+
| typeof TsNewer
|
|
649
|
+
| typeof TsNoMatch
|
|
650
|
+
| typeof TsOlder
|
|
651
|
+
| typeof TsReMatch
|
|
652
|
+
| RawOperator<'BinTestOperator'>;
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* Upstream UnAritOperator constant BitNegation. Its numeric value is preserved exactly.
|
|
656
|
+
*
|
|
657
|
+
* ~
|
|
658
|
+
*
|
|
659
|
+
* @public
|
|
660
|
+
*/
|
|
661
|
+
declare const BitNegation: 40;
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* Block represents a series of commands that should be executed in a nested
|
|
665
|
+
* scope. It is essentially a list of statements within curly braces.
|
|
666
|
+
*
|
|
667
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
668
|
+
*
|
|
669
|
+
* @public
|
|
670
|
+
*/
|
|
671
|
+
export declare interface Block {
|
|
672
|
+
/**
|
|
673
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
674
|
+
*/
|
|
675
|
+
Type: 'Block';
|
|
676
|
+
/**
|
|
677
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array.
|
|
678
|
+
*/
|
|
679
|
+
Last: Comment_2[] | null;
|
|
680
|
+
/**
|
|
681
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
682
|
+
*/
|
|
683
|
+
Lbrace: SyntaxPos;
|
|
684
|
+
/**
|
|
685
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
686
|
+
*/
|
|
687
|
+
Rbrace: SyntaxPos;
|
|
688
|
+
/**
|
|
689
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
690
|
+
*/
|
|
691
|
+
Stmts: (Stmt | null)[] | null;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* BraceExp represents a Bash brace expression, such as "\{a,f\}" or "\{1..10\}".
|
|
696
|
+
*
|
|
697
|
+
* This node will only appear as a result of `SplitBraces`.
|
|
698
|
+
*
|
|
699
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
700
|
+
*
|
|
701
|
+
* @public
|
|
702
|
+
*/
|
|
703
|
+
export declare interface BraceExp {
|
|
704
|
+
/**
|
|
705
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
706
|
+
*/
|
|
707
|
+
Type: 'BraceExp';
|
|
708
|
+
/**
|
|
709
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
710
|
+
*/
|
|
711
|
+
Elems: (Word | null)[] | null;
|
|
712
|
+
/**
|
|
713
|
+
* \{x..y[..incr]\} instead of \{x,y[,...]\}
|
|
714
|
+
*
|
|
715
|
+
* False is an explicit upstream value and is never omitted.
|
|
716
|
+
*/
|
|
717
|
+
Sequence: boolean;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* Upstream CaseOperator constant Break. Its numeric value is preserved exactly.
|
|
722
|
+
*
|
|
723
|
+
* ;;
|
|
724
|
+
*
|
|
725
|
+
* @public
|
|
726
|
+
*/
|
|
727
|
+
declare const Break: 35;
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* CallExpr represents a command execution or function call, otherwise known as
|
|
731
|
+
* a "simple command".
|
|
732
|
+
*
|
|
733
|
+
* If Args is empty, Assigns apply to the shell environment. Otherwise, they are
|
|
734
|
+
* variables that cannot be arrays and which only apply to the call.
|
|
735
|
+
*
|
|
736
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
737
|
+
*
|
|
738
|
+
* @public
|
|
739
|
+
*/
|
|
740
|
+
export declare interface CallExpr {
|
|
741
|
+
/**
|
|
742
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
743
|
+
*/
|
|
744
|
+
Type: 'CallExpr';
|
|
745
|
+
/**
|
|
746
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
747
|
+
*/
|
|
748
|
+
Args: (Word | null)[] | null;
|
|
749
|
+
/**
|
|
750
|
+
* a=x b=y args
|
|
751
|
+
*
|
|
752
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
753
|
+
*/
|
|
754
|
+
Assigns: (Assign | null)[] | null;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* CaseClause represents a case (switch) clause.
|
|
759
|
+
*
|
|
760
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
761
|
+
*
|
|
762
|
+
* @public
|
|
763
|
+
*/
|
|
764
|
+
export declare interface CaseClause {
|
|
765
|
+
/**
|
|
766
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
767
|
+
*/
|
|
768
|
+
Type: 'CaseClause';
|
|
769
|
+
/**
|
|
770
|
+
* deprecated mksh form with braces instead of in/esac
|
|
771
|
+
*
|
|
772
|
+
* False is an explicit upstream value and is never omitted.
|
|
773
|
+
*/
|
|
774
|
+
Braces: boolean;
|
|
775
|
+
/**
|
|
776
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
777
|
+
*/
|
|
778
|
+
Case: SyntaxPos;
|
|
779
|
+
/**
|
|
780
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
781
|
+
*/
|
|
782
|
+
Esac: SyntaxPos;
|
|
783
|
+
/**
|
|
784
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
785
|
+
*/
|
|
786
|
+
In: SyntaxPos;
|
|
787
|
+
/**
|
|
788
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
789
|
+
*/
|
|
790
|
+
Items: (CaseItem | null)[] | null;
|
|
791
|
+
/**
|
|
792
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array.
|
|
793
|
+
*/
|
|
794
|
+
Last: Comment_2[] | null;
|
|
795
|
+
/**
|
|
796
|
+
* Null preserves the upstream absence of this component.
|
|
797
|
+
*/
|
|
798
|
+
Word: Word | null;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* CaseItem represents a pattern list (case) within a `CaseClause`.
|
|
803
|
+
*
|
|
804
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
805
|
+
*
|
|
806
|
+
* @public
|
|
807
|
+
*/
|
|
808
|
+
export declare interface CaseItem {
|
|
809
|
+
/**
|
|
810
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
811
|
+
*/
|
|
812
|
+
Type: 'CaseItem';
|
|
813
|
+
/**
|
|
814
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array.
|
|
815
|
+
*/
|
|
816
|
+
Comments: Comment_2[] | null;
|
|
817
|
+
/**
|
|
818
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array.
|
|
819
|
+
*/
|
|
820
|
+
Last: Comment_2[] | null;
|
|
821
|
+
/**
|
|
822
|
+
* Upstream operator value, preserving named tokens, zero, and explicitly represented raw uint32 values.
|
|
823
|
+
*/
|
|
824
|
+
Op: CaseOperator;
|
|
825
|
+
/**
|
|
826
|
+
* unset if it was finished by "esac"
|
|
827
|
+
*
|
|
828
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
829
|
+
*/
|
|
830
|
+
OpPos: SyntaxPos;
|
|
831
|
+
/**
|
|
832
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
833
|
+
*/
|
|
834
|
+
Patterns: (Word | null)[] | null;
|
|
835
|
+
/**
|
|
836
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
837
|
+
*/
|
|
838
|
+
Stmts: (Stmt | null)[] | null;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* The upstream CaseOperator domain: exact named tokens, the Go zero value, and explicitly validated unnamed uint32 values. Constants shared by upstream families retain their shared numeric identity.
|
|
843
|
+
*
|
|
844
|
+
* @public
|
|
845
|
+
*/
|
|
846
|
+
export declare type CaseOperator =
|
|
847
|
+
| 0
|
|
848
|
+
| typeof Break
|
|
849
|
+
| typeof Fallthrough
|
|
850
|
+
| typeof Resume
|
|
851
|
+
| typeof ResumeKorn
|
|
852
|
+
| RawOperator<'CaseOperator'>;
|
|
853
|
+
|
|
854
|
+
/**
|
|
855
|
+
* Upstream ProcOperator constant CmdIn. Its numeric value is preserved exactly.
|
|
856
|
+
*
|
|
857
|
+
* \<(
|
|
858
|
+
*
|
|
859
|
+
* @public
|
|
860
|
+
*/
|
|
861
|
+
declare const CmdIn: 78;
|
|
862
|
+
|
|
863
|
+
/**
|
|
864
|
+
* Upstream ProcOperator constant CmdInTemp. Its numeric value is preserved exactly.
|
|
865
|
+
*
|
|
866
|
+
* =(
|
|
867
|
+
*
|
|
868
|
+
* @public
|
|
869
|
+
*/
|
|
870
|
+
declare const CmdInTemp: 79;
|
|
871
|
+
|
|
872
|
+
/**
|
|
873
|
+
* Upstream ProcOperator constant CmdOut. Its numeric value is preserved exactly.
|
|
874
|
+
*
|
|
875
|
+
* \>(
|
|
876
|
+
*
|
|
877
|
+
* @public
|
|
878
|
+
*/
|
|
879
|
+
declare const CmdOut: 80;
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* CmdSubst represents a command substitution.
|
|
883
|
+
*
|
|
884
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
885
|
+
*
|
|
886
|
+
* @public
|
|
887
|
+
*/
|
|
888
|
+
export declare interface CmdSubst {
|
|
889
|
+
/**
|
|
890
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
891
|
+
*/
|
|
892
|
+
Type: 'CmdSubst';
|
|
893
|
+
/**
|
|
894
|
+
* deprecated `foo`
|
|
895
|
+
*
|
|
896
|
+
* False is an explicit upstream value and is never omitted.
|
|
897
|
+
*/
|
|
898
|
+
Backquotes: boolean;
|
|
899
|
+
/**
|
|
900
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array.
|
|
901
|
+
*/
|
|
902
|
+
Last: Comment_2[] | null;
|
|
903
|
+
/**
|
|
904
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
905
|
+
*/
|
|
906
|
+
Left: SyntaxPos;
|
|
907
|
+
/**
|
|
908
|
+
* mksh's $\{|foo;\}
|
|
909
|
+
*
|
|
910
|
+
* False is an explicit upstream value and is never omitted.
|
|
911
|
+
*/
|
|
912
|
+
ReplyVar: boolean;
|
|
913
|
+
/**
|
|
914
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
915
|
+
*/
|
|
916
|
+
Right: SyntaxPos;
|
|
917
|
+
/**
|
|
918
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
919
|
+
*/
|
|
920
|
+
Stmts: (Stmt | null)[] | null;
|
|
921
|
+
/**
|
|
922
|
+
* mksh's $\{ foo;\}
|
|
923
|
+
*
|
|
924
|
+
* False is an explicit upstream value and is never omitted.
|
|
925
|
+
*/
|
|
926
|
+
TempFile: boolean;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
/**
|
|
930
|
+
* Upstream BinAritOperator constant Comma. Its numeric value is preserved exactly.
|
|
931
|
+
*
|
|
932
|
+
* ,
|
|
933
|
+
*
|
|
934
|
+
* @public
|
|
935
|
+
*/
|
|
936
|
+
declare const Comma: 98;
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* The concrete records and typed nil pointers accepted by upstream syntax.Command. Typed nil kinds are limited to this interface's actual implementers; auxiliary records are excluded.
|
|
940
|
+
*
|
|
941
|
+
* @public
|
|
942
|
+
*/
|
|
943
|
+
export declare type Command =
|
|
944
|
+
| ArithmCmd
|
|
945
|
+
| BinaryCmd
|
|
946
|
+
| Block
|
|
947
|
+
| CallExpr
|
|
948
|
+
| CaseClause
|
|
949
|
+
| CoprocClause
|
|
950
|
+
| DeclClause
|
|
951
|
+
| ForClause
|
|
952
|
+
| FuncDecl
|
|
953
|
+
| IfClause
|
|
954
|
+
| LetClause
|
|
955
|
+
| Subshell
|
|
956
|
+
| TestClause
|
|
957
|
+
| TestDecl
|
|
958
|
+
| TimeClause
|
|
959
|
+
| WhileClause
|
|
960
|
+
| TypedNil<
|
|
961
|
+
| 'ArithmCmd'
|
|
962
|
+
| 'BinaryCmd'
|
|
963
|
+
| 'Block'
|
|
964
|
+
| 'CallExpr'
|
|
965
|
+
| 'CaseClause'
|
|
966
|
+
| 'CoprocClause'
|
|
967
|
+
| 'DeclClause'
|
|
968
|
+
| 'ForClause'
|
|
969
|
+
| 'FuncDecl'
|
|
970
|
+
| 'IfClause'
|
|
971
|
+
| 'LetClause'
|
|
972
|
+
| 'Subshell'
|
|
973
|
+
| 'TestClause'
|
|
974
|
+
| 'TestDecl'
|
|
975
|
+
| 'TimeClause'
|
|
976
|
+
| 'WhileClause'
|
|
977
|
+
>;
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
* A single frame of the path from the root of the tree down to a
|
|
981
|
+
* {@link CommandSite}, describing *how* the command is reached — never
|
|
982
|
+
* whether it is safe to run. `CommandSite.context` is an ordered stack of
|
|
983
|
+
* these, outermost frame first:
|
|
984
|
+
*
|
|
985
|
+
* - `'and'`/`'or'` (`side: 'right'`) — the right-hand operand of a
|
|
986
|
+
* `BinaryCmd` (mvdan/sh's node for both `&&` and `||`); only the right
|
|
987
|
+
* side is tagged; the left side inherits the surrounding context
|
|
988
|
+
* unchanged, since it runs unconditionally relative to this operator.
|
|
989
|
+
* - `'pipeline'` (`stage: n`) — one stage of a `|`/`|&` chain (also a
|
|
990
|
+
* `BinaryCmd`, left-associatively nested by mvdan/sh); every stage is
|
|
991
|
+
* tagged, 0-indexed left to right, regardless of whether the chain mixes
|
|
992
|
+
* `|` and `|&`.
|
|
993
|
+
* - `'subshell'` — inside a `Subshell` (`( ... )`).
|
|
994
|
+
* - `'cmdSubst'`/`'procSubst'` — inside a `CmdSubst` (`$(...)`/backticks) or
|
|
995
|
+
* `ProcSubst` (`<(...)`/`>(...)`) reached from *any* word-bearing
|
|
996
|
+
* position (an argument, a redirection target, a case subject, a loop's
|
|
997
|
+
* word list, an assignment value, a test/arithmetic operand, …) — not
|
|
998
|
+
* only from `CallExpr.Args`.
|
|
999
|
+
* - `'if'` (`branch: 'cond' | 'then' | 'else'`) — inside an `IfClause`'s
|
|
1000
|
+
* condition, then-branch, or else-branch (mvdan/sh nests `elif` chains as
|
|
1001
|
+
* `IfClause.Else` pointing to another `IfClause`, so an `elif`'s own
|
|
1002
|
+
* condition/then are reached through an `{kind:'if',branch:'else'}` frame
|
|
1003
|
+
* first, then their own `'cond'`/`'then'` frame — reflecting the real
|
|
1004
|
+
* nesting rather than collapsing it).
|
|
1005
|
+
* - `'case'` — inside one `CaseClause` branch's statement list (not the
|
|
1006
|
+
* case subject word or the patterns).
|
|
1007
|
+
* - `'loop'` (`role` is `'body'` or `'cond'`) — inside a `ForClause`'s
|
|
1008
|
+
* statement list (`role: 'body'` only — a `for` loop has no
|
|
1009
|
+
* statement-list condition) or a `WhileClause`'s (`role: 'cond'` for the
|
|
1010
|
+
* condition, `role: 'body'` for the loop body).
|
|
1011
|
+
* - `'function'` (`name`) — inside a `FuncDecl`'s body; `name` is the
|
|
1012
|
+
* function's literal name text.
|
|
1013
|
+
* - `'background'`/`'negated'` — the enclosing `Stmt` has mvdan/sh's
|
|
1014
|
+
* Background/Negated flag set (`cmd &`, `! cmd`).
|
|
1015
|
+
* - `'coproc'` — inside a `CoprocClause`'s statement (a `coproc` block,
|
|
1016
|
+
* optionally named).
|
|
1017
|
+
*
|
|
1018
|
+
* A `Block` grouping (`{ ...; }`) and a `TimeClause` (`time cmd`) are
|
|
1019
|
+
* deliberately transparent — grouping and timing a command doesn't change
|
|
1020
|
+
* how it's reached, so no frame is added for either.
|
|
1021
|
+
*
|
|
1022
|
+
* This union may grow in a **minor** release — a future mvdan/sh grammar
|
|
1023
|
+
* construct this module starts modeling can add a new `kind` variant
|
|
1024
|
+
* without that being a breaking change (mirroring
|
|
1025
|
+
* {@link WordResolutionReason}'s semver policy in `resolve-word.ts`). It is
|
|
1026
|
+
* deliberately not sealed against extension elsewhere in the codebase.
|
|
1027
|
+
* Every existing variant's shape (its extra fields, if any) is stable —
|
|
1028
|
+
* only new variants are ever added — so an exhaustive compile-time
|
|
1029
|
+
* `switch` over `.kind` should still include a `default` case to stay
|
|
1030
|
+
* forward-compatible.
|
|
1031
|
+
*
|
|
1032
|
+
* @public
|
|
1033
|
+
*/
|
|
1034
|
+
export declare type CommandContext = {
|
|
1035
|
+
readonly kind: 'and';
|
|
1036
|
+
readonly side: 'right';
|
|
1037
|
+
} | {
|
|
1038
|
+
readonly kind: 'or';
|
|
1039
|
+
readonly side: 'right';
|
|
1040
|
+
} | {
|
|
1041
|
+
readonly kind: 'pipeline';
|
|
1042
|
+
readonly stage: number;
|
|
1043
|
+
} | {
|
|
1044
|
+
readonly kind: 'subshell';
|
|
1045
|
+
} | {
|
|
1046
|
+
readonly kind: 'cmdSubst';
|
|
1047
|
+
} | {
|
|
1048
|
+
readonly kind: 'procSubst';
|
|
1049
|
+
} | {
|
|
1050
|
+
readonly kind: 'if';
|
|
1051
|
+
readonly branch: 'then' | 'else' | 'cond';
|
|
1052
|
+
} | {
|
|
1053
|
+
readonly kind: 'case';
|
|
1054
|
+
} | {
|
|
1055
|
+
readonly kind: 'loop';
|
|
1056
|
+
readonly role: 'body' | 'cond';
|
|
1057
|
+
} | {
|
|
1058
|
+
readonly kind: 'function';
|
|
1059
|
+
readonly name: GoString;
|
|
1060
|
+
} | {
|
|
1061
|
+
readonly kind: 'background';
|
|
1062
|
+
} | {
|
|
1063
|
+
readonly kind: 'negated';
|
|
1064
|
+
} | {
|
|
1065
|
+
readonly kind: 'coproc';
|
|
1066
|
+
};
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* One place in the tree where a command is actually invoked — a `CallExpr`
|
|
1070
|
+
* node, together with its resolved words and the path used to reach it.
|
|
1071
|
+
* Facts only, matching {@link resolveWord}'s posture: no safety verdict, no
|
|
1072
|
+
* hardcoded command/wrapper list. A dynamic (`static: false`) `argv0` is a
|
|
1073
|
+
* normal, expected result — not an error and not itself reported as
|
|
1074
|
+
* "unknown"/"unsafe".
|
|
1075
|
+
*
|
|
1076
|
+
* @public
|
|
1077
|
+
*/
|
|
1078
|
+
export declare interface CommandSite {
|
|
1079
|
+
/** The `CallExpr` node this site was found at. */
|
|
1080
|
+
readonly node: CallExpr;
|
|
1081
|
+
/**
|
|
1082
|
+
* `resolveWord` applied to the first word (`argv[0]`), with
|
|
1083
|
+
* `{ context: 'command-argument' }` — every `CallExpr` word is an
|
|
1084
|
+
* ordinary command-argument position, never an assignment value, so
|
|
1085
|
+
* only a word-initial unquoted `~` triggers tilde expansion (an
|
|
1086
|
+
* unquoted `~` after a `:`, e.g. `a:~/b`, is literal text here — see
|
|
1087
|
+
* `ResolveWordOptions.context`'s doc comment).
|
|
1088
|
+
*/
|
|
1089
|
+
readonly argv0: WordResolution;
|
|
1090
|
+
/** `resolveWord` applied to every word, in argument order (same `{ context: 'command-argument' }` as {@link CommandSite.argv0}). */
|
|
1091
|
+
readonly argv: readonly WordResolution[];
|
|
1092
|
+
/** The path from the tree root to this site, outermost frame first. */
|
|
1093
|
+
readonly context: readonly CommandContext[];
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
/**
|
|
1097
|
+
* Comment represents a single comment on a single line.
|
|
1098
|
+
*
|
|
1099
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
1100
|
+
*
|
|
1101
|
+
* @public
|
|
1102
|
+
*/
|
|
1103
|
+
declare interface Comment_2 {
|
|
1104
|
+
/**
|
|
1105
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
1106
|
+
*/
|
|
1107
|
+
Type: 'Comment';
|
|
1108
|
+
/**
|
|
1109
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
1110
|
+
*/
|
|
1111
|
+
Hash: SyntaxPos;
|
|
1112
|
+
/**
|
|
1113
|
+
* Upstream string bytes; non-UTF-8 values remain bytes rather than replacement text.
|
|
1114
|
+
*/
|
|
1115
|
+
Text: GoString;
|
|
1116
|
+
}
|
|
1117
|
+
export { Comment_2 as Comment }
|
|
1118
|
+
|
|
1119
|
+
/**
|
|
1120
|
+
* CoprocClause represents a Bash coproc clause.
|
|
1121
|
+
*
|
|
1122
|
+
* This node will only appear with `LangBash`.
|
|
1123
|
+
*
|
|
1124
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
1125
|
+
*
|
|
1126
|
+
* @public
|
|
1127
|
+
*/
|
|
1128
|
+
export declare interface CoprocClause {
|
|
1129
|
+
/**
|
|
1130
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
1131
|
+
*/
|
|
1132
|
+
Type: 'CoprocClause';
|
|
1133
|
+
/**
|
|
1134
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
1135
|
+
*/
|
|
1136
|
+
Coproc: SyntaxPos;
|
|
1137
|
+
/**
|
|
1138
|
+
* Null preserves the upstream absence of this component.
|
|
1139
|
+
*/
|
|
1140
|
+
Name: Word | null;
|
|
1141
|
+
/**
|
|
1142
|
+
* Null preserves the upstream absence of this component.
|
|
1143
|
+
*/
|
|
1144
|
+
Stmt: Stmt | null;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
/**
|
|
1148
|
+
* CStyleLoop represents the behavior of a for clause similar to the C
|
|
1149
|
+
* language.
|
|
1150
|
+
*
|
|
1151
|
+
* This node will only appear with `LangBash`.
|
|
1152
|
+
*
|
|
1153
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
1154
|
+
*
|
|
1155
|
+
* @public
|
|
1156
|
+
*/
|
|
1157
|
+
export declare interface CStyleLoop {
|
|
1158
|
+
/**
|
|
1159
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
1160
|
+
*/
|
|
1161
|
+
Type: 'CStyleLoop';
|
|
1162
|
+
/**
|
|
1163
|
+
* Init, Cond, Post can each be nil, if the for loop construct omits it.
|
|
1164
|
+
*
|
|
1165
|
+
* Null preserves the upstream absence of this component.
|
|
1166
|
+
*/
|
|
1167
|
+
Cond: ArithmExpr | null;
|
|
1168
|
+
/**
|
|
1169
|
+
* Init, Cond, Post can each be nil, if the for loop construct omits it.
|
|
1170
|
+
*
|
|
1171
|
+
* Null preserves the upstream absence of this component.
|
|
1172
|
+
*/
|
|
1173
|
+
Init: ArithmExpr | null;
|
|
1174
|
+
/**
|
|
1175
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
1176
|
+
*/
|
|
1177
|
+
Lparen: SyntaxPos;
|
|
1178
|
+
/**
|
|
1179
|
+
* Init, Cond, Post can each be nil, if the for loop construct omits it.
|
|
1180
|
+
*
|
|
1181
|
+
* Null preserves the upstream absence of this component.
|
|
1182
|
+
*/
|
|
1183
|
+
Post: ArithmExpr | null;
|
|
1184
|
+
/**
|
|
1185
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
1186
|
+
*/
|
|
1187
|
+
Rparen: SyntaxPos;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
/**
|
|
1191
|
+
* Upstream RedirOperator constant DashHdoc. Its numeric value is preserved exactly.
|
|
1192
|
+
*
|
|
1193
|
+
* \<\<-
|
|
1194
|
+
*
|
|
1195
|
+
* @public
|
|
1196
|
+
*/
|
|
1197
|
+
declare const DashHdoc: 72;
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* DblQuoted represents a list of nodes within double quotes.
|
|
1201
|
+
*
|
|
1202
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
1203
|
+
*
|
|
1204
|
+
* @public
|
|
1205
|
+
*/
|
|
1206
|
+
export declare interface DblQuoted {
|
|
1207
|
+
/**
|
|
1208
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
1209
|
+
*/
|
|
1210
|
+
Type: 'DblQuoted';
|
|
1211
|
+
/**
|
|
1212
|
+
* $""
|
|
1213
|
+
*
|
|
1214
|
+
* False is an explicit upstream value and is never omitted.
|
|
1215
|
+
*/
|
|
1216
|
+
Dollar: boolean;
|
|
1217
|
+
/**
|
|
1218
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
1219
|
+
*/
|
|
1220
|
+
Left: SyntaxPos;
|
|
1221
|
+
/**
|
|
1222
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
1223
|
+
*/
|
|
1224
|
+
Parts: (WordPart | null)[] | null;
|
|
1225
|
+
/**
|
|
1226
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
1227
|
+
*/
|
|
1228
|
+
Right: SyntaxPos;
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
/**
|
|
1232
|
+
* Upstream UnAritOperator constant Dec. Its numeric value is preserved exactly.
|
|
1233
|
+
*
|
|
1234
|
+
* --
|
|
1235
|
+
*
|
|
1236
|
+
* @public
|
|
1237
|
+
*/
|
|
1238
|
+
declare const Dec: 42;
|
|
1239
|
+
|
|
1240
|
+
/**
|
|
1241
|
+
* DeclClause represents a Bash declare clause.
|
|
1242
|
+
*
|
|
1243
|
+
* Args can contain a mix of regular and naked assignments. The naked
|
|
1244
|
+
* assignments can represent either options or variable names.
|
|
1245
|
+
*
|
|
1246
|
+
* This node will only appear with `LangBash`.
|
|
1247
|
+
*
|
|
1248
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
1249
|
+
*
|
|
1250
|
+
* @public
|
|
1251
|
+
*/
|
|
1252
|
+
export declare interface DeclClause {
|
|
1253
|
+
/**
|
|
1254
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
1255
|
+
*/
|
|
1256
|
+
Type: 'DeclClause';
|
|
1257
|
+
/**
|
|
1258
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
1259
|
+
*/
|
|
1260
|
+
Args: (Assign | null)[] | null;
|
|
1261
|
+
/**
|
|
1262
|
+
* Variant is one of "declare", "local", "export", "readonly",
|
|
1263
|
+
* "typeset", or "nameref".
|
|
1264
|
+
*
|
|
1265
|
+
* Null preserves the upstream absence of this component.
|
|
1266
|
+
*/
|
|
1267
|
+
Variant: Lit | null;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
/**
|
|
1271
|
+
* `sh-ast/analyze`'s default {@link WrapperSpec} table — every entry's
|
|
1272
|
+
* flag/operand handling is hand-derived from that wrapper's own manual
|
|
1273
|
+
* page (or, for shell builtins, the Bash Reference Manual/POSIX Shell &
|
|
1274
|
+
* Utilities volume), cited per entry below, and cross-checked empirically
|
|
1275
|
+
* against the real utility where one was locally available (GNU coreutils
|
|
1276
|
+
* `env`/`nice` directly; `sudo` via `sudo -h`'s usage/option summary only
|
|
1277
|
+
* — never executed, per this package's "facts only" posture and basic
|
|
1278
|
+
* safety hygiene). This table is *data*, not policy: it names no
|
|
1279
|
+
* "dangerous" commands, makes no safety judgment, and a caller can freely
|
|
1280
|
+
* replace or extend it via {@link ResolveArgv0Options.transparentWrappers}
|
|
1281
|
+
* (see {@link resolveArgv0}'s criterion-4-style configurability guarantee).
|
|
1282
|
+
*
|
|
1283
|
+
* Frozen (including each entry object and its own array/regexp fields) so
|
|
1284
|
+
* immutability of this shared, module-scoped table is a contract, not just
|
|
1285
|
+
* a convention any importer happens to honor. Per-call wrapper options are
|
|
1286
|
+
* separate values and cannot mutate these shared defaults.
|
|
1287
|
+
*
|
|
1288
|
+
* `xargs` is deliberately **excluded**: unlike every entry here, `xargs`
|
|
1289
|
+
* doesn't simply re-exec a single wrapped command word it can point to
|
|
1290
|
+
* statically — it invokes `command [initial-arguments]` once per *batch*
|
|
1291
|
+
* of additional arguments assembled from its own stdin at run time
|
|
1292
|
+
* (batched per `-n`/`-L`/line-splitting rules, GNU xargs(1)). Treating it
|
|
1293
|
+
* as transparent would misrepresent what's actually invoked: the "wrapped
|
|
1294
|
+
* command" is only ever a syntactic *prefix* of the real, stdin-dependent
|
|
1295
|
+
* argv, and that prefix can itself be entirely absent (bare `xargs` reruns
|
|
1296
|
+
* each stdin-derived line as its own command). No `WrapperSpec` shape here
|
|
1297
|
+
* can honestly express that, so `xargs` is left for a caller to model
|
|
1298
|
+
* explicitly if their use case calls for it, rather than shipped as a
|
|
1299
|
+
* silently-wrong default.
|
|
1300
|
+
*
|
|
1301
|
+
* @see https://www.gnu.org/software/bash/manual/bash.html#Bourne-Shell-Builtins — `command`, `exec` (Bash Reference Manual §4.1)
|
|
1302
|
+
* @see https://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html — POSIX `command`
|
|
1303
|
+
* @see https://www.gnu.org/software/coreutils/manual/html_node/env-invocation.html — GNU coreutils `env`
|
|
1304
|
+
* @see https://pubs.opengroup.org/onlinepubs/9699919799/utilities/env.html — POSIX `env`
|
|
1305
|
+
* @see https://pubs.opengroup.org/onlinepubs/9699919799/utilities/nohup.html — POSIX `nohup`
|
|
1306
|
+
* @see https://www.gnu.org/software/coreutils/manual/html_node/nice-invocation.html — GNU coreutils `nice`
|
|
1307
|
+
* @see https://pubs.opengroup.org/onlinepubs/9699919799/utilities/nice.html — POSIX `nice`
|
|
1308
|
+
* @see https://pubs.opengroup.org/onlinepubs/9699919799/utilities/time.html — POSIX `time` utility (distinct from the bash `time` *reserved word*, which mvdan/sh models as a transparent `TimeClause` — see {@link WrapperSpec}'s `time` entry below)
|
|
1309
|
+
* @see https://www.gnu.org/software/coreutils/manual/html_node/timeout-invocation.html — GNU coreutils `timeout`
|
|
1310
|
+
* @see https://www.sudo.ws/docs/man/sudo.man/ — `sudo(8)`
|
|
1311
|
+
* @see https://www.gnu.org/software/findutils/manual/html_node/find_html/xargs-options.html — GNU `xargs` (why it's excluded, above)
|
|
1312
|
+
* @public
|
|
1313
|
+
*/
|
|
1314
|
+
export declare const DEFAULT_TRANSPARENT_WRAPPERS: readonly WrapperSpec[];
|
|
1315
|
+
|
|
1316
|
+
/**
|
|
1317
|
+
* Upstream ParExpOperator constant DefaultUnset. Its numeric value is preserved exactly.
|
|
1318
|
+
*
|
|
1319
|
+
* -
|
|
1320
|
+
*
|
|
1321
|
+
* @public
|
|
1322
|
+
*/
|
|
1323
|
+
declare const DefaultUnset: 83;
|
|
1324
|
+
|
|
1325
|
+
/**
|
|
1326
|
+
* Upstream ParExpOperator constant DefaultUnsetOrNull. Its numeric value is preserved exactly.
|
|
1327
|
+
*
|
|
1328
|
+
* :-
|
|
1329
|
+
*
|
|
1330
|
+
* @public
|
|
1331
|
+
*/
|
|
1332
|
+
declare const DefaultUnsetOrNull: 84;
|
|
1333
|
+
|
|
1334
|
+
/**
|
|
1335
|
+
* Upstream RedirOperator constant DplIn. Its numeric value is preserved exactly.
|
|
1336
|
+
*
|
|
1337
|
+
* \<&
|
|
1338
|
+
*
|
|
1339
|
+
* @public
|
|
1340
|
+
*/
|
|
1341
|
+
declare const DplIn: 67;
|
|
1342
|
+
|
|
1343
|
+
/**
|
|
1344
|
+
* Upstream RedirOperator constant DplOut. Its numeric value is preserved exactly.
|
|
1345
|
+
*
|
|
1346
|
+
* \>&
|
|
1347
|
+
*
|
|
1348
|
+
* @public
|
|
1349
|
+
*/
|
|
1350
|
+
declare const DplOut: 68;
|
|
1351
|
+
|
|
1352
|
+
/**
|
|
1353
|
+
* Enumerates every command invocation (`CallExpr`) reachable from `root`,
|
|
1354
|
+
* with its resolved words ({@link resolveWord}) and the path used to reach
|
|
1355
|
+
* it ({@link CommandContext}). Descends everywhere a command can occur:
|
|
1356
|
+
* statement lists, both sides of `&&`/`||`/pipelines, subshells/blocks,
|
|
1357
|
+
* if/case branches *and* conditions, loop bodies *and* conditions, function
|
|
1358
|
+
* bodies, background/negated/coproc statements, and — critically —
|
|
1359
|
+
* `CmdSubst`/`ProcSubst` nested inside words, wherever those words occur
|
|
1360
|
+
* (arguments, redirection targets, case subjects/patterns, loop word
|
|
1361
|
+
* lists, assignment values, test/arithmetic operands, …), not only inside
|
|
1362
|
+
* `CallExpr.Args`.
|
|
1363
|
+
*
|
|
1364
|
+
* An assignment-only `CallExpr` (`FOO=bar`, `args` empty) has no first word
|
|
1365
|
+
* to resolve and is not itself a command invocation — no program runs — so
|
|
1366
|
+
* it produces no {@link CommandSite}; any command substitution nested in
|
|
1367
|
+
* its assigned value (`FOO=$(sub)`) is still found and reported.
|
|
1368
|
+
*
|
|
1369
|
+
* Results are sorted by source position (`nodePos(node).Offset`), so nested
|
|
1370
|
+
* command substitutions and out-of-structural-order redirection targets
|
|
1371
|
+
* still come back in source order regardless of traversal order.
|
|
1372
|
+
*
|
|
1373
|
+
* Facts only, matching {@link resolveWord}'s posture: no safety verdict, no
|
|
1374
|
+
* command/wrapper allowlist or denylist, no dataflow. A statically unknown
|
|
1375
|
+
* `argv0` (`static: false`) is a normal, expected result.
|
|
1376
|
+
*
|
|
1377
|
+
* A long *linear* chain — `|`/`|&`/`&&`/`||` of any realistic length — is
|
|
1378
|
+
* traversed iteratively and never risks a stack overflow or trips the
|
|
1379
|
+
* nesting-depth guard below, regardless of how many stages/links it has.
|
|
1380
|
+
*
|
|
1381
|
+
* @param root - Any `Node` — typically a `File` from `parseSync`, but any
|
|
1382
|
+
* subtree (a `Stmt`, a `Command`, or even a bare `Word`) is handled.
|
|
1383
|
+
* The depth guard also applies to caller-built or mutated trees.
|
|
1384
|
+
* @throws {@link ShAnalyzeMaxDepthError} if `root`'s genuinely nested
|
|
1385
|
+
* structure (subshells within subshells, chained command/process
|
|
1386
|
+
* substitutions, deeply nested `if`/`case`/loop/function/`time`/`{ }`
|
|
1387
|
+
* bodies, chained `elif`) exceeds this module's defensive recursion-depth
|
|
1388
|
+
* guard — see that error's doc comment for why this fails closed instead
|
|
1389
|
+
* of returning a partial result, and why a gate-style consumer should treat
|
|
1390
|
+
* it as `deny`.
|
|
1391
|
+
* @public
|
|
1392
|
+
*/
|
|
1393
|
+
export declare function enumerateCommands(root: Node_2): CommandSite[];
|
|
1394
|
+
|
|
1395
|
+
/**
|
|
1396
|
+
* Upstream BinAritOperator constant Eql. Its numeric value is preserved exactly.
|
|
1397
|
+
*
|
|
1398
|
+
* ==
|
|
1399
|
+
*
|
|
1400
|
+
* @public
|
|
1401
|
+
*/
|
|
1402
|
+
declare const Eql: 45;
|
|
1403
|
+
|
|
1404
|
+
/**
|
|
1405
|
+
* Upstream ParExpOperator constant ErrorUnset. Its numeric value is preserved exactly.
|
|
1406
|
+
*
|
|
1407
|
+
* ?
|
|
1408
|
+
*
|
|
1409
|
+
* @public
|
|
1410
|
+
*/
|
|
1411
|
+
declare const ErrorUnset: 85;
|
|
1412
|
+
|
|
1413
|
+
/**
|
|
1414
|
+
* Upstream ParExpOperator constant ErrorUnsetOrNull. Its numeric value is preserved exactly.
|
|
1415
|
+
*
|
|
1416
|
+
* :?
|
|
1417
|
+
*
|
|
1418
|
+
* @public
|
|
1419
|
+
*/
|
|
1420
|
+
declare const ErrorUnsetOrNull: 86;
|
|
1421
|
+
|
|
1422
|
+
/**
|
|
1423
|
+
* Expansion represents string manipulation in a `ParamExp` other than those
|
|
1424
|
+
* covered by `Replace`.
|
|
1425
|
+
*
|
|
1426
|
+
* Auxiliary syntax data, not a syntax.Node; it has no independent source bounds.
|
|
1427
|
+
*
|
|
1428
|
+
* @public
|
|
1429
|
+
*/
|
|
1430
|
+
export declare interface Expansion {
|
|
1431
|
+
/**
|
|
1432
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
1433
|
+
*/
|
|
1434
|
+
Type: 'Expansion';
|
|
1435
|
+
/**
|
|
1436
|
+
* Upstream operator value, preserving named tokens, zero, and explicitly represented raw uint32 values.
|
|
1437
|
+
*/
|
|
1438
|
+
Op: ParExpOperator;
|
|
1439
|
+
/**
|
|
1440
|
+
* Null preserves the upstream absence of this component.
|
|
1441
|
+
*/
|
|
1442
|
+
Word: Word | null;
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
/**
|
|
1446
|
+
* ExtGlob represents a Bash extended globbing expression. Note that these are
|
|
1447
|
+
* parsed independently of whether or not `shopt -s extglob` has been used,
|
|
1448
|
+
* as the parser runs statically and independently of any interpreter.
|
|
1449
|
+
*
|
|
1450
|
+
* This node will only appear with `LangBash` and `LangMirBSDKorn`.
|
|
1451
|
+
*
|
|
1452
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
1453
|
+
*
|
|
1454
|
+
* @public
|
|
1455
|
+
*/
|
|
1456
|
+
export declare interface ExtGlob {
|
|
1457
|
+
/**
|
|
1458
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
1459
|
+
*/
|
|
1460
|
+
Type: 'ExtGlob';
|
|
1461
|
+
/**
|
|
1462
|
+
* Upstream operator value, preserving named tokens, zero, and explicitly represented raw uint32 values.
|
|
1463
|
+
*/
|
|
1464
|
+
Op: GlobOperator;
|
|
1465
|
+
/**
|
|
1466
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
1467
|
+
*/
|
|
1468
|
+
OpPos: SyntaxPos;
|
|
1469
|
+
/**
|
|
1470
|
+
* Null preserves the upstream absence of this component.
|
|
1471
|
+
*/
|
|
1472
|
+
Pattern: Lit | null;
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
/**
|
|
1476
|
+
* Upstream CaseOperator constant Fallthrough. Its numeric value is preserved exactly.
|
|
1477
|
+
*
|
|
1478
|
+
* ;&
|
|
1479
|
+
*
|
|
1480
|
+
* @public
|
|
1481
|
+
*/
|
|
1482
|
+
declare const Fallthrough: 36;
|
|
1483
|
+
|
|
1484
|
+
/**
|
|
1485
|
+
* File represents a shell source file.
|
|
1486
|
+
*
|
|
1487
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
1488
|
+
*
|
|
1489
|
+
* @public
|
|
1490
|
+
*/
|
|
1491
|
+
declare interface File_2 {
|
|
1492
|
+
/**
|
|
1493
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
1494
|
+
*/
|
|
1495
|
+
Type: 'File';
|
|
1496
|
+
/**
|
|
1497
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array.
|
|
1498
|
+
*/
|
|
1499
|
+
Last: Comment_2[] | null;
|
|
1500
|
+
/**
|
|
1501
|
+
* Upstream string bytes; non-UTF-8 values remain bytes rather than replacement text.
|
|
1502
|
+
*/
|
|
1503
|
+
Name: GoString;
|
|
1504
|
+
/**
|
|
1505
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
1506
|
+
*/
|
|
1507
|
+
Stmts: (Stmt | null)[] | null;
|
|
1508
|
+
}
|
|
1509
|
+
export { File_2 as File }
|
|
1510
|
+
|
|
1511
|
+
/**
|
|
1512
|
+
* FlagsArithm represents zsh subscript flags attached to an arithmetic expression,
|
|
1513
|
+
* such as $\{array[(flags)expr]\}.
|
|
1514
|
+
*
|
|
1515
|
+
* This node will only appear with `LangZsh`.
|
|
1516
|
+
*
|
|
1517
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
1518
|
+
*
|
|
1519
|
+
* @public
|
|
1520
|
+
*/
|
|
1521
|
+
export declare interface FlagsArithm {
|
|
1522
|
+
/**
|
|
1523
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
1524
|
+
*/
|
|
1525
|
+
Type: 'FlagsArithm';
|
|
1526
|
+
/**
|
|
1527
|
+
* Null preserves the upstream absence of this component.
|
|
1528
|
+
*/
|
|
1529
|
+
Flags: Lit | null;
|
|
1530
|
+
/**
|
|
1531
|
+
* Null preserves the upstream absence of this component.
|
|
1532
|
+
*/
|
|
1533
|
+
X: ArithmExpr | null;
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
/**
|
|
1537
|
+
* ForClause represents a for or a select clause. The latter is only present in
|
|
1538
|
+
* Bash.
|
|
1539
|
+
*
|
|
1540
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
1541
|
+
*
|
|
1542
|
+
* @public
|
|
1543
|
+
*/
|
|
1544
|
+
export declare interface ForClause {
|
|
1545
|
+
/**
|
|
1546
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
1547
|
+
*/
|
|
1548
|
+
Type: 'ForClause';
|
|
1549
|
+
/**
|
|
1550
|
+
* deprecated form with \{ \} instead of do/done
|
|
1551
|
+
*
|
|
1552
|
+
* False is an explicit upstream value and is never omitted.
|
|
1553
|
+
*/
|
|
1554
|
+
Braces: boolean;
|
|
1555
|
+
/**
|
|
1556
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
1557
|
+
*/
|
|
1558
|
+
Do: (Stmt | null)[] | null;
|
|
1559
|
+
/**
|
|
1560
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array.
|
|
1561
|
+
*/
|
|
1562
|
+
DoLast: Comment_2[] | null;
|
|
1563
|
+
/**
|
|
1564
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
1565
|
+
*/
|
|
1566
|
+
DoPos: SyntaxPos;
|
|
1567
|
+
/**
|
|
1568
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
1569
|
+
*/
|
|
1570
|
+
DonePos: SyntaxPos;
|
|
1571
|
+
/**
|
|
1572
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
1573
|
+
*/
|
|
1574
|
+
ForPos: SyntaxPos;
|
|
1575
|
+
/**
|
|
1576
|
+
* Null preserves the upstream absence of this component.
|
|
1577
|
+
*/
|
|
1578
|
+
Loop: Loop | null;
|
|
1579
|
+
/**
|
|
1580
|
+
* False is an explicit upstream value and is never omitted.
|
|
1581
|
+
*/
|
|
1582
|
+
Select: boolean;
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
/**
|
|
1586
|
+
* FuncDecl represents the declaration of a function.
|
|
1587
|
+
*
|
|
1588
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
1589
|
+
*
|
|
1590
|
+
* @public
|
|
1591
|
+
*/
|
|
1592
|
+
export declare interface FuncDecl {
|
|
1593
|
+
/**
|
|
1594
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
1595
|
+
*/
|
|
1596
|
+
Type: 'FuncDecl';
|
|
1597
|
+
/**
|
|
1598
|
+
* Null preserves the upstream absence of this component.
|
|
1599
|
+
*/
|
|
1600
|
+
Body: Stmt | null;
|
|
1601
|
+
/**
|
|
1602
|
+
* Only one of these is set at a time.
|
|
1603
|
+
* Neither is set when declaring an anonymous func with `LangZsh`.
|
|
1604
|
+
*
|
|
1605
|
+
* Null preserves the upstream absence of this component.
|
|
1606
|
+
*/
|
|
1607
|
+
Name: Lit | null;
|
|
1608
|
+
/**
|
|
1609
|
+
* When declaring many func names with `LangZsh`.
|
|
1610
|
+
*
|
|
1611
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
1612
|
+
*/
|
|
1613
|
+
Names: (Lit | null)[] | null;
|
|
1614
|
+
/**
|
|
1615
|
+
* with () parentheses, can only be false when RsrvWord==true
|
|
1616
|
+
*
|
|
1617
|
+
* False is an explicit upstream value and is never omitted.
|
|
1618
|
+
*/
|
|
1619
|
+
Parens: boolean;
|
|
1620
|
+
/**
|
|
1621
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
1622
|
+
*/
|
|
1623
|
+
Position: SyntaxPos;
|
|
1624
|
+
/**
|
|
1625
|
+
* non-posix "function f" style
|
|
1626
|
+
*
|
|
1627
|
+
* False is an explicit upstream value and is never omitted.
|
|
1628
|
+
*/
|
|
1629
|
+
RsrvWord: boolean;
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
/**
|
|
1633
|
+
* Upstream BinAritOperator constant Geq. Its numeric value is preserved exactly.
|
|
1634
|
+
*
|
|
1635
|
+
* \>=
|
|
1636
|
+
*
|
|
1637
|
+
* @public
|
|
1638
|
+
*/
|
|
1639
|
+
declare const Geq: 48;
|
|
1640
|
+
|
|
1641
|
+
/**
|
|
1642
|
+
* Upstream GlobOperator constant GlobExcept. Its numeric value is preserved exactly.
|
|
1643
|
+
*
|
|
1644
|
+
* !(
|
|
1645
|
+
*
|
|
1646
|
+
* @public
|
|
1647
|
+
*/
|
|
1648
|
+
declare const GlobExcept: 143;
|
|
1649
|
+
|
|
1650
|
+
/**
|
|
1651
|
+
* Upstream GlobOperator constant GlobOne. Its numeric value is preserved exactly.
|
|
1652
|
+
*
|
|
1653
|
+
* \@(
|
|
1654
|
+
*
|
|
1655
|
+
* @public
|
|
1656
|
+
*/
|
|
1657
|
+
declare const GlobOne: 142;
|
|
1658
|
+
|
|
1659
|
+
/**
|
|
1660
|
+
* Upstream GlobOperator constant GlobOneOrMore. Its numeric value is preserved exactly.
|
|
1661
|
+
*
|
|
1662
|
+
* +(
|
|
1663
|
+
*
|
|
1664
|
+
* @public
|
|
1665
|
+
*/
|
|
1666
|
+
declare const GlobOneOrMore: 141;
|
|
1667
|
+
|
|
1668
|
+
/**
|
|
1669
|
+
* The upstream GlobOperator domain: exact named tokens, the Go zero value, and explicitly validated unnamed uint32 values. Constants shared by upstream families retain their shared numeric identity.
|
|
1670
|
+
*
|
|
1671
|
+
* @public
|
|
1672
|
+
*/
|
|
1673
|
+
export declare type GlobOperator =
|
|
1674
|
+
| 0
|
|
1675
|
+
| typeof GlobExcept
|
|
1676
|
+
| typeof GlobOne
|
|
1677
|
+
| typeof GlobOneOrMore
|
|
1678
|
+
| typeof GlobZeroOrMore
|
|
1679
|
+
| typeof GlobZeroOrOne
|
|
1680
|
+
| RawOperator<'GlobOperator'>;
|
|
1681
|
+
|
|
1682
|
+
/**
|
|
1683
|
+
* Upstream GlobOperator constant GlobZeroOrMore. Its numeric value is preserved exactly.
|
|
1684
|
+
*
|
|
1685
|
+
* *(
|
|
1686
|
+
*
|
|
1687
|
+
* @public
|
|
1688
|
+
*/
|
|
1689
|
+
declare const GlobZeroOrMore: 140;
|
|
1690
|
+
|
|
1691
|
+
/**
|
|
1692
|
+
* Upstream GlobOperator constant GlobZeroOrOne. Its numeric value is preserved exactly.
|
|
1693
|
+
*
|
|
1694
|
+
* ?(
|
|
1695
|
+
*
|
|
1696
|
+
* @public
|
|
1697
|
+
*/
|
|
1698
|
+
declare const GlobZeroOrOne: 139;
|
|
1699
|
+
|
|
1700
|
+
/**
|
|
1701
|
+
* A Go string's exact bytes. Valid UTF-8 is represented as a JavaScript string; other bytes use Uint8Array. String inputs must not contain unpaired surrogates, which have no faithful UTF-8 representation.
|
|
1702
|
+
*
|
|
1703
|
+
* @public
|
|
1704
|
+
*/
|
|
1705
|
+
export declare type GoString = string | Uint8Array;
|
|
1706
|
+
|
|
1707
|
+
/**
|
|
1708
|
+
* Upstream BinAritOperator constant Gtr. Its numeric value is preserved exactly.
|
|
1709
|
+
*
|
|
1710
|
+
* \>
|
|
1711
|
+
*
|
|
1712
|
+
* @public
|
|
1713
|
+
*/
|
|
1714
|
+
declare const Gtr: 63;
|
|
1715
|
+
|
|
1716
|
+
/**
|
|
1717
|
+
* Upstream RedirOperator constant Hdoc. Its numeric value is preserved exactly.
|
|
1718
|
+
*
|
|
1719
|
+
* \<\<
|
|
1720
|
+
*
|
|
1721
|
+
* @public
|
|
1722
|
+
*/
|
|
1723
|
+
declare const Hdoc: 71;
|
|
1724
|
+
|
|
1725
|
+
/**
|
|
1726
|
+
* IfClause represents an if statement.
|
|
1727
|
+
*
|
|
1728
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
1729
|
+
*
|
|
1730
|
+
* @public
|
|
1731
|
+
*/
|
|
1732
|
+
export declare interface IfClause {
|
|
1733
|
+
/**
|
|
1734
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
1735
|
+
*/
|
|
1736
|
+
Type: 'IfClause';
|
|
1737
|
+
/**
|
|
1738
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
1739
|
+
*/
|
|
1740
|
+
Cond: (Stmt | null)[] | null;
|
|
1741
|
+
/**
|
|
1742
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array.
|
|
1743
|
+
*/
|
|
1744
|
+
CondLast: Comment_2[] | null;
|
|
1745
|
+
/**
|
|
1746
|
+
* if non-nil, an "elif" or an "else"
|
|
1747
|
+
*
|
|
1748
|
+
* Null preserves the upstream absence of this component.
|
|
1749
|
+
*/
|
|
1750
|
+
Else: IfClause | null;
|
|
1751
|
+
/**
|
|
1752
|
+
* position of "fi", shared with .Else if non-nil
|
|
1753
|
+
*
|
|
1754
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
1755
|
+
*/
|
|
1756
|
+
FiPos: SyntaxPos;
|
|
1757
|
+
/**
|
|
1758
|
+
* comments on the first "elif", "else", or "fi"
|
|
1759
|
+
*
|
|
1760
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array.
|
|
1761
|
+
*/
|
|
1762
|
+
Last: Comment_2[] | null;
|
|
1763
|
+
/**
|
|
1764
|
+
* position of the starting "if", "elif", or "else" token
|
|
1765
|
+
*
|
|
1766
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
1767
|
+
*/
|
|
1768
|
+
Position: SyntaxPos;
|
|
1769
|
+
/**
|
|
1770
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
1771
|
+
*/
|
|
1772
|
+
Then: (Stmt | null)[] | null;
|
|
1773
|
+
/**
|
|
1774
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array.
|
|
1775
|
+
*/
|
|
1776
|
+
ThenLast: Comment_2[] | null;
|
|
1777
|
+
/**
|
|
1778
|
+
* position of "then", empty if this is an "else"
|
|
1779
|
+
*
|
|
1780
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
1781
|
+
*/
|
|
1782
|
+
ThenPos: SyntaxPos;
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
/**
|
|
1786
|
+
* Upstream UnAritOperator constant Inc. Its numeric value is preserved exactly.
|
|
1787
|
+
*
|
|
1788
|
+
* ++
|
|
1789
|
+
*
|
|
1790
|
+
* @public
|
|
1791
|
+
*/
|
|
1792
|
+
declare const Inc: 41;
|
|
1793
|
+
|
|
1794
|
+
/**
|
|
1795
|
+
* Upstream BinAritOperator constant Leq. Its numeric value is preserved exactly.
|
|
1796
|
+
*
|
|
1797
|
+
* \<=
|
|
1798
|
+
*
|
|
1799
|
+
* @public
|
|
1800
|
+
*/
|
|
1801
|
+
declare const Leq: 47;
|
|
1802
|
+
|
|
1803
|
+
/**
|
|
1804
|
+
* LetClause represents a Bash let clause.
|
|
1805
|
+
*
|
|
1806
|
+
* This node will only appear with `LangBash` and `LangMirBSDKorn`.
|
|
1807
|
+
*
|
|
1808
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
1809
|
+
*
|
|
1810
|
+
* @public
|
|
1811
|
+
*/
|
|
1812
|
+
export declare interface LetClause {
|
|
1813
|
+
/**
|
|
1814
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
1815
|
+
*/
|
|
1816
|
+
Type: 'LetClause';
|
|
1817
|
+
/**
|
|
1818
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
1819
|
+
*/
|
|
1820
|
+
Exprs: (ArithmExpr | null)[] | null;
|
|
1821
|
+
/**
|
|
1822
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
1823
|
+
*/
|
|
1824
|
+
Let: SyntaxPos;
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
/**
|
|
1828
|
+
* Lit represents a string literal.
|
|
1829
|
+
*
|
|
1830
|
+
* Note that a parsed string literal may not appear as-is in the original source
|
|
1831
|
+
* code, as it is possible to split literals by escaping newlines. The splitting
|
|
1832
|
+
* is lost, but the end position is not.
|
|
1833
|
+
*
|
|
1834
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
1835
|
+
*
|
|
1836
|
+
* @public
|
|
1837
|
+
*/
|
|
1838
|
+
export declare interface Lit {
|
|
1839
|
+
/**
|
|
1840
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
1841
|
+
*/
|
|
1842
|
+
Type: 'Lit';
|
|
1843
|
+
/**
|
|
1844
|
+
* Upstream string bytes; non-UTF-8 values remain bytes rather than replacement text.
|
|
1845
|
+
*/
|
|
1846
|
+
Value: GoString;
|
|
1847
|
+
/**
|
|
1848
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
1849
|
+
*/
|
|
1850
|
+
ValueEnd: SyntaxPos;
|
|
1851
|
+
/**
|
|
1852
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
1853
|
+
*/
|
|
1854
|
+
ValuePos: SyntaxPos;
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
/**
|
|
1858
|
+
* The concrete records and typed nil pointers accepted by upstream syntax.Loop. Typed nil kinds are limited to this interface's actual implementers; auxiliary records are excluded.
|
|
1859
|
+
*
|
|
1860
|
+
* @public
|
|
1861
|
+
*/
|
|
1862
|
+
export declare type Loop = CStyleLoop | WordIter | TypedNil<'CStyleLoop' | 'WordIter'>;
|
|
1863
|
+
|
|
1864
|
+
/**
|
|
1865
|
+
* Upstream ParExpOperator constant LowerAll. Its numeric value is preserved exactly.
|
|
1866
|
+
*
|
|
1867
|
+
* ,,
|
|
1868
|
+
*
|
|
1869
|
+
* @public
|
|
1870
|
+
*/
|
|
1871
|
+
declare const LowerAll: 99;
|
|
1872
|
+
|
|
1873
|
+
/**
|
|
1874
|
+
* Upstream ParExpOperator constant LowerFirst. Its numeric value is preserved exactly.
|
|
1875
|
+
*
|
|
1876
|
+
* ,
|
|
1877
|
+
*
|
|
1878
|
+
* @public
|
|
1879
|
+
*/
|
|
1880
|
+
declare const LowerFirst: 98;
|
|
1881
|
+
|
|
1882
|
+
/**
|
|
1883
|
+
* Upstream BinAritOperator constant Lss. Its numeric value is preserved exactly.
|
|
1884
|
+
*
|
|
1885
|
+
* \<
|
|
1886
|
+
*
|
|
1887
|
+
* @public
|
|
1888
|
+
*/
|
|
1889
|
+
declare const Lss: 65;
|
|
1890
|
+
|
|
1891
|
+
/**
|
|
1892
|
+
* Upstream ParExpOperator constant MatchEmpty. Its numeric value is preserved exactly.
|
|
1893
|
+
*
|
|
1894
|
+
* :# with `LangZsh`
|
|
1895
|
+
*
|
|
1896
|
+
* @public
|
|
1897
|
+
*/
|
|
1898
|
+
declare const MatchEmpty: 93;
|
|
1899
|
+
|
|
1900
|
+
/**
|
|
1901
|
+
* Upstream UnAritOperator constant Minus. Its numeric value is preserved exactly.
|
|
1902
|
+
*
|
|
1903
|
+
* -
|
|
1904
|
+
*
|
|
1905
|
+
* @public
|
|
1906
|
+
*/
|
|
1907
|
+
declare const Minus: 83;
|
|
1908
|
+
|
|
1909
|
+
/**
|
|
1910
|
+
* Upstream BinAritOperator constant Mul. Its numeric value is preserved exactly.
|
|
1911
|
+
*
|
|
1912
|
+
* *
|
|
1913
|
+
*
|
|
1914
|
+
* @public
|
|
1915
|
+
*/
|
|
1916
|
+
declare const Mul: 43;
|
|
1917
|
+
|
|
1918
|
+
/**
|
|
1919
|
+
* Upstream BinAritOperator constant MulAssgn. Its numeric value is preserved exactly.
|
|
1920
|
+
*
|
|
1921
|
+
* *=
|
|
1922
|
+
*
|
|
1923
|
+
* @public
|
|
1924
|
+
*/
|
|
1925
|
+
declare const MulAssgn: 51;
|
|
1926
|
+
|
|
1927
|
+
/**
|
|
1928
|
+
* Upstream ParNamesOperator constant NamesPrefix. Its numeric value is preserved exactly.
|
|
1929
|
+
*
|
|
1930
|
+
* *
|
|
1931
|
+
*
|
|
1932
|
+
* @public
|
|
1933
|
+
*/
|
|
1934
|
+
declare const NamesPrefix: 43;
|
|
1935
|
+
|
|
1936
|
+
/**
|
|
1937
|
+
* Upstream ParNamesOperator constant NamesPrefixWords. Its numeric value is preserved exactly.
|
|
1938
|
+
*
|
|
1939
|
+
* \@
|
|
1940
|
+
*
|
|
1941
|
+
* @public
|
|
1942
|
+
*/
|
|
1943
|
+
declare const NamesPrefixWords: 100;
|
|
1944
|
+
|
|
1945
|
+
/**
|
|
1946
|
+
* Upstream BinAritOperator constant Neq. Its numeric value is preserved exactly.
|
|
1947
|
+
*
|
|
1948
|
+
* !=
|
|
1949
|
+
*
|
|
1950
|
+
* @public
|
|
1951
|
+
*/
|
|
1952
|
+
declare const Neq: 46;
|
|
1953
|
+
|
|
1954
|
+
/**
|
|
1955
|
+
* The concrete records and typed nil pointers accepted by upstream syntax.Node. Typed nil kinds are limited to this interface's actual implementers; auxiliary records are excluded.
|
|
1956
|
+
*
|
|
1957
|
+
* @public
|
|
1958
|
+
*/
|
|
1959
|
+
declare type Node_2 =
|
|
1960
|
+
| ArithmCmd
|
|
1961
|
+
| ArithmExp
|
|
1962
|
+
| ArrayElem
|
|
1963
|
+
| ArrayExpr
|
|
1964
|
+
| Assign
|
|
1965
|
+
| BinaryArithm
|
|
1966
|
+
| BinaryCmd
|
|
1967
|
+
| BinaryTest
|
|
1968
|
+
| Block
|
|
1969
|
+
| BraceExp
|
|
1970
|
+
| CStyleLoop
|
|
1971
|
+
| CallExpr
|
|
1972
|
+
| CaseClause
|
|
1973
|
+
| CaseItem
|
|
1974
|
+
| CmdSubst
|
|
1975
|
+
| Comment_2
|
|
1976
|
+
| CoprocClause
|
|
1977
|
+
| DblQuoted
|
|
1978
|
+
| DeclClause
|
|
1979
|
+
| ExtGlob
|
|
1980
|
+
| File_2
|
|
1981
|
+
| FlagsArithm
|
|
1982
|
+
| ForClause
|
|
1983
|
+
| FuncDecl
|
|
1984
|
+
| IfClause
|
|
1985
|
+
| LetClause
|
|
1986
|
+
| Lit
|
|
1987
|
+
| ParamExp
|
|
1988
|
+
| ParenArithm
|
|
1989
|
+
| ParenTest
|
|
1990
|
+
| ProcSubst
|
|
1991
|
+
| Redirect
|
|
1992
|
+
| SglQuoted
|
|
1993
|
+
| Stmt
|
|
1994
|
+
| Subshell
|
|
1995
|
+
| TestClause
|
|
1996
|
+
| TestDecl
|
|
1997
|
+
| TimeClause
|
|
1998
|
+
| UnaryArithm
|
|
1999
|
+
| UnaryTest
|
|
2000
|
+
| WhileClause
|
|
2001
|
+
| Word
|
|
2002
|
+
| WordIter
|
|
2003
|
+
| TypedNil<
|
|
2004
|
+
| 'ArithmCmd'
|
|
2005
|
+
| 'ArithmExp'
|
|
2006
|
+
| 'ArrayElem'
|
|
2007
|
+
| 'ArrayExpr'
|
|
2008
|
+
| 'Assign'
|
|
2009
|
+
| 'BinaryArithm'
|
|
2010
|
+
| 'BinaryCmd'
|
|
2011
|
+
| 'BinaryTest'
|
|
2012
|
+
| 'Block'
|
|
2013
|
+
| 'BraceExp'
|
|
2014
|
+
| 'CStyleLoop'
|
|
2015
|
+
| 'CallExpr'
|
|
2016
|
+
| 'CaseClause'
|
|
2017
|
+
| 'CaseItem'
|
|
2018
|
+
| 'CmdSubst'
|
|
2019
|
+
| 'Comment'
|
|
2020
|
+
| 'CoprocClause'
|
|
2021
|
+
| 'DblQuoted'
|
|
2022
|
+
| 'DeclClause'
|
|
2023
|
+
| 'ExtGlob'
|
|
2024
|
+
| 'File'
|
|
2025
|
+
| 'FlagsArithm'
|
|
2026
|
+
| 'ForClause'
|
|
2027
|
+
| 'FuncDecl'
|
|
2028
|
+
| 'IfClause'
|
|
2029
|
+
| 'LetClause'
|
|
2030
|
+
| 'Lit'
|
|
2031
|
+
| 'ParamExp'
|
|
2032
|
+
| 'ParenArithm'
|
|
2033
|
+
| 'ParenTest'
|
|
2034
|
+
| 'ProcSubst'
|
|
2035
|
+
| 'Redirect'
|
|
2036
|
+
| 'SglQuoted'
|
|
2037
|
+
| 'Stmt'
|
|
2038
|
+
| 'Subshell'
|
|
2039
|
+
| 'TestClause'
|
|
2040
|
+
| 'TestDecl'
|
|
2041
|
+
| 'TimeClause'
|
|
2042
|
+
| 'UnaryArithm'
|
|
2043
|
+
| 'UnaryTest'
|
|
2044
|
+
| 'WhileClause'
|
|
2045
|
+
| 'Word'
|
|
2046
|
+
| 'WordIter'
|
|
2047
|
+
>;
|
|
2048
|
+
export { Node_2 as Node }
|
|
2049
|
+
|
|
2050
|
+
/**
|
|
2051
|
+
* Upstream UnAritOperator constant Not. Its numeric value is preserved exactly.
|
|
2052
|
+
*
|
|
2053
|
+
* !
|
|
2054
|
+
*
|
|
2055
|
+
* @public
|
|
2056
|
+
*/
|
|
2057
|
+
declare const Not: 39;
|
|
2058
|
+
|
|
2059
|
+
/**
|
|
2060
|
+
* The upstream uint32 operator families. A family name identifies the Go named type, not the spelling of one token.
|
|
2061
|
+
*
|
|
2062
|
+
* @public
|
|
2063
|
+
*/
|
|
2064
|
+
export declare type OperatorFamily =
|
|
2065
|
+
| 'BinAritOperator'
|
|
2066
|
+
| 'BinCmdOperator'
|
|
2067
|
+
| 'BinTestOperator'
|
|
2068
|
+
| 'CaseOperator'
|
|
2069
|
+
| 'GlobOperator'
|
|
2070
|
+
| 'ParExpOperator'
|
|
2071
|
+
| 'ParNamesOperator'
|
|
2072
|
+
| 'ProcOperator'
|
|
2073
|
+
| 'RedirOperator'
|
|
2074
|
+
| 'UnAritOperator'
|
|
2075
|
+
| 'UnTestOperator';
|
|
2076
|
+
|
|
2077
|
+
/**
|
|
2078
|
+
* Upstream BinAritOperator constant Or. Its numeric value is preserved exactly.
|
|
2079
|
+
*
|
|
2080
|
+
* |
|
|
2081
|
+
*
|
|
2082
|
+
* @public
|
|
2083
|
+
*/
|
|
2084
|
+
declare const Or: 13;
|
|
2085
|
+
|
|
2086
|
+
/**
|
|
2087
|
+
* Upstream BinAritOperator constant OrArit. Its numeric value is preserved exactly.
|
|
2088
|
+
*
|
|
2089
|
+
* ||
|
|
2090
|
+
*
|
|
2091
|
+
* @public
|
|
2092
|
+
*/
|
|
2093
|
+
declare const OrArit: 12;
|
|
2094
|
+
|
|
2095
|
+
/**
|
|
2096
|
+
* Upstream BinAritOperator constant OrAssgn. Its numeric value is preserved exactly.
|
|
2097
|
+
*
|
|
2098
|
+
* |=
|
|
2099
|
+
*
|
|
2100
|
+
* @public
|
|
2101
|
+
*/
|
|
2102
|
+
declare const OrAssgn: 55;
|
|
2103
|
+
|
|
2104
|
+
/**
|
|
2105
|
+
* Upstream BinAritOperator constant OrBoolAssgn. Its numeric value is preserved exactly.
|
|
2106
|
+
*
|
|
2107
|
+
* ||=
|
|
2108
|
+
*
|
|
2109
|
+
* @public
|
|
2110
|
+
*/
|
|
2111
|
+
declare const OrBoolAssgn: 60;
|
|
2112
|
+
|
|
2113
|
+
/**
|
|
2114
|
+
* Upstream BinCmdOperator constant OrStmt. Its numeric value is preserved exactly.
|
|
2115
|
+
*
|
|
2116
|
+
* ||
|
|
2117
|
+
*
|
|
2118
|
+
* @public
|
|
2119
|
+
*/
|
|
2120
|
+
declare const OrStmt: 12;
|
|
2121
|
+
|
|
2122
|
+
/**
|
|
2123
|
+
* Upstream BinTestOperator constant OrTest. Its numeric value is preserved exactly.
|
|
2124
|
+
*
|
|
2125
|
+
* ||
|
|
2126
|
+
*
|
|
2127
|
+
* @public
|
|
2128
|
+
*/
|
|
2129
|
+
declare const OrTest: 12;
|
|
2130
|
+
|
|
2131
|
+
/**
|
|
2132
|
+
* Upstream ParExpOperator constant OtherParamOps. Its numeric value is preserved exactly.
|
|
2133
|
+
*
|
|
2134
|
+
* \@
|
|
2135
|
+
*
|
|
2136
|
+
* @public
|
|
2137
|
+
*/
|
|
2138
|
+
declare const OtherParamOps: 100;
|
|
2139
|
+
|
|
2140
|
+
/**
|
|
2141
|
+
* ParamExp represents a parameter expansion.
|
|
2142
|
+
*
|
|
2143
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
2144
|
+
*
|
|
2145
|
+
* @public
|
|
2146
|
+
*/
|
|
2147
|
+
export declare interface ParamExp {
|
|
2148
|
+
/**
|
|
2149
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
2150
|
+
*/
|
|
2151
|
+
Type: 'ParamExp';
|
|
2152
|
+
/**
|
|
2153
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
2154
|
+
*/
|
|
2155
|
+
Dollar: SyntaxPos;
|
|
2156
|
+
/**
|
|
2157
|
+
* Only one of these is set at a time.
|
|
2158
|
+
* given how we've grown the number of booleans
|
|
2159
|
+
* $\{!a\}
|
|
2160
|
+
*
|
|
2161
|
+
* False is an explicit upstream value and is never omitted.
|
|
2162
|
+
*/
|
|
2163
|
+
Excl: boolean;
|
|
2164
|
+
/**
|
|
2165
|
+
* $\{a:-b\}, $\{a#b\}, etc
|
|
2166
|
+
*
|
|
2167
|
+
* Null preserves the upstream absence of this component.
|
|
2168
|
+
*/
|
|
2169
|
+
Exp: Expansion | null;
|
|
2170
|
+
/**
|
|
2171
|
+
* $\{(flags)a\} with `LangZsh`
|
|
2172
|
+
*
|
|
2173
|
+
* Null preserves the upstream absence of this component.
|
|
2174
|
+
*/
|
|
2175
|
+
Flags: Lit | null;
|
|
2176
|
+
/**
|
|
2177
|
+
* $\{a`i`\}, $\{a["k"]\}, or a $\{a[i,j]\} slice with `LangZsh`
|
|
2178
|
+
*
|
|
2179
|
+
* Null preserves the upstream absence of this component.
|
|
2180
|
+
*/
|
|
2181
|
+
Index: ArithmExpr | null;
|
|
2182
|
+
/**
|
|
2183
|
+
* $\{+a\} with `LangZsh`
|
|
2184
|
+
*
|
|
2185
|
+
* False is an explicit upstream value and is never omitted.
|
|
2186
|
+
*/
|
|
2187
|
+
IsSet: boolean;
|
|
2188
|
+
/**
|
|
2189
|
+
* $\{#a\}
|
|
2190
|
+
*
|
|
2191
|
+
* False is an explicit upstream value and is never omitted.
|
|
2192
|
+
*/
|
|
2193
|
+
Length: boolean;
|
|
2194
|
+
/**
|
|
2195
|
+
* Only one of these is set at a time.
|
|
2196
|
+
* because it should be impossible for multiple to be set at once,
|
|
2197
|
+
* and a flat structure like this takes up more space.
|
|
2198
|
+
* $\{a:h2\} with `LangZsh`
|
|
2199
|
+
*
|
|
2200
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
2201
|
+
*/
|
|
2202
|
+
Modifiers: (Lit | null)[] | null;
|
|
2203
|
+
/**
|
|
2204
|
+
* $\{!prefix*\} or $\{!prefix\@\}
|
|
2205
|
+
*
|
|
2206
|
+
* Upstream operator value, preserving named tokens, zero, and explicitly represented raw uint32 values.
|
|
2207
|
+
*/
|
|
2208
|
+
Names: ParNamesOperator;
|
|
2209
|
+
/**
|
|
2210
|
+
* A nested parameter expression in the form of `ParamExp` or `CmdSubst`,
|
|
2211
|
+
* or either of those in a `DblQuoted`. Only possible with `LangZsh`.
|
|
2212
|
+
*
|
|
2213
|
+
* Null preserves the upstream absence of this component.
|
|
2214
|
+
*/
|
|
2215
|
+
NestedParam: WordPart | null;
|
|
2216
|
+
/**
|
|
2217
|
+
* Only one of these is set at a time,
|
|
2218
|
+
* or neither with `LangZsh` when the name is omitted.
|
|
2219
|
+
* even if that would be mildly annoying to non-Zsh users.
|
|
2220
|
+
*
|
|
2221
|
+
* Null preserves the upstream absence of this component.
|
|
2222
|
+
*/
|
|
2223
|
+
Param: Lit | null;
|
|
2224
|
+
/**
|
|
2225
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
2226
|
+
*/
|
|
2227
|
+
Rbrace: SyntaxPos;
|
|
2228
|
+
/**
|
|
2229
|
+
* $\{a/x/y\}
|
|
2230
|
+
*
|
|
2231
|
+
* Null preserves the upstream absence of this component.
|
|
2232
|
+
*/
|
|
2233
|
+
Repl: Replace | null;
|
|
2234
|
+
/**
|
|
2235
|
+
* $a instead of $\{a\}
|
|
2236
|
+
*
|
|
2237
|
+
* False is an explicit upstream value and is never omitted.
|
|
2238
|
+
*/
|
|
2239
|
+
Short: boolean;
|
|
2240
|
+
/**
|
|
2241
|
+
* $\{a:x:y\}
|
|
2242
|
+
*
|
|
2243
|
+
* Null preserves the upstream absence of this component.
|
|
2244
|
+
*/
|
|
2245
|
+
Slice: Slice | null;
|
|
2246
|
+
/**
|
|
2247
|
+
* mksh's $\{%a\}
|
|
2248
|
+
*
|
|
2249
|
+
* False is an explicit upstream value and is never omitted.
|
|
2250
|
+
*/
|
|
2251
|
+
Width: boolean;
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
/**
|
|
2255
|
+
* ParenArithm represents an arithmetic expression within parentheses.
|
|
2256
|
+
*
|
|
2257
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
2258
|
+
*
|
|
2259
|
+
* @public
|
|
2260
|
+
*/
|
|
2261
|
+
export declare interface ParenArithm {
|
|
2262
|
+
/**
|
|
2263
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
2264
|
+
*/
|
|
2265
|
+
Type: 'ParenArithm';
|
|
2266
|
+
/**
|
|
2267
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
2268
|
+
*/
|
|
2269
|
+
Lparen: SyntaxPos;
|
|
2270
|
+
/**
|
|
2271
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
2272
|
+
*/
|
|
2273
|
+
Rparen: SyntaxPos;
|
|
2274
|
+
/**
|
|
2275
|
+
* Null preserves the upstream absence of this component.
|
|
2276
|
+
*/
|
|
2277
|
+
X: ArithmExpr | null;
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2280
|
+
/**
|
|
2281
|
+
* ParenTest represents a test expression within parentheses.
|
|
2282
|
+
*
|
|
2283
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
2284
|
+
*
|
|
2285
|
+
* @public
|
|
2286
|
+
*/
|
|
2287
|
+
export declare interface ParenTest {
|
|
2288
|
+
/**
|
|
2289
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
2290
|
+
*/
|
|
2291
|
+
Type: 'ParenTest';
|
|
2292
|
+
/**
|
|
2293
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
2294
|
+
*/
|
|
2295
|
+
Lparen: SyntaxPos;
|
|
2296
|
+
/**
|
|
2297
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
2298
|
+
*/
|
|
2299
|
+
Rparen: SyntaxPos;
|
|
2300
|
+
/**
|
|
2301
|
+
* Null preserves the upstream absence of this component.
|
|
2302
|
+
*/
|
|
2303
|
+
X: TestExpr | null;
|
|
2304
|
+
}
|
|
2305
|
+
|
|
2306
|
+
/**
|
|
2307
|
+
* The upstream ParExpOperator domain: exact named tokens, the Go zero value, and explicitly validated unnamed uint32 values. Constants shared by upstream families retain their shared numeric identity.
|
|
2308
|
+
*
|
|
2309
|
+
* @public
|
|
2310
|
+
*/
|
|
2311
|
+
export declare type ParExpOperator =
|
|
2312
|
+
| 0
|
|
2313
|
+
| typeof AlternateUnset
|
|
2314
|
+
| typeof AlternateUnsetOrNull
|
|
2315
|
+
| typeof ArrayExclude
|
|
2316
|
+
| typeof ArrayIntersect
|
|
2317
|
+
| typeof AssignUnset
|
|
2318
|
+
| typeof AssignUnsetOrNull
|
|
2319
|
+
| typeof DefaultUnset
|
|
2320
|
+
| typeof DefaultUnsetOrNull
|
|
2321
|
+
| typeof ErrorUnset
|
|
2322
|
+
| typeof ErrorUnsetOrNull
|
|
2323
|
+
| typeof LowerAll
|
|
2324
|
+
| typeof LowerFirst
|
|
2325
|
+
| typeof MatchEmpty
|
|
2326
|
+
| typeof OtherParamOps
|
|
2327
|
+
| typeof RemLargePrefix
|
|
2328
|
+
| typeof RemLargeSuffix
|
|
2329
|
+
| typeof RemSmallPrefix
|
|
2330
|
+
| typeof RemSmallSuffix
|
|
2331
|
+
| typeof UpperAll
|
|
2332
|
+
| typeof UpperFirst
|
|
2333
|
+
| RawOperator<'ParExpOperator'>;
|
|
2334
|
+
|
|
2335
|
+
/**
|
|
2336
|
+
* The upstream ParNamesOperator domain: exact named tokens, the Go zero value, and explicitly validated unnamed uint32 values. Constants shared by upstream families retain their shared numeric identity.
|
|
2337
|
+
*
|
|
2338
|
+
* @public
|
|
2339
|
+
*/
|
|
2340
|
+
export declare type ParNamesOperator =
|
|
2341
|
+
0 | typeof NamesPrefix | typeof NamesPrefixWords | RawOperator<'ParNamesOperator'>;
|
|
2342
|
+
|
|
2343
|
+
/**
|
|
2344
|
+
* Upstream BinCmdOperator constant Pipe. Its numeric value is preserved exactly.
|
|
2345
|
+
*
|
|
2346
|
+
* |
|
|
2347
|
+
*
|
|
2348
|
+
* @public
|
|
2349
|
+
*/
|
|
2350
|
+
declare const Pipe: 13;
|
|
2351
|
+
|
|
2352
|
+
/**
|
|
2353
|
+
* Upstream BinCmdOperator constant PipeAll. Its numeric value is preserved exactly.
|
|
2354
|
+
*
|
|
2355
|
+
* |&
|
|
2356
|
+
*
|
|
2357
|
+
* @public
|
|
2358
|
+
*/
|
|
2359
|
+
declare const PipeAll: 14;
|
|
2360
|
+
|
|
2361
|
+
/**
|
|
2362
|
+
* Upstream UnAritOperator constant Plus. Its numeric value is preserved exactly.
|
|
2363
|
+
*
|
|
2364
|
+
* +
|
|
2365
|
+
*
|
|
2366
|
+
* @public
|
|
2367
|
+
*/
|
|
2368
|
+
declare const Plus: 81;
|
|
2369
|
+
|
|
2370
|
+
/**
|
|
2371
|
+
* Upstream BinAritOperator constant Pow. Its numeric value is preserved exactly.
|
|
2372
|
+
*
|
|
2373
|
+
* **
|
|
2374
|
+
*
|
|
2375
|
+
* @public
|
|
2376
|
+
*/
|
|
2377
|
+
declare const Pow: 44;
|
|
2378
|
+
|
|
2379
|
+
/**
|
|
2380
|
+
* Upstream BinAritOperator constant PowAssgn. Its numeric value is preserved exactly.
|
|
2381
|
+
*
|
|
2382
|
+
* **=
|
|
2383
|
+
*
|
|
2384
|
+
* @public
|
|
2385
|
+
*/
|
|
2386
|
+
declare const PowAssgn: 62;
|
|
2387
|
+
|
|
2388
|
+
/**
|
|
2389
|
+
* The upstream ProcOperator domain: exact named tokens, the Go zero value, and explicitly validated unnamed uint32 values. Constants shared by upstream families retain their shared numeric identity.
|
|
2390
|
+
*
|
|
2391
|
+
* @public
|
|
2392
|
+
*/
|
|
2393
|
+
export declare type ProcOperator =
|
|
2394
|
+
0 | typeof CmdIn | typeof CmdInTemp | typeof CmdOut | RawOperator<'ProcOperator'>;
|
|
2395
|
+
|
|
2396
|
+
/**
|
|
2397
|
+
* ProcSubst represents a Bash process substitution.
|
|
2398
|
+
*
|
|
2399
|
+
* This node will only appear with `LangBash`.
|
|
2400
|
+
*
|
|
2401
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
2402
|
+
*
|
|
2403
|
+
* @public
|
|
2404
|
+
*/
|
|
2405
|
+
export declare interface ProcSubst {
|
|
2406
|
+
/**
|
|
2407
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
2408
|
+
*/
|
|
2409
|
+
Type: 'ProcSubst';
|
|
2410
|
+
/**
|
|
2411
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array.
|
|
2412
|
+
*/
|
|
2413
|
+
Last: Comment_2[] | null;
|
|
2414
|
+
/**
|
|
2415
|
+
* Upstream operator value, preserving named tokens, zero, and explicitly represented raw uint32 values.
|
|
2416
|
+
*/
|
|
2417
|
+
Op: ProcOperator;
|
|
2418
|
+
/**
|
|
2419
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
2420
|
+
*/
|
|
2421
|
+
OpPos: SyntaxPos;
|
|
2422
|
+
/**
|
|
2423
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
2424
|
+
*/
|
|
2425
|
+
Rparen: SyntaxPos;
|
|
2426
|
+
/**
|
|
2427
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
2428
|
+
*/
|
|
2429
|
+
Stmts: (Stmt | null)[] | null;
|
|
2430
|
+
}
|
|
2431
|
+
|
|
2432
|
+
/**
|
|
2433
|
+
* Upstream BinAritOperator constant Quo. Its numeric value is preserved exactly.
|
|
2434
|
+
*
|
|
2435
|
+
* /
|
|
2436
|
+
*
|
|
2437
|
+
* @public
|
|
2438
|
+
*/
|
|
2439
|
+
declare const Quo: 101;
|
|
2440
|
+
|
|
2441
|
+
/**
|
|
2442
|
+
* Upstream BinAritOperator constant QuoAssgn. Its numeric value is preserved exactly.
|
|
2443
|
+
*
|
|
2444
|
+
* /=
|
|
2445
|
+
*
|
|
2446
|
+
* @public
|
|
2447
|
+
*/
|
|
2448
|
+
declare const QuoAssgn: 52;
|
|
2449
|
+
|
|
2450
|
+
/**
|
|
2451
|
+
* An explicitly represented unnamed uint32 value in one upstream operator family. The runtime constructor checks integer range; this type does not claim that every value is meaningful to every parser or printer operation. The structural family marker remains interoperable across package entry points while preventing accidental cross-family assignment.
|
|
2452
|
+
*
|
|
2453
|
+
* @public
|
|
2454
|
+
*/
|
|
2455
|
+
export declare type RawOperator<Family extends OperatorFamily> = number & {
|
|
2456
|
+
readonly __shAstOperatorFamily: Family;
|
|
2457
|
+
};
|
|
2458
|
+
|
|
2459
|
+
/**
|
|
2460
|
+
* Upstream RedirOperator constant RdrAll. Its numeric value is preserved exactly.
|
|
2461
|
+
*
|
|
2462
|
+
* &\>
|
|
2463
|
+
*
|
|
2464
|
+
* @public
|
|
2465
|
+
*/
|
|
2466
|
+
declare const RdrAll: 74;
|
|
2467
|
+
|
|
2468
|
+
/**
|
|
2469
|
+
* Upstream RedirOperator constant RdrAllClob. Its numeric value is preserved exactly.
|
|
2470
|
+
*
|
|
2471
|
+
* &\>| with `LangZsh`
|
|
2472
|
+
*
|
|
2473
|
+
* @public
|
|
2474
|
+
*/
|
|
2475
|
+
declare const RdrAllClob: 75;
|
|
2476
|
+
|
|
2477
|
+
/**
|
|
2478
|
+
* Upstream RedirOperator constant RdrClob. Its numeric value is preserved exactly.
|
|
2479
|
+
*
|
|
2480
|
+
* \>|
|
|
2481
|
+
*
|
|
2482
|
+
* @public
|
|
2483
|
+
*/
|
|
2484
|
+
declare const RdrClob: 69;
|
|
2485
|
+
|
|
2486
|
+
/**
|
|
2487
|
+
* Upstream RedirOperator constant RdrIn. Its numeric value is preserved exactly.
|
|
2488
|
+
*
|
|
2489
|
+
* \<
|
|
2490
|
+
*
|
|
2491
|
+
* @public
|
|
2492
|
+
*/
|
|
2493
|
+
declare const RdrIn: 65;
|
|
2494
|
+
|
|
2495
|
+
/**
|
|
2496
|
+
* Upstream RedirOperator constant RdrInOut. Its numeric value is preserved exactly.
|
|
2497
|
+
*
|
|
2498
|
+
* \<\>
|
|
2499
|
+
*
|
|
2500
|
+
* @public
|
|
2501
|
+
*/
|
|
2502
|
+
declare const RdrInOut: 66;
|
|
2503
|
+
|
|
2504
|
+
/**
|
|
2505
|
+
* Upstream RedirOperator constant RdrOut. Its numeric value is preserved exactly.
|
|
2506
|
+
*
|
|
2507
|
+
* \>
|
|
2508
|
+
*
|
|
2509
|
+
* @public
|
|
2510
|
+
*/
|
|
2511
|
+
declare const RdrOut: 63;
|
|
2512
|
+
|
|
2513
|
+
/**
|
|
2514
|
+
* Redirect represents an input/output redirection.
|
|
2515
|
+
*
|
|
2516
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
2517
|
+
*
|
|
2518
|
+
* @public
|
|
2519
|
+
*/
|
|
2520
|
+
export declare interface Redirect {
|
|
2521
|
+
/**
|
|
2522
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
2523
|
+
*/
|
|
2524
|
+
Type: 'Redirect';
|
|
2525
|
+
/**
|
|
2526
|
+
* here-document body
|
|
2527
|
+
*
|
|
2528
|
+
* Null preserves the upstream absence of this component.
|
|
2529
|
+
*/
|
|
2530
|
+
Hdoc: Word | null;
|
|
2531
|
+
/**
|
|
2532
|
+
* fd\>, or \{varname\}\> in Bash
|
|
2533
|
+
*
|
|
2534
|
+
* Null preserves the upstream absence of this component.
|
|
2535
|
+
*/
|
|
2536
|
+
N: Lit | null;
|
|
2537
|
+
/**
|
|
2538
|
+
* Upstream operator value, preserving named tokens, zero, and explicitly represented raw uint32 values.
|
|
2539
|
+
*/
|
|
2540
|
+
Op: RedirOperator;
|
|
2541
|
+
/**
|
|
2542
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
2543
|
+
*/
|
|
2544
|
+
OpPos: SyntaxPos;
|
|
2545
|
+
/**
|
|
2546
|
+
* \>word
|
|
2547
|
+
*
|
|
2548
|
+
* Null preserves the upstream absence of this component.
|
|
2549
|
+
*/
|
|
2550
|
+
Word: Word | null;
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2553
|
+
/**
|
|
2554
|
+
* The upstream RedirOperator domain: exact named tokens, the Go zero value, and explicitly validated unnamed uint32 values. Constants shared by upstream families retain their shared numeric identity.
|
|
2555
|
+
*
|
|
2556
|
+
* @public
|
|
2557
|
+
*/
|
|
2558
|
+
export declare type RedirOperator =
|
|
2559
|
+
| 0
|
|
2560
|
+
| typeof AppAll
|
|
2561
|
+
| typeof AppAllClob
|
|
2562
|
+
| typeof AppClob
|
|
2563
|
+
| typeof AppOut
|
|
2564
|
+
| typeof DashHdoc
|
|
2565
|
+
| typeof DplIn
|
|
2566
|
+
| typeof DplOut
|
|
2567
|
+
| typeof Hdoc
|
|
2568
|
+
| typeof RdrAll
|
|
2569
|
+
| typeof RdrAllClob
|
|
2570
|
+
| typeof RdrClob
|
|
2571
|
+
| typeof RdrIn
|
|
2572
|
+
| typeof RdrInOut
|
|
2573
|
+
| typeof RdrOut
|
|
2574
|
+
| typeof WordHdoc
|
|
2575
|
+
| RawOperator<'RedirOperator'>;
|
|
2576
|
+
|
|
2577
|
+
/**
|
|
2578
|
+
* Upstream BinAritOperator constant Rem. Its numeric value is preserved exactly.
|
|
2579
|
+
*
|
|
2580
|
+
* %
|
|
2581
|
+
*
|
|
2582
|
+
* @public
|
|
2583
|
+
*/
|
|
2584
|
+
declare const Rem: 89;
|
|
2585
|
+
|
|
2586
|
+
/**
|
|
2587
|
+
* Upstream BinAritOperator constant RemAssgn. Its numeric value is preserved exactly.
|
|
2588
|
+
*
|
|
2589
|
+
* %=
|
|
2590
|
+
*
|
|
2591
|
+
* @public
|
|
2592
|
+
*/
|
|
2593
|
+
declare const RemAssgn: 53;
|
|
2594
|
+
|
|
2595
|
+
/**
|
|
2596
|
+
* Upstream ParExpOperator constant RemLargePrefix. Its numeric value is preserved exactly.
|
|
2597
|
+
*
|
|
2598
|
+
* ##
|
|
2599
|
+
*
|
|
2600
|
+
* @public
|
|
2601
|
+
*/
|
|
2602
|
+
declare const RemLargePrefix: 92;
|
|
2603
|
+
|
|
2604
|
+
/**
|
|
2605
|
+
* Upstream ParExpOperator constant RemLargeSuffix. Its numeric value is preserved exactly.
|
|
2606
|
+
*
|
|
2607
|
+
* %%
|
|
2608
|
+
*
|
|
2609
|
+
* @public
|
|
2610
|
+
*/
|
|
2611
|
+
declare const RemLargeSuffix: 90;
|
|
2612
|
+
|
|
2613
|
+
/**
|
|
2614
|
+
* Upstream ParExpOperator constant RemSmallPrefix. Its numeric value is preserved exactly.
|
|
2615
|
+
*
|
|
2616
|
+
* #
|
|
2617
|
+
*
|
|
2618
|
+
* @public
|
|
2619
|
+
*/
|
|
2620
|
+
declare const RemSmallPrefix: 91;
|
|
2621
|
+
|
|
2622
|
+
/**
|
|
2623
|
+
* Upstream ParExpOperator constant RemSmallSuffix. Its numeric value is preserved exactly.
|
|
2624
|
+
*
|
|
2625
|
+
* %
|
|
2626
|
+
*
|
|
2627
|
+
* @public
|
|
2628
|
+
*/
|
|
2629
|
+
declare const RemSmallSuffix: 89;
|
|
2630
|
+
|
|
2631
|
+
/**
|
|
2632
|
+
* Replace represents a search and replace expression inside a `ParamExp`.
|
|
2633
|
+
*
|
|
2634
|
+
* Auxiliary syntax data, not a syntax.Node; it has no independent source bounds.
|
|
2635
|
+
*
|
|
2636
|
+
* @public
|
|
2637
|
+
*/
|
|
2638
|
+
export declare interface Replace {
|
|
2639
|
+
/**
|
|
2640
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
2641
|
+
*/
|
|
2642
|
+
Type: 'Replace';
|
|
2643
|
+
/**
|
|
2644
|
+
* False is an explicit upstream value and is never omitted.
|
|
2645
|
+
*/
|
|
2646
|
+
All: boolean;
|
|
2647
|
+
/**
|
|
2648
|
+
* Null preserves the upstream absence of this component.
|
|
2649
|
+
*/
|
|
2650
|
+
Orig: Word | null;
|
|
2651
|
+
/**
|
|
2652
|
+
* Null preserves the upstream absence of this component.
|
|
2653
|
+
*/
|
|
2654
|
+
With: Word | null;
|
|
2655
|
+
}
|
|
2656
|
+
|
|
2657
|
+
/**
|
|
2658
|
+
* Follows `site`'s argv0 through zero or more *transparent wrappers* —
|
|
2659
|
+
* commands whose own argv0 isn't the command actually run, because they
|
|
2660
|
+
* just locate and re-exec another command (`env FOO=1 rm -rf /`,
|
|
2661
|
+
* `command rm`, `nohup rm`, `sudo -u x "$prog"`) — to the **effective**
|
|
2662
|
+
* command: the one a permission/policy check must actually judge, since
|
|
2663
|
+
* argv0 alone is trivially spoofable through any of these.
|
|
2664
|
+
*
|
|
2665
|
+
* The wrapper table ({@link ResolveArgv0Options.transparentWrappers},
|
|
2666
|
+
* defaulting to {@link DEFAULT_TRANSPARENT_WRAPPERS}) is plain data: each
|
|
2667
|
+
* {@link WrapperSpec} declares how to locate the word it wraps, and
|
|
2668
|
+
* neither this function nor the table encodes any safety judgment about
|
|
2669
|
+
* *which* commands are dangerous — matching {@link CommandSite}'s and
|
|
2670
|
+
* {@link resolveWord}'s "facts only" posture. A caller can drop a default
|
|
2671
|
+
* entry (that name then resolves as an ordinary, non-transparent
|
|
2672
|
+
* command) or add their own (e.g. a project's `with-retry` helper) and
|
|
2673
|
+
* both directions are followed identically to any built-in entry.
|
|
2674
|
+
*
|
|
2675
|
+
* **A statically-unknowable word is never guessed through** — three
|
|
2676
|
+
* distinct cases all stop the chain immediately at that word rather than
|
|
2677
|
+
* falling back to any other guess:
|
|
2678
|
+
*
|
|
2679
|
+
* 1. `argv0` or any wrapper's located word itself resolves `static: false`
|
|
2680
|
+
* (an expansion, tilde, glob, …) — `sudo -u x "$prog"` reports
|
|
2681
|
+
* `effective: { static: false, reason: 'expansion' }` with
|
|
2682
|
+
* `chain: [<sudo>, <"$prog">]`, not `rm`/`sudo`/anything static.
|
|
2683
|
+
* 2. A *statically known* word shaped like a flag (`-`-prefixed, not
|
|
2684
|
+
* `--`) doesn't match any flag/operand shape the current
|
|
2685
|
+
* {@link WrapperSpec} recognizes — `sudo -D /tmp rm x` (`-D` isn't
|
|
2686
|
+
* modeled for `sudo`) reports an `effective` of `static: false` with
|
|
2687
|
+
* `reason: 'unknown-flag'`, **not** `rm` (the pre-fix behavior: any
|
|
2688
|
+
* unrecognized word, flag-shaped or not, was silently treated as the
|
|
2689
|
+
* wrapped command — a false report that hid the real effective
|
|
2690
|
+
* command behind a flag this table simply hadn't modeled yet).
|
|
2691
|
+
* 3. A recognized flag's value structurally embeds the real command
|
|
2692
|
+
* rather than naming it as a separate word — `env -S 'rm -rf /'`
|
|
2693
|
+
* reports `effective: { static: false, reason: 'embedded-command' }`
|
|
2694
|
+
* (see {@link WrapperSpec.unresolvableFlags}'s doc comment).
|
|
2695
|
+
*
|
|
2696
|
+
* `VAR=val` shell-assignment prefixes on the `CallExpr` itself
|
|
2697
|
+
* (`CommandSite.node.Assigns`, e.g. `FOO=bar rm x`) are always skipped and
|
|
2698
|
+
* counted in {@link Argv0Resolution.assignmentsSkipped} — a mechanism
|
|
2699
|
+
* distinct from a wrapper's own `VAR=val` *operands* (`env A=1 rm x`,
|
|
2700
|
+
* `sudo A=1 rm x`), which {@link WrapperSpec.skipAssignmentOperands}
|
|
2701
|
+
* handles per-wrapper.
|
|
2702
|
+
*
|
|
2703
|
+
* @param site - A {@link CommandSite}, typically from {@link enumerateCommands}.
|
|
2704
|
+
* @param options - See {@link ResolveArgv0Options}.
|
|
2705
|
+
* @throws TypeError if `site.argv` is empty — a programmer-error misuse of
|
|
2706
|
+
* the API (every `CommandSite` `enumerateCommands` ever produces has at
|
|
2707
|
+
* least one argv word; see its doc comment), not a "malformed shell
|
|
2708
|
+
* source" case.
|
|
2709
|
+
* @throws {@link ShAnalyzeInvalidWrapperSpecError} if
|
|
2710
|
+
* `options.transparentWrappers` contains a malformed entry (see
|
|
2711
|
+
* {@link ResolveArgv0Options.transparentWrappers}'s doc comment).
|
|
2712
|
+
* @public
|
|
2713
|
+
*/
|
|
2714
|
+
export declare function resolveArgv0(site: CommandSite, options?: ResolveArgv0Options): Argv0Resolution;
|
|
2715
|
+
|
|
2716
|
+
/**
|
|
2717
|
+
* Options accepted by {@link resolveArgv0}.
|
|
2718
|
+
*
|
|
2719
|
+
* @public
|
|
2720
|
+
*/
|
|
2721
|
+
export declare interface ResolveArgv0Options {
|
|
2722
|
+
/**
|
|
2723
|
+
* The transparent-wrapper table to follow. Defaults to
|
|
2724
|
+
* {@link DEFAULT_TRANSPARENT_WRAPPERS}. Pass a replacement array to drop
|
|
2725
|
+
* a default entry entirely (that wrapper is then treated as an ordinary,
|
|
2726
|
+
* non-transparent effective command), or add project-specific entries
|
|
2727
|
+
* (e.g. a `with-retry` wrapper) — the table is plain data, not baked-in
|
|
2728
|
+
* policy.
|
|
2729
|
+
*
|
|
2730
|
+
* Validated at the {@link resolveArgv0} boundary: a malformed entry (a
|
|
2731
|
+
* non-array `names`, an empty `names`, or a wrong-typed flag field)
|
|
2732
|
+
* throws {@link ShAnalyzeInvalidWrapperSpecError} immediately, rather
|
|
2733
|
+
* than failing later with a confusing native `TypeError` deep inside
|
|
2734
|
+
* flag matching.
|
|
2735
|
+
*/
|
|
2736
|
+
readonly transparentWrappers?: readonly WrapperSpec[];
|
|
2737
|
+
}
|
|
2738
|
+
|
|
2739
|
+
/**
|
|
2740
|
+
* Determines whether a `Word` node is statically a known string, and if
|
|
2741
|
+
* so, what that string is — the atom of shell-AST static analysis (e.g.
|
|
2742
|
+
* "is this word literally `rm`"). A word is static iff every part is a
|
|
2743
|
+
* literal after shell unquoting: a bare `Lit` (backslash escapes
|
|
2744
|
+
* processed), a `SglQuoted` (including `$'...'` ANSI-C escapes decoded),
|
|
2745
|
+
* or a `DblQuoted` containing only literal parts (and not itself a
|
|
2746
|
+
* `$"..."` locale translation) — including concatenations of these (`'r'm`
|
|
2747
|
+
* resolves to `"rm"`). A word containing any expansion (`ParamExp`,
|
|
2748
|
+
* `CmdSubst`, `ArithmExp`, `ProcSubst`), a triggering unquoted `~` (see
|
|
2749
|
+
* `options.context`), an unquoted glob metacharacter/bracket
|
|
2750
|
+
* expression/`ExtGlob`, a `$"..."` locale translation, or an unrepresentable
|
|
2751
|
+
* `$'\U...'` escape is `static: false` with a reason — never an error, and
|
|
2752
|
+
* never a safety judgment (see {@link WordResolution}).
|
|
2753
|
+
*
|
|
2754
|
+
* @param word - A `Word` node, e.g. `parseSync(...).Stmts[0].Cmd.Args[0]`.
|
|
2755
|
+
* @param options - See {@link ResolveWordOptions}.
|
|
2756
|
+
* @throws TypeError if `word.Type` is neither `"Word"` nor `"TypedNil"` — a programmer-error
|
|
2757
|
+
* misuse of the API, not a "malformed shell source" case (well-formed
|
|
2758
|
+
* shell source, however dynamic, never throws; see {@link WordResolution}).
|
|
2759
|
+
*
|
|
2760
|
+
* @public
|
|
2761
|
+
*/
|
|
2762
|
+
export declare function resolveWord(word: Node_2, options?: ResolveWordOptions): WordResolution;
|
|
2763
|
+
|
|
2764
|
+
/**
|
|
2765
|
+
* Options controlling {@link resolveWord}'s tilde-expansion detection.
|
|
2766
|
+
*
|
|
2767
|
+
* @public
|
|
2768
|
+
*/
|
|
2769
|
+
export declare interface ResolveWordOptions {
|
|
2770
|
+
/**
|
|
2771
|
+
* Which Bash grammar position `word` occupies — the two positions Bash
|
|
2772
|
+
* §3.5.2 ("Tilde Expansion") documents distinct tilde-expansion triggers
|
|
2773
|
+
* for:
|
|
2774
|
+
*
|
|
2775
|
+
* - `'command-argument'` — an ordinary simple-command argument word (e.g.
|
|
2776
|
+
* `echo <word>`). Only a *word-initial* unquoted `~` triggers tilde
|
|
2777
|
+
* expansion; an unquoted `~` elsewhere in the word (including right
|
|
2778
|
+
* after a `:`) is an ordinary character (`echo a:~b` prints `a:~b`
|
|
2779
|
+
* literally in real bash).
|
|
2780
|
+
* - `'assignment-value'` — the value side of a shell assignment (e.g.
|
|
2781
|
+
* `PATH=<word>`, an `Assign` node's `value`). Bash additionally
|
|
2782
|
+
* tilde-expands an unquoted `~` immediately following an unquoted `:`
|
|
2783
|
+
* anywhere in the value (`PATH=/foo:~/bar` expands the `~/bar`
|
|
2784
|
+
* segment) — this is documented for `PATH`-like colon-separated
|
|
2785
|
+
* assignment values specifically.
|
|
2786
|
+
*
|
|
2787
|
+
* **Default: `'assignment-value'` semantics apply whenever this option is
|
|
2788
|
+
* omitted.** `resolveWord` takes a bare `Word` node with no grammar
|
|
2789
|
+
* context attached, so it cannot see whether its caller extracted that
|
|
2790
|
+
* word from a command argument or an assignment value — omitting this
|
|
2791
|
+
* option is deliberately treated as the *more conservative* of the two
|
|
2792
|
+
* (the one that reports `'tilde'` in more cases), so a caller that
|
|
2793
|
+
* doesn't know or care about the distinction never under-reports a real
|
|
2794
|
+
* tilde-expansion site. Pass `'command-argument'` explicitly to opt into
|
|
2795
|
+
* the narrower, word-initial-only check that matches real bash's
|
|
2796
|
+
* behavior for ordinary arguments.
|
|
2797
|
+
*
|
|
2798
|
+
* @see https://www.gnu.org/software/bash/manual/bash.html#Tilde-Expansion
|
|
2799
|
+
*/
|
|
2800
|
+
readonly context?: 'command-argument' | 'assignment-value';
|
|
2801
|
+
}
|
|
2802
|
+
|
|
2803
|
+
/**
|
|
2804
|
+
* Upstream CaseOperator constant Resume. Its numeric value is preserved exactly.
|
|
2805
|
+
*
|
|
2806
|
+
* ;;&
|
|
2807
|
+
*
|
|
2808
|
+
* @public
|
|
2809
|
+
*/
|
|
2810
|
+
declare const Resume: 37;
|
|
2811
|
+
|
|
2812
|
+
/**
|
|
2813
|
+
* Upstream CaseOperator constant ResumeKorn. Its numeric value is preserved exactly.
|
|
2814
|
+
*
|
|
2815
|
+
* ;|
|
|
2816
|
+
*
|
|
2817
|
+
* @public
|
|
2818
|
+
*/
|
|
2819
|
+
declare const ResumeKorn: 38;
|
|
2820
|
+
|
|
2821
|
+
/**
|
|
2822
|
+
* SglQuoted represents a string within single quotes.
|
|
2823
|
+
*
|
|
2824
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
2825
|
+
*
|
|
2826
|
+
* @public
|
|
2827
|
+
*/
|
|
2828
|
+
export declare interface SglQuoted {
|
|
2829
|
+
/**
|
|
2830
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
2831
|
+
*/
|
|
2832
|
+
Type: 'SglQuoted';
|
|
2833
|
+
/**
|
|
2834
|
+
* $''
|
|
2835
|
+
*
|
|
2836
|
+
* False is an explicit upstream value and is never omitted.
|
|
2837
|
+
*/
|
|
2838
|
+
Dollar: boolean;
|
|
2839
|
+
/**
|
|
2840
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
2841
|
+
*/
|
|
2842
|
+
Left: SyntaxPos;
|
|
2843
|
+
/**
|
|
2844
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
2845
|
+
*/
|
|
2846
|
+
Right: SyntaxPos;
|
|
2847
|
+
/**
|
|
2848
|
+
* Upstream string bytes; non-UTF-8 values remain bytes rather than replacement text.
|
|
2849
|
+
*/
|
|
2850
|
+
Value: GoString;
|
|
2851
|
+
}
|
|
2852
|
+
|
|
2853
|
+
/**
|
|
2854
|
+
* Thrown by `sh-ast/analyze`'s `resolveArgv0` when a caller-supplied
|
|
2855
|
+
* `options.transparentWrappers` array contains a malformed `WrapperSpec`
|
|
2856
|
+
* entry — e.g. a non-array or empty `names`, or a flag field that isn't an
|
|
2857
|
+
* array of strings. Fails closed with a clear, specific message at the
|
|
2858
|
+
* point the malformed table is supplied, rather than letting the bad shape
|
|
2859
|
+
* reach flag-matching logic and surface as a confusing native `TypeError`
|
|
2860
|
+
* (or, worse, a silently wrong match) far from its actual cause.
|
|
2861
|
+
*
|
|
2862
|
+
* @public
|
|
2863
|
+
*/
|
|
2864
|
+
export declare class ShAnalyzeInvalidWrapperSpecError extends ShAstError {
|
|
2865
|
+
readonly code = "SH_AST_ANALYZE_INVALID_WRAPPER_SPEC";
|
|
2866
|
+
constructor(message: string);
|
|
2867
|
+
}
|
|
2868
|
+
|
|
2869
|
+
/**
|
|
2870
|
+
* Thrown by `sh-ast/analyze`'s `enumerateCommands` when a tree's genuinely
|
|
2871
|
+
* nested structure — subshells within subshells, chained command/process
|
|
2872
|
+
* substitutions, deeply nested `if`/`case`/loop/function/`time`/`{ }`
|
|
2873
|
+
* bodies, deeply chained `elif` — exceeds its defensive recursion-depth
|
|
2874
|
+
* guard. **Not** thrown for a long *linear* chain (`|`/`|&`/`&&`/`||` of
|
|
2875
|
+
* any realistic length): `enumerateCommands` traverses those iteratively,
|
|
2876
|
+
* so chain length alone never grows this guard's depth counter — only
|
|
2877
|
+
* genuine tree nesting does.
|
|
2878
|
+
*
|
|
2879
|
+
* `enumerateCommands` deliberately fails closed here rather than returning
|
|
2880
|
+
* a truncated, partial result: a partial `CommandSite[]` silently omits
|
|
2881
|
+
* real command sites, which is a false negative for a permission-hook-style
|
|
2882
|
+
* consumer that treats "command not found in the enumeration" as "nothing
|
|
2883
|
+
* to worry about" — an explicit, documented throw is safer than a silent
|
|
2884
|
+
* under-report. Gate-style consumers should treat this error as `deny`,
|
|
2885
|
+
* not fall back to "no commands found, so allow".
|
|
2886
|
+
*
|
|
2887
|
+
* @public
|
|
2888
|
+
*/
|
|
2889
|
+
export declare class ShAnalyzeMaxDepthError extends ShAstError {
|
|
2890
|
+
readonly code = "SH_AST_ANALYZE_MAX_DEPTH";
|
|
2891
|
+
/** The maximum nesting depth `enumerateCommands` supports; the same value every time (not caller-configurable). */
|
|
2892
|
+
readonly maxDepth: number;
|
|
2893
|
+
constructor(maxDepth: number);
|
|
2894
|
+
}
|
|
2895
|
+
|
|
2896
|
+
/** Shared failure classes for binding invariants, resource limits, and analysis contracts. */
|
|
2897
|
+
/**
|
|
2898
|
+
* Common base for every package failure, including upstream syntax errors and
|
|
2899
|
+
* analysis errors. The stable code discriminator supports programmatic handling
|
|
2900
|
+
* without interpreting display messages. Only concrete subclasses are thrown.
|
|
2901
|
+
* @public
|
|
2902
|
+
*/
|
|
2903
|
+
export declare abstract class ShAstError extends Error {
|
|
2904
|
+
/** Stable machine-readable identity of the concrete failure kind. */
|
|
2905
|
+
abstract readonly code: string;
|
|
2906
|
+
}
|
|
2907
|
+
|
|
2908
|
+
/**
|
|
2909
|
+
* Upstream BinAritOperator constant Shl. Its numeric value is preserved exactly.
|
|
2910
|
+
*
|
|
2911
|
+
* \<\<
|
|
2912
|
+
*
|
|
2913
|
+
* @public
|
|
2914
|
+
*/
|
|
2915
|
+
declare const Shl: 71;
|
|
2916
|
+
|
|
2917
|
+
/**
|
|
2918
|
+
* Upstream BinAritOperator constant ShlAssgn. Its numeric value is preserved exactly.
|
|
2919
|
+
*
|
|
2920
|
+
* \<\<=
|
|
2921
|
+
*
|
|
2922
|
+
* @public
|
|
2923
|
+
*/
|
|
2924
|
+
declare const ShlAssgn: 57;
|
|
2925
|
+
|
|
2926
|
+
/**
|
|
2927
|
+
* Upstream BinAritOperator constant Shr. Its numeric value is preserved exactly.
|
|
2928
|
+
*
|
|
2929
|
+
* \>\>
|
|
2930
|
+
*
|
|
2931
|
+
* @public
|
|
2932
|
+
*/
|
|
2933
|
+
declare const Shr: 64;
|
|
2934
|
+
|
|
2935
|
+
/**
|
|
2936
|
+
* Upstream BinAritOperator constant ShrAssgn. Its numeric value is preserved exactly.
|
|
2937
|
+
*
|
|
2938
|
+
* \>\>=
|
|
2939
|
+
*
|
|
2940
|
+
* @public
|
|
2941
|
+
*/
|
|
2942
|
+
declare const ShrAssgn: 58;
|
|
2943
|
+
|
|
2944
|
+
/**
|
|
2945
|
+
* Slice represents a character slicing expression inside a `ParamExp`.
|
|
2946
|
+
*
|
|
2947
|
+
* This node will only appear with `LangBash` and `LangMirBSDKorn`.
|
|
2948
|
+
* `LangZsh` uses a `BinaryArithm` with `Comma` in `ParamExp.Index` instead.
|
|
2949
|
+
*
|
|
2950
|
+
* Auxiliary syntax data, not a syntax.Node; it has no independent source bounds.
|
|
2951
|
+
*
|
|
2952
|
+
* @public
|
|
2953
|
+
*/
|
|
2954
|
+
export declare interface Slice {
|
|
2955
|
+
/**
|
|
2956
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
2957
|
+
*/
|
|
2958
|
+
Type: 'Slice';
|
|
2959
|
+
/**
|
|
2960
|
+
* Null preserves the upstream absence of this component.
|
|
2961
|
+
*/
|
|
2962
|
+
Length: ArithmExpr | null;
|
|
2963
|
+
/**
|
|
2964
|
+
* Null preserves the upstream absence of this component.
|
|
2965
|
+
*/
|
|
2966
|
+
Offset: ArithmExpr | null;
|
|
2967
|
+
}
|
|
2968
|
+
|
|
2969
|
+
/**
|
|
2970
|
+
* Stmt represents a statement, also known as a "complete command". It is
|
|
2971
|
+
* compromised of a command and other components that may come before or after
|
|
2972
|
+
* it.
|
|
2973
|
+
*
|
|
2974
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
2975
|
+
*
|
|
2976
|
+
* @public
|
|
2977
|
+
*/
|
|
2978
|
+
export declare interface Stmt {
|
|
2979
|
+
/**
|
|
2980
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
2981
|
+
*/
|
|
2982
|
+
Type: 'Stmt';
|
|
2983
|
+
/**
|
|
2984
|
+
* stmt &
|
|
2985
|
+
*
|
|
2986
|
+
* False is an explicit upstream value and is never omitted.
|
|
2987
|
+
*/
|
|
2988
|
+
Background: boolean;
|
|
2989
|
+
/**
|
|
2990
|
+
* Null preserves the upstream absence of this component.
|
|
2991
|
+
*/
|
|
2992
|
+
Cmd: Command | null;
|
|
2993
|
+
/**
|
|
2994
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array.
|
|
2995
|
+
*/
|
|
2996
|
+
Comments: Comment_2[] | null;
|
|
2997
|
+
/**
|
|
2998
|
+
* mksh's |&
|
|
2999
|
+
*
|
|
3000
|
+
* False is an explicit upstream value and is never omitted.
|
|
3001
|
+
*/
|
|
3002
|
+
Coprocess: boolean;
|
|
3003
|
+
/**
|
|
3004
|
+
* zsh's &| or &!
|
|
3005
|
+
*
|
|
3006
|
+
* False is an explicit upstream value and is never omitted.
|
|
3007
|
+
*/
|
|
3008
|
+
Disown: boolean;
|
|
3009
|
+
/**
|
|
3010
|
+
* ! stmt
|
|
3011
|
+
*
|
|
3012
|
+
* False is an explicit upstream value and is never omitted.
|
|
3013
|
+
*/
|
|
3014
|
+
Negated: boolean;
|
|
3015
|
+
/**
|
|
3016
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
3017
|
+
*/
|
|
3018
|
+
Position: SyntaxPos;
|
|
3019
|
+
/**
|
|
3020
|
+
* stmt \>a \<b
|
|
3021
|
+
*
|
|
3022
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
3023
|
+
*/
|
|
3024
|
+
Redirs: (Redirect | null)[] | null;
|
|
3025
|
+
/**
|
|
3026
|
+
* position of ';', '&', or '|&', if any
|
|
3027
|
+
*
|
|
3028
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
3029
|
+
*/
|
|
3030
|
+
Semicolon: SyntaxPos;
|
|
3031
|
+
}
|
|
3032
|
+
|
|
3033
|
+
/**
|
|
3034
|
+
* Upstream BinAritOperator constant Sub. Its numeric value is preserved exactly.
|
|
3035
|
+
*
|
|
3036
|
+
* -
|
|
3037
|
+
*
|
|
3038
|
+
* @public
|
|
3039
|
+
*/
|
|
3040
|
+
declare const Sub: 83;
|
|
3041
|
+
|
|
3042
|
+
/**
|
|
3043
|
+
* Upstream BinAritOperator constant SubAssgn. Its numeric value is preserved exactly.
|
|
3044
|
+
*
|
|
3045
|
+
* -=
|
|
3046
|
+
*
|
|
3047
|
+
* @public
|
|
3048
|
+
*/
|
|
3049
|
+
declare const SubAssgn: 50;
|
|
3050
|
+
|
|
3051
|
+
/**
|
|
3052
|
+
* Subshell represents a series of commands that should be executed in a nested
|
|
3053
|
+
* shell environment.
|
|
3054
|
+
*
|
|
3055
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
3056
|
+
*
|
|
3057
|
+
* @public
|
|
3058
|
+
*/
|
|
3059
|
+
export declare interface Subshell {
|
|
3060
|
+
/**
|
|
3061
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
3062
|
+
*/
|
|
3063
|
+
Type: 'Subshell';
|
|
3064
|
+
/**
|
|
3065
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array.
|
|
3066
|
+
*/
|
|
3067
|
+
Last: Comment_2[] | null;
|
|
3068
|
+
/**
|
|
3069
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
3070
|
+
*/
|
|
3071
|
+
Lparen: SyntaxPos;
|
|
3072
|
+
/**
|
|
3073
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
3074
|
+
*/
|
|
3075
|
+
Rparen: SyntaxPos;
|
|
3076
|
+
/**
|
|
3077
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
3078
|
+
*/
|
|
3079
|
+
Stmts: (Stmt | null)[] | null;
|
|
3080
|
+
}
|
|
3081
|
+
|
|
3082
|
+
/**
|
|
3083
|
+
* The observable value of an upstream syntax.Pos. Offset and Col count bytes; Line and Col use upstream numbering and overflow behavior. IsValid, IsRecovered, and OffsetOverflow retain distinctions that coordinates alone cannot express. Token positions are data; node bounds are derived operations.
|
|
3084
|
+
*
|
|
3085
|
+
* @public
|
|
3086
|
+
*/
|
|
3087
|
+
export declare interface SyntaxPos {
|
|
3088
|
+
/**
|
|
3089
|
+
* Zero-based source byte offset, including upstream saturation behavior.
|
|
3090
|
+
*/
|
|
3091
|
+
Offset: number;
|
|
3092
|
+
/**
|
|
3093
|
+
* One-based source line; zero retains upstream invalid or overflow information.
|
|
3094
|
+
*/
|
|
3095
|
+
Line: number;
|
|
3096
|
+
/**
|
|
3097
|
+
* One-based byte column; zero retains upstream invalid or overflow information.
|
|
3098
|
+
*/
|
|
3099
|
+
Col: number;
|
|
3100
|
+
/**
|
|
3101
|
+
* Whether upstream considers this position useful; recovered positions are not valid.
|
|
3102
|
+
*/
|
|
3103
|
+
IsValid: boolean;
|
|
3104
|
+
/**
|
|
3105
|
+
* Whether upstream synthesized this missing syntax position during error recovery.
|
|
3106
|
+
*/
|
|
3107
|
+
IsRecovered: boolean;
|
|
3108
|
+
/**
|
|
3109
|
+
* Whether the stored upstream offset exceeds its representable source-offset maximum, including the recovered sentinel. This preserves ordering distinctions even when Offset() reports zero; ordinary zero-invalid positions have false here.
|
|
3110
|
+
*/
|
|
3111
|
+
OffsetOverflow: boolean;
|
|
3112
|
+
}
|
|
3113
|
+
|
|
3114
|
+
/**
|
|
3115
|
+
* Upstream BinAritOperator constant TernColon. Its numeric value is preserved exactly.
|
|
3116
|
+
*
|
|
3117
|
+
* :
|
|
3118
|
+
*
|
|
3119
|
+
* @public
|
|
3120
|
+
*/
|
|
3121
|
+
declare const TernColon: 104;
|
|
3122
|
+
|
|
3123
|
+
/**
|
|
3124
|
+
* Upstream BinAritOperator constant TernQuest. Its numeric value is preserved exactly.
|
|
3125
|
+
*
|
|
3126
|
+
* ?
|
|
3127
|
+
*
|
|
3128
|
+
* @public
|
|
3129
|
+
*/
|
|
3130
|
+
declare const TernQuest: 85;
|
|
3131
|
+
|
|
3132
|
+
/**
|
|
3133
|
+
* TestClause represents a Bash extended test clause.
|
|
3134
|
+
*
|
|
3135
|
+
* This node will only appear with `LangBash` and `LangMirBSDKorn`.
|
|
3136
|
+
*
|
|
3137
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
3138
|
+
*
|
|
3139
|
+
* @public
|
|
3140
|
+
*/
|
|
3141
|
+
export declare interface TestClause {
|
|
3142
|
+
/**
|
|
3143
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
3144
|
+
*/
|
|
3145
|
+
Type: 'TestClause';
|
|
3146
|
+
/**
|
|
3147
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
3148
|
+
*/
|
|
3149
|
+
Left: SyntaxPos;
|
|
3150
|
+
/**
|
|
3151
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
3152
|
+
*/
|
|
3153
|
+
Right: SyntaxPos;
|
|
3154
|
+
/**
|
|
3155
|
+
* Null preserves the upstream absence of this component.
|
|
3156
|
+
*/
|
|
3157
|
+
X: TestExpr | null;
|
|
3158
|
+
}
|
|
3159
|
+
|
|
3160
|
+
/**
|
|
3161
|
+
* TestDecl represents the declaration of a Bats test function.
|
|
3162
|
+
*
|
|
3163
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
3164
|
+
*
|
|
3165
|
+
* @public
|
|
3166
|
+
*/
|
|
3167
|
+
export declare interface TestDecl {
|
|
3168
|
+
/**
|
|
3169
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
3170
|
+
*/
|
|
3171
|
+
Type: 'TestDecl';
|
|
3172
|
+
/**
|
|
3173
|
+
* Null preserves the upstream absence of this component.
|
|
3174
|
+
*/
|
|
3175
|
+
Body: Stmt | null;
|
|
3176
|
+
/**
|
|
3177
|
+
* Null preserves the upstream absence of this component.
|
|
3178
|
+
*/
|
|
3179
|
+
Description: Word | null;
|
|
3180
|
+
/**
|
|
3181
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
3182
|
+
*/
|
|
3183
|
+
Position: SyntaxPos;
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3186
|
+
/**
|
|
3187
|
+
* The concrete records and typed nil pointers accepted by upstream syntax.TestExpr. Typed nil kinds are limited to this interface's actual implementers; auxiliary records are excluded.
|
|
3188
|
+
*
|
|
3189
|
+
* @public
|
|
3190
|
+
*/
|
|
3191
|
+
export declare type TestExpr =
|
|
3192
|
+
| BinaryTest
|
|
3193
|
+
| ParenTest
|
|
3194
|
+
| UnaryTest
|
|
3195
|
+
| Word
|
|
3196
|
+
| TypedNil<'BinaryTest' | 'ParenTest' | 'UnaryTest' | 'Word'>;
|
|
3197
|
+
|
|
3198
|
+
/**
|
|
3199
|
+
* TimeClause represents a Bash time clause. PosixFormat corresponds to the -p
|
|
3200
|
+
* flag.
|
|
3201
|
+
*
|
|
3202
|
+
* This node will only appear with `LangBash` and `LangMirBSDKorn`.
|
|
3203
|
+
*
|
|
3204
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
3205
|
+
*
|
|
3206
|
+
* @public
|
|
3207
|
+
*/
|
|
3208
|
+
export declare interface TimeClause {
|
|
3209
|
+
/**
|
|
3210
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
3211
|
+
*/
|
|
3212
|
+
Type: 'TimeClause';
|
|
3213
|
+
/**
|
|
3214
|
+
* False is an explicit upstream value and is never omitted.
|
|
3215
|
+
*/
|
|
3216
|
+
PosixFormat: boolean;
|
|
3217
|
+
/**
|
|
3218
|
+
* Null preserves the upstream absence of this component.
|
|
3219
|
+
*/
|
|
3220
|
+
Stmt: Stmt | null;
|
|
3221
|
+
/**
|
|
3222
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
3223
|
+
*/
|
|
3224
|
+
Time: SyntaxPos;
|
|
3225
|
+
}
|
|
3226
|
+
|
|
3227
|
+
/**
|
|
3228
|
+
* Upstream BinTestOperator constant TsAfter. Its numeric value is preserved exactly.
|
|
3229
|
+
*
|
|
3230
|
+
* \>
|
|
3231
|
+
*
|
|
3232
|
+
* @public
|
|
3233
|
+
*/
|
|
3234
|
+
declare const TsAfter: 63;
|
|
3235
|
+
|
|
3236
|
+
/**
|
|
3237
|
+
* Upstream BinTestOperator constant TsBefore. Its numeric value is preserved exactly.
|
|
3238
|
+
*
|
|
3239
|
+
* \<
|
|
3240
|
+
*
|
|
3241
|
+
* @public
|
|
3242
|
+
*/
|
|
3243
|
+
declare const TsBefore: 65;
|
|
3244
|
+
|
|
3245
|
+
/**
|
|
3246
|
+
* Upstream UnTestOperator constant TsBlckSp. Its numeric value is preserved exactly.
|
|
3247
|
+
*
|
|
3248
|
+
* -b
|
|
3249
|
+
*
|
|
3250
|
+
* @public
|
|
3251
|
+
*/
|
|
3252
|
+
declare const TsBlckSp: 109;
|
|
3253
|
+
|
|
3254
|
+
/**
|
|
3255
|
+
* Upstream UnTestOperator constant TsCharSp. Its numeric value is preserved exactly.
|
|
3256
|
+
*
|
|
3257
|
+
* -c
|
|
3258
|
+
*
|
|
3259
|
+
* @public
|
|
3260
|
+
*/
|
|
3261
|
+
declare const TsCharSp: 108;
|
|
3262
|
+
|
|
3263
|
+
/**
|
|
3264
|
+
* Upstream BinTestOperator constant TsDevIno. Its numeric value is preserved exactly.
|
|
3265
|
+
*
|
|
3266
|
+
* -ef
|
|
3267
|
+
*
|
|
3268
|
+
* @public
|
|
3269
|
+
*/
|
|
3270
|
+
declare const TsDevIno: 132;
|
|
3271
|
+
|
|
3272
|
+
/**
|
|
3273
|
+
* Upstream UnTestOperator constant TsDirect. Its numeric value is preserved exactly.
|
|
3274
|
+
*
|
|
3275
|
+
* -d
|
|
3276
|
+
*
|
|
3277
|
+
* @public
|
|
3278
|
+
*/
|
|
3279
|
+
declare const TsDirect: 107;
|
|
3280
|
+
|
|
3281
|
+
/**
|
|
3282
|
+
* Upstream UnTestOperator constant TsEmpStr. Its numeric value is preserved exactly.
|
|
3283
|
+
*
|
|
3284
|
+
* -z
|
|
3285
|
+
*
|
|
3286
|
+
* @public
|
|
3287
|
+
*/
|
|
3288
|
+
declare const TsEmpStr: 124;
|
|
3289
|
+
|
|
3290
|
+
/**
|
|
3291
|
+
* Upstream BinTestOperator constant TsEql. Its numeric value is preserved exactly.
|
|
3292
|
+
*
|
|
3293
|
+
* -eq
|
|
3294
|
+
*
|
|
3295
|
+
* @public
|
|
3296
|
+
*/
|
|
3297
|
+
declare const TsEql: 133;
|
|
3298
|
+
|
|
3299
|
+
/**
|
|
3300
|
+
* Upstream UnTestOperator constant TsExec. Its numeric value is preserved exactly.
|
|
3301
|
+
*
|
|
3302
|
+
* -x
|
|
3303
|
+
*
|
|
3304
|
+
* @public
|
|
3305
|
+
*/
|
|
3306
|
+
declare const TsExec: 121;
|
|
3307
|
+
|
|
3308
|
+
/**
|
|
3309
|
+
* Upstream UnTestOperator constant TsExists. Its numeric value is preserved exactly.
|
|
3310
|
+
*
|
|
3311
|
+
* -e
|
|
3312
|
+
*
|
|
3313
|
+
* @public
|
|
3314
|
+
*/
|
|
3315
|
+
declare const TsExists: 105;
|
|
3316
|
+
|
|
3317
|
+
/**
|
|
3318
|
+
* Upstream UnTestOperator constant TsFdTerm. Its numeric value is preserved exactly.
|
|
3319
|
+
*
|
|
3320
|
+
* -t
|
|
3321
|
+
*
|
|
3322
|
+
* @public
|
|
3323
|
+
*/
|
|
3324
|
+
declare const TsFdTerm: 123;
|
|
3325
|
+
|
|
3326
|
+
/**
|
|
3327
|
+
* Upstream BinTestOperator constant TsGeq. Its numeric value is preserved exactly.
|
|
3328
|
+
*
|
|
3329
|
+
* -ge
|
|
3330
|
+
*
|
|
3331
|
+
* @public
|
|
3332
|
+
*/
|
|
3333
|
+
declare const TsGeq: 136;
|
|
3334
|
+
|
|
3335
|
+
/**
|
|
3336
|
+
* Upstream UnTestOperator constant TsGIDSet. Its numeric value is preserved exactly.
|
|
3337
|
+
*
|
|
3338
|
+
* -g
|
|
3339
|
+
*
|
|
3340
|
+
* @public
|
|
3341
|
+
*/
|
|
3342
|
+
declare const TsGIDSet: 114;
|
|
3343
|
+
|
|
3344
|
+
/**
|
|
3345
|
+
* Upstream UnTestOperator constant TsGrpOwn. Its numeric value is preserved exactly.
|
|
3346
|
+
*
|
|
3347
|
+
* -G
|
|
3348
|
+
*
|
|
3349
|
+
* @public
|
|
3350
|
+
*/
|
|
3351
|
+
declare const TsGrpOwn: 116;
|
|
3352
|
+
|
|
3353
|
+
/**
|
|
3354
|
+
* Upstream BinTestOperator constant TsGtr. Its numeric value is preserved exactly.
|
|
3355
|
+
*
|
|
3356
|
+
* -gt
|
|
3357
|
+
*
|
|
3358
|
+
* @public
|
|
3359
|
+
*/
|
|
3360
|
+
declare const TsGtr: 138;
|
|
3361
|
+
|
|
3362
|
+
/**
|
|
3363
|
+
* Upstream BinTestOperator constant TsLeq. Its numeric value is preserved exactly.
|
|
3364
|
+
*
|
|
3365
|
+
* -le
|
|
3366
|
+
*
|
|
3367
|
+
* @public
|
|
3368
|
+
*/
|
|
3369
|
+
declare const TsLeq: 135;
|
|
3370
|
+
|
|
3371
|
+
/**
|
|
3372
|
+
* Upstream BinTestOperator constant TsLss. Its numeric value is preserved exactly.
|
|
3373
|
+
*
|
|
3374
|
+
* -lt
|
|
3375
|
+
*
|
|
3376
|
+
* @public
|
|
3377
|
+
*/
|
|
3378
|
+
declare const TsLss: 137;
|
|
3379
|
+
|
|
3380
|
+
/**
|
|
3381
|
+
* Upstream BinTestOperator constant TsMatch. Its numeric value is preserved exactly.
|
|
3382
|
+
*
|
|
3383
|
+
* ==
|
|
3384
|
+
*
|
|
3385
|
+
* @public
|
|
3386
|
+
*/
|
|
3387
|
+
declare const TsMatch: 45;
|
|
3388
|
+
|
|
3389
|
+
/**
|
|
3390
|
+
* Upstream BinTestOperator constant TsMatchShort. Its numeric value is preserved exactly.
|
|
3391
|
+
*
|
|
3392
|
+
* =
|
|
3393
|
+
*
|
|
3394
|
+
* @public
|
|
3395
|
+
*/
|
|
3396
|
+
declare const TsMatchShort: 87;
|
|
3397
|
+
|
|
3398
|
+
/**
|
|
3399
|
+
* Upstream UnTestOperator constant TsModif. Its numeric value is preserved exactly.
|
|
3400
|
+
*
|
|
3401
|
+
* -N
|
|
3402
|
+
*
|
|
3403
|
+
* @public
|
|
3404
|
+
*/
|
|
3405
|
+
declare const TsModif: 118;
|
|
3406
|
+
|
|
3407
|
+
/**
|
|
3408
|
+
* Upstream UnTestOperator constant TsNempStr. Its numeric value is preserved exactly.
|
|
3409
|
+
*
|
|
3410
|
+
* -n
|
|
3411
|
+
*
|
|
3412
|
+
* @public
|
|
3413
|
+
*/
|
|
3414
|
+
declare const TsNempStr: 125;
|
|
3415
|
+
|
|
3416
|
+
/**
|
|
3417
|
+
* Upstream BinTestOperator constant TsNeq. Its numeric value is preserved exactly.
|
|
3418
|
+
*
|
|
3419
|
+
* -ne
|
|
3420
|
+
*
|
|
3421
|
+
* @public
|
|
3422
|
+
*/
|
|
3423
|
+
declare const TsNeq: 134;
|
|
3424
|
+
|
|
3425
|
+
/**
|
|
3426
|
+
* Upstream BinTestOperator constant TsNewer. Its numeric value is preserved exactly.
|
|
3427
|
+
*
|
|
3428
|
+
* -nt
|
|
3429
|
+
*
|
|
3430
|
+
* @public
|
|
3431
|
+
*/
|
|
3432
|
+
declare const TsNewer: 130;
|
|
3433
|
+
|
|
3434
|
+
/**
|
|
3435
|
+
* Upstream UnTestOperator constant TsNmPipe. Its numeric value is preserved exactly.
|
|
3436
|
+
*
|
|
3437
|
+
* -p
|
|
3438
|
+
*
|
|
3439
|
+
* @public
|
|
3440
|
+
*/
|
|
3441
|
+
declare const TsNmPipe: 110;
|
|
3442
|
+
|
|
3443
|
+
/**
|
|
3444
|
+
* Upstream UnTestOperator constant TsNoEmpty. Its numeric value is preserved exactly.
|
|
3445
|
+
*
|
|
3446
|
+
* -s
|
|
3447
|
+
*
|
|
3448
|
+
* @public
|
|
3449
|
+
*/
|
|
3450
|
+
declare const TsNoEmpty: 122;
|
|
3451
|
+
|
|
3452
|
+
/**
|
|
3453
|
+
* Upstream BinTestOperator constant TsNoMatch. Its numeric value is preserved exactly.
|
|
3454
|
+
*
|
|
3455
|
+
* !=
|
|
3456
|
+
*
|
|
3457
|
+
* @public
|
|
3458
|
+
*/
|
|
3459
|
+
declare const TsNoMatch: 46;
|
|
3460
|
+
|
|
3461
|
+
/**
|
|
3462
|
+
* Upstream UnTestOperator constant TsNot. Its numeric value is preserved exactly.
|
|
3463
|
+
*
|
|
3464
|
+
* !
|
|
3465
|
+
*
|
|
3466
|
+
* @public
|
|
3467
|
+
*/
|
|
3468
|
+
declare const TsNot: 39;
|
|
3469
|
+
|
|
3470
|
+
/**
|
|
3471
|
+
* Upstream BinTestOperator constant TsOlder. Its numeric value is preserved exactly.
|
|
3472
|
+
*
|
|
3473
|
+
* -ot
|
|
3474
|
+
*
|
|
3475
|
+
* @public
|
|
3476
|
+
*/
|
|
3477
|
+
declare const TsOlder: 131;
|
|
3478
|
+
|
|
3479
|
+
/**
|
|
3480
|
+
* Upstream UnTestOperator constant TsOptSet. Its numeric value is preserved exactly.
|
|
3481
|
+
*
|
|
3482
|
+
* -o
|
|
3483
|
+
*
|
|
3484
|
+
* @public
|
|
3485
|
+
*/
|
|
3486
|
+
declare const TsOptSet: 126;
|
|
3487
|
+
|
|
3488
|
+
/**
|
|
3489
|
+
* Upstream UnTestOperator constant TsParen. Its numeric value is preserved exactly.
|
|
3490
|
+
*
|
|
3491
|
+
* (
|
|
3492
|
+
*
|
|
3493
|
+
* @public
|
|
3494
|
+
*/
|
|
3495
|
+
declare const TsParen: 27;
|
|
3496
|
+
|
|
3497
|
+
/**
|
|
3498
|
+
* Upstream UnTestOperator constant TsRead. Its numeric value is preserved exactly.
|
|
3499
|
+
*
|
|
3500
|
+
* -r
|
|
3501
|
+
*
|
|
3502
|
+
* @public
|
|
3503
|
+
*/
|
|
3504
|
+
declare const TsRead: 119;
|
|
378
3505
|
|
|
379
3506
|
/**
|
|
380
|
-
*
|
|
3507
|
+
* Upstream UnTestOperator constant TsRefVar. Its numeric value is preserved exactly.
|
|
3508
|
+
*
|
|
3509
|
+
* -R
|
|
381
3510
|
*
|
|
382
3511
|
* @public
|
|
383
3512
|
*/
|
|
384
|
-
|
|
3513
|
+
declare const TsRefVar: 128;
|
|
3514
|
+
|
|
3515
|
+
/**
|
|
3516
|
+
* Upstream UnTestOperator constant TsRegFile. Its numeric value is preserved exactly.
|
|
3517
|
+
*
|
|
3518
|
+
* -f
|
|
3519
|
+
*
|
|
3520
|
+
* @public
|
|
3521
|
+
*/
|
|
3522
|
+
declare const TsRegFile: 106;
|
|
3523
|
+
|
|
3524
|
+
/**
|
|
3525
|
+
* Upstream BinTestOperator constant TsReMatch. Its numeric value is preserved exactly.
|
|
3526
|
+
*
|
|
3527
|
+
* =~
|
|
3528
|
+
*
|
|
3529
|
+
* @public
|
|
3530
|
+
*/
|
|
3531
|
+
declare const TsReMatch: 129;
|
|
3532
|
+
|
|
3533
|
+
/**
|
|
3534
|
+
* Upstream UnTestOperator constant TsSmbLink. Its numeric value is preserved exactly.
|
|
3535
|
+
*
|
|
3536
|
+
* -L
|
|
3537
|
+
*
|
|
3538
|
+
* @public
|
|
3539
|
+
*/
|
|
3540
|
+
declare const TsSmbLink: 112;
|
|
3541
|
+
|
|
3542
|
+
/**
|
|
3543
|
+
* Upstream UnTestOperator constant TsSocket. Its numeric value is preserved exactly.
|
|
3544
|
+
*
|
|
3545
|
+
* -S
|
|
3546
|
+
*
|
|
3547
|
+
* @public
|
|
3548
|
+
*/
|
|
3549
|
+
declare const TsSocket: 111;
|
|
3550
|
+
|
|
3551
|
+
/**
|
|
3552
|
+
* Upstream UnTestOperator constant TsSticky. Its numeric value is preserved exactly.
|
|
3553
|
+
*
|
|
3554
|
+
* -k
|
|
3555
|
+
*
|
|
3556
|
+
* @public
|
|
3557
|
+
*/
|
|
3558
|
+
declare const TsSticky: 113;
|
|
3559
|
+
|
|
3560
|
+
/**
|
|
3561
|
+
* Upstream UnTestOperator constant TsUIDSet. Its numeric value is preserved exactly.
|
|
3562
|
+
*
|
|
3563
|
+
* -u
|
|
3564
|
+
*
|
|
3565
|
+
* @public
|
|
3566
|
+
*/
|
|
3567
|
+
declare const TsUIDSet: 115;
|
|
3568
|
+
|
|
3569
|
+
/**
|
|
3570
|
+
* Upstream UnTestOperator constant TsUsrOwn. Its numeric value is preserved exactly.
|
|
3571
|
+
*
|
|
3572
|
+
* -O
|
|
3573
|
+
*
|
|
3574
|
+
* @public
|
|
3575
|
+
*/
|
|
3576
|
+
declare const TsUsrOwn: 117;
|
|
3577
|
+
|
|
3578
|
+
/**
|
|
3579
|
+
* Upstream UnTestOperator constant TsVarSet. Its numeric value is preserved exactly.
|
|
3580
|
+
*
|
|
3581
|
+
* -v
|
|
3582
|
+
*
|
|
3583
|
+
* @public
|
|
3584
|
+
*/
|
|
3585
|
+
declare const TsVarSet: 127;
|
|
3586
|
+
|
|
3587
|
+
/**
|
|
3588
|
+
* Upstream UnTestOperator constant TsWrite. Its numeric value is preserved exactly.
|
|
3589
|
+
*
|
|
3590
|
+
* -w
|
|
3591
|
+
*
|
|
3592
|
+
* @public
|
|
3593
|
+
*/
|
|
3594
|
+
declare const TsWrite: 120;
|
|
3595
|
+
|
|
3596
|
+
/**
|
|
3597
|
+
* An upstream interface containing a nil pointer of a concrete syntax.Node kind. This differs from a nil interface (null): the concrete Go type remains observable and can affect operations. Only interface-valued positions admit this tag; concrete pointer fields use null. No record fields or node bounds are stored on the tag.
|
|
3598
|
+
*
|
|
3599
|
+
* @public
|
|
3600
|
+
*/
|
|
3601
|
+
export declare interface TypedNil<
|
|
3602
|
+
ConcreteKind extends
|
|
3603
|
+
| 'ArithmCmd'
|
|
3604
|
+
| 'ArithmExp'
|
|
3605
|
+
| 'ArrayElem'
|
|
3606
|
+
| 'ArrayExpr'
|
|
3607
|
+
| 'Assign'
|
|
3608
|
+
| 'BinaryArithm'
|
|
3609
|
+
| 'BinaryCmd'
|
|
3610
|
+
| 'BinaryTest'
|
|
3611
|
+
| 'Block'
|
|
3612
|
+
| 'BraceExp'
|
|
3613
|
+
| 'CStyleLoop'
|
|
3614
|
+
| 'CallExpr'
|
|
3615
|
+
| 'CaseClause'
|
|
3616
|
+
| 'CaseItem'
|
|
3617
|
+
| 'CmdSubst'
|
|
3618
|
+
| 'Comment'
|
|
3619
|
+
| 'CoprocClause'
|
|
3620
|
+
| 'DblQuoted'
|
|
3621
|
+
| 'DeclClause'
|
|
3622
|
+
| 'ExtGlob'
|
|
3623
|
+
| 'File'
|
|
3624
|
+
| 'FlagsArithm'
|
|
3625
|
+
| 'ForClause'
|
|
3626
|
+
| 'FuncDecl'
|
|
3627
|
+
| 'IfClause'
|
|
3628
|
+
| 'LetClause'
|
|
3629
|
+
| 'Lit'
|
|
3630
|
+
| 'ParamExp'
|
|
3631
|
+
| 'ParenArithm'
|
|
3632
|
+
| 'ParenTest'
|
|
3633
|
+
| 'ProcSubst'
|
|
3634
|
+
| 'Redirect'
|
|
3635
|
+
| 'SglQuoted'
|
|
3636
|
+
| 'Stmt'
|
|
3637
|
+
| 'Subshell'
|
|
3638
|
+
| 'TestClause'
|
|
3639
|
+
| 'TestDecl'
|
|
3640
|
+
| 'TimeClause'
|
|
3641
|
+
| 'UnaryArithm'
|
|
3642
|
+
| 'UnaryTest'
|
|
3643
|
+
| 'WhileClause'
|
|
3644
|
+
| 'Word'
|
|
3645
|
+
| 'WordIter',
|
|
3646
|
+
> {
|
|
385
3647
|
/**
|
|
386
|
-
*
|
|
387
|
-
* {@link DEFAULT_TRANSPARENT_WRAPPERS}. Pass a replacement array to drop
|
|
388
|
-
* a default entry entirely (that wrapper is then treated as an ordinary,
|
|
389
|
-
* non-transparent effective command), or add project-specific entries
|
|
390
|
-
* (e.g. a `with-retry` wrapper) — the table is plain data, not baked-in
|
|
391
|
-
* policy.
|
|
392
|
-
*
|
|
393
|
-
* Validated at the {@link resolveArgv0} boundary: a malformed entry (a
|
|
394
|
-
* non-array `names`, an empty `names`, or a wrong-typed flag field)
|
|
395
|
-
* throws {@link ShAnalyzeInvalidWrapperSpecError} immediately, rather
|
|
396
|
-
* than failing later with a confusing native `TypeError` deep inside
|
|
397
|
-
* flag matching.
|
|
3648
|
+
* Distinguishes a typed nil interface value from a concrete syntax record.
|
|
398
3649
|
*/
|
|
399
|
-
|
|
3650
|
+
Type: 'TypedNil';
|
|
3651
|
+
/**
|
|
3652
|
+
* The concrete Go pointer type retained by the non-nil interface.
|
|
3653
|
+
*/
|
|
3654
|
+
Kind: ConcreteKind;
|
|
400
3655
|
}
|
|
401
3656
|
|
|
402
3657
|
/**
|
|
403
|
-
*
|
|
404
|
-
* so, what that string is — the atom of shell-AST static analysis (e.g.
|
|
405
|
-
* "is this word literally `rm`"). A word is static iff every part is a
|
|
406
|
-
* literal after shell unquoting: a bare `Lit` (backslash escapes
|
|
407
|
-
* processed), a `SglQuoted` (including `$'...'` ANSI-C escapes decoded),
|
|
408
|
-
* or a `DblQuoted` containing only literal parts (and not itself a
|
|
409
|
-
* `$"..."` locale translation) — including concatenations of these (`'r'm`
|
|
410
|
-
* resolves to `"rm"`). A word containing any expansion (`ParamExp`,
|
|
411
|
-
* `CmdSubst`, `ArithmExp`, `ProcSubst`), a triggering unquoted `~` (see
|
|
412
|
-
* `options.context`), an unquoted glob metacharacter/bracket
|
|
413
|
-
* expression/`ExtGlob`, a `$"..."` locale translation, or an unrepresentable
|
|
414
|
-
* `$'\U...'` escape is `static: false` with a reason — never an error, and
|
|
415
|
-
* never a safety judgment (see {@link WordResolution}).
|
|
416
|
-
*
|
|
417
|
-
* @param word - A `Word` node, e.g. `parseSync(...).stmts[0].cmd.args[0]`.
|
|
418
|
-
* A `word` sourced from `parseSync` has already passed that function's own
|
|
419
|
-
* pathological-nesting guard (`ShParseMaxDepthError` — see
|
|
420
|
-
* `parse-depth-guard.ts`), which rejects deeply-nested input before it is
|
|
421
|
-
* ever turned into a tree at all, so `resolveWord` itself never needs (and
|
|
422
|
-
* does not implement) a depth guard of its own.
|
|
423
|
-
* @param options - See {@link ResolveWordOptions}.
|
|
424
|
-
* @throws TypeError if `word.type` is not `"Word"` — a programmer-error
|
|
425
|
-
* misuse of the API, not a "malformed shell source" case (well-formed
|
|
426
|
-
* shell source, however dynamic, never throws; see {@link WordResolution}).
|
|
3658
|
+
* The upstream UnAritOperator domain: exact named tokens, the Go zero value, and explicitly validated unnamed uint32 values. Constants shared by upstream families retain their shared numeric identity.
|
|
427
3659
|
*
|
|
428
3660
|
* @public
|
|
429
3661
|
*/
|
|
430
|
-
export declare
|
|
3662
|
+
export declare type UnAritOperator =
|
|
3663
|
+
| 0
|
|
3664
|
+
| typeof BitNegation
|
|
3665
|
+
| typeof Dec
|
|
3666
|
+
| typeof Inc
|
|
3667
|
+
| typeof Minus
|
|
3668
|
+
| typeof Not
|
|
3669
|
+
| typeof Plus
|
|
3670
|
+
| RawOperator<'UnAritOperator'>;
|
|
431
3671
|
|
|
432
3672
|
/**
|
|
433
|
-
*
|
|
3673
|
+
* UnaryArithm represents an unary arithmetic expression. The unary operator
|
|
3674
|
+
* may come before or after the sub-expression.
|
|
3675
|
+
*
|
|
3676
|
+
* If Op is `Inc` or `Dec`, X will be a word with a single `Lit` whose value is a
|
|
3677
|
+
* valid name.
|
|
3678
|
+
*
|
|
3679
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
434
3680
|
*
|
|
435
3681
|
* @public
|
|
436
3682
|
*/
|
|
437
|
-
export declare interface
|
|
3683
|
+
export declare interface UnaryArithm {
|
|
438
3684
|
/**
|
|
439
|
-
*
|
|
440
|
-
* §3.5.2 ("Tilde Expansion") documents distinct tilde-expansion triggers
|
|
441
|
-
* for:
|
|
442
|
-
*
|
|
443
|
-
* - `'command-argument'` — an ordinary simple-command argument word (e.g.
|
|
444
|
-
* `echo <word>`). Only a *word-initial* unquoted `~` triggers tilde
|
|
445
|
-
* expansion; an unquoted `~` elsewhere in the word (including right
|
|
446
|
-
* after a `:`) is an ordinary character (`echo a:~b` prints `a:~b`
|
|
447
|
-
* literally in real bash).
|
|
448
|
-
* - `'assignment-value'` — the value side of a shell assignment (e.g.
|
|
449
|
-
* `PATH=<word>`, an `Assign` node's `value`). Bash additionally
|
|
450
|
-
* tilde-expands an unquoted `~` immediately following an unquoted `:`
|
|
451
|
-
* anywhere in the value (`PATH=/foo:~/bar` expands the `~/bar`
|
|
452
|
-
* segment) — this is documented for `PATH`-like colon-separated
|
|
453
|
-
* assignment values specifically.
|
|
454
|
-
*
|
|
455
|
-
* **Default: `'assignment-value'` semantics apply whenever this option is
|
|
456
|
-
* omitted.** `resolveWord` takes a bare `Word` node with no grammar
|
|
457
|
-
* context attached, so it cannot see whether its caller extracted that
|
|
458
|
-
* word from a command argument or an assignment value — omitting this
|
|
459
|
-
* option is deliberately treated as the *more conservative* of the two
|
|
460
|
-
* (the one that reports `'tilde'` in more cases), so a caller that
|
|
461
|
-
* doesn't know or care about the distinction never under-reports a real
|
|
462
|
-
* tilde-expansion site. Pass `'command-argument'` explicitly to opt into
|
|
463
|
-
* the narrower, word-initial-only check that matches real bash's
|
|
464
|
-
* behavior for ordinary arguments.
|
|
465
|
-
*
|
|
466
|
-
* @see https://www.gnu.org/software/bash/manual/bash.html#Tilde-Expansion
|
|
3685
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
467
3686
|
*/
|
|
468
|
-
|
|
3687
|
+
Type: 'UnaryArithm';
|
|
3688
|
+
/**
|
|
3689
|
+
* Upstream operator value, preserving named tokens, zero, and explicitly represented raw uint32 values.
|
|
3690
|
+
*/
|
|
3691
|
+
Op: UnAritOperator;
|
|
3692
|
+
/**
|
|
3693
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
3694
|
+
*/
|
|
3695
|
+
OpPos: SyntaxPos;
|
|
3696
|
+
/**
|
|
3697
|
+
* False is an explicit upstream value and is never omitted.
|
|
3698
|
+
*/
|
|
3699
|
+
Post: boolean;
|
|
3700
|
+
/**
|
|
3701
|
+
* Null preserves the upstream absence of this component.
|
|
3702
|
+
*/
|
|
3703
|
+
X: ArithmExpr | null;
|
|
469
3704
|
}
|
|
470
3705
|
|
|
471
3706
|
/**
|
|
472
|
-
*
|
|
473
|
-
*
|
|
474
|
-
*
|
|
475
|
-
*
|
|
476
|
-
* point the malformed table is supplied, rather than letting the bad shape
|
|
477
|
-
* reach flag-matching logic and surface as a confusing native `TypeError`
|
|
478
|
-
* (or, worse, a silently wrong match) far from its actual cause.
|
|
3707
|
+
* UnaryTest represents a unary test expression. The unary operator may come
|
|
3708
|
+
* before or after the sub-expression.
|
|
3709
|
+
*
|
|
3710
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
479
3711
|
*
|
|
480
3712
|
* @public
|
|
481
3713
|
*/
|
|
482
|
-
export declare
|
|
483
|
-
|
|
484
|
-
|
|
3714
|
+
export declare interface UnaryTest {
|
|
3715
|
+
/**
|
|
3716
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
3717
|
+
*/
|
|
3718
|
+
Type: 'UnaryTest';
|
|
3719
|
+
/**
|
|
3720
|
+
* Upstream operator value, preserving named tokens, zero, and explicitly represented raw uint32 values.
|
|
3721
|
+
*/
|
|
3722
|
+
Op: UnTestOperator;
|
|
3723
|
+
/**
|
|
3724
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
3725
|
+
*/
|
|
3726
|
+
OpPos: SyntaxPos;
|
|
3727
|
+
/**
|
|
3728
|
+
* Null preserves the upstream absence of this component.
|
|
3729
|
+
*/
|
|
3730
|
+
X: TestExpr | null;
|
|
485
3731
|
}
|
|
486
3732
|
|
|
487
3733
|
/**
|
|
488
|
-
*
|
|
489
|
-
* nested structure — subshells within subshells, chained command/process
|
|
490
|
-
* substitutions, deeply nested `if`/`case`/loop/function/`time`/`{ }`
|
|
491
|
-
* bodies, deeply chained `elif` — exceeds its defensive recursion-depth
|
|
492
|
-
* guard. **Not** thrown for a long *linear* chain (`|`/`|&`/`&&`/`||` of
|
|
493
|
-
* any realistic length): `enumerateCommands` traverses those iteratively,
|
|
494
|
-
* so chain length alone never grows this guard's depth counter — only
|
|
495
|
-
* genuine tree nesting does.
|
|
3734
|
+
* The upstream UnTestOperator domain: exact named tokens, the Go zero value, and explicitly validated unnamed uint32 values. Constants shared by upstream families retain their shared numeric identity.
|
|
496
3735
|
*
|
|
497
|
-
*
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
3736
|
+
* @public
|
|
3737
|
+
*/
|
|
3738
|
+
export declare type UnTestOperator =
|
|
3739
|
+
| 0
|
|
3740
|
+
| typeof TsBlckSp
|
|
3741
|
+
| typeof TsCharSp
|
|
3742
|
+
| typeof TsDirect
|
|
3743
|
+
| typeof TsEmpStr
|
|
3744
|
+
| typeof TsExec
|
|
3745
|
+
| typeof TsExists
|
|
3746
|
+
| typeof TsFdTerm
|
|
3747
|
+
| typeof TsGIDSet
|
|
3748
|
+
| typeof TsGrpOwn
|
|
3749
|
+
| typeof TsModif
|
|
3750
|
+
| typeof TsNempStr
|
|
3751
|
+
| typeof TsNmPipe
|
|
3752
|
+
| typeof TsNoEmpty
|
|
3753
|
+
| typeof TsNot
|
|
3754
|
+
| typeof TsOptSet
|
|
3755
|
+
| typeof TsParen
|
|
3756
|
+
| typeof TsRead
|
|
3757
|
+
| typeof TsRefVar
|
|
3758
|
+
| typeof TsRegFile
|
|
3759
|
+
| typeof TsSmbLink
|
|
3760
|
+
| typeof TsSocket
|
|
3761
|
+
| typeof TsSticky
|
|
3762
|
+
| typeof TsUIDSet
|
|
3763
|
+
| typeof TsUsrOwn
|
|
3764
|
+
| typeof TsVarSet
|
|
3765
|
+
| typeof TsWrite
|
|
3766
|
+
| RawOperator<'UnTestOperator'>;
|
|
3767
|
+
|
|
3768
|
+
/**
|
|
3769
|
+
* Upstream ParExpOperator constant UpperAll. Its numeric value is preserved exactly.
|
|
3770
|
+
*
|
|
3771
|
+
* ^^
|
|
504
3772
|
*
|
|
505
3773
|
* @public
|
|
506
3774
|
*/
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
3775
|
+
declare const UpperAll: 97;
|
|
3776
|
+
|
|
3777
|
+
/**
|
|
3778
|
+
* Upstream ParExpOperator constant UpperFirst. Its numeric value is preserved exactly.
|
|
3779
|
+
*
|
|
3780
|
+
* ^
|
|
3781
|
+
*
|
|
3782
|
+
* @public
|
|
3783
|
+
*/
|
|
3784
|
+
declare const UpperFirst: 96;
|
|
3785
|
+
|
|
3786
|
+
/**
|
|
3787
|
+
* WhileClause represents a while or an until clause.
|
|
3788
|
+
*
|
|
3789
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
3790
|
+
*
|
|
3791
|
+
* @public
|
|
3792
|
+
*/
|
|
3793
|
+
export declare interface WhileClause {
|
|
3794
|
+
/**
|
|
3795
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
3796
|
+
*/
|
|
3797
|
+
Type: 'WhileClause';
|
|
3798
|
+
/**
|
|
3799
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
3800
|
+
*/
|
|
3801
|
+
Cond: (Stmt | null)[] | null;
|
|
3802
|
+
/**
|
|
3803
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array.
|
|
3804
|
+
*/
|
|
3805
|
+
CondLast: Comment_2[] | null;
|
|
3806
|
+
/**
|
|
3807
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
3808
|
+
*/
|
|
3809
|
+
Do: (Stmt | null)[] | null;
|
|
3810
|
+
/**
|
|
3811
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array.
|
|
3812
|
+
*/
|
|
3813
|
+
DoLast: Comment_2[] | null;
|
|
3814
|
+
/**
|
|
3815
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
3816
|
+
*/
|
|
3817
|
+
DoPos: SyntaxPos;
|
|
3818
|
+
/**
|
|
3819
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
3820
|
+
*/
|
|
3821
|
+
DonePos: SyntaxPos;
|
|
3822
|
+
/**
|
|
3823
|
+
* False is an explicit upstream value and is never omitted.
|
|
3824
|
+
*/
|
|
3825
|
+
Until: boolean;
|
|
3826
|
+
/**
|
|
3827
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
3828
|
+
*/
|
|
3829
|
+
WhilePos: SyntaxPos;
|
|
512
3830
|
}
|
|
513
3831
|
|
|
514
3832
|
/**
|
|
515
|
-
*
|
|
516
|
-
*
|
|
517
|
-
*
|
|
518
|
-
* {@link ShAnalyzeInvalidWrapperSpecError}). Provides a stable, documented
|
|
519
|
-
* `code` discriminator (e.g. `"SH_AST_PARSE_ERROR"`) alongside the usual
|
|
520
|
-
* `instanceof` narrowing, so consumers can branch on failure kind
|
|
521
|
-
* programmatically without parsing `.message` strings. Never thrown directly
|
|
522
|
-
* — only via its concrete subclasses
|
|
523
|
-
* ({@link sh-ast#ShParseError | ShParseError},
|
|
524
|
-
* {@link sh-ast#ShInvalidDialectError | ShInvalidDialectError},
|
|
525
|
-
* {@link sh-ast#ShInternalError | ShInternalError},
|
|
526
|
-
* {@link ShAnalyzeMaxDepthError},
|
|
527
|
-
* {@link sh-ast#ShParseMaxDepthError | ShParseMaxDepthError},
|
|
528
|
-
* {@link ShAnalyzeInvalidWrapperSpecError}).
|
|
3833
|
+
* Word represents a shell word, containing one or more word parts contiguous to
|
|
3834
|
+
* each other. The word is delimited by word boundaries, such as spaces,
|
|
3835
|
+
* newlines, semicolons, or parentheses.
|
|
529
3836
|
*
|
|
530
|
-
*
|
|
531
|
-
* point (see #23) — every subclass thrown by `sh-ast/analyze`'s own
|
|
532
|
-
* functions extends this, so a consumer of that subpath alone can
|
|
533
|
-
* `catch`/reference the base without also importing from root.
|
|
3837
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
534
3838
|
*
|
|
535
3839
|
* @public
|
|
536
3840
|
*/
|
|
537
|
-
export declare
|
|
3841
|
+
export declare interface Word {
|
|
538
3842
|
/**
|
|
539
|
-
*
|
|
540
|
-
* per subclass and will not change once published.
|
|
3843
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
541
3844
|
*/
|
|
542
|
-
|
|
3845
|
+
Type: 'Word';
|
|
3846
|
+
/**
|
|
3847
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
3848
|
+
*/
|
|
3849
|
+
Parts: (WordPart | null)[] | null;
|
|
543
3850
|
}
|
|
544
3851
|
|
|
545
3852
|
/**
|
|
546
|
-
*
|
|
3853
|
+
* Upstream RedirOperator constant WordHdoc. Its numeric value is preserved exactly.
|
|
3854
|
+
*
|
|
3855
|
+
* \<\<\<
|
|
547
3856
|
*
|
|
548
|
-
*
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
*
|
|
554
|
-
*
|
|
3857
|
+
* @public
|
|
3858
|
+
*/
|
|
3859
|
+
declare const WordHdoc: 73;
|
|
3860
|
+
|
|
3861
|
+
/**
|
|
3862
|
+
* WordIter represents the iteration of a variable over a series of words in a
|
|
3863
|
+
* for clause. If InPos is an invalid position, the "in" token was missing, so
|
|
3864
|
+
* the iteration is over the shell's positional parameters.
|
|
555
3865
|
*
|
|
556
|
-
*
|
|
557
|
-
* surface consumes and exposes `ShNode`, so a consumer can reference the type
|
|
558
|
-
* without also importing from the root `sh-ast` entry point.
|
|
3866
|
+
* A syntax node with mutable upstream fields. Its source bounds are derived from the current fields and children.
|
|
559
3867
|
*
|
|
560
3868
|
* @public
|
|
561
3869
|
*/
|
|
562
|
-
export declare interface
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
3870
|
+
export declare interface WordIter {
|
|
3871
|
+
/**
|
|
3872
|
+
* Identifies the upstream concrete record when carried through an interface union.
|
|
3873
|
+
*/
|
|
3874
|
+
Type: 'WordIter';
|
|
3875
|
+
/**
|
|
3876
|
+
* position of "in"
|
|
3877
|
+
*
|
|
3878
|
+
* Recorded source position; invalid and recovered states remain distinct.
|
|
3879
|
+
*/
|
|
3880
|
+
InPos: SyntaxPos;
|
|
3881
|
+
/**
|
|
3882
|
+
* Ordered upstream entries. Null preserves a nil slice and differs from an empty array. Null entries preserve nil elements.
|
|
3883
|
+
*/
|
|
3884
|
+
Items: (Word | null)[] | null;
|
|
3885
|
+
/**
|
|
3886
|
+
* Null preserves the upstream absence of this component.
|
|
3887
|
+
*/
|
|
3888
|
+
Name: Lit | null;
|
|
570
3889
|
}
|
|
571
3890
|
|
|
3891
|
+
/**
|
|
3892
|
+
* The concrete records and typed nil pointers accepted by upstream syntax.WordPart. Typed nil kinds are limited to this interface's actual implementers; auxiliary records are excluded.
|
|
3893
|
+
*
|
|
3894
|
+
* @public
|
|
3895
|
+
*/
|
|
3896
|
+
export declare type WordPart =
|
|
3897
|
+
| ArithmExp
|
|
3898
|
+
| BraceExp
|
|
3899
|
+
| CmdSubst
|
|
3900
|
+
| DblQuoted
|
|
3901
|
+
| ExtGlob
|
|
3902
|
+
| Lit
|
|
3903
|
+
| ParamExp
|
|
3904
|
+
| ProcSubst
|
|
3905
|
+
| SglQuoted
|
|
3906
|
+
| TypedNil<
|
|
3907
|
+
| 'ArithmExp'
|
|
3908
|
+
| 'BraceExp'
|
|
3909
|
+
| 'CmdSubst'
|
|
3910
|
+
| 'DblQuoted'
|
|
3911
|
+
| 'ExtGlob'
|
|
3912
|
+
| 'Lit'
|
|
3913
|
+
| 'ParamExp'
|
|
3914
|
+
| 'ProcSubst'
|
|
3915
|
+
| 'SglQuoted'
|
|
3916
|
+
>;
|
|
3917
|
+
|
|
572
3918
|
/**
|
|
573
3919
|
* The result of statically resolving a `Word` node's text. Reports facts
|
|
574
3920
|
* only — never a safety verdict, never a hardcoded command/wrapper list.
|
|
@@ -630,7 +3976,8 @@ export declare const DEFAULT_TRANSPARENT_WRAPPERS: readonly WrapperSpec[];
|
|
|
630
3976
|
* `$"..."` word's *contents* would otherwise report — the `DblQuoted`
|
|
631
3977
|
* node's own `dollar` flag is checked before its children are visited at
|
|
632
3978
|
* all, so e.g. `$"hi $x"` reports `'locale'`, never `'expansion'`.
|
|
633
|
-
* - `'unsupported'` —
|
|
3979
|
+
* - `'unsupported'` — a word contains a nil or typed nil part, a literal carries a byte-preserving `Uint8Array`
|
|
3980
|
+
* rather than Unicode text, or the word contains a `$'...'` (ANSI-C quoted) `\u`/`\U`
|
|
634
3981
|
* escape whose value has no corresponding Unicode character (greater than
|
|
635
3982
|
* `U+10FFFF`, e.g. `$'\UFFFFFFFF'`): real bash's output for this case is
|
|
636
3983
|
* an undocumented, non-UTF-8 byte sequence with no exact representation
|
|
@@ -702,7 +4049,7 @@ export declare const DEFAULT_TRANSPARENT_WRAPPERS: readonly WrapperSpec[];
|
|
|
702
4049
|
* skipped — this is `env`'s and `sudo`'s own `VAR=val` *operand*
|
|
703
4050
|
* mechanism (setting variables in the wrapped command's environment),
|
|
704
4051
|
* which is a distinct, per-wrapper concept from the shell-level
|
|
705
|
-
* `CallExpr.
|
|
4052
|
+
* `CallExpr.Assigns` prefixes {@link Argv0Resolution.assignmentsSkipped}
|
|
706
4053
|
* counts.
|
|
707
4054
|
*/
|
|
708
4055
|
readonly skipAssignmentOperands?: boolean;
|
|
@@ -768,4 +4115,40 @@ export declare const DEFAULT_TRANSPARENT_WRAPPERS: readonly WrapperSpec[];
|
|
|
768
4115
|
readonly positionalOperandsBeforeCommand?: number;
|
|
769
4116
|
}
|
|
770
4117
|
|
|
4118
|
+
/**
|
|
4119
|
+
* Upstream BinAritOperator constant Xor. Its numeric value is preserved exactly.
|
|
4120
|
+
*
|
|
4121
|
+
* ^
|
|
4122
|
+
*
|
|
4123
|
+
* @public
|
|
4124
|
+
*/
|
|
4125
|
+
declare const Xor: 96;
|
|
4126
|
+
|
|
4127
|
+
/**
|
|
4128
|
+
* Upstream BinAritOperator constant XorAssgn. Its numeric value is preserved exactly.
|
|
4129
|
+
*
|
|
4130
|
+
* ^=
|
|
4131
|
+
*
|
|
4132
|
+
* @public
|
|
4133
|
+
*/
|
|
4134
|
+
declare const XorAssgn: 56;
|
|
4135
|
+
|
|
4136
|
+
/**
|
|
4137
|
+
* Upstream BinAritOperator constant XorBool. Its numeric value is preserved exactly.
|
|
4138
|
+
*
|
|
4139
|
+
* ^^
|
|
4140
|
+
*
|
|
4141
|
+
* @public
|
|
4142
|
+
*/
|
|
4143
|
+
declare const XorBool: 97;
|
|
4144
|
+
|
|
4145
|
+
/**
|
|
4146
|
+
* Upstream BinAritOperator constant XorBoolAssgn. Its numeric value is preserved exactly.
|
|
4147
|
+
*
|
|
4148
|
+
* ^^=
|
|
4149
|
+
*
|
|
4150
|
+
* @public
|
|
4151
|
+
*/
|
|
4152
|
+
declare const XorBoolAssgn: 61;
|
|
4153
|
+
|
|
771
4154
|
export { }
|