jruby-prism-parser 0.23.0.pre.SNAPSHOT-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +401 -0
  3. data/CODE_OF_CONDUCT.md +76 -0
  4. data/CONTRIBUTING.md +62 -0
  5. data/LICENSE.md +7 -0
  6. data/Makefile +101 -0
  7. data/README.md +98 -0
  8. data/config.yml +2902 -0
  9. data/docs/build_system.md +91 -0
  10. data/docs/configuration.md +64 -0
  11. data/docs/cruby_compilation.md +27 -0
  12. data/docs/design.md +53 -0
  13. data/docs/encoding.md +121 -0
  14. data/docs/fuzzing.md +88 -0
  15. data/docs/heredocs.md +36 -0
  16. data/docs/javascript.md +118 -0
  17. data/docs/local_variable_depth.md +229 -0
  18. data/docs/mapping.md +117 -0
  19. data/docs/parser_translation.md +34 -0
  20. data/docs/parsing_rules.md +19 -0
  21. data/docs/releasing.md +98 -0
  22. data/docs/ripper.md +36 -0
  23. data/docs/ruby_api.md +43 -0
  24. data/docs/ruby_parser_translation.md +19 -0
  25. data/docs/serialization.md +209 -0
  26. data/docs/testing.md +55 -0
  27. data/ext/prism/api_node.c +5098 -0
  28. data/ext/prism/api_pack.c +267 -0
  29. data/ext/prism/extconf.rb +110 -0
  30. data/ext/prism/extension.c +1155 -0
  31. data/ext/prism/extension.h +18 -0
  32. data/include/prism/ast.h +5807 -0
  33. data/include/prism/defines.h +102 -0
  34. data/include/prism/diagnostic.h +339 -0
  35. data/include/prism/encoding.h +265 -0
  36. data/include/prism/node.h +57 -0
  37. data/include/prism/options.h +230 -0
  38. data/include/prism/pack.h +152 -0
  39. data/include/prism/parser.h +732 -0
  40. data/include/prism/prettyprint.h +26 -0
  41. data/include/prism/regexp.h +33 -0
  42. data/include/prism/util/pm_buffer.h +155 -0
  43. data/include/prism/util/pm_char.h +205 -0
  44. data/include/prism/util/pm_constant_pool.h +209 -0
  45. data/include/prism/util/pm_list.h +97 -0
  46. data/include/prism/util/pm_memchr.h +29 -0
  47. data/include/prism/util/pm_newline_list.h +93 -0
  48. data/include/prism/util/pm_state_stack.h +42 -0
  49. data/include/prism/util/pm_string.h +150 -0
  50. data/include/prism/util/pm_string_list.h +44 -0
  51. data/include/prism/util/pm_strncasecmp.h +32 -0
  52. data/include/prism/util/pm_strpbrk.h +46 -0
  53. data/include/prism/version.h +29 -0
  54. data/include/prism.h +289 -0
  55. data/jruby-prism.jar +0 -0
  56. data/lib/prism/compiler.rb +486 -0
  57. data/lib/prism/debug.rb +206 -0
  58. data/lib/prism/desugar_compiler.rb +207 -0
  59. data/lib/prism/dispatcher.rb +2150 -0
  60. data/lib/prism/dot_visitor.rb +4634 -0
  61. data/lib/prism/dsl.rb +785 -0
  62. data/lib/prism/ffi.rb +346 -0
  63. data/lib/prism/lex_compat.rb +908 -0
  64. data/lib/prism/mutation_compiler.rb +753 -0
  65. data/lib/prism/node.rb +17864 -0
  66. data/lib/prism/node_ext.rb +212 -0
  67. data/lib/prism/node_inspector.rb +68 -0
  68. data/lib/prism/pack.rb +224 -0
  69. data/lib/prism/parse_result/comments.rb +177 -0
  70. data/lib/prism/parse_result/newlines.rb +64 -0
  71. data/lib/prism/parse_result.rb +498 -0
  72. data/lib/prism/pattern.rb +250 -0
  73. data/lib/prism/serialize.rb +1354 -0
  74. data/lib/prism/translation/parser/compiler.rb +1838 -0
  75. data/lib/prism/translation/parser/lexer.rb +335 -0
  76. data/lib/prism/translation/parser/rubocop.rb +37 -0
  77. data/lib/prism/translation/parser.rb +178 -0
  78. data/lib/prism/translation/ripper.rb +577 -0
  79. data/lib/prism/translation/ruby_parser.rb +1521 -0
  80. data/lib/prism/translation.rb +11 -0
  81. data/lib/prism/version.rb +3 -0
  82. data/lib/prism/visitor.rb +495 -0
  83. data/lib/prism.rb +99 -0
  84. data/prism.gemspec +135 -0
  85. data/rbi/prism.rbi +7767 -0
  86. data/rbi/prism_static.rbi +207 -0
  87. data/sig/prism.rbs +4773 -0
  88. data/sig/prism_static.rbs +201 -0
  89. data/src/diagnostic.c +400 -0
  90. data/src/encoding.c +5132 -0
  91. data/src/node.c +2786 -0
  92. data/src/options.c +213 -0
  93. data/src/pack.c +493 -0
  94. data/src/prettyprint.c +8881 -0
  95. data/src/prism.c +18406 -0
  96. data/src/regexp.c +638 -0
  97. data/src/serialize.c +1554 -0
  98. data/src/token_type.c +700 -0
  99. data/src/util/pm_buffer.c +190 -0
  100. data/src/util/pm_char.c +318 -0
  101. data/src/util/pm_constant_pool.c +322 -0
  102. data/src/util/pm_list.c +49 -0
  103. data/src/util/pm_memchr.c +35 -0
  104. data/src/util/pm_newline_list.c +84 -0
  105. data/src/util/pm_state_stack.c +25 -0
  106. data/src/util/pm_string.c +203 -0
  107. data/src/util/pm_string_list.c +28 -0
  108. data/src/util/pm_strncasecmp.c +24 -0
  109. data/src/util/pm_strpbrk.c +180 -0
  110. metadata +156 -0
