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