peachsim 0.1.2441 → 0.1.2442

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 (125) hide show
  1. package/README.md +4 -2
  2. package/detox/index.ts +20 -1
  3. package/dist-lib/agent-daemon-client.cjs +2 -2
  4. package/dist-lib/agent-events.cjs +1 -1
  5. package/dist-lib/attached-projects.cjs +1 -1
  6. package/dist-lib/auth/shared-session.cjs +1 -1
  7. package/dist-lib/backend-origin.cjs +1 -1
  8. package/dist-lib/beta.cjs +1 -1
  9. package/dist-lib/beta.mjs +2 -2
  10. package/dist-lib/bridge-constants.cjs +1 -1
  11. package/dist-lib/bridge-contract-input.cjs +1 -1
  12. package/dist-lib/bridge-contract-input.mjs +5 -5
  13. package/dist-lib/bridge-contract.cjs +1 -1
  14. package/dist-lib/bridge-contract.mjs +3 -3
  15. package/dist-lib/bundle-channel.cjs +42 -22
  16. package/dist-lib/capture-contract.cjs +1 -1
  17. package/dist-lib/capture-contract.mjs +3 -3
  18. package/dist-lib/cloud-contract.cjs +1 -1
  19. package/dist-lib/cloud-contract.mjs +3 -3
  20. package/dist-lib/cloud-test-args.cjs +1 -1
  21. package/dist-lib/cloud-test-args.mjs +2 -2
  22. package/dist-lib/cloud.cjs +1 -1
  23. package/dist-lib/cloud.mjs +7 -7
  24. package/dist-lib/config.cjs +1 -1
  25. package/dist-lib/config.mjs +5 -5
  26. package/dist-lib/detox/index.cjs +17 -5
  27. package/dist-lib/dev-bundle-resolution.cjs +1 -1
  28. package/dist-lib/esm-chunks/{acorn-FRQNHKFC.mjs → acorn-D5YJOCIH.mjs} +3 -3
  29. package/dist-lib/esm-chunks/{chunk-VAQJQDWI.mjs → chunk-2WXLADPB.mjs} +1 -1
  30. package/dist-lib/esm-chunks/{chunk-QYYJESMK.mjs → chunk-AAUTS54C.mjs} +1 -1
  31. package/dist-lib/esm-chunks/{chunk-PMGJ7FLI.mjs → chunk-CHX6MVMJ.mjs} +1 -1
  32. package/dist-lib/esm-chunks/{chunk-DJMWTW2B.mjs → chunk-COWKF3A3.mjs} +1 -1
  33. package/dist-lib/esm-chunks/{chunk-ZCMAKWHN.mjs → chunk-DGMP72J3.mjs} +1 -1
  34. package/dist-lib/esm-chunks/{chunk-NPLEBOWJ.mjs → chunk-DSGMAFCS.mjs} +1 -1
  35. package/dist-lib/esm-chunks/{chunk-O4EOBXAP.mjs → chunk-HBINLWOI.mjs} +1 -1
  36. package/dist-lib/esm-chunks/{chunk-IRMC5BCX.mjs → chunk-IL72GVD2.mjs} +1 -1
  37. package/dist-lib/esm-chunks/{chunk-VCAJFWZD.mjs → chunk-MYQU622L.mjs} +1 -1
  38. package/dist-lib/esm-chunks/{chunk-4ZRMJ5YO.mjs → chunk-NPSA7CAZ.mjs} +1 -1
  39. package/dist-lib/esm-chunks/{chunk-4BZ3Z3IQ.mjs → chunk-NZRT4DMX.mjs} +2 -2
  40. package/dist-lib/esm-chunks/{chunk-QUBR7LHU.mjs → chunk-PTLTHUGX.mjs} +37 -13
  41. package/dist-lib/esm-chunks/{chunk-ABMB3G7I.mjs → chunk-Q3B6RI26.mjs} +3 -3
  42. package/dist-lib/esm-chunks/{chunk-BAYRN7ZL.mjs → chunk-QUCZFE4Q.mjs} +1 -1
  43. package/dist-lib/esm-chunks/{chunk-6A6JEVIF.mjs → chunk-QZBKRPVC.mjs} +1 -1
  44. package/dist-lib/esm-chunks/{chunk-XO5GX4PI.mjs → chunk-S6SCCQXW.mjs} +1 -1
  45. package/dist-lib/esm-chunks/{chunk-4HEUXQGM.mjs → chunk-VIB2KS3Z.mjs} +4 -4
  46. package/dist-lib/esm-chunks/{chunk-ORYS5CC4.mjs → chunk-ZTXYR22R.mjs} +1 -1
  47. package/dist-lib/esm-chunks/{metro-layout-parser-AUAVE5VL.mjs → metro-layout-parser-BIIH3PF6.mjs} +3 -3
  48. package/dist-lib/expo-swift-bundle.cjs +41 -15
  49. package/dist-lib/expo-swift-metadata.cjs +1 -1
  50. package/dist-lib/expo-swift-metadata.mjs +7 -7
  51. package/dist-lib/home-paths.cjs +1 -1
  52. package/dist-lib/host/bridge-host.cjs +45 -25
  53. package/dist-lib/host/fetch-proxy-handler.cjs +6 -12
  54. package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
  55. package/dist-lib/host/fetch-proxy-overrides.mjs +2 -2
  56. package/dist-lib/host/replacement-module-handler.cjs +1 -1
  57. package/dist-lib/host/websocket-proxy.cjs +2 -2
  58. package/dist-lib/index.cjs +2 -2
  59. package/dist-lib/jump-to-source-babel.cjs +1 -1
  60. package/dist-lib/jump-to-source-native.cjs +14 -1
  61. package/dist-lib/kotlin-host.cjs +1 -1
  62. package/dist-lib/menu.cjs +1 -1
  63. package/dist-lib/menu.mjs +3 -3
  64. package/dist-lib/metro-fingerprint-registry.cjs +1 -1
  65. package/dist-lib/metro-fingerprint-registry.mjs +3 -3
  66. package/dist-lib/metro-production-bundle.cjs +1 -1
  67. package/dist-lib/metro-production-bundle.mjs +4 -4
  68. package/dist-lib/native-app-identity-project.cjs +2 -2
  69. package/dist-lib/native-app-identity-project.mjs +12 -12
  70. package/dist-lib/native-app-identity.cjs +1 -1
  71. package/dist-lib/native-app-identity.mjs +6 -6
  72. package/dist-lib/native-firebase-metadata.cjs +1 -1
  73. package/dist-lib/native-firebase-metadata.mjs +3 -3
  74. package/dist-lib/pdfium-raster.cjs +1 -1
  75. package/dist-lib/pdfium-raster.mjs +2 -2
  76. package/dist-lib/plist.cjs +1 -1
  77. package/dist-lib/plist.mjs +3 -3
  78. package/dist-lib/profiles.cjs +1 -1
  79. package/dist-lib/public-brand.cjs +1 -1
  80. package/dist-lib/public-origins-lib-esm.json +64 -64
  81. package/dist-lib/public-origins-lib-static.json +1 -1
  82. package/dist-lib/public-origins-lib.json +112 -66
  83. package/dist-lib/react-native-host-modules.cjs +1 -1
  84. package/dist-lib/react-native-host-modules.mjs +2 -2
  85. package/dist-lib/reap-browser.cjs +1 -1
  86. package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
  87. package/dist-lib/sdk.cjs +1 -1
  88. package/dist-lib/sdk.mjs +7 -7
  89. package/dist-lib/skills.cjs +55 -35
  90. package/dist-lib/swift-compile.cjs +33 -9
  91. package/dist-lib/swift-compile.mjs +8 -8
  92. package/dist-lib/swift-package.cjs +1 -1
  93. package/dist-lib/swift-package.mjs +3 -3
  94. package/dist-lib/swift-submit.cjs +1 -1
  95. package/dist-lib/swift-submit.mjs +5 -5
  96. package/dist-lib/swift-toolchain.cjs +1 -1
  97. package/dist-lib/swift.cjs +1 -1
  98. package/dist-lib/vendor/@peculiar/x509.cjs +1 -1
  99. package/dist-lib/vendor/@ruby/prism/src/nodes.js.cjs +14770 -0
  100. package/dist-lib/vendor/@ruby/prism/src/parsePrism.js.cjs +2790 -0
  101. package/dist-lib/vendor/acorn.cjs +1 -1
  102. package/dist-lib/vendor/bplist-parser.cjs +1 -1
  103. package/dist-lib/vendor/ignore.cjs +1 -1
  104. package/dist-lib/vendor/jiti.cjs +32732 -0
  105. package/dist-lib/vendor/magic-string.cjs +1 -1
  106. package/dist-lib/vendor/plist.cjs +1 -1
  107. package/dist-lib/vendor/prism.wasm +0 -0
  108. package/dist-lib/vendor/smol-toml.cjs +1 -1
  109. package/dist-lib/vendor/stream-json.cjs +1 -1
  110. package/dist-lib/vendor/sucrase/dist/index.js.cjs +1 -1
  111. package/dist-lib/vendor/sucrase/dist/parser/index.js.cjs +1 -1
  112. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/index.js.cjs +1 -1
  113. package/dist-lib/vendor/sucrase/dist/parser/tokenizer/types.js.cjs +1 -1
  114. package/dist-lib/vendor/sucrase.cjs +1 -1
  115. package/dist-lib/vendor/terser.cjs +1 -1
  116. package/dist-lib/vendor/valibot.cjs +1 -1
  117. package/dist-lib/vendor/ws.cjs +3710 -0
  118. package/dist-lib/vendor/zod.cjs +1 -1
  119. package/dist-lib/worklet-executable.cjs +1 -1
  120. package/dist-lib/worklet-executable.mjs +3 -3
  121. package/package.json +25 -6
  122. package/src/jump-to-source-native.ts +1 -0
  123. package/src/oxc-parser-peer.ts +12 -0
  124. package/src/podspec-prism.ts +7 -1
  125. package/src/swift-compile.ts +38 -8