@@ -0,0 +1,1354 @@
1
+ # frozen_string_literal: true
2
+ =begin
3
+ This file is generated by the templates/template.rb script and should not be
4
+ modified manually. See templates/lib/prism/serialize.rb.erb
5
+ if you are looking to modify the template
6
+ =end
7
+
8
+ require "stringio"
9
+
10
+ # Polyfill for String#unpack1 with the offset parameter.
11
+ if String.instance_method(:unpack1).parameters.none? { |_, name| name == :offset }
12
+ String.prepend(
13
+ Module.new {
14
+ def unpack1(format, offset: 0) # :nodoc:
15
+ offset == 0 ? super(format) : self[offset..].unpack1(format)
16
+ end
17
+ }
18
+ )
19
+ end
20
+
21
+ module Prism
22
+ # A module responsible for deserializing parse results.
23
+ module Serialize
24
+ # The major version of prism that we are expecting to find in the serialized
25
+ # strings.
26
+ MAJOR_VERSION = 0
27
+
28
+ # The minor version of prism that we are expecting to find in the serialized
29
+ # strings.
30
+ MINOR_VERSION = 23
31
+
32
+ # The patch version of prism that we are expecting to find in the serialized
33
+ # strings.
34
+ PATCH_VERSION = 0
35
+
36
+ # Deserialize the AST represented by the given string into a parse result.
37
+ def self.load(input, serialized)
38
+ input = input.dup
39
+ source = Source.new(input)
40
+ loader = Loader.new(source, serialized)
41
+ result = loader.load_result
42
+
43
+ input.force_encoding(loader.encoding)
44
+ result
45
+ end
46
+
47
+ # Deserialize the tokens represented by the given string into a parse
48
+ # result.
49
+ def self.load_tokens(source, serialized)
50
+ Loader.new(source, serialized).load_tokens_result
51
+ end
52
+
53
+ class Loader # :nodoc:
54
+ attr_reader :encoding, :input, :serialized, :io
55
+ attr_reader :constant_pool_offset, :constant_pool, :source
56
+ attr_reader :start_line
57
+
58
+ def initialize(source, serialized)
59
+ @encoding = Encoding::UTF_8
60
+
61
+ @input = source.source.dup
62
+ @serialized = serialized
63
+ @io = StringIO.new(serialized)
64
+ @io.set_encoding(Encoding::BINARY)
65
+
66
+ @constant_pool_offset = nil
67
+ @constant_pool = nil
68
+
69
+ @source = source
70
+ define_load_node_lambdas unless RUBY_ENGINE == "ruby"
71
+ end
72
+
73
+ def load_header
74
+ raise "Invalid serialization" if io.read(5) != "PRISM"
75
+ raise "Invalid serialization" if io.read(3).unpack("C3") != [MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION]
76
+ only_semantic_fields = io.read(1).unpack1("C")
77
+ unless only_semantic_fields == 0
78
+ raise "Invalid serialization (location fields must be included but are not)"
79
+ end
80
+ end
81
+
82
+ def load_encoding
83
+ @encoding = Encoding.find(io.read(load_varuint))
84
+ @input = input.force_encoding(@encoding).freeze
85
+ @encoding
86
+ end
87
+
88
+ def load_start_line
89
+ source.instance_variable_set :@start_line, load_varsint
90
+ end
91
+
92
+ def load_line_offsets
93
+ source.instance_variable_set :@offsets, Array.new(load_varuint) { load_varuint }
94
+ end
95
+
96
+ def load_comments
97
+ Array.new(load_varuint) do
98
+ case load_varuint
99
+ when 0 then InlineComment.new(load_location)
100
+ when 1 then EmbDocComment.new(load_location)
101
+ when 2 then DATAComment.new(load_location)
102
+ end
103
+ end
104
+ end
105
+
106
+ def load_metadata
107
+ comments = load_comments
108
+ magic_comments = Array.new(load_varuint) { MagicComment.new(load_location, load_location) }
109
+ data_loc = load_optional_location
110
+ errors = Array.new(load_varuint) { ParseError.new(load_embedded_string, load_location, load_error_level) }
111
+ warnings = Array.new(load_varuint) { ParseWarning.new(load_embedded_string, load_location, load_warning_level) }
112
+ [comments, magic_comments, data_loc, errors, warnings]
113
+ end
114
+
115
+ def load_tokens
116
+ tokens = []
117
+ while type = TOKEN_TYPES.fetch(load_varuint)
118
+ start = load_varuint
119
+ length = load_varuint
120
+ lex_state = load_varuint
121
+ location = Location.new(@source, start, length)
122
+ tokens << [Prism::Token.new(type, location.slice, location), lex_state]
123
+ end
124
+
125
+ tokens
126
+ end
127
+
128
+ def load_tokens_result
129
+ tokens = load_tokens
130
+ encoding = load_encoding
131
+ load_start_line
132
+ load_line_offsets
133
+ comments, magic_comments, data_loc, errors, warnings = load_metadata
134
+ tokens.each { |token,| token.value.force_encoding(encoding) }
135
+
136
+ raise "Expected to consume all bytes while deserializing" unless @io.eof?
137
+ Prism::ParseResult.new(tokens, comments, magic_comments, data_loc, errors, warnings, @source)
138
+ end
139
+
140
+ def load_nodes
141
+ load_header
142
+ load_encoding
143
+ load_start_line
144
+ load_line_offsets
145
+
146
+ comments, magic_comments, data_loc, errors, warnings = load_metadata
147
+
148
+ @constant_pool_offset = io.read(4).unpack1("L")
149
+ @constant_pool = Array.new(load_varuint, nil)
150
+
151
+ [load_node, comments, magic_comments, data_loc, errors, warnings]
152
+ end
153
+
154
+ def load_result
155
+ node, comments, magic_comments, data_loc, errors, warnings = load_nodes
156
+ Prism::ParseResult.new(node, comments, magic_comments, data_loc, errors, warnings, @source)
157
+ end
158
+
159
+ private
160
+
161
+ # variable-length integer using https://en.wikipedia.org/wiki/LEB128
162
+ # This is also what protobuf uses: https://protobuf.dev/programming-guides/encoding/#varints
163
+ def load_varuint
164
+ n = io.getbyte
165
+ if n < 128
166
+ n
167
+ else
168
+ n -= 128
169
+ shift = 0
170
+ while (b = io.getbyte) >= 128
171
+ n += (b - 128) << (shift += 7)
172
+ end
173
+ n + (b << (shift + 7))
174
+ end
175
+ end
176
+
177
+ def load_varsint
178
+ n = load_varuint
179
+ (n >> 1) ^ (-(n & 1))
180
+ end
181
+
182
+ def load_serialized_length
183
+ io.read(4).unpack1("L")
184
+ end
185
+
186
+ def load_optional_node
187
+ if io.getbyte != 0
188
+ io.pos -= 1
189
+ load_node
190
+ end
191
+ end
192
+
193
+ def load_embedded_string
194
+ io.read(load_varuint).force_encoding(encoding)
195
+ end
196
+
197
+ def load_string
198
+ type = io.getbyte
199
+ case type
200
+ when 1
201
+ input.byteslice(load_varuint, load_varuint).force_encoding(encoding)
202
+ when 2
203
+ load_embedded_string
204
+ else
205
+ raise "Unknown serialized string type: #{type}"
206
+ end
207
+ end
208
+
209
+ def load_location
210
+ Location.new(source, load_varuint, load_varuint)
211
+ end
212
+
213
+ def load_optional_location
214
+ load_location if io.getbyte != 0
215
+ end
216
+
217
+ def load_constant(index)
218
+ constant = constant_pool[index]
219
+
220
+ unless constant
221
+ offset = constant_pool_offset + index * 8
222
+ start = serialized.unpack1("L", offset: offset)
223
+ length = serialized.unpack1("L", offset: offset + 4)
224
+
225
+ constant =
226
+ if start.nobits?(1 << 31)
227
+ input.byteslice(start, length).force_encoding(@encoding).to_sym
228
+ else
229
+ serialized.byteslice(start & ((1 << 31) - 1), length).force_encoding(@encoding).to_sym
230
+ end
231
+
232
+ constant_pool[index] = constant
233
+ end
234
+
235
+ constant
236
+ end
237
+
238
+ def load_required_constant
239
+ load_constant(load_varuint - 1)
240
+ end
241
+
242
+ def load_optional_constant
243
+ index = load_varuint
244
+ load_constant(index - 1) if index != 0
245
+ end
246
+
247
+ def load_error_level
248
+ level = io.getbyte
249
+
250
+ case level
251
+ when 0
252
+ :fatal
253
+ when 1
254
+ :argument
255
+ else
256
+ raise "Unknown level: #{level}"
257
+ end
258
+ end
259
+
260
+ def load_warning_level
261
+ level = io.getbyte
262
+
263
+ case level
264
+ when 0
265
+ :default
266
+ when 1
267
+ :verbose
268
+ else
269
+ raise "Unknown level: #{level}"
270
+ end
271
+ end
272
+
273
+ if RUBY_ENGINE == 'ruby'
274
+ def load_node
275
+ type = io.getbyte
276
+ location = load_location
277
+
278
+ case type
279
+ when 1 then
280
+ AliasGlobalVariableNode.new(load_node, load_node, load_location, location)
281
+ when 2 then
282
+ AliasMethodNode.new(load_node, load_node, load_location, location)
283
+ when 3 then
284
+ AlternationPatternNode.new(load_node, load_node, load_location, location)
285
+ when 4 then
286
+ AndNode.new(load_node, load_node, load_location, location)
287
+ when 5 then
288
+ ArgumentsNode.new(load_varuint, Array.new(load_varuint) { load_node }, location)
289
+ when 6 then
290
+ ArrayNode.new(load_varuint, Array.new(load_varuint) { load_node }, load_optional_location, load_optional_location, location)
291
+ when 7 then
292
+ ArrayPatternNode.new(load_optional_node, Array.new(load_varuint) { load_node }, load_optional_node, Array.new(load_varuint) { load_node }, load_optional_location, load_optional_location, location)
293
+ when 8 then
294
+ AssocNode.new(load_node, load_node, load_optional_location, location)
295
+ when 9 then
296
+ AssocSplatNode.new(load_optional_node, load_location, location)
297
+ when 10 then
298
+ BackReferenceReadNode.new(load_required_constant, location)
299
+ when 11 then
300
+ BeginNode.new(load_optional_location, load_optional_node, load_optional_node, load_optional_node, load_optional_node, load_optional_location, location)
301
+ when 12 then
302
+ BlockArgumentNode.new(load_optional_node, load_location, location)
303
+ when 13 then
304
+ BlockLocalVariableNode.new(load_varuint, load_required_constant, location)
305
+ when 14 then
306
+ BlockNode.new(Array.new(load_varuint) { load_required_constant }, load_optional_node, load_optional_node, load_location, load_location, location)
307
+ when 15 then
308
+ BlockParameterNode.new(load_varuint, load_optional_constant, load_optional_location, load_location, location)
309
+ when 16 then
310
+ BlockParametersNode.new(load_optional_node, Array.new(load_varuint) { load_node }, load_optional_location, load_optional_location, location)
311
+ when 17 then
312
+ BreakNode.new(load_optional_node, load_location, location)
313
+ when 18 then
314
+ CallAndWriteNode.new(load_varuint, load_optional_node, load_optional_location, load_optional_location, load_required_constant, load_required_constant, load_location, load_node, location)
315
+ when 19 then
316
+ CallNode.new(load_varuint, load_optional_node, load_optional_location, load_required_constant, load_optional_location, load_optional_location, load_optional_node, load_optional_location, load_optional_node, location)
317
+ when 20 then
318
+ CallOperatorWriteNode.new(load_varuint, load_optional_node, load_optional_location, load_optional_location, load_required_constant, load_required_constant, load_required_constant, load_location, load_node, location)
319
+ when 21 then
320
+ CallOrWriteNode.new(load_varuint, load_optional_node, load_optional_location, load_optional_location, load_required_constant, load_required_constant, load_location, load_node, location)
321
+ when 22 then
322
+ CallTargetNode.new(load_varuint, load_node, load_location, load_required_constant, load_location, location)
323
+ when 23 then
324
+ CapturePatternNode.new(load_node, load_node, load_location, location)
325
+ when 24 then
326
+ CaseMatchNode.new(load_optional_node, Array.new(load_varuint) { load_node }, load_optional_node, load_location, load_location, location)
327
+ when 25 then
328
+ CaseNode.new(load_optional_node, Array.new(load_varuint) { load_node }, load_optional_node, load_location, load_location, location)
329
+ when 26 then
330
+ ClassNode.new(Array.new(load_varuint) { load_required_constant }, load_location, load_node, load_optional_location, load_optional_node, load_optional_node, load_location, load_required_constant, location)
331
+ when 27 then
332
+ ClassVariableAndWriteNode.new(load_required_constant, load_location, load_location, load_node, location)
333
+ when 28 then
334
+ ClassVariableOperatorWriteNode.new(load_required_constant, load_location, load_location, load_node, load_required_constant, location)
335
+ when 29 then
336
+ ClassVariableOrWriteNode.new(load_required_constant, load_location, load_location, load_node, location)
337
+ when 30 then
338
+ ClassVariableReadNode.new(load_required_constant, location)
339
+ when 31 then
340
+ ClassVariableTargetNode.new(load_required_constant, location)
341
+ when 32 then
342
+ ClassVariableWriteNode.new(load_required_constant, load_location, load_node, load_optional_location, location)
343
+ when 33 then
344
+ ConstantAndWriteNode.new(load_required_constant, load_location, load_location, load_node, location)
345
+ when 34 then
346
+ ConstantOperatorWriteNode.new(load_required_constant, load_location, load_location, load_node, load_required_constant, location)
347
+ when 35 then
348
+ ConstantOrWriteNode.new(load_required_constant, load_location, load_location, load_node, location)
349
+ when 36 then
350
+ ConstantPathAndWriteNode.new(load_node, load_location, load_node, location)
351
+ when 37 then
352
+ ConstantPathNode.new(load_optional_node, load_node, load_location, location)
353
+ when 38 then
354
+ ConstantPathOperatorWriteNode.new(load_node, load_location, load_node, load_required_constant, location)
355
+ when 39 then
356
+ ConstantPathOrWriteNode.new(load_node, load_location, load_node, location)
357
+ when 40 then
358
+ ConstantPathTargetNode.new(load_optional_node, load_node, load_location, location)
359
+ when 41 then
360
+ ConstantPathWriteNode.new(load_node, load_location, load_node, location)
361
+ when 42 then
362
+ ConstantReadNode.new(load_required_constant, location)
363
+ when 43 then
364
+ ConstantTargetNode.new(load_required_constant, location)
365
+ when 44 then
366
+ ConstantWriteNode.new(load_required_constant, load_location, load_node, load_location, location)
367
+ when 45 then
368
+ load_serialized_length
369
+ DefNode.new(load_required_constant, load_location, load_optional_node, load_optional_node, load_optional_node, Array.new(load_varuint) { load_required_constant }, load_location, load_optional_location, load_optional_location, load_optional_location, load_optional_location, load_optional_location, location)
370
+ when 46 then
371
+ DefinedNode.new(load_optional_location, load_node, load_optional_location, load_location, location)
372
+ when 47 then
373
+ ElseNode.new(load_location, load_optional_node, load_optional_location, location)
374
+ when 48 then
375
+ EmbeddedStatementsNode.new(load_location, load_optional_node, load_location, location)
376
+ when 49 then
377
+ EmbeddedVariableNode.new(load_location, load_node, location)
378
+ when 50 then
379
+ EnsureNode.new(load_location, load_optional_node, load_location, location)
380
+ when 51 then
381
+ FalseNode.new(location)
382
+ when 52 then
383
+ FindPatternNode.new(load_optional_node, load_node, Array.new(load_varuint) { load_node }, load_node, load_optional_location, load_optional_location, location)
384
+ when 53 then
385
+ FlipFlopNode.new(load_varuint, load_optional_node, load_optional_node, load_location, location)
386
+ when 54 then
387
+ FloatNode.new(location)
388
+ when 55 then
389
+ ForNode.new(load_node, load_node, load_optional_node, load_location, load_location, load_optional_location, load_location, location)
390
+ when 56 then
391
+ ForwardingArgumentsNode.new(location)
392
+ when 57 then
393
+ ForwardingParameterNode.new(location)
394
+ when 58 then
395
+ ForwardingSuperNode.new(load_optional_node, location)
396
+ when 59 then
397
+ GlobalVariableAndWriteNode.new(load_required_constant, load_location, load_location, load_node, location)
398
+ when 60 then
399
+ GlobalVariableOperatorWriteNode.new(load_required_constant, load_location, load_location, load_node, load_required_constant, location)
400
+ when 61 then
401
+ GlobalVariableOrWriteNode.new(load_required_constant, load_location, load_location, load_node, location)
402
+ when 62 then
403
+ GlobalVariableReadNode.new(load_required_constant, location)
404
+ when 63 then
405
+ GlobalVariableTargetNode.new(load_required_constant, location)
406
+ when 64 then
407
+ GlobalVariableWriteNode.new(load_required_constant, load_location, load_node, load_location, location)
408
+ when 65 then
409
+ HashNode.new(load_location, Array.new(load_varuint) { load_node }, load_location, location)
410
+ when 66 then
411
+ HashPatternNode.new(load_optional_node, Array.new(load_varuint) { load_node }, load_optional_node, load_optional_location, load_optional_location, location)
412
+ when 67 then
413
+ IfNode.new(load_optional_location, load_node, load_optional_location, load_optional_node, load_optional_node, load_optional_location, location)
414
+ when 68 then
415
+ ImaginaryNode.new(load_node, location)
416
+ when 69 then
417
+ ImplicitNode.new(load_node, location)
418
+ when 70 then
419
+ ImplicitRestNode.new(location)
420
+ when 71 then
421
+ InNode.new(load_node, load_optional_node, load_location, load_optional_location, location)
422
+ when 72 then
423
+ IndexAndWriteNode.new(load_varuint, load_optional_node, load_optional_location, load_location, load_optional_node, load_location, load_optional_node, load_location, load_node, location)
424
+ when 73 then
425
+ IndexOperatorWriteNode.new(load_varuint, load_optional_node, load_optional_location, load_location, load_optional_node, load_location, load_optional_node, load_required_constant, load_location, load_node, location)
426
+ when 74 then
427
+ IndexOrWriteNode.new(load_varuint, load_optional_node, load_optional_location, load_location, load_optional_node, load_location, load_optional_node, load_location, load_node, location)
428
+ when 75 then
429
+ IndexTargetNode.new(load_varuint, load_node, load_location, load_optional_node, load_location, load_optional_node, location)
430
+ when 76 then
431
+ InstanceVariableAndWriteNode.new(load_required_constant, load_location, load_location, load_node, location)
432
+ when 77 then
433
+ InstanceVariableOperatorWriteNode.new(load_required_constant, load_location, load_location, load_node, load_required_constant, location)
434
+ when 78 then
435
+ InstanceVariableOrWriteNode.new(load_required_constant, load_location, load_location, load_node, location)
436
+ when 79 then
437
+ InstanceVariableReadNode.new(load_required_constant, location)
438
+ when 80 then
439
+ InstanceVariableTargetNode.new(load_required_constant, location)
440
+ when 81 then
441
+ InstanceVariableWriteNode.new(load_required_constant, load_location, load_node, load_location, location)
442
+ when 82 then
443
+ IntegerNode.new(load_varuint, location)
444
+ when 83 then
445
+ InterpolatedMatchLastLineNode.new(load_varuint, load_location, Array.new(load_varuint) { load_node }, load_location, location)
446
+ when 84 then
447
+ InterpolatedRegularExpressionNode.new(load_varuint, load_location, Array.new(load_varuint) { load_node }, load_location, location)
448
+ when 85 then
449
+ InterpolatedStringNode.new(load_optional_location, Array.new(load_varuint) { load_node }, load_optional_location, location)
450
+ when 86 then
451
+ InterpolatedSymbolNode.new(load_optional_location, Array.new(load_varuint) { load_node }, load_optional_location, location)
452
+ when 87 then
453
+ InterpolatedXStringNode.new(load_location, Array.new(load_varuint) { load_node }, load_location, location)
454
+ when 88 then
455
+ KeywordHashNode.new(load_varuint, Array.new(load_varuint) { load_node }, location)
456
+ when 89 then
457
+ KeywordRestParameterNode.new(load_varuint, load_optional_constant, load_optional_location, load_location, location)
458
+ when 90 then
459
+ LambdaNode.new(Array.new(load_varuint) { load_required_constant }, load_location, load_location, load_location, load_optional_node, load_optional_node, location)
460
+ when 91 then
461
+ LocalVariableAndWriteNode.new(load_location, load_location, load_node, load_required_constant, load_varuint, location)
462
+ when 92 then
463
+ LocalVariableOperatorWriteNode.new(load_location, load_location, load_node, load_required_constant, load_required_constant, load_varuint, location)
464
+ when 93 then
465
+ LocalVariableOrWriteNode.new(load_location, load_location, load_node, load_required_constant, load_varuint, location)
466
+ when 94 then
467
+ LocalVariableReadNode.new(load_required_constant, load_varuint, location)
468
+ when 95 then
469
+ LocalVariableTargetNode.new(load_required_constant, load_varuint, location)
470
+ when 96 then
471
+ LocalVariableWriteNode.new(load_required_constant, load_varuint, load_location, load_node, load_location, location)
472
+ when 97 then
473
+ MatchLastLineNode.new(load_varuint, load_location, load_location, load_location, load_string, location)
474
+ when 98 then
475
+ MatchPredicateNode.new(load_node, load_node, load_location, location)
476
+ when 99 then
477
+ MatchRequiredNode.new(load_node, load_node, load_location, location)
478
+ when 100 then
479
+ MatchWriteNode.new(load_node, Array.new(load_varuint) { load_node }, location)
480
+ when 101 then
481
+ MissingNode.new(location)
482
+ when 102 then
483
+ ModuleNode.new(Array.new(load_varuint) { load_required_constant }, load_location, load_node, load_optional_node, load_location, load_required_constant, location)
484
+ when 103 then
485
+ MultiTargetNode.new(Array.new(load_varuint) { load_node }, load_optional_node, Array.new(load_varuint) { load_node }, load_optional_location, load_optional_location, location)
486
+ when 104 then
487
+ MultiWriteNode.new(Array.new(load_varuint) { load_node }, load_optional_node, Array.new(load_varuint) { load_node }, load_optional_location, load_optional_location, load_location, load_node, location)
488
+ when 105 then
489
+ NextNode.new(load_optional_node, load_location, location)
490
+ when 106 then
491
+ NilNode.new(location)
492
+ when 107 then
493
+ NoKeywordsParameterNode.new(load_location, load_location, location)
494
+ when 108 then
495
+ NumberedParametersNode.new(io.getbyte, location)
496
+ when 109 then
497
+ NumberedReferenceReadNode.new(load_varuint, location)
498
+ when 110 then
499
+ OptionalKeywordParameterNode.new(load_varuint, load_required_constant, load_location, load_node, location)
500
+ when 111 then
501
+ OptionalParameterNode.new(load_varuint, load_required_constant, load_location, load_location, load_node, location)
502
+ when 112 then
503
+ OrNode.new(load_node, load_node, load_location, location)
504
+ when 113 then
505
+ ParametersNode.new(Array.new(load_varuint) { load_node }, Array.new(load_varuint) { load_node }, load_optional_node, Array.new(load_varuint) { load_node }, Array.new(load_varuint) { load_node }, load_optional_node, load_optional_node, location)
506
+ when 114 then
507
+ ParenthesesNode.new(load_optional_node, load_location, load_location, location)
508
+ when 115 then
509
+ PinnedExpressionNode.new(load_node, load_location, load_location, load_location, location)
510
+ when 116 then
511
+ PinnedVariableNode.new(load_node, load_location, location)
512
+ when 117 then
513
+ PostExecutionNode.new(load_optional_node, load_location, load_location, load_location, location)
514
+ when 118 then
515
+ PreExecutionNode.new(load_optional_node, load_location, load_location, load_location, location)
516
+ when 119 then
517
+ ProgramNode.new(Array.new(load_varuint) { load_required_constant }, load_node, location)
518
+ when 120 then
519
+ RangeNode.new(load_varuint, load_optional_node, load_optional_node, load_location, location)
520
+ when 121 then
521
+ RationalNode.new(load_node, location)
522
+ when 122 then
523
+ RedoNode.new(location)
524
+ when 123 then
525
+ RegularExpressionNode.new(load_varuint, load_location, load_location, load_location, load_string, location)
526
+ when 124 then
527
+ RequiredKeywordParameterNode.new(load_varuint, load_required_constant, load_location, location)
528
+ when 125 then
529
+ RequiredParameterNode.new(load_varuint, load_required_constant, location)
530
+ when 126 then
531
+ RescueModifierNode.new(load_node, load_location, load_node, location)
532
+ when 127 then
533
+ RescueNode.new(load_location, Array.new(load_varuint) { load_node }, load_optional_location, load_optional_node, load_optional_node, load_optional_node, location)
534
+ when 128 then
535
+ RestParameterNode.new(load_varuint, load_optional_constant, load_optional_location, load_location, location)
536
+ when 129 then
537
+ RetryNode.new(location)
538
+ when 130 then
539
+ ReturnNode.new(load_location, load_optional_node, location)
540
+ when 131 then
541
+ SelfNode.new(location)
542
+ when 132 then
543
+ SingletonClassNode.new(Array.new(load_varuint) { load_required_constant }, load_location, load_location, load_node, load_optional_node, load_location, location)
544
+ when 133 then
545
+ SourceEncodingNode.new(location)
546
+ when 134 then
547
+ SourceFileNode.new(load_string, location)
548
+ when 135 then
549
+ SourceLineNode.new(location)
550
+ when 136 then
551
+ SplatNode.new(load_location, load_optional_node, location)
552
+ when 137 then
553
+ StatementsNode.new(Array.new(load_varuint) { load_node }, location)
554
+ when 138 then
555
+ StringNode.new(load_varuint, load_optional_location, load_location, load_optional_location, load_string, location)
556
+ when 139 then
557
+ SuperNode.new(load_location, load_optional_location, load_optional_node, load_optional_location, load_optional_node, location)
558
+ when 140 then
559
+ SymbolNode.new(load_varuint, load_optional_location, load_optional_location, load_optional_location, load_string, location)
560
+ when 141 then
561
+ TrueNode.new(location)
562
+ when 142 then
563
+ UndefNode.new(Array.new(load_varuint) { load_node }, load_location, location)
564
+ when 143 then
565
+ UnlessNode.new(load_location, load_node, load_optional_location, load_optional_node, load_optional_node, load_optional_location, location)
566
+ when 144 then
567
+ UntilNode.new(load_varuint, load_location, load_optional_location, load_node, load_optional_node, location)
568
+ when 145 then
569
+ WhenNode.new(load_location, Array.new(load_varuint) { load_node }, load_optional_node, location)
570
+ when 146 then
571
+ WhileNode.new(load_varuint, load_location, load_optional_location, load_node, load_optional_node, location)
572
+ when 147 then
573
+ XStringNode.new(load_varuint, load_location, load_location, load_location, load_string, location)
574
+ when 148 then
575
+ YieldNode.new(load_location, load_optional_location, load_optional_node, load_optional_location, location)
576
+ end
577
+ end
578
+ else
579
+ def load_node
580
+ type = io.getbyte
581
+ @load_node_lambdas[type].call
582
+ end
583
+
584
+ def define_load_node_lambdas
585
+ @load_node_lambdas = [
586
+ nil,
587
+ -> {
588
+ location = load_location
589
+ AliasGlobalVariableNode.new(load_node, load_node, load_location, location)
590
+ },
591
+ -> {
592
+ location = load_location
593
+ AliasMethodNode.new(load_node, load_node, load_location, location)
594
+ },
595
+ -> {
596
+ location = load_location
597
+ AlternationPatternNode.new(load_node, load_node, load_location, location)
598
+ },
599
+ -> {
600
+ location = load_location
601
+ AndNode.new(load_node, load_node, load_location, location)
602
+ },
603
+ -> {
604
+ location = load_location
605
+ ArgumentsNode.new(load_varuint, Array.new(load_varuint) { load_node }, location)
606
+ },
607
+ -> {
608
+ location = load_location
609
+ ArrayNode.new(load_varuint, Array.new(load_varuint) { load_node }, load_optional_location, load_optional_location, location)
610
+ },
611
+ -> {
612
+ location = load_location
613
+ ArrayPatternNode.new(load_optional_node, Array.new(load_varuint) { load_node }, load_optional_node, Array.new(load_varuint) { load_node }, load_optional_location, load_optional_location, location)
614
+ },
615
+ -> {
616
+ location = load_location
617
+ AssocNode.new(load_node, load_node, load_optional_location, location)
618
+ },
619
+ -> {
620
+ location = load_location
621
+ AssocSplatNode.new(load_optional_node, load_location, location)
622
+ },
623
+ -> {
624
+ location = load_location
625
+ BackReferenceReadNode.new(load_required_constant, location)
626
+ },
627
+ -> {
628
+ location = load_location
629
+ BeginNode.new(load_optional_location, load_optional_node, load_optional_node, load_optional_node, load_optional_node, load_optional_location, location)
630
+ },
631
+ -> {
632
+ location = load_location
633
+ BlockArgumentNode.new(load_optional_node, load_location, location)
634
+ },
635
+ -> {
636
+ location = load_location
637
+ BlockLocalVariableNode.new(load_varuint, load_required_constant, location)
638
+ },
639
+ -> {
640
+ location = load_location
641
+ BlockNode.new(Array.new(load_varuint) { load_required_constant }, load_optional_node, load_optional_node, load_location, load_location, location)
642
+ },
643
+ -> {
644
+ location = load_location
645
+ BlockParameterNode.new(load_varuint, load_optional_constant, load_optional_location, load_location, location)
646
+ },
647
+ -> {
648
+ location = load_location
649
+ BlockParametersNode.new(load_optional_node, Array.new(load_varuint) { load_node }, load_optional_location, load_optional_location, location)
650
+ },
651
+ -> {
652
+ location = load_location
653
+ BreakNode.new(load_optional_node, load_location, location)
654
+ },
655
+ -> {
656
+ location = load_location
657
+ CallAndWriteNode.new(load_varuint, load_optional_node, load_optional_location, load_optional_location, load_required_constant, load_required_constant, load_location, load_node, location)
658
+ },
659
+ -> {
660
+ location = load_location
661
+ CallNode.new(load_varuint, load_optional_node, load_optional_location, load_required_constant, load_optional_location, load_optional_location, load_optional_node, load_optional_location, load_optional_node, location)
662
+ },
663
+ -> {
664
+ location = load_location
665
+ CallOperatorWriteNode.new(load_varuint, load_optional_node, load_optional_location, load_optional_location, load_required_constant, load_required_constant, load_required_constant, load_location, load_node, location)
666
+ },
667
+ -> {
668
+ location = load_location
669
+ CallOrWriteNode.new(load_varuint, load_optional_node, load_optional_location, load_optional_location, load_required_constant, load_required_constant, load_location, load_node, location)
670
+ },
671
+ -> {
672
+ location = load_location
673
+ CallTargetNode.new(load_varuint, load_node, load_location, load_required_constant, load_location, location)
674
+ },
675
+ -> {
676
+ location = load_location
677
+ CapturePatternNode.new(load_node, load_node, load_location, location)
678
+ },
679
+ -> {
680
+ location = load_location
681
+ CaseMatchNode.new(load_optional_node, Array.new(load_varuint) { load_node }, load_optional_node, load_location, load_location, location)
682
+ },
683
+ -> {
684
+ location = load_location
685
+ CaseNode.new(load_optional_node, Array.new(load_varuint) { load_node }, load_optional_node, load_location, load_location, location)
686
+ },
687
+ -> {
688
+ location = load_location
689
+ ClassNode.new(Array.new(load_varuint) { load_required_constant }, load_location, load_node, load_optional_location, load_optional_node, load_optional_node, load_location, load_required_constant, location)
690
+ },
691
+ -> {
692
+ location = load_location
693
+ ClassVariableAndWriteNode.new(load_required_constant, load_location, load_location, load_node, location)
694
+ },
695
+ -> {
696
+ location = load_location
697
+ ClassVariableOperatorWriteNode.new(load_required_constant, load_location, load_location, load_node, load_required_constant, location)
698
+ },
699
+ -> {
700
+ location = load_location
701
+ ClassVariableOrWriteNode.new(load_required_constant, load_location, load_location, load_node, location)
702
+ },
703
+ -> {
704
+ location = load_location
705
+ ClassVariableReadNode.new(load_required_constant, location)
706
+ },
707
+ -> {
708
+ location = load_location
709
+ ClassVariableTargetNode.new(load_required_constant, location)
710
+ },
711
+ -> {
712
+ location = load_location
713
+ ClassVariableWriteNode.new(load_required_constant, load_location, load_node, load_optional_location, location)
714
+ },
715
+ -> {
716
+ location = load_location
717
+ ConstantAndWriteNode.new(load_required_constant, load_location, load_location, load_node, location)
718
+ },
719
+ -> {
720
+ location = load_location
721
+ ConstantOperatorWriteNode.new(load_required_constant, load_location, load_location, load_node, load_required_constant, location)
722
+ },
723
+ -> {
724
+ location = load_location
725
+ ConstantOrWriteNode.new(load_required_constant, load_location, load_location, load_node, location)
726
+ },
727
+ -> {
728
+ location = load_location
729
+ ConstantPathAndWriteNode.new(load_node, load_location, load_node, location)
730
+ },
731
+ -> {
732
+ location = load_location
733
+ ConstantPathNode.new(load_optional_node, load_node, load_location, location)
734
+ },
735
+ -> {
736
+ location = load_location
737
+ ConstantPathOperatorWriteNode.new(load_node, load_location, load_node, load_required_constant, location)
738
+ },
739
+ -> {
740
+ location = load_location
741
+ ConstantPathOrWriteNode.new(load_node, load_location, load_node, location)
742
+ },
743
+ -> {
744
+ location = load_location
745
+ ConstantPathTargetNode.new(load_optional_node, load_node, load_location, location)
746
+ },
747
+ -> {
748
+ location = load_location
749
+ ConstantPathWriteNode.new(load_node, load_location, load_node, location)
750
+ },
751
+ -> {
752
+ location = load_location
753
+ ConstantReadNode.new(load_required_constant, location)
754
+ },
755
+ -> {
756
+ location = load_location
757
+ ConstantTargetNode.new(load_required_constant, location)
758
+ },
759
+ -> {
760
+ location = load_location
761
+ ConstantWriteNode.new(load_required_constant, load_location, load_node, load_location, location)
762
+ },
763
+ -> {
764
+ location = load_location
765
+ load_serialized_length
766
+ DefNode.new(load_required_constant, load_location, load_optional_node, load_optional_node, load_optional_node, Array.new(load_varuint) { load_required_constant }, load_location, load_optional_location, load_optional_location, load_optional_location, load_optional_location, load_optional_location, location)
767
+ },
768
+ -> {
769
+ location = load_location
770
+ DefinedNode.new(load_optional_location, load_node, load_optional_location, load_location, location)
771
+ },
772
+ -> {
773
+ location = load_location
774
+ ElseNode.new(load_location, load_optional_node, load_optional_location, location)
775
+ },
776
+ -> {
777
+ location = load_location
778
+ EmbeddedStatementsNode.new(load_location, load_optional_node, load_location, location)
779
+ },
780
+ -> {
781
+ location = load_location
782
+ EmbeddedVariableNode.new(load_location, load_node, location)
783
+ },
784
+ -> {
785
+ location = load_location
786
+ EnsureNode.new(load_location, load_optional_node, load_location, location)
787
+ },
788
+ -> {
789
+ location = load_location
790
+ FalseNode.new(location)
791
+ },
792
+ -> {
793
+ location = load_location
794
+ FindPatternNode.new(load_optional_node, load_node, Array.new(load_varuint) { load_node }, load_node, load_optional_location, load_optional_location, location)
795
+ },
796
+ -> {
797
+ location = load_location
798
+ FlipFlopNode.new(load_varuint, load_optional_node, load_optional_node, load_location, location)
799
+ },
800
+ -> {
801
+ location = load_location
802
+ FloatNode.new(location)
803
+ },
804
+ -> {
805
+ location = load_location
806
+ ForNode.new(load_node, load_node, load_optional_node, load_location, load_location, load_optional_location, load_location, location)
807
+ },
808
+ -> {
809
+ location = load_location
810
+ ForwardingArgumentsNode.new(location)
811
+ },
812
+ -> {
813
+ location = load_location
814
+ ForwardingParameterNode.new(location)
815
+ },
816
+ -> {
817
+ location = load_location
818
+ ForwardingSuperNode.new(load_optional_node, location)
819
+ },
820
+ -> {
821
+ location = load_location
822
+ GlobalVariableAndWriteNode.new(load_required_constant, load_location, load_location, load_node, location)
823
+ },
824
+ -> {
825
+ location = load_location
826
+ GlobalVariableOperatorWriteNode.new(load_required_constant, load_location, load_location, load_node, load_required_constant, location)
827
+ },
828
+ -> {
829
+ location = load_location
830
+ GlobalVariableOrWriteNode.new(load_required_constant, load_location, load_location, load_node, location)
831
+ },
832
+ -> {
833
+ location = load_location
834
+ GlobalVariableReadNode.new(load_required_constant, location)
835
+ },
836
+ -> {
837
+ location = load_location
838
+ GlobalVariableTargetNode.new(load_required_constant, location)
839
+ },
840
+ -> {
841
+ location = load_location
842
+ GlobalVariableWriteNode.new(load_required_constant, load_location, load_node, load_location, location)
843
+ },
844
+ -> {
845
+ location = load_location
846
+ HashNode.new(load_location, Array.new(load_varuint) { load_node }, load_location, location)
847
+ },
848
+ -> {
849
+ location = load_location
850
+ HashPatternNode.new(load_optional_node, Array.new(load_varuint) { load_node }, load_optional_node, load_optional_location, load_optional_location, location)
851
+ },
852
+ -> {
853
+ location = load_location
854
+ IfNode.new(load_optional_location, load_node, load_optional_location, load_optional_node, load_optional_node, load_optional_location, location)
855
+ },
856
+ -> {
857
+ location = load_location
858
+ ImaginaryNode.new(load_node, location)
859
+ },
860
+ -> {
861
+ location = load_location
862
+ ImplicitNode.new(load_node, location)
863
+ },
864
+ -> {
865
+ location = load_location
866
+ ImplicitRestNode.new(location)
867
+ },
868
+ -> {
869
+ location = load_location
870
+ InNode.new(load_node, load_optional_node, load_location, load_optional_location, location)
871
+ },
872
+ -> {
873
+ location = load_location
874
+ IndexAndWriteNode.new(load_varuint, load_optional_node, load_optional_location, load_location, load_optional_node, load_location, load_optional_node, load_location, load_node, location)
875
+ },
876
+ -> {
877
+ location = load_location
878
+ IndexOperatorWriteNode.new(load_varuint, load_optional_node, load_optional_location, load_location, load_optional_node, load_location, load_optional_node, load_required_constant, load_location, load_node, location)
879
+ },
880
+ -> {
881
+ location = load_location
882
+ IndexOrWriteNode.new(load_varuint, load_optional_node, load_optional_location, load_location, load_optional_node, load_location, load_optional_node, load_location, load_node, location)
883
+ },
884
+ -> {
885
+ location = load_location
886
+ IndexTargetNode.new(load_varuint, load_node, load_location, load_optional_node, load_location, load_optional_node, location)
887
+ },
888
+ -> {
889
+ location = load_location
890
+ InstanceVariableAndWriteNode.new(load_required_constant, load_location, load_location, load_node, location)
891
+ },
892
+ -> {
893
+ location = load_location
894
+ InstanceVariableOperatorWriteNode.new(load_required_constant, load_location, load_location, load_node, load_required_constant, location)
895
+ },
896
+ -> {
897
+ location = load_location
898
+ InstanceVariableOrWriteNode.new(load_required_constant, load_location, load_location, load_node, location)
899
+ },
900
+ -> {
901
+ location = load_location
902
+ InstanceVariableReadNode.new(load_required_constant, location)
903
+ },
904
+ -> {
905
+ location = load_location
906
+ InstanceVariableTargetNode.new(load_required_constant, location)
907
+ },
908
+ -> {
909
+ location = load_location
910
+ InstanceVariableWriteNode.new(load_required_constant, load_location, load_node, load_location, location)
911
+ },
912
+ -> {
913
+ location = load_location
914
+ IntegerNode.new(load_varuint, location)
915
+ },
916
+ -> {
917
+ location = load_location
918
+ InterpolatedMatchLastLineNode.new(load_varuint, load_location, Array.new(load_varuint) { load_node }, load_location, location)
919
+ },
920
+ -> {
921
+ location = load_location
922
+ InterpolatedRegularExpressionNode.new(load_varuint, load_location, Array.new(load_varuint) { load_node }, load_location, location)
923
+ },
924
+ -> {
925
+ location = load_location
926
+ InterpolatedStringNode.new(load_optional_location, Array.new(load_varuint) { load_node }, load_optional_location, location)
927
+ },
928
+ -> {
929
+ location = load_location
930
+ InterpolatedSymbolNode.new(load_optional_location, Array.new(load_varuint) { load_node }, load_optional_location, location)
931
+ },
932
+ -> {
933
+ location = load_location
934
+ InterpolatedXStringNode.new(load_location, Array.new(load_varuint) { load_node }, load_location, location)
935
+ },
936
+ -> {
937
+ location = load_location
938
+ KeywordHashNode.new(load_varuint, Array.new(load_varuint) { load_node }, location)
939
+ },
940
+ -> {
941
+ location = load_location
942
+ KeywordRestParameterNode.new(load_varuint, load_optional_constant, load_optional_location, load_location, location)
943
+ },
944
+ -> {
945
+ location = load_location
946
+ LambdaNode.new(Array.new(load_varuint) { load_required_constant }, load_location, load_location, load_location, load_optional_node, load_optional_node, location)
947
+ },
948
+ -> {
949
+ location = load_location
950
+ LocalVariableAndWriteNode.new(load_location, load_location, load_node, load_required_constant, load_varuint, location)
951
+ },
952
+ -> {
953
+ location = load_location
954
+ LocalVariableOperatorWriteNode.new(load_location, load_location, load_node, load_required_constant, load_required_constant, load_varuint, location)
955
+ },
956
+ -> {
957
+ location = load_location
958
+ LocalVariableOrWriteNode.new(load_location, load_location, load_node, load_required_constant, load_varuint, location)
959
+ },
960
+ -> {
961
+ location = load_location
962
+ LocalVariableReadNode.new(load_required_constant, load_varuint, location)
963
+ },
964
+ -> {
965
+ location = load_location
966
+ LocalVariableTargetNode.new(load_required_constant, load_varuint, location)
967
+ },
968
+ -> {
969
+ location = load_location
970
+ LocalVariableWriteNode.new(load_required_constant, load_varuint, load_location, load_node, load_location, location)
971
+ },
972
+ -> {
973
+ location = load_location
974
+ MatchLastLineNode.new(load_varuint, load_location, load_location, load_location, load_string, location)
975
+ },
976
+ -> {
977
+ location = load_location
978
+ MatchPredicateNode.new(load_node, load_node, load_location, location)
979
+ },
980
+ -> {
981
+ location = load_location
982
+ MatchRequiredNode.new(load_node, load_node, load_location, location)
983
+ },
984
+ -> {
985
+ location = load_location
986
+ MatchWriteNode.new(load_node, Array.new(load_varuint) { load_node }, location)
987
+ },
988
+ -> {
989
+ location = load_location
990
+ MissingNode.new(location)
991
+ },
992
+ -> {
993
+ location = load_location
994
+ ModuleNode.new(Array.new(load_varuint) { load_required_constant }, load_location, load_node, load_optional_node, load_location, load_required_constant, location)
995
+ },
996
+ -> {
997
+ location = load_location
998
+ MultiTargetNode.new(Array.new(load_varuint) { load_node }, load_optional_node, Array.new(load_varuint) { load_node }, load_optional_location, load_optional_location, location)
999
+ },
1000
+ -> {
1001
+ location = load_location
1002
+ MultiWriteNode.new(Array.new(load_varuint) { load_node }, load_optional_node, Array.new(load_varuint) { load_node }, load_optional_location, load_optional_location, load_location, load_node, location)
1003
+ },
1004
+ -> {
1005
+ location = load_location
1006
+ NextNode.new(load_optional_node, load_location, location)
1007
+ },
1008
+ -> {
1009
+ location = load_location
1010
+ NilNode.new(location)
1011
+ },
1012
+ -> {
1013
+ location = load_location
1014
+ NoKeywordsParameterNode.new(load_location, load_location, location)
1015
+ },
1016
+ -> {
1017
+ location = load_location
1018
+ NumberedParametersNode.new(io.getbyte, location)
1019
+ },
1020
+ -> {
1021
+ location = load_location
1022
+ NumberedReferenceReadNode.new(load_varuint, location)
1023
+ },
1024
+ -> {
1025
+ location = load_location
1026
+ OptionalKeywordParameterNode.new(load_varuint, load_required_constant, load_location, load_node, location)
1027
+ },
1028
+ -> {
1029
+ location = load_location
1030
+ OptionalParameterNode.new(load_varuint, load_required_constant, load_location, load_location, load_node, location)
1031
+ },
1032
+ -> {
1033
+ location = load_location
1034
+ OrNode.new(load_node, load_node, load_location, location)
1035
+ },
1036
+ -> {
1037
+ location = load_location
1038
+ ParametersNode.new(Array.new(load_varuint) { load_node }, Array.new(load_varuint) { load_node }, load_optional_node, Array.new(load_varuint) { load_node }, Array.new(load_varuint) { load_node }, load_optional_node, load_optional_node, location)
1039
+ },
1040
+ -> {
1041
+ location = load_location
1042
+ ParenthesesNode.new(load_optional_node, load_location, load_location, location)
1043
+ },
1044
+ -> {
1045
+ location = load_location
1046
+ PinnedExpressionNode.new(load_node, load_location, load_location, load_location, location)
1047
+ },
1048
+ -> {
1049
+ location = load_location
1050
+ PinnedVariableNode.new(load_node, load_location, location)
1051
+ },
1052
+ -> {
1053
+ location = load_location
1054
+ PostExecutionNode.new(load_optional_node, load_location, load_location, load_location, location)
1055
+ },
1056
+ -> {
1057
+ location = load_location
1058
+ PreExecutionNode.new(load_optional_node, load_location, load_location, load_location, location)
1059
+ },
1060
+ -> {
1061
+ location = load_location
1062
+ ProgramNode.new(Array.new(load_varuint) { load_required_constant }, load_node, location)
1063
+ },
1064
+ -> {
1065
+ location = load_location
1066
+ RangeNode.new(load_varuint, load_optional_node, load_optional_node, load_location, location)
1067
+ },
1068
+ -> {
1069
+ location = load_location
1070
+ RationalNode.new(load_node, location)
1071
+ },
1072
+ -> {
1073
+ location = load_location
1074
+ RedoNode.new(location)
1075
+ },
1076
+ -> {
1077
+ location = load_location
1078
+ RegularExpressionNode.new(load_varuint, load_location, load_location, load_location, load_string, location)
1079
+ },
1080
+ -> {
1081
+ location = load_location
1082
+ RequiredKeywordParameterNode.new(load_varuint, load_required_constant, load_location, location)
1083
+ },
1084
+ -> {
1085
+ location = load_location
1086
+ RequiredParameterNode.new(load_varuint, load_required_constant, location)
1087
+ },
1088
+ -> {
1089
+ location = load_location
1090
+ RescueModifierNode.new(load_node, load_location, load_node, location)
1091
+ },
1092
+ -> {
1093
+ location = load_location
1094
+ RescueNode.new(load_location, Array.new(load_varuint) { load_node }, load_optional_location, load_optional_node, load_optional_node, load_optional_node, location)
1095
+ },
1096
+ -> {
1097
+ location = load_location
1098
+ RestParameterNode.new(load_varuint, load_optional_constant, load_optional_location, load_location, location)
1099
+ },
1100
+ -> {
1101
+ location = load_location
1102
+ RetryNode.new(location)
1103
+ },
1104
+ -> {
1105
+ location = load_location
1106
+ ReturnNode.new(load_location, load_optional_node, location)
1107
+ },
1108
+ -> {
1109
+ location = load_location
1110
+ SelfNode.new(location)
1111
+ },
1112
+ -> {
1113
+ location = load_location
1114
+ SingletonClassNode.new(Array.new(load_varuint) { load_required_constant }, load_location, load_location, load_node, load_optional_node, load_location, location)
1115
+ },
1116
+ -> {
1117
+ location = load_location
1118
+ SourceEncodingNode.new(location)
1119
+ },
1120
+ -> {
1121
+ location = load_location
1122
+ SourceFileNode.new(load_string, location)
1123
+ },
1124
+ -> {
1125
+ location = load_location
1126
+ SourceLineNode.new(location)
1127
+ },
1128
+ -> {
1129
+ location = load_location
1130
+ SplatNode.new(load_location, load_optional_node, location)
1131
+ },
1132
+ -> {
1133
+ location = load_location
1134
+ StatementsNode.new(Array.new(load_varuint) { load_node }, location)
1135
+ },
1136
+ -> {
1137
+ location = load_location
1138
+ StringNode.new(load_varuint, load_optional_location, load_location, load_optional_location, load_string, location)
1139
+ },
1140
+ -> {
1141
+ location = load_location
1142
+ SuperNode.new(load_location, load_optional_location, load_optional_node, load_optional_location, load_optional_node, location)
1143
+ },
1144
+ -> {
1145
+ location = load_location
1146
+ SymbolNode.new(load_varuint, load_optional_location, load_optional_location, load_optional_location, load_string, location)
1147
+ },
1148
+ -> {
1149
+ location = load_location
1150
+ TrueNode.new(location)
1151
+ },
1152
+ -> {
1153
+ location = load_location
1154
+ UndefNode.new(Array.new(load_varuint) { load_node }, load_location, location)
1155
+ },
1156
+ -> {
1157
+ location = load_location
1158
+ UnlessNode.new(load_location, load_node, load_optional_location, load_optional_node, load_optional_node, load_optional_location, location)
1159
+ },
1160
+ -> {
1161
+ location = load_location
1162
+ UntilNode.new(load_varuint, load_location, load_optional_location, load_node, load_optional_node, location)
1163
+ },
1164
+ -> {
1165
+ location = load_location
1166
+ WhenNode.new(load_location, Array.new(load_varuint) { load_node }, load_optional_node, location)
1167
+ },
1168
+ -> {
1169
+ location = load_location
1170
+ WhileNode.new(load_varuint, load_location, load_optional_location, load_node, load_optional_node, location)
1171
+ },
1172
+ -> {
1173
+ location = load_location
1174
+ XStringNode.new(load_varuint, load_location, load_location, load_location, load_string, location)
1175
+ },
1176
+ -> {
1177
+ location = load_location
1178
+ YieldNode.new(load_location, load_optional_location, load_optional_node, load_optional_location, location)
1179
+ },
1180
+ ]
1181
+ end
1182
+ end
1183
+ end
1184
+
1185
+ # The token types that can be indexed by their enum values.
1186
+ TOKEN_TYPES = [
1187
+ nil,
1188
+ :EOF,
1189
+ :MISSING,
1190
+ :NOT_PROVIDED,
1191
+ :AMPERSAND,
1192
+ :AMPERSAND_AMPERSAND,
1193
+ :AMPERSAND_AMPERSAND_EQUAL,
1194
+ :AMPERSAND_DOT,
1195
+ :AMPERSAND_EQUAL,
1196
+ :BACKTICK,
1197
+ :BACK_REFERENCE,
1198
+ :BANG,
1199
+ :BANG_EQUAL,
1200
+ :BANG_TILDE,
1201
+ :BRACE_LEFT,
1202
+ :BRACE_RIGHT,
1203
+ :BRACKET_LEFT,
1204
+ :BRACKET_LEFT_ARRAY,
1205
+ :BRACKET_LEFT_RIGHT,
1206
+ :BRACKET_LEFT_RIGHT_EQUAL,
1207
+ :BRACKET_RIGHT,
1208
+ :CARET,
1209
+ :CARET_EQUAL,
1210
+ :CHARACTER_LITERAL,
1211
+ :CLASS_VARIABLE,
1212
+ :COLON,
1213
+ :COLON_COLON,
1214
+ :COMMA,
1215
+ :COMMENT,
1216
+ :CONSTANT,
1217
+ :DOT,
1218
+ :DOT_DOT,
1219
+ :DOT_DOT_DOT,
1220
+ :EMBDOC_BEGIN,
1221
+ :EMBDOC_END,
1222
+ :EMBDOC_LINE,
1223
+ :EMBEXPR_BEGIN,
1224
+ :EMBEXPR_END,
1225
+ :EMBVAR,
1226
+ :EQUAL,
1227
+ :EQUAL_EQUAL,
1228
+ :EQUAL_EQUAL_EQUAL,
1229
+ :EQUAL_GREATER,
1230
+ :EQUAL_TILDE,
1231
+ :FLOAT,
1232
+ :FLOAT_IMAGINARY,
1233
+ :FLOAT_RATIONAL,
1234
+ :FLOAT_RATIONAL_IMAGINARY,
1235
+ :GLOBAL_VARIABLE,
1236
+ :GREATER,
1237
+ :GREATER_EQUAL,
1238
+ :GREATER_GREATER,
1239
+ :GREATER_GREATER_EQUAL,
1240
+ :HEREDOC_END,
1241
+ :HEREDOC_START,
1242
+ :IDENTIFIER,
1243
+ :IGNORED_NEWLINE,
1244
+ :INSTANCE_VARIABLE,
1245
+ :INTEGER,
1246
+ :INTEGER_IMAGINARY,
1247
+ :INTEGER_RATIONAL,
1248
+ :INTEGER_RATIONAL_IMAGINARY,
1249
+ :KEYWORD_ALIAS,
1250
+ :KEYWORD_AND,
1251
+ :KEYWORD_BEGIN,
1252
+ :KEYWORD_BEGIN_UPCASE,
1253
+ :KEYWORD_BREAK,
1254
+ :KEYWORD_CASE,
1255
+ :KEYWORD_CLASS,
1256
+ :KEYWORD_DEF,
1257
+ :KEYWORD_DEFINED,
1258
+ :KEYWORD_DO,
1259
+ :KEYWORD_DO_LOOP,
1260
+ :KEYWORD_ELSE,
1261
+ :KEYWORD_ELSIF,
1262
+ :KEYWORD_END,
1263
+ :KEYWORD_END_UPCASE,
1264
+ :KEYWORD_ENSURE,
1265
+ :KEYWORD_FALSE,
1266
+ :KEYWORD_FOR,
1267
+ :KEYWORD_IF,
1268
+ :KEYWORD_IF_MODIFIER,
1269
+ :KEYWORD_IN,
1270
+ :KEYWORD_MODULE,
1271
+ :KEYWORD_NEXT,
1272
+ :KEYWORD_NIL,
1273
+ :KEYWORD_NOT,
1274
+ :KEYWORD_OR,
1275
+ :KEYWORD_REDO,
1276
+ :KEYWORD_RESCUE,
1277
+ :KEYWORD_RESCUE_MODIFIER,
1278
+ :KEYWORD_RETRY,
1279
+ :KEYWORD_RETURN,
1280
+ :KEYWORD_SELF,
1281
+ :KEYWORD_SUPER,
1282
+ :KEYWORD_THEN,
1283
+ :KEYWORD_TRUE,
1284
+ :KEYWORD_UNDEF,
1285
+ :KEYWORD_UNLESS,
1286
+ :KEYWORD_UNLESS_MODIFIER,
1287
+ :KEYWORD_UNTIL,
1288
+ :KEYWORD_UNTIL_MODIFIER,
1289
+ :KEYWORD_WHEN,
1290
+ :KEYWORD_WHILE,
1291
+ :KEYWORD_WHILE_MODIFIER,
1292
+ :KEYWORD_YIELD,
1293
+ :KEYWORD___ENCODING__,
1294
+ :KEYWORD___FILE__,
1295
+ :KEYWORD___LINE__,
1296
+ :LABEL,
1297
+ :LABEL_END,
1298
+ :LAMBDA_BEGIN,
1299
+ :LESS,
1300
+ :LESS_EQUAL,
1301
+ :LESS_EQUAL_GREATER,
1302
+ :LESS_LESS,
1303
+ :LESS_LESS_EQUAL,
1304
+ :METHOD_NAME,
1305
+ :MINUS,
1306
+ :MINUS_EQUAL,
1307
+ :MINUS_GREATER,
1308
+ :NEWLINE,
1309
+ :NUMBERED_REFERENCE,
1310
+ :PARENTHESIS_LEFT,
1311
+ :PARENTHESIS_LEFT_PARENTHESES,
1312
+ :PARENTHESIS_RIGHT,
1313
+ :PERCENT,
1314
+ :PERCENT_EQUAL,
1315
+ :PERCENT_LOWER_I,
1316
+ :PERCENT_LOWER_W,
1317
+ :PERCENT_LOWER_X,
1318
+ :PERCENT_UPPER_I,
1319
+ :PERCENT_UPPER_W,
1320
+ :PIPE,
1321
+ :PIPE_EQUAL,
1322
+ :PIPE_PIPE,
1323
+ :PIPE_PIPE_EQUAL,
1324
+ :PLUS,
1325
+ :PLUS_EQUAL,
1326
+ :QUESTION_MARK,
1327
+ :REGEXP_BEGIN,
1328
+ :REGEXP_END,
1329
+ :SEMICOLON,
1330
+ :SLASH,
1331
+ :SLASH_EQUAL,
1332
+ :STAR,
1333
+ :STAR_EQUAL,
1334
+ :STAR_STAR,
1335
+ :STAR_STAR_EQUAL,
1336
+ :STRING_BEGIN,
1337
+ :STRING_CONTENT,
1338
+ :STRING_END,
1339
+ :SYMBOL_BEGIN,
1340
+ :TILDE,
1341
+ :UAMPERSAND,
1342
+ :UCOLON_COLON,
1343
+ :UDOT_DOT,
1344
+ :UDOT_DOT_DOT,
1345
+ :UMINUS,
1346
+ :UMINUS_NUM,
1347
+ :UPLUS,
1348
+ :USTAR,
1349
+ :USTAR_STAR,
1350
+ :WORDS_SEP,
1351
+ :__END__,
1352
+ ]
1353
+ end
1354
+ end