@@ -0,0 +1,2790 @@
1
+ /*! peach v0.1.2442 | (c) 2026 Tamagui LLC | Proprietary; see LICENSE */
2
+ let __sootsim_import_meta_url = '', __sootsim_import_meta_dirname = '', __sootsim_import_meta_filename = ''; try { __sootsim_import_meta_url = require('url').pathToFileURL(__filename).href; __sootsim_import_meta_dirname = __dirname; __sootsim_import_meta_filename = __filename; } catch {}
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // ../../node_modules/@ruby/prism/src/parsePrism.js
32
+ var parsePrism_exports = {};
33
+ __export(parsePrism_exports, {
34
+ parsePrism: () => parsePrism
35
+ });
36
+ module.exports = __toCommonJS(parsePrism_exports);
37
+
38
+ // ../../node_modules/@ruby/prism/src/deserialize.js
39
+ var nodes = __toESM(require("peachsim/vendor/@ruby/prism/src/nodes.js"), 1);
40
+
41
+ // ../../node_modules/@ruby/prism/src/decoding.js
42
+ var binaryTextDecoder = {
43
+ /**
44
+ * Decodes a byte array into a string by treating each byte as a single
45
+ * character. This is used for the ASCII-8BIT encoding from Ruby.
46
+ *
47
+ * @param {Uint8Array} bytes
48
+ * @returns {string}
49
+ */
50
+ decode(bytes) {
51
+ let result = "";
52
+ for (const byte of bytes) {
53
+ result += String.fromCharCode(byte);
54
+ }
55
+ return result;
56
+ }
57
+ };
58
+ var decoders = /* @__PURE__ */ new Map();
59
+ function getDecoder(name, options = { fatal: false }) {
60
+ const lower = name.toLowerCase();
61
+ const key = `${lower}:${options.fatal ? "fatal" : "replacement"}`;
62
+ let decoder = decoders.get(key);
63
+ if (decoder !== void 0) {
64
+ return decoder;
65
+ }
66
+ if (lower === "ascii-8bit" || lower === "binary") {
67
+ decoder = binaryTextDecoder;
68
+ } else {
69
+ try {
70
+ decoder = new TextDecoder(lower, options);
71
+ } catch (error) {
72
+ if (error instanceof RangeError) {
73
+ decoder = binaryTextDecoder;
74
+ } else {
75
+ throw error;
76
+ }
77
+ }
78
+ }
79
+ decoders.set(key, decoder);
80
+ return decoder;
81
+ }
82
+
83
+ // ../../node_modules/@ruby/prism/src/source.js
84
+ var encoder = new TextEncoder();
85
+ var Source = class {
86
+ /**
87
+ * The bytes of the source code, in the encoding that it was parsed in.
88
+ *
89
+ * @type {Uint8Array}
90
+ */
91
+ bytes;
92
+ /**
93
+ * The name of the encoding that the source code is in, as determined by the
94
+ * parser options or by the encoding magic comment.
95
+ *
96
+ * @type {string}
97
+ */
98
+ encoding;
99
+ /**
100
+ * The line number that the source starts on.
101
+ *
102
+ * @type {number}
103
+ */
104
+ startLine;
105
+ /**
106
+ * The byte offset of the start of each line in the source code. The first
107
+ * element is always 0 to mark the first line.
108
+ *
109
+ * @type {number[]}
110
+ */
111
+ offsets;
112
+ /**
113
+ * The decoder used to convert this source's bytes into strings. It is created
114
+ * on first use because not every encoding that the parser accepts has a
115
+ * TextDecoder equivalent, and parsing should not fail on that basis.
116
+ *
117
+ * @type {Decoder | null}
118
+ */
119
+ #decoder;
120
+ /**
121
+ * Construct a new Source.
122
+ *
123
+ * @param {Uint8Array} bytes
124
+ * @param {string} encoding
125
+ * @param {number} startLine
126
+ * @param {number[]} offsets
127
+ */
128
+ constructor(bytes, encoding, startLine, offsets) {
129
+ this.bytes = bytes;
130
+ this.encoding = encoding;
131
+ this.startLine = startLine;
132
+ this.offsets = offsets;
133
+ this.#decoder = null;
134
+ }
135
+ /**
136
+ * Decode the given byte range of the source code into a string. Because a
137
+ * byte range can begin or end in the middle of a multi-byte character, bytes
138
+ * that do not form a whole character are decoded into replacement
139
+ * characters.
140
+ *
141
+ * @param {number} byteOffset
142
+ * @param {number} length
143
+ * @param {TextDecoder | null} decoder
144
+ * @returns {string}
145
+ */
146
+ slice(byteOffset, length, decoder = null) {
147
+ if (decoder === null) {
148
+ decoder = this.#defaultDecoder();
149
+ }
150
+ return decoder.decode(this.bytes.subarray(byteOffset, byteOffset + length));
151
+ }
152
+ /**
153
+ * The decoder for this source's own encoding. It is created on first use
154
+ * because not every encoding that the parser accepts has a TextDecoder
155
+ * equivalent, and parsing should not fail on that basis.
156
+ *
157
+ * @returns {Decoder}
158
+ */
159
+ #defaultDecoder() {
160
+ if (this.#decoder === null) {
161
+ this.#decoder = getDecoder(this.encoding);
162
+ }
163
+ return this.#decoder;
164
+ }
165
+ /**
166
+ * The line number that the given byte offset is on.
167
+ *
168
+ * @param {number} byteOffset
169
+ * @returns {number}
170
+ */
171
+ line(byteOffset) {
172
+ return this.startLine + this.findLine(byteOffset);
173
+ }
174
+ /**
175
+ * The byte offset of the start of the line that the given byte offset is on.
176
+ *
177
+ * @param {number} byteOffset
178
+ * @returns {number}
179
+ */
180
+ lineStart(byteOffset) {
181
+ return this.offsets[this.findLine(byteOffset)];
182
+ }
183
+ /**
184
+ * The byte offset of the end of the line that the given byte offset is on.
185
+ *
186
+ * @param {number} byteOffset
187
+ * @returns {number}
188
+ */
189
+ lineEnd(byteOffset) {
190
+ const offset = this.offsets[this.findLine(byteOffset) + 1];
191
+ return offset === void 0 ? this.bytes.length : offset;
192
+ }
193
+ /**
194
+ * The column in bytes of the given byte offset from the start of its line.
195
+ *
196
+ * @param {number} byteOffset
197
+ * @returns {number}
198
+ */
199
+ column(byteOffset) {
200
+ return byteOffset - this.lineStart(byteOffset);
201
+ }
202
+ /**
203
+ * The column in code units of the given byte offset from the start of its
204
+ * line, counted in the given position encoding. A code unit is the smallest
205
+ * unit of an encoding form, so utf-8 counts bytes, utf-16 counts sixteen bit
206
+ * units where characters outside the basic multilingual plane take two, and
207
+ * utf-32 counts whole codepoints.
208
+ *
209
+ * These are the three position encodings of the language server protocol,
210
+ * spelled the way the protocol spells them, so a negotiated value can be
211
+ * passed straight through. It defaults to utf-16 because that is what the
212
+ * protocol defaults to.
213
+ *
214
+ * The prefix of the line is decoded through this source's own encoding
215
+ * first, so a given character resolves to the same column no matter which
216
+ * encoding the source was parsed in.
217
+ *
218
+ * @param {number} byteOffset
219
+ * @param {"utf-8" | "utf-16" | "utf-32"} encoding
220
+ * @returns {number}
221
+ */
222
+ codeUnitsColumn(byteOffset, encoding = "utf-16") {
223
+ const lineStart = this.lineStart(byteOffset);
224
+ if (encoding === "utf-8" && this.encoding.toLowerCase() === "utf-8") {
225
+ return byteOffset - lineStart;
226
+ }
227
+ const prefix = this.#defaultDecoder().decode(this.bytes.subarray(lineStart, byteOffset));
228
+ switch (encoding) {
229
+ case "utf-8":
230
+ return encoder.encode(prefix).length;
231
+ case "utf-16":
232
+ return prefix.length;
233
+ case "utf-32": {
234
+ let count = prefix.length;
235
+ for (let index = 0; index < prefix.length; index++) {
236
+ const unit = prefix.charCodeAt(index);
237
+ if (unit >= 56320 && unit <= 57343) count--;
238
+ }
239
+ return count;
240
+ }
241
+ default:
242
+ throw new Error(`Unsupported position encoding '${encoding}'`);
243
+ }
244
+ }
245
+ /**
246
+ * Binary search through the offsets to find the index of the line that the
247
+ * given byte offset is on.
248
+ *
249
+ * @param {number} byteOffset
250
+ * @returns {number}
251
+ */
252
+ findLine(byteOffset) {
253
+ let low = 0;
254
+ let high = this.offsets.length;
255
+ while (low < high) {
256
+ const middle = low + high >>> 1;
257
+ if (this.offsets[middle] > byteOffset) {
258
+ high = middle;
259
+ } else {
260
+ low = middle + 1;
261
+ }
262
+ }
263
+ return low - 1;
264
+ }
265
+ };
266
+
267
+ // ../../node_modules/@ruby/prism/src/location.js
268
+ var Location = class {
269
+ /**
270
+ * The source that this location points into. It is private so that it stays
271
+ * off of the instance itself, which keeps locations cheap to serialize with
272
+ * JSON.stringify.
273
+ *
274
+ * @type {Source}
275
+ */
276
+ #source;
277
+ /**
278
+ * The byte offset from the beginning of the source where this location
279
+ * starts.
280
+ *
281
+ * @type {number}
282
+ */
283
+ startOffset;
284
+ /**
285
+ * The length of this location in bytes.
286
+ *
287
+ * @type {number}
288
+ */
289
+ length;
290
+ /**
291
+ * Construct a new Location.
292
+ *
293
+ * @param {Source} source
294
+ * @param {number} startOffset
295
+ * @param {number} length
296
+ */
297
+ constructor(source, startOffset, length) {
298
+ this.#source = source;
299
+ this.startOffset = startOffset;
300
+ this.length = length;
301
+ }
302
+ /**
303
+ * The byte offset from the beginning of the source where this location ends.
304
+ *
305
+ * @returns {number}
306
+ */
307
+ endOffset() {
308
+ return this.startOffset + this.length;
309
+ }
310
+ /**
311
+ * The line number where this location starts.
312
+ *
313
+ * @returns {number}
314
+ */
315
+ startLine() {
316
+ return this.#source.line(this.startOffset);
317
+ }
318
+ /**
319
+ * The line number where this location ends.
320
+ *
321
+ * @returns {number}
322
+ */
323
+ endLine() {
324
+ return this.#source.line(this.endOffset());
325
+ }
326
+ /**
327
+ * The column in bytes where this location starts from the start of its line.
328
+ *
329
+ * @returns {number}
330
+ */
331
+ startColumn() {
332
+ return this.#source.column(this.startOffset);
333
+ }
334
+ /**
335
+ * The column in bytes where this location ends from the start of its line.
336
+ *
337
+ * @returns {number}
338
+ */
339
+ endColumn() {
340
+ return this.#source.column(this.endOffset());
341
+ }
342
+ /**
343
+ * The column in code units where this location starts from the start of its
344
+ * line, counted in the given position encoding.
345
+ *
346
+ * @param {"utf-8" | "utf-16" | "utf-32"} encoding
347
+ * @returns {number}
348
+ */
349
+ startCodeUnitsColumn(encoding = "utf-16") {
350
+ return this.#source.codeUnitsColumn(this.startOffset, encoding);
351
+ }
352
+ /**
353
+ * The column in code units where this location ends from the start of its
354
+ * line, counted in the given position encoding.
355
+ *
356
+ * @param {"utf-8" | "utf-16" | "utf-32"} encoding
357
+ * @returns {number}
358
+ */
359
+ endCodeUnitsColumn(encoding = "utf-16") {
360
+ return this.#source.codeUnitsColumn(this.endOffset(), encoding);
361
+ }
362
+ /**
363
+ * The source code that this location represents.
364
+ *
365
+ * @param {TextDecoder | null} decoder
366
+ * @returns {string}
367
+ */
368
+ slice(decoder = null) {
369
+ return this.#source.slice(this.startOffset, this.length, decoder);
370
+ }
371
+ };
372
+
373
+ // ../../node_modules/@ruby/prism/src/deserialize.js
374
+ var MAJOR_VERSION = 2;
375
+ var MINOR_VERSION = 1;
376
+ var PATCH_VERSION = 0;
377
+ var LITTLE_ENDIAN = (() => {
378
+ let uint32 = new Uint32Array([287454020]);
379
+ let uint8 = new Uint8Array(uint32.buffer);
380
+ if (uint8[0] === 68) {
381
+ return true;
382
+ } else if (uint8[0] === 17) {
383
+ return false;
384
+ } else {
385
+ throw new Error("Mixed endianness");
386
+ }
387
+ })();
388
+ var SerializationBuffer = class {
389
+ constructor(array) {
390
+ this.array = array;
391
+ this.index = 0;
392
+ this.encoding = "utf-8";
393
+ this.source = null;
394
+ }
395
+ readByte() {
396
+ const result = this.array[this.index];
397
+ this.index += 1;
398
+ return result;
399
+ }
400
+ readBytes(length) {
401
+ const result = this.array.slice(this.index, this.index + length);
402
+ this.index += length;
403
+ return result;
404
+ }
405
+ readString(length, flags) {
406
+ return this.decodeString(this.readBytes(length), flags).value;
407
+ }
408
+ /* Read a 32-bit unsigned integer in little-endian format. */
409
+ readUint32() {
410
+ const result = this.scanUint32(this.index);
411
+ this.index += 4;
412
+ return result;
413
+ }
414
+ scanUint32(offset) {
415
+ const bytes = this.array.slice(offset, offset + 4);
416
+ return bytes[0] | bytes[1] << 8 | bytes[2] << 16 | bytes[3] << 24;
417
+ }
418
+ /**
419
+ * Read a signed integer that was written in zigzag encoding, where the low
420
+ * bit carries the sign. Both operators here are 32-bit, which is what makes
421
+ * this correct for zigzag values above 2^31, where readVarInt overflows and
422
+ * returns the bit pattern as a negative number.
423
+ */
424
+ readVarSInt() {
425
+ const value = this.readVarInt();
426
+ return value >>> 1 ^ -(value & 1);
427
+ }
428
+ readVarInt() {
429
+ let result = 0;
430
+ let shift = 0;
431
+ while (true) {
432
+ const byte = this.readByte();
433
+ result += (byte & 127) << shift;
434
+ shift += 7;
435
+ if ((byte & 128) === 0) {
436
+ break;
437
+ }
438
+ }
439
+ return result;
440
+ }
441
+ readLocation() {
442
+ const startOffset = this.readVarInt();
443
+ const length = this.readVarInt();
444
+ return new Location(this.source, startOffset, length);
445
+ }
446
+ readOptionalLocation() {
447
+ if (this.readByte() != 0) {
448
+ return this.readLocation();
449
+ } else {
450
+ return null;
451
+ }
452
+ }
453
+ readStringField(flags) {
454
+ if (flags === void 0) flags = 0;
455
+ return this.decodeString(this.readBytes(this.readVarInt()), flags);
456
+ }
457
+ scanConstant(constantPoolOffset, constantIndex) {
458
+ const offset = constantPoolOffset + constantIndex * 8;
459
+ const startOffset = this.scanUint32(offset);
460
+ const length = this.scanUint32(offset + 4);
461
+ return getDecoder(this.encoding, { fatal: true }).decode(this.array.slice(startOffset, startOffset + length));
462
+ }
463
+ readDouble() {
464
+ const view = new DataView(new ArrayBuffer(8));
465
+ for (let index = 0; index < 8; index++) {
466
+ view.setUint8(index, this.readByte());
467
+ }
468
+ return view.getFloat64(0, LITTLE_ENDIAN);
469
+ }
470
+ decodeString(bytes, flags) {
471
+ let value, encoding, validEncoding;
472
+ if ((flags & nodes.StringFlags.FORCED_BINARY_ENCODING) !== 0) {
473
+ encoding = "ascii-8bit";
474
+ } else if ((flags & nodes.StringFlags.FORCED_UTF8_ENCODING) !== 0) {
475
+ encoding = "utf-8";
476
+ } else {
477
+ encoding = this.encoding.toLowerCase();
478
+ }
479
+ const decoder = getDecoder(encoding, { fatal: true });
480
+ try {
481
+ value = decoder.decode(bytes);
482
+ validEncoding = true;
483
+ } catch (error) {
484
+ if (error instanceof TypeError) {
485
+ value = getDecoder("ascii-8bit").decode(bytes);
486
+ validEncoding = false;
487
+ } else {
488
+ throw error;
489
+ }
490
+ }
491
+ return { value, encoding, validEncoding };
492
+ }
493
+ };
494
+ var ParseResult = class {
495
+ /**
496
+ * @type {nodes.ProgramNode}
497
+ */
498
+ value;
499
+ /**
500
+ * @type {Comment[]}
501
+ */
502
+ comments;
503
+ /**
504
+ * @type {MagicComment[]}
505
+ */
506
+ magicComments;
507
+ /**
508
+ * @type {Location | null}
509
+ */
510
+ dataLoc;
511
+ /**
512
+ * @type {ParseError[]}
513
+ */
514
+ errors;
515
+ /**
516
+ * @type {ParseWarning[]}
517
+ */
518
+ warnings;
519
+ /**
520
+ * @type {boolean}
521
+ */
522
+ continuable;
523
+ /**
524
+ * @param {nodes.ProgramNode} value
525
+ * @param {Comment[]} comments
526
+ * @param {MagicComment[]} magicComments
527
+ * @param {Location | null} dataLoc
528
+ * @param {ParseError[]} errors
529
+ * @param {ParseWarning[]} warnings
530
+ * @param {boolean} continuable
531
+ */
532
+ constructor(value, comments, magicComments, dataLoc, errors, warnings, continuable) {
533
+ this.value = value;
534
+ this.comments = comments;
535
+ this.magicComments = magicComments;
536
+ this.dataLoc = dataLoc;
537
+ this.errors = errors;
538
+ this.warnings = warnings;
539
+ this.continuable = continuable;
540
+ }
541
+ };
542
+ var errorLevels = ["syntax", "argument", "load"];
543
+ var errorTypes = [
544
+ "alias_argument",
545
+ "alias_argument_numbered_reference",
546
+ "ampampeq_multi_assign",
547
+ "argument_after_block",
548
+ "argument_after_forwarding_ellipses",
549
+ "argument_bare_hash",
550
+ "argument_block_multi",
551
+ "argument_conflict_ampersand",
552
+ "argument_conflict_star",
553
+ "argument_conflict_star_star",
554
+ "argument_formal_class",
555
+ "argument_formal_constant",
556
+ "argument_formal_global",
557
+ "argument_formal_ivar",
558
+ "argument_forwarding_unbound",
559
+ "argument_no_forwarding_ampersand",
560
+ "argument_no_forwarding_ellipses",
561
+ "argument_no_forwarding_ellipses_lambda",
562
+ "argument_no_forwarding_ellipses_block",
563
+ "argument_no_forwarding_star",
564
+ "argument_no_forwarding_star_star",
565
+ "argument_splat_after_assoc_splat",
566
+ "argument_splat_after_splat",
567
+ "argument_term_paren",
568
+ "argument_unexpected_block",
569
+ "array_element",
570
+ "array_expression",
571
+ "array_expression_after_star",
572
+ "array_separator",
573
+ "array_term",
574
+ "begin_lonely_else",
575
+ "begin_term",
576
+ "begin_upcase_brace",
577
+ "begin_upcase_term",
578
+ "begin_upcase_toplevel",
579
+ "block_param_local_variable",
580
+ "block_param_pipe_term",
581
+ "block_term_brace",
582
+ "block_term_end",
583
+ "cannot_parse_expression",
584
+ "cannot_parse_string_part",
585
+ "case_expression_after_case",
586
+ "case_expression_after_when",
587
+ "case_match_missing_predicate",
588
+ "case_missing_conditions",
589
+ "case_term",
590
+ "class_in_method",
591
+ "class_name",
592
+ "class_superclass",
593
+ "class_term",
594
+ "class_unexpected_end",
595
+ "class_variable_bare",
596
+ "conditional_elsif_predicate",
597
+ "conditional_if_predicate",
598
+ "conditional_predicate_term",
599
+ "conditional_term",
600
+ "conditional_term_else",
601
+ "conditional_unless_predicate",
602
+ "conditional_until_predicate",
603
+ "conditional_while_predicate",
604
+ "constant_path_colon_colon_constant",
605
+ "def_endless",
606
+ "def_endless_parameters",
607
+ "def_endless_setter",
608
+ "def_endless_do_block",
609
+ "def_name",
610
+ "def_params_term",
611
+ "def_params_term_paren",
612
+ "def_receiver",
613
+ "def_receiver_term",
614
+ "def_term",
615
+ "defined_expression",
616
+ "embdoc_term",
617
+ "embexpr_end",
618
+ "embvar_invalid",
619
+ "end_upcase_brace",
620
+ "end_upcase_term",
621
+ "escape_invalid_control",
622
+ "escape_invalid_control_repeat",
623
+ "escape_invalid_hexadecimal",
624
+ "escape_invalid_meta",
625
+ "escape_invalid_meta_repeat",
626
+ "escape_invalid_unicode",
627
+ "escape_invalid_unicode_cm_flags",
628
+ "escape_invalid_unicode_list",
629
+ "escape_invalid_unicode_literal",
630
+ "escape_invalid_unicode_long",
631
+ "escape_invalid_unicode_short",
632
+ "escape_invalid_unicode_term",
633
+ "expect_argument",
634
+ "expect_eol_after_statement",
635
+ "expect_expression_after_ampampeq",
636
+ "expect_expression_after_comma",
637
+ "expect_expression_after_equal",
638
+ "expect_expression_after_less_less",
639
+ "expect_expression_after_lparen",
640
+ "expect_expression_after_operator",
641
+ "expect_expression_after_pipepipeeq",
642
+ "expect_expression_after_splat",
643
+ "expect_expression_after_splat_hash",
644
+ "expect_expression_after_star",
645
+ "expect_for_delimiter",
646
+ "expect_ident_req_parameter",
647
+ "expect_in_delimiter",
648
+ "expect_lparen_after_not_lparen",
649
+ "expect_lparen_after_not_other",
650
+ "expect_lparen_req_parameter",
651
+ "expect_message",
652
+ "expect_rbracket",
653
+ "expect_rparen",
654
+ "expect_rparen_after_multi",
655
+ "expect_rparen_req_parameter",
656
+ "expect_singleton_class_delimiter",
657
+ "expect_string_content",
658
+ "expect_when_delimiter",
659
+ "expression_bare_hash",
660
+ "expression_not_writable",
661
+ "expression_not_writable_encoding",
662
+ "expression_not_writable_false",
663
+ "expression_not_writable_file",
664
+ "expression_not_writable_line",
665
+ "expression_not_writable_nil",
666
+ "expression_not_writable_numbered",
667
+ "expression_not_writable_self",
668
+ "expression_not_writable_true",
669
+ "float_parse",
670
+ "for_collection",
671
+ "for_in",
672
+ "for_index",
673
+ "for_term",
674
+ "global_variable_bare",
675
+ "hash_expression_after_label",
676
+ "hash_key",
677
+ "hash_rocket",
678
+ "hash_term",
679
+ "hash_value",
680
+ "heredoc_identifier",
681
+ "heredoc_term",
682
+ "incomplete_question_mark",
683
+ "incomplete_variable_class",
684
+ "incomplete_variable_class_3_3",
685
+ "incomplete_variable_instance",
686
+ "incomplete_variable_instance_3_3",
687
+ "instance_variable_bare",
688
+ "invalid_block_exit",
689
+ "invalid_character",
690
+ "invalid_comma",
691
+ "invalid_encoding_magic_comment",
692
+ "invalid_escape_character",
693
+ "invalid_float_exponent",
694
+ "invalid_local_variable_read",
695
+ "invalid_local_variable_write",
696
+ "invalid_multibyte_char",
697
+ "invalid_multibyte_character",
698
+ "invalid_multibyte_escape",
699
+ "invalid_number_binary",
700
+ "invalid_number_decimal",
701
+ "invalid_number_fraction",
702
+ "invalid_number_hexadecimal",
703
+ "invalid_number_octal",
704
+ "invalid_number_underscore_inner",
705
+ "invalid_number_underscore_trailing",
706
+ "invalid_percent",
707
+ "invalid_percent_eof",
708
+ "invalid_printable_character",
709
+ "invalid_retry_after_else",
710
+ "invalid_retry_after_ensure",
711
+ "invalid_retry_without_rescue",
712
+ "invalid_symbol",
713
+ "invalid_variable_global",
714
+ "invalid_variable_global_3_3",
715
+ "invalid_yield",
716
+ "it_not_allowed_numbered",
717
+ "it_not_allowed_ordinary",
718
+ "lambda_open",
719
+ "lambda_term_brace",
720
+ "lambda_term_end",
721
+ "list_i_lower_element",
722
+ "list_i_lower_term",
723
+ "list_i_upper_element",
724
+ "list_i_upper_term",
725
+ "list_w_lower_element",
726
+ "list_w_lower_term",
727
+ "list_w_upper_element",
728
+ "list_w_upper_term",
729
+ "malloc_failed",
730
+ "mixed_encoding",
731
+ "module_in_method",
732
+ "module_name",
733
+ "module_term",
734
+ "multi_assign_multi_splats",
735
+ "multi_assign_unexpected_rest",
736
+ "nesting_too_deep",
737
+ "no_local_variable",
738
+ "non_associative_operator",
739
+ "not_expression",
740
+ "number_literal_underscore",
741
+ "numbered_parameter_inner_block",
742
+ "numbered_parameter_it",
743
+ "numbered_parameter_ordinary",
744
+ "numbered_parameter_outer_block",
745
+ "operator_multi_assign",
746
+ "operator_write_arguments",
747
+ "operator_write_block",
748
+ "parameter_assoc_splat_multi",
749
+ "parameter_block_multi",
750
+ "parameter_circular",
751
+ "parameter_forwarding_after_rest",
752
+ "parameter_method_name",
753
+ "parameter_name_duplicated",
754
+ "parameter_no_default",
755
+ "parameter_no_default_kw",
756
+ "parameter_numbered_reserved",
757
+ "parameter_order",
758
+ "parameter_splat_multi",
759
+ "parameter_star",
760
+ "parameter_unexpected_fwd",
761
+ "parameter_unexpected_no_kw",
762
+ "parameter_wild_loose_comma",
763
+ "pattern_array_multiple_rests",
764
+ "pattern_capture_duplicate",
765
+ "pattern_capture_in_alternative",
766
+ "pattern_expression_after_bracket",
767
+ "pattern_expression_after_comma",
768
+ "pattern_expression_after_hrocket",
769
+ "pattern_expression_after_in",
770
+ "pattern_expression_after_key",
771
+ "pattern_expression_after_paren",
772
+ "pattern_expression_after_pin",
773
+ "pattern_expression_after_pipe",
774
+ "pattern_expression_after_range",
775
+ "pattern_expression_after_rest",
776
+ "pattern_find_missing_inner",
777
+ "pattern_hash_implicit",
778
+ "pattern_hash_key",
779
+ "pattern_hash_key_duplicate",
780
+ "pattern_hash_key_interpolated",
781
+ "pattern_hash_key_label",
782
+ "pattern_hash_key_locals",
783
+ "pattern_ident_after_hrocket",
784
+ "pattern_label_after_comma",
785
+ "pattern_rest",
786
+ "pattern_term_brace",
787
+ "pattern_term_bracket",
788
+ "pattern_term_paren",
789
+ "pipepipeeq_multi_assign",
790
+ "regexp_encoding_option_mismatch",
791
+ "regexp_escaped_non_ascii_in_utf8",
792
+ "regexp_incompat_char_encoding",
793
+ "regexp_invalid_char_property",
794
+ "regexp_invalid_unicode_range",
795
+ "regexp_non_escaped_mbc",
796
+ "regexp_parse_error",
797
+ "regexp_term",
798
+ "regexp_unknown_options",
799
+ "regexp_utf8_char_non_utf8_regexp",
800
+ "rescue_expression",
801
+ "rescue_modifier_value",
802
+ "rescue_term",
803
+ "rescue_variable",
804
+ "return_invalid",
805
+ "script_not_found",
806
+ "singleton_for_literals",
807
+ "statement_alias",
808
+ "statement_postexe_end",
809
+ "statement_preexe_begin",
810
+ "statement_undef",
811
+ "string_concatenation",
812
+ "string_interpolated_term",
813
+ "string_literal_eof",
814
+ "string_literal_term",
815
+ "symbol_invalid",
816
+ "symbol_term_dynamic",
817
+ "symbol_term_interpolated",
818
+ "ternary_colon",
819
+ "ternary_expression_false",
820
+ "ternary_expression_true",
821
+ "unary_disallowed",
822
+ "unary_receiver",
823
+ "undef_argument",
824
+ "unexpected_block_argument",
825
+ "unexpected_index_block",
826
+ "unexpected_index_keywords",
827
+ "unexpected_label",
828
+ "unexpected_multi_write",
829
+ "unexpected_parameter_default_value",
830
+ "unexpected_range_operator",
831
+ "unexpected_safe_navigation",
832
+ "unexpected_token_close_context",
833
+ "unexpected_token_ignore",
834
+ "until_term",
835
+ "void_expression",
836
+ "while_term",
837
+ "write_target_in_method",
838
+ "write_target_readonly",
839
+ "write_target_unexpected",
840
+ "xstring_term"
841
+ ];
842
+ var warningLevels = ["default", "verbose"];
843
+ var warningTypes = [
844
+ "ambiguous_binary_operator",
845
+ "ambiguous_first_argument_minus",
846
+ "ambiguous_first_argument_plus",
847
+ "ambiguous_prefix_ampersand",
848
+ "ambiguous_prefix_star",
849
+ "ambiguous_prefix_star_star",
850
+ "ambiguous_slash",
851
+ "comparison_after_comparison",
852
+ "dot_dot_dot_eol",
853
+ "equal_in_conditional",
854
+ "equal_in_conditional_3_3",
855
+ "end_in_method",
856
+ "duplicated_hash_key",
857
+ "duplicated_when_clause",
858
+ "float_out_of_range",
859
+ "ignored_frozen_string_literal",
860
+ "indentation_mismatch",
861
+ "integer_in_flip_flop",
862
+ "invalid_character",
863
+ "invalid_magic_comment_value",
864
+ "invalid_numbered_reference",
865
+ "keyword_eol",
866
+ "literal_in_condition_default",
867
+ "literal_in_condition_verbose",
868
+ "shareable_constant_value_line",
869
+ "shebang_carriage_return",
870
+ "unexpected_carriage_return",
871
+ "unreachable_statement",
872
+ "unused_local_variable",
873
+ "void_statement"
874
+ ];
875
+ function deserialize(source, array) {
876
+ const buffer = new SerializationBuffer(array);
877
+ if (buffer.readString(5) !== "PRISM") {
878
+ throw new Error("Invalid serialization");
879
+ }
880
+ if (buffer.readByte() != MAJOR_VERSION || buffer.readByte() != MINOR_VERSION || buffer.readByte() != PATCH_VERSION) {
881
+ throw new Error("Invalid serialization");
882
+ }
883
+ if (buffer.readByte() != 0) {
884
+ throw new Error("Invalid serialization (location fields must be included but are not)");
885
+ }
886
+ buffer.encoding = buffer.readString(buffer.readVarInt());
887
+ const startLine = buffer.readVarSInt();
888
+ buffer.readBytes(8);
889
+ const lineOffsets = Array.from({ length: buffer.readVarInt() }, () => buffer.readVarInt());
890
+ buffer.source = new Source(source, buffer.encoding, startLine, lineOffsets);
891
+ const comments = Array.from({ length: buffer.readVarInt() }, () => ({
892
+ type: buffer.readVarInt(),
893
+ location: buffer.readLocation()
894
+ }));
895
+ for (let count = buffer.readVarInt(); count > 0; count--) {
896
+ buffer.readVarInt();
897
+ for (let length = buffer.readVarInt(); length > 0; length--) {
898
+ buffer.readVarInt();
899
+ }
900
+ }
901
+ const magicComments = Array.from({ length: buffer.readVarInt() }, () => ({
902
+ startLocation: buffer.readLocation(),
903
+ endLocation: buffer.readLocation()
904
+ }));
905
+ const dataLoc = buffer.readOptionalLocation();
906
+ const errors = Array.from({ length: buffer.readVarInt() }, () => ({
907
+ type: errorTypes[buffer.readVarInt()],
908
+ message: buffer.readString(buffer.readVarInt()),
909
+ location: buffer.readLocation(),
910
+ level: errorLevels[buffer.readByte()]
911
+ }));
912
+ const warnings = Array.from({ length: buffer.readVarInt() }, () => ({
913
+ type: warningTypes[buffer.readVarInt()],
914
+ message: buffer.readString(buffer.readVarInt()),
915
+ location: buffer.readLocation(),
916
+ level: warningLevels[buffer.readByte()]
917
+ }));
918
+ const continuable = buffer.readByte() !== 0;
919
+ const constantPoolOffset = buffer.readUint32();
920
+ const constants = Array.from({ length: buffer.readVarInt() }, () => null);
921
+ return new ParseResult(readNodes(constantPoolOffset), comments, magicComments, dataLoc, errors, warnings, continuable);
922
+ function readNodes(finish) {
923
+ const stack = [];
924
+ while (buffer.index < finish) {
925
+ const type = buffer.readByte();
926
+ switch (type) {
927
+ case 0:
928
+ stack.push(null);
929
+ break;
930
+ case 255:
931
+ buffer.readUint32();
932
+ buffer.readUint32();
933
+ break;
934
+ case 1: {
935
+ const nodeID = buffer.readVarInt();
936
+ const location = buffer.readLocation();
937
+ const flags = buffer.readVarInt();
938
+ const keywordLoc = buffer.readLocation();
939
+ const oldName = stack.pop();
940
+ const newName = stack.pop();
941
+ stack.push(new nodes.AliasGlobalVariableNode(nodeID, location, flags, newName, oldName, keywordLoc));
942
+ break;
943
+ }
944
+ case 2: {
945
+ const nodeID = buffer.readVarInt();
946
+ const location = buffer.readLocation();
947
+ const flags = buffer.readVarInt();
948
+ const keywordLoc = buffer.readLocation();
949
+ const oldName = stack.pop();
950
+ const newName = stack.pop();
951
+ stack.push(new nodes.AliasMethodNode(nodeID, location, flags, newName, oldName, keywordLoc));
952
+ break;
953
+ }
954
+ case 3: {
955
+ const nodeID = buffer.readVarInt();
956
+ const location = buffer.readLocation();
957
+ const flags = buffer.readVarInt();
958
+ const operatorLoc = buffer.readLocation();
959
+ const right = stack.pop();
960
+ const left = stack.pop();
961
+ stack.push(new nodes.AlternationPatternNode(nodeID, location, flags, left, right, operatorLoc));
962
+ break;
963
+ }
964
+ case 4: {
965
+ const nodeID = buffer.readVarInt();
966
+ const location = buffer.readLocation();
967
+ const flags = buffer.readVarInt();
968
+ const operatorLoc = buffer.readLocation();
969
+ const right = stack.pop();
970
+ const left = stack.pop();
971
+ stack.push(new nodes.AndNode(nodeID, location, flags, left, right, operatorLoc));
972
+ break;
973
+ }
974
+ case 5: {
975
+ const nodeID = buffer.readVarInt();
976
+ const location = buffer.readLocation();
977
+ const flags = buffer.readVarInt();
978
+ const arguments_Size = buffer.readVarInt();
979
+ const arguments_ = stack.splice(stack.length - arguments_Size, arguments_Size);
980
+ stack.push(new nodes.ArgumentsNode(nodeID, location, flags, arguments_));
981
+ break;
982
+ }
983
+ case 6: {
984
+ const nodeID = buffer.readVarInt();
985
+ const location = buffer.readLocation();
986
+ const flags = buffer.readVarInt();
987
+ const elementsSize = buffer.readVarInt();
988
+ const openingLoc = buffer.readOptionalLocation();
989
+ const closingLoc = buffer.readOptionalLocation();
990
+ const elements = stack.splice(stack.length - elementsSize, elementsSize);
991
+ stack.push(new nodes.ArrayNode(nodeID, location, flags, elements, openingLoc, closingLoc));
992
+ break;
993
+ }
994
+ case 7: {
995
+ const nodeID = buffer.readVarInt();
996
+ const location = buffer.readLocation();
997
+ const flags = buffer.readVarInt();
998
+ const requiredsSize = buffer.readVarInt();
999
+ const postsSize = buffer.readVarInt();
1000
+ const openingLoc = buffer.readOptionalLocation();
1001
+ const closingLoc = buffer.readOptionalLocation();
1002
+ const posts = stack.splice(stack.length - postsSize, postsSize);
1003
+ const rest = stack.pop();
1004
+ const requireds = stack.splice(stack.length - requiredsSize, requiredsSize);
1005
+ const constant = stack.pop();
1006
+ stack.push(new nodes.ArrayPatternNode(nodeID, location, flags, constant, requireds, rest, posts, openingLoc, closingLoc));
1007
+ break;
1008
+ }
1009
+ case 8: {
1010
+ const nodeID = buffer.readVarInt();
1011
+ const location = buffer.readLocation();
1012
+ const flags = buffer.readVarInt();
1013
+ const operatorLoc = buffer.readOptionalLocation();
1014
+ const value = stack.pop();
1015
+ const key = stack.pop();
1016
+ stack.push(new nodes.AssocNode(nodeID, location, flags, key, value, operatorLoc));
1017
+ break;
1018
+ }
1019
+ case 9: {
1020
+ const nodeID = buffer.readVarInt();
1021
+ const location = buffer.readLocation();
1022
+ const flags = buffer.readVarInt();
1023
+ const operatorLoc = buffer.readLocation();
1024
+ const value = stack.pop();
1025
+ stack.push(new nodes.AssocSplatNode(nodeID, location, flags, value, operatorLoc));
1026
+ break;
1027
+ }
1028
+ case 10: {
1029
+ const nodeID = buffer.readVarInt();
1030
+ const location = buffer.readLocation();
1031
+ const flags = buffer.readVarInt();
1032
+ const name = readRequiredConstant();
1033
+ stack.push(new nodes.BackReferenceReadNode(nodeID, location, flags, name));
1034
+ break;
1035
+ }
1036
+ case 11: {
1037
+ const nodeID = buffer.readVarInt();
1038
+ const location = buffer.readLocation();
1039
+ const flags = buffer.readVarInt();
1040
+ const beginKeywordLoc = buffer.readOptionalLocation();
1041
+ const endKeywordLoc = buffer.readOptionalLocation();
1042
+ const ensureClause = stack.pop();
1043
+ const elseClause = stack.pop();
1044
+ const rescueClause = stack.pop();
1045
+ const statements = stack.pop();
1046
+ stack.push(new nodes.BeginNode(nodeID, location, flags, beginKeywordLoc, statements, rescueClause, elseClause, ensureClause, endKeywordLoc));
1047
+ break;
1048
+ }
1049
+ case 12: {
1050
+ const nodeID = buffer.readVarInt();
1051
+ const location = buffer.readLocation();
1052
+ const flags = buffer.readVarInt();
1053
+ const operatorLoc = buffer.readLocation();
1054
+ const expression = stack.pop();
1055
+ stack.push(new nodes.BlockArgumentNode(nodeID, location, flags, expression, operatorLoc));
1056
+ break;
1057
+ }
1058
+ case 13: {
1059
+ const nodeID = buffer.readVarInt();
1060
+ const location = buffer.readLocation();
1061
+ const flags = buffer.readVarInt();
1062
+ const name = readRequiredConstant();
1063
+ stack.push(new nodes.BlockLocalVariableNode(nodeID, location, flags, name));
1064
+ break;
1065
+ }
1066
+ case 14: {
1067
+ const nodeID = buffer.readVarInt();
1068
+ const location = buffer.readLocation();
1069
+ const flags = buffer.readVarInt();
1070
+ const locals = Array.from({ length: buffer.readVarInt() }, readRequiredConstant);
1071
+ const openingLoc = buffer.readLocation();
1072
+ const closingLoc = buffer.readLocation();
1073
+ const body = stack.pop();
1074
+ const parameters = stack.pop();
1075
+ stack.push(new nodes.BlockNode(nodeID, location, flags, locals, parameters, body, openingLoc, closingLoc));
1076
+ break;
1077
+ }
1078
+ case 15: {
1079
+ const nodeID = buffer.readVarInt();
1080
+ const location = buffer.readLocation();
1081
+ const flags = buffer.readVarInt();
1082
+ const name = readOptionalConstant();
1083
+ const nameLoc = buffer.readOptionalLocation();
1084
+ const operatorLoc = buffer.readLocation();
1085
+ stack.push(new nodes.BlockParameterNode(nodeID, location, flags, name, nameLoc, operatorLoc));
1086
+ break;
1087
+ }
1088
+ case 16: {
1089
+ const nodeID = buffer.readVarInt();
1090
+ const location = buffer.readLocation();
1091
+ const flags = buffer.readVarInt();
1092
+ const localsSize = buffer.readVarInt();
1093
+ const openingLoc = buffer.readOptionalLocation();
1094
+ const closingLoc = buffer.readOptionalLocation();
1095
+ const locals = stack.splice(stack.length - localsSize, localsSize);
1096
+ const parameters = stack.pop();
1097
+ stack.push(new nodes.BlockParametersNode(nodeID, location, flags, parameters, locals, openingLoc, closingLoc));
1098
+ break;
1099
+ }
1100
+ case 17: {
1101
+ const nodeID = buffer.readVarInt();
1102
+ const location = buffer.readLocation();
1103
+ const flags = buffer.readVarInt();
1104
+ const keywordLoc = buffer.readLocation();
1105
+ const arguments_ = stack.pop();
1106
+ stack.push(new nodes.BreakNode(nodeID, location, flags, arguments_, keywordLoc));
1107
+ break;
1108
+ }
1109
+ case 18: {
1110
+ const nodeID = buffer.readVarInt();
1111
+ const location = buffer.readLocation();
1112
+ const flags = buffer.readVarInt();
1113
+ const callOperatorLoc = buffer.readOptionalLocation();
1114
+ const messageLoc = buffer.readOptionalLocation();
1115
+ const readName = readRequiredConstant();
1116
+ const writeName = readRequiredConstant();
1117
+ const operatorLoc = buffer.readLocation();
1118
+ const value = stack.pop();
1119
+ const receiver = stack.pop();
1120
+ stack.push(new nodes.CallAndWriteNode(nodeID, location, flags, receiver, callOperatorLoc, messageLoc, readName, writeName, operatorLoc, value));
1121
+ break;
1122
+ }
1123
+ case 19: {
1124
+ const nodeID = buffer.readVarInt();
1125
+ const location = buffer.readLocation();
1126
+ const flags = buffer.readVarInt();
1127
+ const callOperatorLoc = buffer.readOptionalLocation();
1128
+ const name = readRequiredConstant();
1129
+ const messageLoc = buffer.readOptionalLocation();
1130
+ const openingLoc = buffer.readOptionalLocation();
1131
+ const closingLoc = buffer.readOptionalLocation();
1132
+ const equalLoc = buffer.readOptionalLocation();
1133
+ const block = stack.pop();
1134
+ const arguments_ = stack.pop();
1135
+ const receiver = stack.pop();
1136
+ stack.push(new nodes.CallNode(nodeID, location, flags, receiver, callOperatorLoc, name, messageLoc, openingLoc, arguments_, closingLoc, equalLoc, block));
1137
+ break;
1138
+ }
1139
+ case 20: {
1140
+ const nodeID = buffer.readVarInt();
1141
+ const location = buffer.readLocation();
1142
+ const flags = buffer.readVarInt();
1143
+ const callOperatorLoc = buffer.readOptionalLocation();
1144
+ const messageLoc = buffer.readOptionalLocation();
1145
+ const readName = readRequiredConstant();
1146
+ const writeName = readRequiredConstant();
1147
+ const binaryOperator = readRequiredConstant();
1148
+ const binaryOperatorLoc = buffer.readLocation();
1149
+ const value = stack.pop();
1150
+ const receiver = stack.pop();
1151
+ stack.push(new nodes.CallOperatorWriteNode(nodeID, location, flags, receiver, callOperatorLoc, messageLoc, readName, writeName, binaryOperator, binaryOperatorLoc, value));
1152
+ break;
1153
+ }
1154
+ case 21: {
1155
+ const nodeID = buffer.readVarInt();
1156
+ const location = buffer.readLocation();
1157
+ const flags = buffer.readVarInt();
1158
+ const callOperatorLoc = buffer.readOptionalLocation();
1159
+ const messageLoc = buffer.readOptionalLocation();
1160
+ const readName = readRequiredConstant();
1161
+ const writeName = readRequiredConstant();
1162
+ const operatorLoc = buffer.readLocation();
1163
+ const value = stack.pop();
1164
+ const receiver = stack.pop();
1165
+ stack.push(new nodes.CallOrWriteNode(nodeID, location, flags, receiver, callOperatorLoc, messageLoc, readName, writeName, operatorLoc, value));
1166
+ break;
1167
+ }
1168
+ case 22: {
1169
+ const nodeID = buffer.readVarInt();
1170
+ const location = buffer.readLocation();
1171
+ const flags = buffer.readVarInt();
1172
+ const callOperatorLoc = buffer.readLocation();
1173
+ const name = readRequiredConstant();
1174
+ const messageLoc = buffer.readLocation();
1175
+ const receiver = stack.pop();
1176
+ stack.push(new nodes.CallTargetNode(nodeID, location, flags, receiver, callOperatorLoc, name, messageLoc));
1177
+ break;
1178
+ }
1179
+ case 23: {
1180
+ const nodeID = buffer.readVarInt();
1181
+ const location = buffer.readLocation();
1182
+ const flags = buffer.readVarInt();
1183
+ const operatorLoc = buffer.readLocation();
1184
+ const target = stack.pop();
1185
+ const value = stack.pop();
1186
+ stack.push(new nodes.CapturePatternNode(nodeID, location, flags, value, target, operatorLoc));
1187
+ break;
1188
+ }
1189
+ case 24: {
1190
+ const nodeID = buffer.readVarInt();
1191
+ const location = buffer.readLocation();
1192
+ const flags = buffer.readVarInt();
1193
+ const conditionsSize = buffer.readVarInt();
1194
+ const caseKeywordLoc = buffer.readLocation();
1195
+ const endKeywordLoc = buffer.readLocation();
1196
+ const elseClause = stack.pop();
1197
+ const conditions = stack.splice(stack.length - conditionsSize, conditionsSize);
1198
+ const predicate = stack.pop();
1199
+ stack.push(new nodes.CaseMatchNode(nodeID, location, flags, predicate, conditions, elseClause, caseKeywordLoc, endKeywordLoc));
1200
+ break;
1201
+ }
1202
+ case 25: {
1203
+ const nodeID = buffer.readVarInt();
1204
+ const location = buffer.readLocation();
1205
+ const flags = buffer.readVarInt();
1206
+ const conditionsSize = buffer.readVarInt();
1207
+ const caseKeywordLoc = buffer.readLocation();
1208
+ const endKeywordLoc = buffer.readLocation();
1209
+ const elseClause = stack.pop();
1210
+ const conditions = stack.splice(stack.length - conditionsSize, conditionsSize);
1211
+ const predicate = stack.pop();
1212
+ stack.push(new nodes.CaseNode(nodeID, location, flags, predicate, conditions, elseClause, caseKeywordLoc, endKeywordLoc));
1213
+ break;
1214
+ }
1215
+ case 26: {
1216
+ const nodeID = buffer.readVarInt();
1217
+ const location = buffer.readLocation();
1218
+ const flags = buffer.readVarInt();
1219
+ const locals = Array.from({ length: buffer.readVarInt() }, readRequiredConstant);
1220
+ const classKeywordLoc = buffer.readLocation();
1221
+ const inheritanceOperatorLoc = buffer.readOptionalLocation();
1222
+ const endKeywordLoc = buffer.readLocation();
1223
+ const name = readRequiredConstant();
1224
+ const body = stack.pop();
1225
+ const superclass = stack.pop();
1226
+ const constantPath = stack.pop();
1227
+ stack.push(new nodes.ClassNode(nodeID, location, flags, locals, classKeywordLoc, constantPath, inheritanceOperatorLoc, superclass, body, endKeywordLoc, name));
1228
+ break;
1229
+ }
1230
+ case 27: {
1231
+ const nodeID = buffer.readVarInt();
1232
+ const location = buffer.readLocation();
1233
+ const flags = buffer.readVarInt();
1234
+ const name = readRequiredConstant();
1235
+ const nameLoc = buffer.readLocation();
1236
+ const operatorLoc = buffer.readLocation();
1237
+ const value = stack.pop();
1238
+ stack.push(new nodes.ClassVariableAndWriteNode(nodeID, location, flags, name, nameLoc, operatorLoc, value));
1239
+ break;
1240
+ }
1241
+ case 28: {
1242
+ const nodeID = buffer.readVarInt();
1243
+ const location = buffer.readLocation();
1244
+ const flags = buffer.readVarInt();
1245
+ const name = readRequiredConstant();
1246
+ const nameLoc = buffer.readLocation();
1247
+ const binaryOperatorLoc = buffer.readLocation();
1248
+ const binaryOperator = readRequiredConstant();
1249
+ const value = stack.pop();
1250
+ stack.push(new nodes.ClassVariableOperatorWriteNode(nodeID, location, flags, name, nameLoc, binaryOperatorLoc, value, binaryOperator));
1251
+ break;
1252
+ }
1253
+ case 29: {
1254
+ const nodeID = buffer.readVarInt();
1255
+ const location = buffer.readLocation();
1256
+ const flags = buffer.readVarInt();
1257
+ const name = readRequiredConstant();
1258
+ const nameLoc = buffer.readLocation();
1259
+ const operatorLoc = buffer.readLocation();
1260
+ const value = stack.pop();
1261
+ stack.push(new nodes.ClassVariableOrWriteNode(nodeID, location, flags, name, nameLoc, operatorLoc, value));
1262
+ break;
1263
+ }
1264
+ case 30: {
1265
+ const nodeID = buffer.readVarInt();
1266
+ const location = buffer.readLocation();
1267
+ const flags = buffer.readVarInt();
1268
+ const name = readRequiredConstant();
1269
+ stack.push(new nodes.ClassVariableReadNode(nodeID, location, flags, name));
1270
+ break;
1271
+ }
1272
+ case 31: {
1273
+ const nodeID = buffer.readVarInt();
1274
+ const location = buffer.readLocation();
1275
+ const flags = buffer.readVarInt();
1276
+ const name = readRequiredConstant();
1277
+ stack.push(new nodes.ClassVariableTargetNode(nodeID, location, flags, name));
1278
+ break;
1279
+ }
1280
+ case 32: {
1281
+ const nodeID = buffer.readVarInt();
1282
+ const location = buffer.readLocation();
1283
+ const flags = buffer.readVarInt();
1284
+ const name = readRequiredConstant();
1285
+ const nameLoc = buffer.readLocation();
1286
+ const operatorLoc = buffer.readLocation();
1287
+ const value = stack.pop();
1288
+ stack.push(new nodes.ClassVariableWriteNode(nodeID, location, flags, name, nameLoc, value, operatorLoc));
1289
+ break;
1290
+ }
1291
+ case 33: {
1292
+ const nodeID = buffer.readVarInt();
1293
+ const location = buffer.readLocation();
1294
+ const flags = buffer.readVarInt();
1295
+ const name = readRequiredConstant();
1296
+ const nameLoc = buffer.readLocation();
1297
+ const operatorLoc = buffer.readLocation();
1298
+ const value = stack.pop();
1299
+ stack.push(new nodes.ConstantAndWriteNode(nodeID, location, flags, name, nameLoc, operatorLoc, value));
1300
+ break;
1301
+ }
1302
+ case 34: {
1303
+ const nodeID = buffer.readVarInt();
1304
+ const location = buffer.readLocation();
1305
+ const flags = buffer.readVarInt();
1306
+ const name = readRequiredConstant();
1307
+ const nameLoc = buffer.readLocation();
1308
+ const binaryOperatorLoc = buffer.readLocation();
1309
+ const binaryOperator = readRequiredConstant();
1310
+ const value = stack.pop();
1311
+ stack.push(new nodes.ConstantOperatorWriteNode(nodeID, location, flags, name, nameLoc, binaryOperatorLoc, value, binaryOperator));
1312
+ break;
1313
+ }
1314
+ case 35: {
1315
+ const nodeID = buffer.readVarInt();
1316
+ const location = buffer.readLocation();
1317
+ const flags = buffer.readVarInt();
1318
+ const name = readRequiredConstant();
1319
+ const nameLoc = buffer.readLocation();
1320
+ const operatorLoc = buffer.readLocation();
1321
+ const value = stack.pop();
1322
+ stack.push(new nodes.ConstantOrWriteNode(nodeID, location, flags, name, nameLoc, operatorLoc, value));
1323
+ break;
1324
+ }
1325
+ case 36: {
1326
+ const nodeID = buffer.readVarInt();
1327
+ const location = buffer.readLocation();
1328
+ const flags = buffer.readVarInt();
1329
+ const operatorLoc = buffer.readLocation();
1330
+ const value = stack.pop();
1331
+ const target = stack.pop();
1332
+ stack.push(new nodes.ConstantPathAndWriteNode(nodeID, location, flags, target, operatorLoc, value));
1333
+ break;
1334
+ }
1335
+ case 37: {
1336
+ const nodeID = buffer.readVarInt();
1337
+ const location = buffer.readLocation();
1338
+ const flags = buffer.readVarInt();
1339
+ const name = readOptionalConstant();
1340
+ const delimiterLoc = buffer.readLocation();
1341
+ const nameLoc = buffer.readLocation();
1342
+ const parent = stack.pop();
1343
+ stack.push(new nodes.ConstantPathNode(nodeID, location, flags, parent, name, delimiterLoc, nameLoc));
1344
+ break;
1345
+ }
1346
+ case 38: {
1347
+ const nodeID = buffer.readVarInt();
1348
+ const location = buffer.readLocation();
1349
+ const flags = buffer.readVarInt();
1350
+ const binaryOperatorLoc = buffer.readLocation();
1351
+ const binaryOperator = readRequiredConstant();
1352
+ const value = stack.pop();
1353
+ const target = stack.pop();
1354
+ stack.push(new nodes.ConstantPathOperatorWriteNode(nodeID, location, flags, target, binaryOperatorLoc, value, binaryOperator));
1355
+ break;
1356
+ }
1357
+ case 39: {
1358
+ const nodeID = buffer.readVarInt();
1359
+ const location = buffer.readLocation();
1360
+ const flags = buffer.readVarInt();
1361
+ const operatorLoc = buffer.readLocation();
1362
+ const value = stack.pop();
1363
+ const target = stack.pop();
1364
+ stack.push(new nodes.ConstantPathOrWriteNode(nodeID, location, flags, target, operatorLoc, value));
1365
+ break;
1366
+ }
1367
+ case 40: {
1368
+ const nodeID = buffer.readVarInt();
1369
+ const location = buffer.readLocation();
1370
+ const flags = buffer.readVarInt();
1371
+ const name = readOptionalConstant();
1372
+ const delimiterLoc = buffer.readLocation();
1373
+ const nameLoc = buffer.readLocation();
1374
+ const parent = stack.pop();
1375
+ stack.push(new nodes.ConstantPathTargetNode(nodeID, location, flags, parent, name, delimiterLoc, nameLoc));
1376
+ break;
1377
+ }
1378
+ case 41: {
1379
+ const nodeID = buffer.readVarInt();
1380
+ const location = buffer.readLocation();
1381
+ const flags = buffer.readVarInt();
1382
+ const operatorLoc = buffer.readLocation();
1383
+ const value = stack.pop();
1384
+ const target = stack.pop();
1385
+ stack.push(new nodes.ConstantPathWriteNode(nodeID, location, flags, target, operatorLoc, value));
1386
+ break;
1387
+ }
1388
+ case 42: {
1389
+ const nodeID = buffer.readVarInt();
1390
+ const location = buffer.readLocation();
1391
+ const flags = buffer.readVarInt();
1392
+ const name = readRequiredConstant();
1393
+ stack.push(new nodes.ConstantReadNode(nodeID, location, flags, name));
1394
+ break;
1395
+ }
1396
+ case 43: {
1397
+ const nodeID = buffer.readVarInt();
1398
+ const location = buffer.readLocation();
1399
+ const flags = buffer.readVarInt();
1400
+ const name = readRequiredConstant();
1401
+ stack.push(new nodes.ConstantTargetNode(nodeID, location, flags, name));
1402
+ break;
1403
+ }
1404
+ case 44: {
1405
+ const nodeID = buffer.readVarInt();
1406
+ const location = buffer.readLocation();
1407
+ const flags = buffer.readVarInt();
1408
+ const name = readRequiredConstant();
1409
+ const nameLoc = buffer.readLocation();
1410
+ const operatorLoc = buffer.readLocation();
1411
+ const value = stack.pop();
1412
+ stack.push(new nodes.ConstantWriteNode(nodeID, location, flags, name, nameLoc, value, operatorLoc));
1413
+ break;
1414
+ }
1415
+ case 45: {
1416
+ const nodeID = buffer.readVarInt();
1417
+ const location = buffer.readLocation();
1418
+ const flags = buffer.readVarInt();
1419
+ const name = readRequiredConstant();
1420
+ const nameLoc = buffer.readLocation();
1421
+ const locals = Array.from({ length: buffer.readVarInt() }, readRequiredConstant);
1422
+ const defKeywordLoc = buffer.readLocation();
1423
+ const operatorLoc = buffer.readOptionalLocation();
1424
+ const lparenLoc = buffer.readOptionalLocation();
1425
+ const rparenLoc = buffer.readOptionalLocation();
1426
+ const equalLoc = buffer.readOptionalLocation();
1427
+ const endKeywordLoc = buffer.readOptionalLocation();
1428
+ const body = stack.pop();
1429
+ const parameters = stack.pop();
1430
+ const receiver = stack.pop();
1431
+ stack.push(new nodes.DefNode(nodeID, location, flags, name, nameLoc, receiver, parameters, body, locals, defKeywordLoc, operatorLoc, lparenLoc, rparenLoc, equalLoc, endKeywordLoc));
1432
+ break;
1433
+ }
1434
+ case 46: {
1435
+ const nodeID = buffer.readVarInt();
1436
+ const location = buffer.readLocation();
1437
+ const flags = buffer.readVarInt();
1438
+ const lparenLoc = buffer.readOptionalLocation();
1439
+ const rparenLoc = buffer.readOptionalLocation();
1440
+ const keywordLoc = buffer.readLocation();
1441
+ const value = stack.pop();
1442
+ stack.push(new nodes.DefinedNode(nodeID, location, flags, lparenLoc, value, rparenLoc, keywordLoc));
1443
+ break;
1444
+ }
1445
+ case 47: {
1446
+ const nodeID = buffer.readVarInt();
1447
+ const location = buffer.readLocation();
1448
+ const flags = buffer.readVarInt();
1449
+ const elseKeywordLoc = buffer.readLocation();
1450
+ const endKeywordLoc = buffer.readOptionalLocation();
1451
+ const statements = stack.pop();
1452
+ stack.push(new nodes.ElseNode(nodeID, location, flags, elseKeywordLoc, statements, endKeywordLoc));
1453
+ break;
1454
+ }
1455
+ case 48: {
1456
+ const nodeID = buffer.readVarInt();
1457
+ const location = buffer.readLocation();
1458
+ const flags = buffer.readVarInt();
1459
+ const openingLoc = buffer.readLocation();
1460
+ const closingLoc = buffer.readLocation();
1461
+ const statements = stack.pop();
1462
+ stack.push(new nodes.EmbeddedStatementsNode(nodeID, location, flags, openingLoc, statements, closingLoc));
1463
+ break;
1464
+ }
1465
+ case 49: {
1466
+ const nodeID = buffer.readVarInt();
1467
+ const location = buffer.readLocation();
1468
+ const flags = buffer.readVarInt();
1469
+ const operatorLoc = buffer.readLocation();
1470
+ const variable = stack.pop();
1471
+ stack.push(new nodes.EmbeddedVariableNode(nodeID, location, flags, operatorLoc, variable));
1472
+ break;
1473
+ }
1474
+ case 50: {
1475
+ const nodeID = buffer.readVarInt();
1476
+ const location = buffer.readLocation();
1477
+ const flags = buffer.readVarInt();
1478
+ const ensureKeywordLoc = buffer.readLocation();
1479
+ const endKeywordLoc = buffer.readLocation();
1480
+ const statements = stack.pop();
1481
+ stack.push(new nodes.EnsureNode(nodeID, location, flags, ensureKeywordLoc, statements, endKeywordLoc));
1482
+ break;
1483
+ }
1484
+ case 51: {
1485
+ const nodeID = buffer.readVarInt();
1486
+ const location = buffer.readLocation();
1487
+ const flags = buffer.readVarInt();
1488
+ const unexpected = stack.pop();
1489
+ stack.push(new nodes.ErrorRecoveryNode(nodeID, location, flags, unexpected));
1490
+ break;
1491
+ }
1492
+ case 52: {
1493
+ const nodeID = buffer.readVarInt();
1494
+ const location = buffer.readLocation();
1495
+ const flags = buffer.readVarInt();
1496
+ stack.push(new nodes.FalseNode(nodeID, location, flags));
1497
+ break;
1498
+ }
1499
+ case 53: {
1500
+ const nodeID = buffer.readVarInt();
1501
+ const location = buffer.readLocation();
1502
+ const flags = buffer.readVarInt();
1503
+ const requiredsSize = buffer.readVarInt();
1504
+ const openingLoc = buffer.readOptionalLocation();
1505
+ const closingLoc = buffer.readOptionalLocation();
1506
+ const right = stack.pop();
1507
+ const requireds = stack.splice(stack.length - requiredsSize, requiredsSize);
1508
+ const left = stack.pop();
1509
+ const constant = stack.pop();
1510
+ stack.push(new nodes.FindPatternNode(nodeID, location, flags, constant, left, requireds, right, openingLoc, closingLoc));
1511
+ break;
1512
+ }
1513
+ case 54: {
1514
+ const nodeID = buffer.readVarInt();
1515
+ const location = buffer.readLocation();
1516
+ const flags = buffer.readVarInt();
1517
+ const operatorLoc = buffer.readLocation();
1518
+ const right = stack.pop();
1519
+ const left = stack.pop();
1520
+ stack.push(new nodes.FlipFlopNode(nodeID, location, flags, left, right, operatorLoc));
1521
+ break;
1522
+ }
1523
+ case 55: {
1524
+ const nodeID = buffer.readVarInt();
1525
+ const location = buffer.readLocation();
1526
+ const flags = buffer.readVarInt();
1527
+ const value = buffer.readDouble();
1528
+ stack.push(new nodes.FloatNode(nodeID, location, flags, value));
1529
+ break;
1530
+ }
1531
+ case 56: {
1532
+ const nodeID = buffer.readVarInt();
1533
+ const location = buffer.readLocation();
1534
+ const flags = buffer.readVarInt();
1535
+ const forKeywordLoc = buffer.readLocation();
1536
+ const inKeywordLoc = buffer.readLocation();
1537
+ const doKeywordLoc = buffer.readOptionalLocation();
1538
+ const endKeywordLoc = buffer.readLocation();
1539
+ const statements = stack.pop();
1540
+ const collection = stack.pop();
1541
+ const index = stack.pop();
1542
+ stack.push(new nodes.ForNode(nodeID, location, flags, index, collection, statements, forKeywordLoc, inKeywordLoc, doKeywordLoc, endKeywordLoc));
1543
+ break;
1544
+ }
1545
+ case 57: {
1546
+ const nodeID = buffer.readVarInt();
1547
+ const location = buffer.readLocation();
1548
+ const flags = buffer.readVarInt();
1549
+ stack.push(new nodes.ForwardingArgumentsNode(nodeID, location, flags));
1550
+ break;
1551
+ }
1552
+ case 58: {
1553
+ const nodeID = buffer.readVarInt();
1554
+ const location = buffer.readLocation();
1555
+ const flags = buffer.readVarInt();
1556
+ stack.push(new nodes.ForwardingParameterNode(nodeID, location, flags));
1557
+ break;
1558
+ }
1559
+ case 59: {
1560
+ const nodeID = buffer.readVarInt();
1561
+ const location = buffer.readLocation();
1562
+ const flags = buffer.readVarInt();
1563
+ const keywordLoc = buffer.readLocation();
1564
+ const block = stack.pop();
1565
+ stack.push(new nodes.ForwardingSuperNode(nodeID, location, flags, keywordLoc, block));
1566
+ break;
1567
+ }
1568
+ case 60: {
1569
+ const nodeID = buffer.readVarInt();
1570
+ const location = buffer.readLocation();
1571
+ const flags = buffer.readVarInt();
1572
+ const name = readRequiredConstant();
1573
+ const nameLoc = buffer.readLocation();
1574
+ const operatorLoc = buffer.readLocation();
1575
+ const value = stack.pop();
1576
+ stack.push(new nodes.GlobalVariableAndWriteNode(nodeID, location, flags, name, nameLoc, operatorLoc, value));
1577
+ break;
1578
+ }
1579
+ case 61: {
1580
+ const nodeID = buffer.readVarInt();
1581
+ const location = buffer.readLocation();
1582
+ const flags = buffer.readVarInt();
1583
+ const name = readRequiredConstant();
1584
+ const nameLoc = buffer.readLocation();
1585
+ const binaryOperatorLoc = buffer.readLocation();
1586
+ const binaryOperator = readRequiredConstant();
1587
+ const value = stack.pop();
1588
+ stack.push(new nodes.GlobalVariableOperatorWriteNode(nodeID, location, flags, name, nameLoc, binaryOperatorLoc, value, binaryOperator));
1589
+ break;
1590
+ }
1591
+ case 62: {
1592
+ const nodeID = buffer.readVarInt();
1593
+ const location = buffer.readLocation();
1594
+ const flags = buffer.readVarInt();
1595
+ const name = readRequiredConstant();
1596
+ const nameLoc = buffer.readLocation();
1597
+ const operatorLoc = buffer.readLocation();
1598
+ const value = stack.pop();
1599
+ stack.push(new nodes.GlobalVariableOrWriteNode(nodeID, location, flags, name, nameLoc, operatorLoc, value));
1600
+ break;
1601
+ }
1602
+ case 63: {
1603
+ const nodeID = buffer.readVarInt();
1604
+ const location = buffer.readLocation();
1605
+ const flags = buffer.readVarInt();
1606
+ const name = readRequiredConstant();
1607
+ stack.push(new nodes.GlobalVariableReadNode(nodeID, location, flags, name));
1608
+ break;
1609
+ }
1610
+ case 64: {
1611
+ const nodeID = buffer.readVarInt();
1612
+ const location = buffer.readLocation();
1613
+ const flags = buffer.readVarInt();
1614
+ const name = readRequiredConstant();
1615
+ stack.push(new nodes.GlobalVariableTargetNode(nodeID, location, flags, name));
1616
+ break;
1617
+ }
1618
+ case 65: {
1619
+ const nodeID = buffer.readVarInt();
1620
+ const location = buffer.readLocation();
1621
+ const flags = buffer.readVarInt();
1622
+ const name = readRequiredConstant();
1623
+ const nameLoc = buffer.readLocation();
1624
+ const operatorLoc = buffer.readLocation();
1625
+ const value = stack.pop();
1626
+ stack.push(new nodes.GlobalVariableWriteNode(nodeID, location, flags, name, nameLoc, value, operatorLoc));
1627
+ break;
1628
+ }
1629
+ case 66: {
1630
+ const nodeID = buffer.readVarInt();
1631
+ const location = buffer.readLocation();
1632
+ const flags = buffer.readVarInt();
1633
+ const openingLoc = buffer.readLocation();
1634
+ const elementsSize = buffer.readVarInt();
1635
+ const closingLoc = buffer.readLocation();
1636
+ const elements = stack.splice(stack.length - elementsSize, elementsSize);
1637
+ stack.push(new nodes.HashNode(nodeID, location, flags, openingLoc, elements, closingLoc));
1638
+ break;
1639
+ }
1640
+ case 67: {
1641
+ const nodeID = buffer.readVarInt();
1642
+ const location = buffer.readLocation();
1643
+ const flags = buffer.readVarInt();
1644
+ const elementsSize = buffer.readVarInt();
1645
+ const openingLoc = buffer.readOptionalLocation();
1646
+ const closingLoc = buffer.readOptionalLocation();
1647
+ const rest = stack.pop();
1648
+ const elements = stack.splice(stack.length - elementsSize, elementsSize);
1649
+ const constant = stack.pop();
1650
+ stack.push(new nodes.HashPatternNode(nodeID, location, flags, constant, elements, rest, openingLoc, closingLoc));
1651
+ break;
1652
+ }
1653
+ case 68: {
1654
+ const nodeID = buffer.readVarInt();
1655
+ const location = buffer.readLocation();
1656
+ const flags = buffer.readVarInt();
1657
+ const ifKeywordLoc = buffer.readOptionalLocation();
1658
+ const thenKeywordLoc = buffer.readOptionalLocation();
1659
+ const endKeywordLoc = buffer.readOptionalLocation();
1660
+ const subsequent = stack.pop();
1661
+ const statements = stack.pop();
1662
+ const predicate = stack.pop();
1663
+ stack.push(new nodes.IfNode(nodeID, location, flags, ifKeywordLoc, predicate, thenKeywordLoc, statements, subsequent, endKeywordLoc));
1664
+ break;
1665
+ }
1666
+ case 69: {
1667
+ const nodeID = buffer.readVarInt();
1668
+ const location = buffer.readLocation();
1669
+ const flags = buffer.readVarInt();
1670
+ const numeric = stack.pop();
1671
+ stack.push(new nodes.ImaginaryNode(nodeID, location, flags, numeric));
1672
+ break;
1673
+ }
1674
+ case 70: {
1675
+ const nodeID = buffer.readVarInt();
1676
+ const location = buffer.readLocation();
1677
+ const flags = buffer.readVarInt();
1678
+ const value = stack.pop();
1679
+ stack.push(new nodes.ImplicitNode(nodeID, location, flags, value));
1680
+ break;
1681
+ }
1682
+ case 71: {
1683
+ const nodeID = buffer.readVarInt();
1684
+ const location = buffer.readLocation();
1685
+ const flags = buffer.readVarInt();
1686
+ stack.push(new nodes.ImplicitRestNode(nodeID, location, flags));
1687
+ break;
1688
+ }
1689
+ case 72: {
1690
+ const nodeID = buffer.readVarInt();
1691
+ const location = buffer.readLocation();
1692
+ const flags = buffer.readVarInt();
1693
+ const inKeywordLoc = buffer.readLocation();
1694
+ const thenKeywordLoc = buffer.readOptionalLocation();
1695
+ const statements = stack.pop();
1696
+ const pattern = stack.pop();
1697
+ stack.push(new nodes.InNode(nodeID, location, flags, pattern, statements, inKeywordLoc, thenKeywordLoc));
1698
+ break;
1699
+ }
1700
+ case 73: {
1701
+ const nodeID = buffer.readVarInt();
1702
+ const location = buffer.readLocation();
1703
+ const flags = buffer.readVarInt();
1704
+ const callOperatorLoc = buffer.readOptionalLocation();
1705
+ const openingLoc = buffer.readLocation();
1706
+ const closingLoc = buffer.readLocation();
1707
+ const operatorLoc = buffer.readLocation();
1708
+ const value = stack.pop();
1709
+ const block = stack.pop();
1710
+ const arguments_ = stack.pop();
1711
+ const receiver = stack.pop();
1712
+ stack.push(new nodes.IndexAndWriteNode(nodeID, location, flags, receiver, callOperatorLoc, openingLoc, arguments_, closingLoc, block, operatorLoc, value));
1713
+ break;
1714
+ }
1715
+ case 74: {
1716
+ const nodeID = buffer.readVarInt();
1717
+ const location = buffer.readLocation();
1718
+ const flags = buffer.readVarInt();
1719
+ const callOperatorLoc = buffer.readOptionalLocation();
1720
+ const openingLoc = buffer.readLocation();
1721
+ const closingLoc = buffer.readLocation();
1722
+ const binaryOperator = readRequiredConstant();
1723
+ const binaryOperatorLoc = buffer.readLocation();
1724
+ const value = stack.pop();
1725
+ const block = stack.pop();
1726
+ const arguments_ = stack.pop();
1727
+ const receiver = stack.pop();
1728
+ stack.push(new nodes.IndexOperatorWriteNode(nodeID, location, flags, receiver, callOperatorLoc, openingLoc, arguments_, closingLoc, block, binaryOperator, binaryOperatorLoc, value));
1729
+ break;
1730
+ }
1731
+ case 75: {
1732
+ const nodeID = buffer.readVarInt();
1733
+ const location = buffer.readLocation();
1734
+ const flags = buffer.readVarInt();
1735
+ const callOperatorLoc = buffer.readOptionalLocation();
1736
+ const openingLoc = buffer.readLocation();
1737
+ const closingLoc = buffer.readLocation();
1738
+ const operatorLoc = buffer.readLocation();
1739
+ const value = stack.pop();
1740
+ const block = stack.pop();
1741
+ const arguments_ = stack.pop();
1742
+ const receiver = stack.pop();
1743
+ stack.push(new nodes.IndexOrWriteNode(nodeID, location, flags, receiver, callOperatorLoc, openingLoc, arguments_, closingLoc, block, operatorLoc, value));
1744
+ break;
1745
+ }
1746
+ case 76: {
1747
+ const nodeID = buffer.readVarInt();
1748
+ const location = buffer.readLocation();
1749
+ const flags = buffer.readVarInt();
1750
+ const openingLoc = buffer.readLocation();
1751
+ const closingLoc = buffer.readLocation();
1752
+ const block = stack.pop();
1753
+ const arguments_ = stack.pop();
1754
+ const receiver = stack.pop();
1755
+ stack.push(new nodes.IndexTargetNode(nodeID, location, flags, receiver, openingLoc, arguments_, closingLoc, block));
1756
+ break;
1757
+ }
1758
+ case 77: {
1759
+ const nodeID = buffer.readVarInt();
1760
+ const location = buffer.readLocation();
1761
+ const flags = buffer.readVarInt();
1762
+ const name = readRequiredConstant();
1763
+ const nameLoc = buffer.readLocation();
1764
+ const operatorLoc = buffer.readLocation();
1765
+ const value = stack.pop();
1766
+ stack.push(new nodes.InstanceVariableAndWriteNode(nodeID, location, flags, name, nameLoc, operatorLoc, value));
1767
+ break;
1768
+ }
1769
+ case 78: {
1770
+ const nodeID = buffer.readVarInt();
1771
+ const location = buffer.readLocation();
1772
+ const flags = buffer.readVarInt();
1773
+ const name = readRequiredConstant();
1774
+ const nameLoc = buffer.readLocation();
1775
+ const binaryOperatorLoc = buffer.readLocation();
1776
+ const binaryOperator = readRequiredConstant();
1777
+ const value = stack.pop();
1778
+ stack.push(new nodes.InstanceVariableOperatorWriteNode(nodeID, location, flags, name, nameLoc, binaryOperatorLoc, value, binaryOperator));
1779
+ break;
1780
+ }
1781
+ case 79: {
1782
+ const nodeID = buffer.readVarInt();
1783
+ const location = buffer.readLocation();
1784
+ const flags = buffer.readVarInt();
1785
+ const name = readRequiredConstant();
1786
+ const nameLoc = buffer.readLocation();
1787
+ const operatorLoc = buffer.readLocation();
1788
+ const value = stack.pop();
1789
+ stack.push(new nodes.InstanceVariableOrWriteNode(nodeID, location, flags, name, nameLoc, operatorLoc, value));
1790
+ break;
1791
+ }
1792
+ case 80: {
1793
+ const nodeID = buffer.readVarInt();
1794
+ const location = buffer.readLocation();
1795
+ const flags = buffer.readVarInt();
1796
+ const name = readRequiredConstant();
1797
+ stack.push(new nodes.InstanceVariableReadNode(nodeID, location, flags, name));
1798
+ break;
1799
+ }
1800
+ case 81: {
1801
+ const nodeID = buffer.readVarInt();
1802
+ const location = buffer.readLocation();
1803
+ const flags = buffer.readVarInt();
1804
+ const name = readRequiredConstant();
1805
+ stack.push(new nodes.InstanceVariableTargetNode(nodeID, location, flags, name));
1806
+ break;
1807
+ }
1808
+ case 82: {
1809
+ const nodeID = buffer.readVarInt();
1810
+ const location = buffer.readLocation();
1811
+ const flags = buffer.readVarInt();
1812
+ const name = readRequiredConstant();
1813
+ const nameLoc = buffer.readLocation();
1814
+ const operatorLoc = buffer.readLocation();
1815
+ const value = stack.pop();
1816
+ stack.push(new nodes.InstanceVariableWriteNode(nodeID, location, flags, name, nameLoc, value, operatorLoc));
1817
+ break;
1818
+ }
1819
+ case 83: {
1820
+ const nodeID = buffer.readVarInt();
1821
+ const location = buffer.readLocation();
1822
+ const flags = buffer.readVarInt();
1823
+ const value = readInteger();
1824
+ stack.push(new nodes.IntegerNode(nodeID, location, flags, value));
1825
+ break;
1826
+ }
1827
+ case 84: {
1828
+ const nodeID = buffer.readVarInt();
1829
+ const location = buffer.readLocation();
1830
+ const flags = buffer.readVarInt();
1831
+ const openingLoc = buffer.readLocation();
1832
+ const partsSize = buffer.readVarInt();
1833
+ const closingLoc = buffer.readLocation();
1834
+ const parts = stack.splice(stack.length - partsSize, partsSize);
1835
+ stack.push(new nodes.InterpolatedMatchLastLineNode(nodeID, location, flags, openingLoc, parts, closingLoc));
1836
+ break;
1837
+ }
1838
+ case 85: {
1839
+ const nodeID = buffer.readVarInt();
1840
+ const location = buffer.readLocation();
1841
+ const flags = buffer.readVarInt();
1842
+ const openingLoc = buffer.readLocation();
1843
+ const partsSize = buffer.readVarInt();
1844
+ const closingLoc = buffer.readLocation();
1845
+ const parts = stack.splice(stack.length - partsSize, partsSize);
1846
+ stack.push(new nodes.InterpolatedRegularExpressionNode(nodeID, location, flags, openingLoc, parts, closingLoc));
1847
+ break;
1848
+ }
1849
+ case 86: {
1850
+ const nodeID = buffer.readVarInt();
1851
+ const location = buffer.readLocation();
1852
+ const flags = buffer.readVarInt();
1853
+ const openingLoc = buffer.readOptionalLocation();
1854
+ const partsSize = buffer.readVarInt();
1855
+ const closingLoc = buffer.readOptionalLocation();
1856
+ const parts = stack.splice(stack.length - partsSize, partsSize);
1857
+ stack.push(new nodes.InterpolatedStringNode(nodeID, location, flags, openingLoc, parts, closingLoc));
1858
+ break;
1859
+ }
1860
+ case 87: {
1861
+ const nodeID = buffer.readVarInt();
1862
+ const location = buffer.readLocation();
1863
+ const flags = buffer.readVarInt();
1864
+ const openingLoc = buffer.readOptionalLocation();
1865
+ const partsSize = buffer.readVarInt();
1866
+ const closingLoc = buffer.readOptionalLocation();
1867
+ const parts = stack.splice(stack.length - partsSize, partsSize);
1868
+ stack.push(new nodes.InterpolatedSymbolNode(nodeID, location, flags, openingLoc, parts, closingLoc));
1869
+ break;
1870
+ }
1871
+ case 88: {
1872
+ const nodeID = buffer.readVarInt();
1873
+ const location = buffer.readLocation();
1874
+ const flags = buffer.readVarInt();
1875
+ const openingLoc = buffer.readLocation();
1876
+ const partsSize = buffer.readVarInt();
1877
+ const closingLoc = buffer.readLocation();
1878
+ const parts = stack.splice(stack.length - partsSize, partsSize);
1879
+ stack.push(new nodes.InterpolatedXStringNode(nodeID, location, flags, openingLoc, parts, closingLoc));
1880
+ break;
1881
+ }
1882
+ case 89: {
1883
+ const nodeID = buffer.readVarInt();
1884
+ const location = buffer.readLocation();
1885
+ const flags = buffer.readVarInt();
1886
+ stack.push(new nodes.ItLocalVariableReadNode(nodeID, location, flags));
1887
+ break;
1888
+ }
1889
+ case 90: {
1890
+ const nodeID = buffer.readVarInt();
1891
+ const location = buffer.readLocation();
1892
+ const flags = buffer.readVarInt();
1893
+ stack.push(new nodes.ItParametersNode(nodeID, location, flags));
1894
+ break;
1895
+ }
1896
+ case 91: {
1897
+ const nodeID = buffer.readVarInt();
1898
+ const location = buffer.readLocation();
1899
+ const flags = buffer.readVarInt();
1900
+ const elementsSize = buffer.readVarInt();
1901
+ const elements = stack.splice(stack.length - elementsSize, elementsSize);
1902
+ stack.push(new nodes.KeywordHashNode(nodeID, location, flags, elements));
1903
+ break;
1904
+ }
1905
+ case 92: {
1906
+ const nodeID = buffer.readVarInt();
1907
+ const location = buffer.readLocation();
1908
+ const flags = buffer.readVarInt();
1909
+ const name = readOptionalConstant();
1910
+ const nameLoc = buffer.readOptionalLocation();
1911
+ const operatorLoc = buffer.readLocation();
1912
+ stack.push(new nodes.KeywordRestParameterNode(nodeID, location, flags, name, nameLoc, operatorLoc));
1913
+ break;
1914
+ }
1915
+ case 93: {
1916
+ const nodeID = buffer.readVarInt();
1917
+ const location = buffer.readLocation();
1918
+ const flags = buffer.readVarInt();
1919
+ const locals = Array.from({ length: buffer.readVarInt() }, readRequiredConstant);
1920
+ const operatorLoc = buffer.readLocation();
1921
+ const openingLoc = buffer.readLocation();
1922
+ const closingLoc = buffer.readLocation();
1923
+ const body = stack.pop();
1924
+ const parameters = stack.pop();
1925
+ stack.push(new nodes.LambdaNode(nodeID, location, flags, locals, operatorLoc, openingLoc, closingLoc, parameters, body));
1926
+ break;
1927
+ }
1928
+ case 94: {
1929
+ const nodeID = buffer.readVarInt();
1930
+ const location = buffer.readLocation();
1931
+ const flags = buffer.readVarInt();
1932
+ const nameLoc = buffer.readLocation();
1933
+ const operatorLoc = buffer.readLocation();
1934
+ const name = readRequiredConstant();
1935
+ const depth = buffer.readVarInt();
1936
+ const value = stack.pop();
1937
+ stack.push(new nodes.LocalVariableAndWriteNode(nodeID, location, flags, nameLoc, operatorLoc, value, name, depth));
1938
+ break;
1939
+ }
1940
+ case 95: {
1941
+ const nodeID = buffer.readVarInt();
1942
+ const location = buffer.readLocation();
1943
+ const flags = buffer.readVarInt();
1944
+ const nameLoc = buffer.readLocation();
1945
+ const binaryOperatorLoc = buffer.readLocation();
1946
+ const name = readRequiredConstant();
1947
+ const binaryOperator = readRequiredConstant();
1948
+ const depth = buffer.readVarInt();
1949
+ const value = stack.pop();
1950
+ stack.push(new nodes.LocalVariableOperatorWriteNode(nodeID, location, flags, nameLoc, binaryOperatorLoc, value, name, binaryOperator, depth));
1951
+ break;
1952
+ }
1953
+ case 96: {
1954
+ const nodeID = buffer.readVarInt();
1955
+ const location = buffer.readLocation();
1956
+ const flags = buffer.readVarInt();
1957
+ const nameLoc = buffer.readLocation();
1958
+ const operatorLoc = buffer.readLocation();
1959
+ const name = readRequiredConstant();
1960
+ const depth = buffer.readVarInt();
1961
+ const value = stack.pop();
1962
+ stack.push(new nodes.LocalVariableOrWriteNode(nodeID, location, flags, nameLoc, operatorLoc, value, name, depth));
1963
+ break;
1964
+ }
1965
+ case 97: {
1966
+ const nodeID = buffer.readVarInt();
1967
+ const location = buffer.readLocation();
1968
+ const flags = buffer.readVarInt();
1969
+ const name = readRequiredConstant();
1970
+ const depth = buffer.readVarInt();
1971
+ stack.push(new nodes.LocalVariableReadNode(nodeID, location, flags, name, depth));
1972
+ break;
1973
+ }
1974
+ case 98: {
1975
+ const nodeID = buffer.readVarInt();
1976
+ const location = buffer.readLocation();
1977
+ const flags = buffer.readVarInt();
1978
+ const name = readRequiredConstant();
1979
+ const depth = buffer.readVarInt();
1980
+ stack.push(new nodes.LocalVariableTargetNode(nodeID, location, flags, name, depth));
1981
+ break;
1982
+ }
1983
+ case 99: {
1984
+ const nodeID = buffer.readVarInt();
1985
+ const location = buffer.readLocation();
1986
+ const flags = buffer.readVarInt();
1987
+ const name = readRequiredConstant();
1988
+ const depth = buffer.readVarInt();
1989
+ const nameLoc = buffer.readLocation();
1990
+ const operatorLoc = buffer.readLocation();
1991
+ const value = stack.pop();
1992
+ stack.push(new nodes.LocalVariableWriteNode(nodeID, location, flags, name, depth, nameLoc, value, operatorLoc));
1993
+ break;
1994
+ }
1995
+ case 100: {
1996
+ const nodeID = buffer.readVarInt();
1997
+ const location = buffer.readLocation();
1998
+ const flags = buffer.readVarInt();
1999
+ const openingLoc = buffer.readLocation();
2000
+ const contentLoc = buffer.readLocation();
2001
+ const closingLoc = buffer.readLocation();
2002
+ const unescaped = buffer.readStringField(flags);
2003
+ stack.push(new nodes.MatchLastLineNode(nodeID, location, flags, openingLoc, contentLoc, closingLoc, unescaped));
2004
+ break;
2005
+ }
2006
+ case 101: {
2007
+ const nodeID = buffer.readVarInt();
2008
+ const location = buffer.readLocation();
2009
+ const flags = buffer.readVarInt();
2010
+ const keywordLoc = buffer.readLocation();
2011
+ const pattern = stack.pop();
2012
+ const value = stack.pop();
2013
+ stack.push(new nodes.MatchPredicateNode(nodeID, location, flags, value, pattern, keywordLoc));
2014
+ break;
2015
+ }
2016
+ case 102: {
2017
+ const nodeID = buffer.readVarInt();
2018
+ const location = buffer.readLocation();
2019
+ const flags = buffer.readVarInt();
2020
+ const operatorLoc = buffer.readLocation();
2021
+ const pattern = stack.pop();
2022
+ const value = stack.pop();
2023
+ stack.push(new nodes.MatchRequiredNode(nodeID, location, flags, value, pattern, operatorLoc));
2024
+ break;
2025
+ }
2026
+ case 103: {
2027
+ const nodeID = buffer.readVarInt();
2028
+ const location = buffer.readLocation();
2029
+ const flags = buffer.readVarInt();
2030
+ const targetsSize = buffer.readVarInt();
2031
+ const targets = stack.splice(stack.length - targetsSize, targetsSize);
2032
+ const call = stack.pop();
2033
+ stack.push(new nodes.MatchWriteNode(nodeID, location, flags, call, targets));
2034
+ break;
2035
+ }
2036
+ case 104: {
2037
+ const nodeID = buffer.readVarInt();
2038
+ const location = buffer.readLocation();
2039
+ const flags = buffer.readVarInt();
2040
+ const locals = Array.from({ length: buffer.readVarInt() }, readRequiredConstant);
2041
+ const moduleKeywordLoc = buffer.readLocation();
2042
+ const endKeywordLoc = buffer.readLocation();
2043
+ const name = readRequiredConstant();
2044
+ const body = stack.pop();
2045
+ const constantPath = stack.pop();
2046
+ stack.push(new nodes.ModuleNode(nodeID, location, flags, locals, moduleKeywordLoc, constantPath, body, endKeywordLoc, name));
2047
+ break;
2048
+ }
2049
+ case 105: {
2050
+ const nodeID = buffer.readVarInt();
2051
+ const location = buffer.readLocation();
2052
+ const flags = buffer.readVarInt();
2053
+ const leftsSize = buffer.readVarInt();
2054
+ const rightsSize = buffer.readVarInt();
2055
+ const lparenLoc = buffer.readOptionalLocation();
2056
+ const rparenLoc = buffer.readOptionalLocation();
2057
+ const rights = stack.splice(stack.length - rightsSize, rightsSize);
2058
+ const rest = stack.pop();
2059
+ const lefts = stack.splice(stack.length - leftsSize, leftsSize);
2060
+ stack.push(new nodes.MultiTargetNode(nodeID, location, flags, lefts, rest, rights, lparenLoc, rparenLoc));
2061
+ break;
2062
+ }
2063
+ case 106: {
2064
+ const nodeID = buffer.readVarInt();
2065
+ const location = buffer.readLocation();
2066
+ const flags = buffer.readVarInt();
2067
+ const leftsSize = buffer.readVarInt();
2068
+ const rightsSize = buffer.readVarInt();
2069
+ const lparenLoc = buffer.readOptionalLocation();
2070
+ const rparenLoc = buffer.readOptionalLocation();
2071
+ const operatorLoc = buffer.readLocation();
2072
+ const value = stack.pop();
2073
+ const rights = stack.splice(stack.length - rightsSize, rightsSize);
2074
+ const rest = stack.pop();
2075
+ const lefts = stack.splice(stack.length - leftsSize, leftsSize);
2076
+ stack.push(new nodes.MultiWriteNode(nodeID, location, flags, lefts, rest, rights, lparenLoc, rparenLoc, operatorLoc, value));
2077
+ break;
2078
+ }
2079
+ case 107: {
2080
+ const nodeID = buffer.readVarInt();
2081
+ const location = buffer.readLocation();
2082
+ const flags = buffer.readVarInt();
2083
+ const keywordLoc = buffer.readLocation();
2084
+ const arguments_ = stack.pop();
2085
+ stack.push(new nodes.NextNode(nodeID, location, flags, arguments_, keywordLoc));
2086
+ break;
2087
+ }
2088
+ case 108: {
2089
+ const nodeID = buffer.readVarInt();
2090
+ const location = buffer.readLocation();
2091
+ const flags = buffer.readVarInt();
2092
+ stack.push(new nodes.NilNode(nodeID, location, flags));
2093
+ break;
2094
+ }
2095
+ case 109: {
2096
+ const nodeID = buffer.readVarInt();
2097
+ const location = buffer.readLocation();
2098
+ const flags = buffer.readVarInt();
2099
+ const operatorLoc = buffer.readLocation();
2100
+ const keywordLoc = buffer.readLocation();
2101
+ stack.push(new nodes.NoBlockParameterNode(nodeID, location, flags, operatorLoc, keywordLoc));
2102
+ break;
2103
+ }
2104
+ case 110: {
2105
+ const nodeID = buffer.readVarInt();
2106
+ const location = buffer.readLocation();
2107
+ const flags = buffer.readVarInt();
2108
+ const operatorLoc = buffer.readLocation();
2109
+ const keywordLoc = buffer.readLocation();
2110
+ stack.push(new nodes.NoKeywordsParameterNode(nodeID, location, flags, operatorLoc, keywordLoc));
2111
+ break;
2112
+ }
2113
+ case 111: {
2114
+ const nodeID = buffer.readVarInt();
2115
+ const location = buffer.readLocation();
2116
+ const flags = buffer.readVarInt();
2117
+ const maximum = buffer.readByte();
2118
+ stack.push(new nodes.NumberedParametersNode(nodeID, location, flags, maximum));
2119
+ break;
2120
+ }
2121
+ case 112: {
2122
+ const nodeID = buffer.readVarInt();
2123
+ const location = buffer.readLocation();
2124
+ const flags = buffer.readVarInt();
2125
+ const number = buffer.readVarInt();
2126
+ stack.push(new nodes.NumberedReferenceReadNode(nodeID, location, flags, number));
2127
+ break;
2128
+ }
2129
+ case 113: {
2130
+ const nodeID = buffer.readVarInt();
2131
+ const location = buffer.readLocation();
2132
+ const flags = buffer.readVarInt();
2133
+ const name = readRequiredConstant();
2134
+ const nameLoc = buffer.readLocation();
2135
+ const value = stack.pop();
2136
+ stack.push(new nodes.OptionalKeywordParameterNode(nodeID, location, flags, name, nameLoc, value));
2137
+ break;
2138
+ }
2139
+ case 114: {
2140
+ const nodeID = buffer.readVarInt();
2141
+ const location = buffer.readLocation();
2142
+ const flags = buffer.readVarInt();
2143
+ const name = readRequiredConstant();
2144
+ const nameLoc = buffer.readLocation();
2145
+ const operatorLoc = buffer.readLocation();
2146
+ const value = stack.pop();
2147
+ stack.push(new nodes.OptionalParameterNode(nodeID, location, flags, name, nameLoc, operatorLoc, value));
2148
+ break;
2149
+ }
2150
+ case 115: {
2151
+ const nodeID = buffer.readVarInt();
2152
+ const location = buffer.readLocation();
2153
+ const flags = buffer.readVarInt();
2154
+ const operatorLoc = buffer.readLocation();
2155
+ const right = stack.pop();
2156
+ const left = stack.pop();
2157
+ stack.push(new nodes.OrNode(nodeID, location, flags, left, right, operatorLoc));
2158
+ break;
2159
+ }
2160
+ case 116: {
2161
+ const nodeID = buffer.readVarInt();
2162
+ const location = buffer.readLocation();
2163
+ const flags = buffer.readVarInt();
2164
+ const requiredsSize = buffer.readVarInt();
2165
+ const optionalsSize = buffer.readVarInt();
2166
+ const postsSize = buffer.readVarInt();
2167
+ const keywordsSize = buffer.readVarInt();
2168
+ const block = stack.pop();
2169
+ const keywordRest = stack.pop();
2170
+ const keywords = stack.splice(stack.length - keywordsSize, keywordsSize);
2171
+ const posts = stack.splice(stack.length - postsSize, postsSize);
2172
+ const rest = stack.pop();
2173
+ const optionals = stack.splice(stack.length - optionalsSize, optionalsSize);
2174
+ const requireds = stack.splice(stack.length - requiredsSize, requiredsSize);
2175
+ stack.push(new nodes.ParametersNode(nodeID, location, flags, requireds, optionals, rest, posts, keywords, keywordRest, block));
2176
+ break;
2177
+ }
2178
+ case 117: {
2179
+ const nodeID = buffer.readVarInt();
2180
+ const location = buffer.readLocation();
2181
+ const flags = buffer.readVarInt();
2182
+ const openingLoc = buffer.readLocation();
2183
+ const closingLoc = buffer.readLocation();
2184
+ const body = stack.pop();
2185
+ stack.push(new nodes.ParenthesesNode(nodeID, location, flags, body, openingLoc, closingLoc));
2186
+ break;
2187
+ }
2188
+ case 118: {
2189
+ const nodeID = buffer.readVarInt();
2190
+ const location = buffer.readLocation();
2191
+ const flags = buffer.readVarInt();
2192
+ const operatorLoc = buffer.readLocation();
2193
+ const lparenLoc = buffer.readLocation();
2194
+ const rparenLoc = buffer.readLocation();
2195
+ const expression = stack.pop();
2196
+ stack.push(new nodes.PinnedExpressionNode(nodeID, location, flags, expression, operatorLoc, lparenLoc, rparenLoc));
2197
+ break;
2198
+ }
2199
+ case 119: {
2200
+ const nodeID = buffer.readVarInt();
2201
+ const location = buffer.readLocation();
2202
+ const flags = buffer.readVarInt();
2203
+ const operatorLoc = buffer.readLocation();
2204
+ const variable = stack.pop();
2205
+ stack.push(new nodes.PinnedVariableNode(nodeID, location, flags, variable, operatorLoc));
2206
+ break;
2207
+ }
2208
+ case 120: {
2209
+ const nodeID = buffer.readVarInt();
2210
+ const location = buffer.readLocation();
2211
+ const flags = buffer.readVarInt();
2212
+ const keywordLoc = buffer.readLocation();
2213
+ const openingLoc = buffer.readLocation();
2214
+ const closingLoc = buffer.readLocation();
2215
+ const statements = stack.pop();
2216
+ stack.push(new nodes.PostExecutionNode(nodeID, location, flags, statements, keywordLoc, openingLoc, closingLoc));
2217
+ break;
2218
+ }
2219
+ case 121: {
2220
+ const nodeID = buffer.readVarInt();
2221
+ const location = buffer.readLocation();
2222
+ const flags = buffer.readVarInt();
2223
+ const keywordLoc = buffer.readLocation();
2224
+ const openingLoc = buffer.readLocation();
2225
+ const closingLoc = buffer.readLocation();
2226
+ const statements = stack.pop();
2227
+ stack.push(new nodes.PreExecutionNode(nodeID, location, flags, statements, keywordLoc, openingLoc, closingLoc));
2228
+ break;
2229
+ }
2230
+ case 122: {
2231
+ const nodeID = buffer.readVarInt();
2232
+ const location = buffer.readLocation();
2233
+ const flags = buffer.readVarInt();
2234
+ const locals = Array.from({ length: buffer.readVarInt() }, readRequiredConstant);
2235
+ const statements = stack.pop();
2236
+ stack.push(new nodes.ProgramNode(nodeID, location, flags, locals, statements));
2237
+ break;
2238
+ }
2239
+ case 123: {
2240
+ const nodeID = buffer.readVarInt();
2241
+ const location = buffer.readLocation();
2242
+ const flags = buffer.readVarInt();
2243
+ const operatorLoc = buffer.readLocation();
2244
+ const right = stack.pop();
2245
+ const left = stack.pop();
2246
+ stack.push(new nodes.RangeNode(nodeID, location, flags, left, right, operatorLoc));
2247
+ break;
2248
+ }
2249
+ case 124: {
2250
+ const nodeID = buffer.readVarInt();
2251
+ const location = buffer.readLocation();
2252
+ const flags = buffer.readVarInt();
2253
+ const numerator = readInteger();
2254
+ const denominator = readInteger();
2255
+ stack.push(new nodes.RationalNode(nodeID, location, flags, numerator, denominator));
2256
+ break;
2257
+ }
2258
+ case 125: {
2259
+ const nodeID = buffer.readVarInt();
2260
+ const location = buffer.readLocation();
2261
+ const flags = buffer.readVarInt();
2262
+ stack.push(new nodes.RedoNode(nodeID, location, flags));
2263
+ break;
2264
+ }
2265
+ case 126: {
2266
+ const nodeID = buffer.readVarInt();
2267
+ const location = buffer.readLocation();
2268
+ const flags = buffer.readVarInt();
2269
+ const openingLoc = buffer.readLocation();
2270
+ const contentLoc = buffer.readLocation();
2271
+ const closingLoc = buffer.readLocation();
2272
+ const unescaped = buffer.readStringField(flags);
2273
+ stack.push(new nodes.RegularExpressionNode(nodeID, location, flags, openingLoc, contentLoc, closingLoc, unescaped));
2274
+ break;
2275
+ }
2276
+ case 127: {
2277
+ const nodeID = buffer.readVarInt();
2278
+ const location = buffer.readLocation();
2279
+ const flags = buffer.readVarInt();
2280
+ const name = readRequiredConstant();
2281
+ const nameLoc = buffer.readLocation();
2282
+ stack.push(new nodes.RequiredKeywordParameterNode(nodeID, location, flags, name, nameLoc));
2283
+ break;
2284
+ }
2285
+ case 128: {
2286
+ const nodeID = buffer.readVarInt();
2287
+ const location = buffer.readLocation();
2288
+ const flags = buffer.readVarInt();
2289
+ const name = readRequiredConstant();
2290
+ stack.push(new nodes.RequiredParameterNode(nodeID, location, flags, name));
2291
+ break;
2292
+ }
2293
+ case 129: {
2294
+ const nodeID = buffer.readVarInt();
2295
+ const location = buffer.readLocation();
2296
+ const flags = buffer.readVarInt();
2297
+ const keywordLoc = buffer.readLocation();
2298
+ const rescueExpression = stack.pop();
2299
+ const expression = stack.pop();
2300
+ stack.push(new nodes.RescueModifierNode(nodeID, location, flags, expression, keywordLoc, rescueExpression));
2301
+ break;
2302
+ }
2303
+ case 130: {
2304
+ const nodeID = buffer.readVarInt();
2305
+ const location = buffer.readLocation();
2306
+ const flags = buffer.readVarInt();
2307
+ const keywordLoc = buffer.readLocation();
2308
+ const exceptionsSize = buffer.readVarInt();
2309
+ const operatorLoc = buffer.readOptionalLocation();
2310
+ const thenKeywordLoc = buffer.readOptionalLocation();
2311
+ const subsequent = stack.pop();
2312
+ const statements = stack.pop();
2313
+ const reference = stack.pop();
2314
+ const exceptions = stack.splice(stack.length - exceptionsSize, exceptionsSize);
2315
+ stack.push(new nodes.RescueNode(nodeID, location, flags, keywordLoc, exceptions, operatorLoc, reference, thenKeywordLoc, statements, subsequent));
2316
+ break;
2317
+ }
2318
+ case 131: {
2319
+ const nodeID = buffer.readVarInt();
2320
+ const location = buffer.readLocation();
2321
+ const flags = buffer.readVarInt();
2322
+ const name = readOptionalConstant();
2323
+ const nameLoc = buffer.readOptionalLocation();
2324
+ const operatorLoc = buffer.readLocation();
2325
+ stack.push(new nodes.RestParameterNode(nodeID, location, flags, name, nameLoc, operatorLoc));
2326
+ break;
2327
+ }
2328
+ case 132: {
2329
+ const nodeID = buffer.readVarInt();
2330
+ const location = buffer.readLocation();
2331
+ const flags = buffer.readVarInt();
2332
+ stack.push(new nodes.RetryNode(nodeID, location, flags));
2333
+ break;
2334
+ }
2335
+ case 133: {
2336
+ const nodeID = buffer.readVarInt();
2337
+ const location = buffer.readLocation();
2338
+ const flags = buffer.readVarInt();
2339
+ const keywordLoc = buffer.readLocation();
2340
+ const arguments_ = stack.pop();
2341
+ stack.push(new nodes.ReturnNode(nodeID, location, flags, keywordLoc, arguments_));
2342
+ break;
2343
+ }
2344
+ case 134: {
2345
+ const nodeID = buffer.readVarInt();
2346
+ const location = buffer.readLocation();
2347
+ const flags = buffer.readVarInt();
2348
+ stack.push(new nodes.SelfNode(nodeID, location, flags));
2349
+ break;
2350
+ }
2351
+ case 135: {
2352
+ const nodeID = buffer.readVarInt();
2353
+ const location = buffer.readLocation();
2354
+ const flags = buffer.readVarInt();
2355
+ const write = stack.pop();
2356
+ stack.push(new nodes.ShareableConstantNode(nodeID, location, flags, write));
2357
+ break;
2358
+ }
2359
+ case 136: {
2360
+ const nodeID = buffer.readVarInt();
2361
+ const location = buffer.readLocation();
2362
+ const flags = buffer.readVarInt();
2363
+ const locals = Array.from({ length: buffer.readVarInt() }, readRequiredConstant);
2364
+ const classKeywordLoc = buffer.readLocation();
2365
+ const operatorLoc = buffer.readLocation();
2366
+ const endKeywordLoc = buffer.readLocation();
2367
+ const body = stack.pop();
2368
+ const expression = stack.pop();
2369
+ stack.push(new nodes.SingletonClassNode(nodeID, location, flags, locals, classKeywordLoc, operatorLoc, expression, body, endKeywordLoc));
2370
+ break;
2371
+ }
2372
+ case 137: {
2373
+ const nodeID = buffer.readVarInt();
2374
+ const location = buffer.readLocation();
2375
+ const flags = buffer.readVarInt();
2376
+ stack.push(new nodes.SourceEncodingNode(nodeID, location, flags));
2377
+ break;
2378
+ }
2379
+ case 138: {
2380
+ const nodeID = buffer.readVarInt();
2381
+ const location = buffer.readLocation();
2382
+ const flags = buffer.readVarInt();
2383
+ const filepath = buffer.readStringField(flags);
2384
+ stack.push(new nodes.SourceFileNode(nodeID, location, flags, filepath));
2385
+ break;
2386
+ }
2387
+ case 139: {
2388
+ const nodeID = buffer.readVarInt();
2389
+ const location = buffer.readLocation();
2390
+ const flags = buffer.readVarInt();
2391
+ stack.push(new nodes.SourceLineNode(nodeID, location, flags));
2392
+ break;
2393
+ }
2394
+ case 140: {
2395
+ const nodeID = buffer.readVarInt();
2396
+ const location = buffer.readLocation();
2397
+ const flags = buffer.readVarInt();
2398
+ const operatorLoc = buffer.readLocation();
2399
+ const expression = stack.pop();
2400
+ stack.push(new nodes.SplatNode(nodeID, location, flags, operatorLoc, expression));
2401
+ break;
2402
+ }
2403
+ case 141: {
2404
+ const nodeID = buffer.readVarInt();
2405
+ const location = buffer.readLocation();
2406
+ const flags = buffer.readVarInt();
2407
+ const bodySize = buffer.readVarInt();
2408
+ const body = stack.splice(stack.length - bodySize, bodySize);
2409
+ stack.push(new nodes.StatementsNode(nodeID, location, flags, body));
2410
+ break;
2411
+ }
2412
+ case 142: {
2413
+ const nodeID = buffer.readVarInt();
2414
+ const location = buffer.readLocation();
2415
+ const flags = buffer.readVarInt();
2416
+ const openingLoc = buffer.readOptionalLocation();
2417
+ const contentLoc = buffer.readLocation();
2418
+ const closingLoc = buffer.readOptionalLocation();
2419
+ const unescaped = buffer.readStringField(flags);
2420
+ stack.push(new nodes.StringNode(nodeID, location, flags, openingLoc, contentLoc, closingLoc, unescaped));
2421
+ break;
2422
+ }
2423
+ case 143: {
2424
+ const nodeID = buffer.readVarInt();
2425
+ const location = buffer.readLocation();
2426
+ const flags = buffer.readVarInt();
2427
+ const keywordLoc = buffer.readLocation();
2428
+ const lparenLoc = buffer.readOptionalLocation();
2429
+ const rparenLoc = buffer.readOptionalLocation();
2430
+ const block = stack.pop();
2431
+ const arguments_ = stack.pop();
2432
+ stack.push(new nodes.SuperNode(nodeID, location, flags, keywordLoc, lparenLoc, arguments_, rparenLoc, block));
2433
+ break;
2434
+ }
2435
+ case 144: {
2436
+ const nodeID = buffer.readVarInt();
2437
+ const location = buffer.readLocation();
2438
+ const flags = buffer.readVarInt();
2439
+ const openingLoc = buffer.readOptionalLocation();
2440
+ const contentLoc = buffer.readLocation();
2441
+ const closingLoc = buffer.readOptionalLocation();
2442
+ const unescaped = buffer.readStringField(flags);
2443
+ stack.push(new nodes.SymbolNode(nodeID, location, flags, openingLoc, contentLoc, closingLoc, unescaped));
2444
+ break;
2445
+ }
2446
+ case 145: {
2447
+ const nodeID = buffer.readVarInt();
2448
+ const location = buffer.readLocation();
2449
+ const flags = buffer.readVarInt();
2450
+ stack.push(new nodes.TrueNode(nodeID, location, flags));
2451
+ break;
2452
+ }
2453
+ case 146: {
2454
+ const nodeID = buffer.readVarInt();
2455
+ const location = buffer.readLocation();
2456
+ const flags = buffer.readVarInt();
2457
+ const namesSize = buffer.readVarInt();
2458
+ const keywordLoc = buffer.readLocation();
2459
+ const names = stack.splice(stack.length - namesSize, namesSize);
2460
+ stack.push(new nodes.UndefNode(nodeID, location, flags, names, keywordLoc));
2461
+ break;
2462
+ }
2463
+ case 147: {
2464
+ const nodeID = buffer.readVarInt();
2465
+ const location = buffer.readLocation();
2466
+ const flags = buffer.readVarInt();
2467
+ const unlessKeywordLoc = buffer.readLocation();
2468
+ const thenKeywordLoc = buffer.readOptionalLocation();
2469
+ const endKeywordLoc = buffer.readOptionalLocation();
2470
+ const elseClause = stack.pop();
2471
+ const statements = stack.pop();
2472
+ const predicate = stack.pop();
2473
+ stack.push(new nodes.UnlessNode(nodeID, location, flags, unlessKeywordLoc, predicate, thenKeywordLoc, statements, elseClause, endKeywordLoc));
2474
+ break;
2475
+ }
2476
+ case 148: {
2477
+ const nodeID = buffer.readVarInt();
2478
+ const location = buffer.readLocation();
2479
+ const flags = buffer.readVarInt();
2480
+ const untilKeywordLoc = buffer.readLocation();
2481
+ const doKeywordLoc = buffer.readOptionalLocation();
2482
+ const endKeywordLoc = buffer.readOptionalLocation();
2483
+ const statements = stack.pop();
2484
+ const predicate = stack.pop();
2485
+ stack.push(new nodes.UntilNode(nodeID, location, flags, untilKeywordLoc, doKeywordLoc, endKeywordLoc, predicate, statements));
2486
+ break;
2487
+ }
2488
+ case 149: {
2489
+ const nodeID = buffer.readVarInt();
2490
+ const location = buffer.readLocation();
2491
+ const flags = buffer.readVarInt();
2492
+ const whenKeywordLoc = buffer.readLocation();
2493
+ const conditionsSize = buffer.readVarInt();
2494
+ const thenKeywordLoc = buffer.readOptionalLocation();
2495
+ const statements = stack.pop();
2496
+ const conditions = stack.splice(stack.length - conditionsSize, conditionsSize);
2497
+ stack.push(new nodes.WhenNode(nodeID, location, flags, whenKeywordLoc, conditions, thenKeywordLoc, statements));
2498
+ break;
2499
+ }
2500
+ case 150: {
2501
+ const nodeID = buffer.readVarInt();
2502
+ const location = buffer.readLocation();
2503
+ const flags = buffer.readVarInt();
2504
+ const whileKeywordLoc = buffer.readLocation();
2505
+ const doKeywordLoc = buffer.readOptionalLocation();
2506
+ const endKeywordLoc = buffer.readOptionalLocation();
2507
+ const statements = stack.pop();
2508
+ const predicate = stack.pop();
2509
+ stack.push(new nodes.WhileNode(nodeID, location, flags, whileKeywordLoc, doKeywordLoc, endKeywordLoc, predicate, statements));
2510
+ break;
2511
+ }
2512
+ case 151: {
2513
+ const nodeID = buffer.readVarInt();
2514
+ const location = buffer.readLocation();
2515
+ const flags = buffer.readVarInt();
2516
+ const openingLoc = buffer.readLocation();
2517
+ const contentLoc = buffer.readLocation();
2518
+ const closingLoc = buffer.readLocation();
2519
+ const unescaped = buffer.readStringField(flags);
2520
+ stack.push(new nodes.XStringNode(nodeID, location, flags, openingLoc, contentLoc, closingLoc, unescaped));
2521
+ break;
2522
+ }
2523
+ case 152: {
2524
+ const nodeID = buffer.readVarInt();
2525
+ const location = buffer.readLocation();
2526
+ const flags = buffer.readVarInt();
2527
+ const keywordLoc = buffer.readLocation();
2528
+ const lparenLoc = buffer.readOptionalLocation();
2529
+ const rparenLoc = buffer.readOptionalLocation();
2530
+ const arguments_ = stack.pop();
2531
+ stack.push(new nodes.YieldNode(nodeID, location, flags, keywordLoc, lparenLoc, arguments_, rparenLoc));
2532
+ break;
2533
+ }
2534
+ default:
2535
+ throw new Error(`Unknown node type: ${type}`);
2536
+ }
2537
+ }
2538
+ if (buffer.index !== finish || stack.length !== 1) {
2539
+ throw new Error("Expected the serialized nodes to end at the constant pool with exactly one root");
2540
+ }
2541
+ return stack[0];
2542
+ }
2543
+ function scanConstant(constantIndex) {
2544
+ if (constants[constantIndex] === null) {
2545
+ constants[constantIndex] = buffer.scanConstant(constantPoolOffset, constantIndex);
2546
+ }
2547
+ return constants[constantIndex];
2548
+ }
2549
+ function readRequiredConstant() {
2550
+ return scanConstant(buffer.readVarInt() - 1);
2551
+ }
2552
+ function readOptionalConstant() {
2553
+ const index = buffer.readVarInt();
2554
+ if (index === 0) {
2555
+ return null;
2556
+ } else {
2557
+ return scanConstant(index - 1);
2558
+ }
2559
+ }
2560
+ function readInteger() {
2561
+ const negative = buffer.readByte() != 0;
2562
+ const length = buffer.readVarInt();
2563
+ const firstWord = buffer.readVarInt();
2564
+ if (length == 1) {
2565
+ if (negative && firstWord >= 2147483648) {
2566
+ return -BigInt(firstWord);
2567
+ } else if (negative) {
2568
+ return -firstWord;
2569
+ } else {
2570
+ return firstWord;
2571
+ }
2572
+ }
2573
+ let result = BigInt(firstWord);
2574
+ for (let index = 1; index < length; index++) {
2575
+ result |= BigInt(buffer.readVarInt()) << BigInt(index * 32);
2576
+ }
2577
+ return negative ? -result : result;
2578
+ }
2579
+ }
2580
+
2581
+ // ../../node_modules/@ruby/prism/src/parsePrism.js
2582
+ function parsePrism(prism, source, options = {}) {
2583
+ const dumpedOptions = dumpOptions(options);
2584
+ const bufferPointer = prism.pm_buffer_new();
2585
+ const sourcePointer = prism.malloc(source.length);
2586
+ const optionsPointer = prism.malloc(dumpedOptions.length);
2587
+ const sourceView = new Uint8Array(prism.memory.buffer, sourcePointer, source.length);
2588
+ sourceView.set(source);
2589
+ const optionsView = new Uint8Array(prism.memory.buffer, optionsPointer, dumpedOptions.length);
2590
+ optionsView.set(dumpedOptions);
2591
+ prism.pm_serialize_parse(bufferPointer, sourcePointer, source.length, optionsPointer);
2592
+ const serializedView = new Uint8Array(prism.memory.buffer, prism.pm_buffer_value(bufferPointer), prism.pm_buffer_length(bufferPointer));
2593
+ const deserialized = deserialize(source, serializedView);
2594
+ prism.pm_buffer_free(bufferPointer);
2595
+ prism.free(sourcePointer);
2596
+ prism.free(optionsPointer);
2597
+ return deserialized;
2598
+ }
2599
+ function dumpCommandLineOptions(options) {
2600
+ if (options.command_line === void 0) {
2601
+ return 0;
2602
+ }
2603
+ const commandLine = options.command_line;
2604
+ if (typeof commandLine !== "string") {
2605
+ throw new Error("command_line must be a string");
2606
+ }
2607
+ let value = 0;
2608
+ for (let index = 0; index < commandLine.length; index++) {
2609
+ switch (commandLine[index]) {
2610
+ case "a":
2611
+ value |= 1;
2612
+ break;
2613
+ case "e":
2614
+ value |= 2;
2615
+ break;
2616
+ case "l":
2617
+ value |= 4;
2618
+ break;
2619
+ case "n":
2620
+ value |= 8;
2621
+ break;
2622
+ case "p":
2623
+ value |= 16;
2624
+ break;
2625
+ case "x":
2626
+ value |= 32;
2627
+ break;
2628
+ default:
2629
+ throw new Error(`Unsupported command line flag '${commandLine[index]}'`);
2630
+ }
2631
+ }
2632
+ return value;
2633
+ }
2634
+ function dumpBooleanOption(value) {
2635
+ return value === void 0 || value === false || value === null ? 0 : 1;
2636
+ }
2637
+ function dumpOptions(options) {
2638
+ const template = [];
2639
+ const values = [];
2640
+ const encoder2 = new TextEncoder();
2641
+ template.push("L");
2642
+ if (options.filepath) {
2643
+ const filepath = encoder2.encode(options.filepath);
2644
+ values.push(filepath.length);
2645
+ values.push(filepath);
2646
+ template.push("A");
2647
+ } else {
2648
+ values.push(0);
2649
+ }
2650
+ template.push("l");
2651
+ values.push(options.line === void 0 ? 1 : options.line);
2652
+ template.push("L");
2653
+ if (options.encoding) {
2654
+ const encoding = encoder2.encode(options.encoding);
2655
+ values.push(encoding.length);
2656
+ values.push(encoding);
2657
+ template.push("A");
2658
+ } else {
2659
+ values.push(0);
2660
+ }
2661
+ template.push("C");
2662
+ values.push(dumpBooleanOption(options.frozen_string_literal));
2663
+ template.push("C");
2664
+ values.push(dumpCommandLineOptions(options));
2665
+ template.push("C");
2666
+ if (!options.version || options.version === "latest") {
2667
+ values.push(0);
2668
+ } else if (options.version.match(/^3\.3(\.\d+)?$/)) {
2669
+ values.push(1);
2670
+ } else if (options.version.match(/^3\.4(\.\d+)?$/)) {
2671
+ values.push(2);
2672
+ } else if (options.version.match(/^3\.5(\.\d+)?$/) || options.version.match(/^4\.0(\.\d+)?$/)) {
2673
+ values.push(3);
2674
+ } else if (options.version.match(/^4\.1(\.\d+)?$/)) {
2675
+ values.push(4);
2676
+ } else {
2677
+ throw new Error(`Unsupported version '${options.version}' in compiler options`);
2678
+ }
2679
+ template.push("C");
2680
+ values.push(options.encoding === false ? 1 : 0);
2681
+ template.push("C");
2682
+ values.push(dumpBooleanOption(options.main_script));
2683
+ template.push("C");
2684
+ values.push(dumpBooleanOption(options.partial_script));
2685
+ template.push("C");
2686
+ values.push(0);
2687
+ template.push("C");
2688
+ values.push(0);
2689
+ template.push("L");
2690
+ if (options.scopes) {
2691
+ const scopes = options.scopes;
2692
+ values.push(scopes.length);
2693
+ for (const scope of scopes) {
2694
+ let locals;
2695
+ let forwarding = 0;
2696
+ if (Array.isArray(scope)) {
2697
+ locals = scope;
2698
+ } else {
2699
+ locals = scope.locals || [];
2700
+ for (const forward of scope.forwarding || []) {
2701
+ switch (forward) {
2702
+ case "*":
2703
+ forwarding |= 1;
2704
+ break;
2705
+ case "**":
2706
+ forwarding |= 2;
2707
+ break;
2708
+ case "&":
2709
+ forwarding |= 4;
2710
+ break;
2711
+ case "...":
2712
+ forwarding |= 8;
2713
+ break;
2714
+ default:
2715
+ throw new Error(`invalid forwarding value: ${forward}`);
2716
+ }
2717
+ }
2718
+ }
2719
+ template.push("L");
2720
+ values.push(locals.length);
2721
+ template.push("C");
2722
+ values.push(forwarding);
2723
+ for (const local of locals) {
2724
+ template.push("L");
2725
+ values.push(local.length);
2726
+ template.push("A");
2727
+ values.push(encoder2.encode(local));
2728
+ }
2729
+ }
2730
+ } else {
2731
+ values.push(0);
2732
+ }
2733
+ return pack(values, template);
2734
+ }
2735
+ function pack(values, template) {
2736
+ const littleEndian = endianness() === "LE";
2737
+ const buffer = new ArrayBuffer(totalSizeOf(values, template));
2738
+ const data_view = new DataView(buffer);
2739
+ let offset = 0;
2740
+ for (let i = 0; i < values.length; i++) {
2741
+ switch (template[i]) {
2742
+ case "A":
2743
+ for (let c = 0; c < values[i].length; c++) {
2744
+ data_view.setUint8(offset + c, values[i][c]);
2745
+ }
2746
+ break;
2747
+ case "l":
2748
+ data_view.setInt32(offset, values[i], littleEndian);
2749
+ break;
2750
+ case "L":
2751
+ data_view.setUint32(offset, values[i], littleEndian);
2752
+ break;
2753
+ case "C":
2754
+ data_view.setUint8(offset, values[i], littleEndian);
2755
+ break;
2756
+ }
2757
+ offset += sizeOf(values, template, i);
2758
+ }
2759
+ return new Uint8Array(buffer);
2760
+ }
2761
+ function totalSizeOf(values, template) {
2762
+ let size = 0;
2763
+ for (let i = 0; i < values.length; i++) {
2764
+ size += sizeOf(values, template, i);
2765
+ }
2766
+ return size;
2767
+ }
2768
+ function sizeOf(values, template, index) {
2769
+ switch (template[index]) {
2770
+ // arbitrary binary string
2771
+ case "A":
2772
+ return values[index].length;
2773
+ // l: signed 32-bit integer, L: unsigned 32-bit integer
2774
+ case "l":
2775
+ case "L":
2776
+ return 4;
2777
+ // 8-bit unsigned integer
2778
+ case "C":
2779
+ return 1;
2780
+ }
2781
+ }
2782
+ function endianness() {
2783
+ const arr = new Uint8Array(4);
2784
+ new Uint32Array(arr.buffer)[0] = 4291559441;
2785
+ return arr[0] === 255 ? "BE" : "LE";
2786
+ }
2787
+ // Annotate the CommonJS export names for ESM import in node:
2788
+ 0 && (module.exports = {
2789
+ parsePrism
2790
+ });