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
data/lib/prism/dsl.rb ADDED
@@ -0,0 +1,785 @@
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/dsl.rb.erb
5
+ if you are looking to modify the template
6
+ =end
7
+
8
+ module Prism
9
+ # The DSL module provides a set of methods that can be used to create prism
10
+ # nodes in a more concise manner. For example, instead of writing:
11
+ #
12
+ # source = Prism::Source.new("[1]")
13
+ #
14
+ # Prism::ArrayNode.new(
15
+ # [
16
+ # Prism::IntegerNode.new(
17
+ # Prism::IntegerBaseFlags::DECIMAL,
18
+ # Prism::Location.new(source, 1, 1),
19
+ # )
20
+ # ],
21
+ # Prism::Location.new(source, 0, 1),
22
+ # Prism::Location.new(source, 2, 1)
23
+ # )
24
+ #
25
+ # you could instead write:
26
+ #
27
+ # source = Prism::Source.new("[1]")
28
+ #
29
+ # ArrayNode(
30
+ # IntegerNode(Prism::IntegerBaseFlags::DECIMAL, Location(source, 1, 1))),
31
+ # Location(source, 0, 1),
32
+ # Location(source, 2, 1)
33
+ # )
34
+ #
35
+ # This is mostly helpful in the context of writing tests, but can also be used
36
+ # to generate trees programmatically.
37
+ module DSL
38
+ private
39
+
40
+ # Create a new Location object
41
+ def Location(source = nil, start_offset = 0, length = 0)
42
+ Location.new(source, start_offset, length)
43
+ end
44
+
45
+ # Create a new AliasGlobalVariableNode node
46
+ def AliasGlobalVariableNode(new_name, old_name, keyword_loc, location = Location())
47
+ AliasGlobalVariableNode.new(new_name, old_name, keyword_loc, location)
48
+ end
49
+
50
+ # Create a new AliasMethodNode node
51
+ def AliasMethodNode(new_name, old_name, keyword_loc, location = Location())
52
+ AliasMethodNode.new(new_name, old_name, keyword_loc, location)
53
+ end
54
+
55
+ # Create a new AlternationPatternNode node
56
+ def AlternationPatternNode(left, right, operator_loc, location = Location())
57
+ AlternationPatternNode.new(left, right, operator_loc, location)
58
+ end
59
+
60
+ # Create a new AndNode node
61
+ def AndNode(left, right, operator_loc, location = Location())
62
+ AndNode.new(left, right, operator_loc, location)
63
+ end
64
+
65
+ # Create a new ArgumentsNode node
66
+ def ArgumentsNode(flags, arguments, location = Location())
67
+ ArgumentsNode.new(flags, arguments, location)
68
+ end
69
+
70
+ # Create a new ArrayNode node
71
+ def ArrayNode(flags, elements, opening_loc, closing_loc, location = Location())
72
+ ArrayNode.new(flags, elements, opening_loc, closing_loc, location)
73
+ end
74
+
75
+ # Create a new ArrayPatternNode node
76
+ def ArrayPatternNode(constant, requireds, rest, posts, opening_loc, closing_loc, location = Location())
77
+ ArrayPatternNode.new(constant, requireds, rest, posts, opening_loc, closing_loc, location)
78
+ end
79
+
80
+ # Create a new AssocNode node
81
+ def AssocNode(key, value, operator_loc, location = Location())
82
+ AssocNode.new(key, value, operator_loc, location)
83
+ end
84
+
85
+ # Create a new AssocSplatNode node
86
+ def AssocSplatNode(value, operator_loc, location = Location())
87
+ AssocSplatNode.new(value, operator_loc, location)
88
+ end
89
+
90
+ # Create a new BackReferenceReadNode node
91
+ def BackReferenceReadNode(name, location = Location())
92
+ BackReferenceReadNode.new(name, location)
93
+ end
94
+
95
+ # Create a new BeginNode node
96
+ def BeginNode(begin_keyword_loc, statements, rescue_clause, else_clause, ensure_clause, end_keyword_loc, location = Location())
97
+ BeginNode.new(begin_keyword_loc, statements, rescue_clause, else_clause, ensure_clause, end_keyword_loc, location)
98
+ end
99
+
100
+ # Create a new BlockArgumentNode node
101
+ def BlockArgumentNode(expression, operator_loc, location = Location())
102
+ BlockArgumentNode.new(expression, operator_loc, location)
103
+ end
104
+
105
+ # Create a new BlockLocalVariableNode node
106
+ def BlockLocalVariableNode(flags, name, location = Location())
107
+ BlockLocalVariableNode.new(flags, name, location)
108
+ end
109
+
110
+ # Create a new BlockNode node
111
+ def BlockNode(locals, parameters, body, opening_loc, closing_loc, location = Location())
112
+ BlockNode.new(locals, parameters, body, opening_loc, closing_loc, location)
113
+ end
114
+
115
+ # Create a new BlockParameterNode node
116
+ def BlockParameterNode(flags, name, name_loc, operator_loc, location = Location())
117
+ BlockParameterNode.new(flags, name, name_loc, operator_loc, location)
118
+ end
119
+
120
+ # Create a new BlockParametersNode node
121
+ def BlockParametersNode(parameters, locals, opening_loc, closing_loc, location = Location())
122
+ BlockParametersNode.new(parameters, locals, opening_loc, closing_loc, location)
123
+ end
124
+
125
+ # Create a new BreakNode node
126
+ def BreakNode(arguments, keyword_loc, location = Location())
127
+ BreakNode.new(arguments, keyword_loc, location)
128
+ end
129
+
130
+ # Create a new CallAndWriteNode node
131
+ def CallAndWriteNode(flags, receiver, call_operator_loc, message_loc, read_name, write_name, operator_loc, value, location = Location())
132
+ CallAndWriteNode.new(flags, receiver, call_operator_loc, message_loc, read_name, write_name, operator_loc, value, location)
133
+ end
134
+
135
+ # Create a new CallNode node
136
+ def CallNode(flags, receiver, call_operator_loc, name, message_loc, opening_loc, arguments, closing_loc, block, location = Location())
137
+ CallNode.new(flags, receiver, call_operator_loc, name, message_loc, opening_loc, arguments, closing_loc, block, location)
138
+ end
139
+
140
+ # Create a new CallOperatorWriteNode node
141
+ def CallOperatorWriteNode(flags, receiver, call_operator_loc, message_loc, read_name, write_name, operator, operator_loc, value, location = Location())
142
+ CallOperatorWriteNode.new(flags, receiver, call_operator_loc, message_loc, read_name, write_name, operator, operator_loc, value, location)
143
+ end
144
+
145
+ # Create a new CallOrWriteNode node
146
+ def CallOrWriteNode(flags, receiver, call_operator_loc, message_loc, read_name, write_name, operator_loc, value, location = Location())
147
+ CallOrWriteNode.new(flags, receiver, call_operator_loc, message_loc, read_name, write_name, operator_loc, value, location)
148
+ end
149
+
150
+ # Create a new CallTargetNode node
151
+ def CallTargetNode(flags, receiver, call_operator_loc, name, message_loc, location = Location())
152
+ CallTargetNode.new(flags, receiver, call_operator_loc, name, message_loc, location)
153
+ end
154
+
155
+ # Create a new CapturePatternNode node
156
+ def CapturePatternNode(value, target, operator_loc, location = Location())
157
+ CapturePatternNode.new(value, target, operator_loc, location)
158
+ end
159
+
160
+ # Create a new CaseMatchNode node
161
+ def CaseMatchNode(predicate, conditions, consequent, case_keyword_loc, end_keyword_loc, location = Location())
162
+ CaseMatchNode.new(predicate, conditions, consequent, case_keyword_loc, end_keyword_loc, location)
163
+ end
164
+
165
+ # Create a new CaseNode node
166
+ def CaseNode(predicate, conditions, consequent, case_keyword_loc, end_keyword_loc, location = Location())
167
+ CaseNode.new(predicate, conditions, consequent, case_keyword_loc, end_keyword_loc, location)
168
+ end
169
+
170
+ # Create a new ClassNode node
171
+ def ClassNode(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, name, location = Location())
172
+ ClassNode.new(locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, name, location)
173
+ end
174
+
175
+ # Create a new ClassVariableAndWriteNode node
176
+ def ClassVariableAndWriteNode(name, name_loc, operator_loc, value, location = Location())
177
+ ClassVariableAndWriteNode.new(name, name_loc, operator_loc, value, location)
178
+ end
179
+
180
+ # Create a new ClassVariableOperatorWriteNode node
181
+ def ClassVariableOperatorWriteNode(name, name_loc, operator_loc, value, operator, location = Location())
182
+ ClassVariableOperatorWriteNode.new(name, name_loc, operator_loc, value, operator, location)
183
+ end
184
+
185
+ # Create a new ClassVariableOrWriteNode node
186
+ def ClassVariableOrWriteNode(name, name_loc, operator_loc, value, location = Location())
187
+ ClassVariableOrWriteNode.new(name, name_loc, operator_loc, value, location)
188
+ end
189
+
190
+ # Create a new ClassVariableReadNode node
191
+ def ClassVariableReadNode(name, location = Location())
192
+ ClassVariableReadNode.new(name, location)
193
+ end
194
+
195
+ # Create a new ClassVariableTargetNode node
196
+ def ClassVariableTargetNode(name, location = Location())
197
+ ClassVariableTargetNode.new(name, location)
198
+ end
199
+
200
+ # Create a new ClassVariableWriteNode node
201
+ def ClassVariableWriteNode(name, name_loc, value, operator_loc, location = Location())
202
+ ClassVariableWriteNode.new(name, name_loc, value, operator_loc, location)
203
+ end
204
+
205
+ # Create a new ConstantAndWriteNode node
206
+ def ConstantAndWriteNode(name, name_loc, operator_loc, value, location = Location())
207
+ ConstantAndWriteNode.new(name, name_loc, operator_loc, value, location)
208
+ end
209
+
210
+ # Create a new ConstantOperatorWriteNode node
211
+ def ConstantOperatorWriteNode(name, name_loc, operator_loc, value, operator, location = Location())
212
+ ConstantOperatorWriteNode.new(name, name_loc, operator_loc, value, operator, location)
213
+ end
214
+
215
+ # Create a new ConstantOrWriteNode node
216
+ def ConstantOrWriteNode(name, name_loc, operator_loc, value, location = Location())
217
+ ConstantOrWriteNode.new(name, name_loc, operator_loc, value, location)
218
+ end
219
+
220
+ # Create a new ConstantPathAndWriteNode node
221
+ def ConstantPathAndWriteNode(target, operator_loc, value, location = Location())
222
+ ConstantPathAndWriteNode.new(target, operator_loc, value, location)
223
+ end
224
+
225
+ # Create a new ConstantPathNode node
226
+ def ConstantPathNode(parent, child, delimiter_loc, location = Location())
227
+ ConstantPathNode.new(parent, child, delimiter_loc, location)
228
+ end
229
+
230
+ # Create a new ConstantPathOperatorWriteNode node
231
+ def ConstantPathOperatorWriteNode(target, operator_loc, value, operator, location = Location())
232
+ ConstantPathOperatorWriteNode.new(target, operator_loc, value, operator, location)
233
+ end
234
+
235
+ # Create a new ConstantPathOrWriteNode node
236
+ def ConstantPathOrWriteNode(target, operator_loc, value, location = Location())
237
+ ConstantPathOrWriteNode.new(target, operator_loc, value, location)
238
+ end
239
+
240
+ # Create a new ConstantPathTargetNode node
241
+ def ConstantPathTargetNode(parent, child, delimiter_loc, location = Location())
242
+ ConstantPathTargetNode.new(parent, child, delimiter_loc, location)
243
+ end
244
+
245
+ # Create a new ConstantPathWriteNode node
246
+ def ConstantPathWriteNode(target, operator_loc, value, location = Location())
247
+ ConstantPathWriteNode.new(target, operator_loc, value, location)
248
+ end
249
+
250
+ # Create a new ConstantReadNode node
251
+ def ConstantReadNode(name, location = Location())
252
+ ConstantReadNode.new(name, location)
253
+ end
254
+
255
+ # Create a new ConstantTargetNode node
256
+ def ConstantTargetNode(name, location = Location())
257
+ ConstantTargetNode.new(name, location)
258
+ end
259
+
260
+ # Create a new ConstantWriteNode node
261
+ def ConstantWriteNode(name, name_loc, value, operator_loc, location = Location())
262
+ ConstantWriteNode.new(name, name_loc, value, operator_loc, location)
263
+ end
264
+
265
+ # Create a new DefNode node
266
+ def DefNode(name, name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, location = Location())
267
+ DefNode.new(name, name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc, location)
268
+ end
269
+
270
+ # Create a new DefinedNode node
271
+ def DefinedNode(lparen_loc, value, rparen_loc, keyword_loc, location = Location())
272
+ DefinedNode.new(lparen_loc, value, rparen_loc, keyword_loc, location)
273
+ end
274
+
275
+ # Create a new ElseNode node
276
+ def ElseNode(else_keyword_loc, statements, end_keyword_loc, location = Location())
277
+ ElseNode.new(else_keyword_loc, statements, end_keyword_loc, location)
278
+ end
279
+
280
+ # Create a new EmbeddedStatementsNode node
281
+ def EmbeddedStatementsNode(opening_loc, statements, closing_loc, location = Location())
282
+ EmbeddedStatementsNode.new(opening_loc, statements, closing_loc, location)
283
+ end
284
+
285
+ # Create a new EmbeddedVariableNode node
286
+ def EmbeddedVariableNode(operator_loc, variable, location = Location())
287
+ EmbeddedVariableNode.new(operator_loc, variable, location)
288
+ end
289
+
290
+ # Create a new EnsureNode node
291
+ def EnsureNode(ensure_keyword_loc, statements, end_keyword_loc, location = Location())
292
+ EnsureNode.new(ensure_keyword_loc, statements, end_keyword_loc, location)
293
+ end
294
+
295
+ # Create a new FalseNode node
296
+ def FalseNode(location = Location())
297
+ FalseNode.new(location)
298
+ end
299
+
300
+ # Create a new FindPatternNode node
301
+ def FindPatternNode(constant, left, requireds, right, opening_loc, closing_loc, location = Location())
302
+ FindPatternNode.new(constant, left, requireds, right, opening_loc, closing_loc, location)
303
+ end
304
+
305
+ # Create a new FlipFlopNode node
306
+ def FlipFlopNode(flags, left, right, operator_loc, location = Location())
307
+ FlipFlopNode.new(flags, left, right, operator_loc, location)
308
+ end
309
+
310
+ # Create a new FloatNode node
311
+ def FloatNode(location = Location())
312
+ FloatNode.new(location)
313
+ end
314
+
315
+ # Create a new ForNode node
316
+ def ForNode(index, collection, statements, for_keyword_loc, in_keyword_loc, do_keyword_loc, end_keyword_loc, location = Location())
317
+ ForNode.new(index, collection, statements, for_keyword_loc, in_keyword_loc, do_keyword_loc, end_keyword_loc, location)
318
+ end
319
+
320
+ # Create a new ForwardingArgumentsNode node
321
+ def ForwardingArgumentsNode(location = Location())
322
+ ForwardingArgumentsNode.new(location)
323
+ end
324
+
325
+ # Create a new ForwardingParameterNode node
326
+ def ForwardingParameterNode(location = Location())
327
+ ForwardingParameterNode.new(location)
328
+ end
329
+
330
+ # Create a new ForwardingSuperNode node
331
+ def ForwardingSuperNode(block, location = Location())
332
+ ForwardingSuperNode.new(block, location)
333
+ end
334
+
335
+ # Create a new GlobalVariableAndWriteNode node
336
+ def GlobalVariableAndWriteNode(name, name_loc, operator_loc, value, location = Location())
337
+ GlobalVariableAndWriteNode.new(name, name_loc, operator_loc, value, location)
338
+ end
339
+
340
+ # Create a new GlobalVariableOperatorWriteNode node
341
+ def GlobalVariableOperatorWriteNode(name, name_loc, operator_loc, value, operator, location = Location())
342
+ GlobalVariableOperatorWriteNode.new(name, name_loc, operator_loc, value, operator, location)
343
+ end
344
+
345
+ # Create a new GlobalVariableOrWriteNode node
346
+ def GlobalVariableOrWriteNode(name, name_loc, operator_loc, value, location = Location())
347
+ GlobalVariableOrWriteNode.new(name, name_loc, operator_loc, value, location)
348
+ end
349
+
350
+ # Create a new GlobalVariableReadNode node
351
+ def GlobalVariableReadNode(name, location = Location())
352
+ GlobalVariableReadNode.new(name, location)
353
+ end
354
+
355
+ # Create a new GlobalVariableTargetNode node
356
+ def GlobalVariableTargetNode(name, location = Location())
357
+ GlobalVariableTargetNode.new(name, location)
358
+ end
359
+
360
+ # Create a new GlobalVariableWriteNode node
361
+ def GlobalVariableWriteNode(name, name_loc, value, operator_loc, location = Location())
362
+ GlobalVariableWriteNode.new(name, name_loc, value, operator_loc, location)
363
+ end
364
+
365
+ # Create a new HashNode node
366
+ def HashNode(opening_loc, elements, closing_loc, location = Location())
367
+ HashNode.new(opening_loc, elements, closing_loc, location)
368
+ end
369
+
370
+ # Create a new HashPatternNode node
371
+ def HashPatternNode(constant, elements, rest, opening_loc, closing_loc, location = Location())
372
+ HashPatternNode.new(constant, elements, rest, opening_loc, closing_loc, location)
373
+ end
374
+
375
+ # Create a new IfNode node
376
+ def IfNode(if_keyword_loc, predicate, then_keyword_loc, statements, consequent, end_keyword_loc, location = Location())
377
+ IfNode.new(if_keyword_loc, predicate, then_keyword_loc, statements, consequent, end_keyword_loc, location)
378
+ end
379
+
380
+ # Create a new ImaginaryNode node
381
+ def ImaginaryNode(numeric, location = Location())
382
+ ImaginaryNode.new(numeric, location)
383
+ end
384
+
385
+ # Create a new ImplicitNode node
386
+ def ImplicitNode(value, location = Location())
387
+ ImplicitNode.new(value, location)
388
+ end
389
+
390
+ # Create a new ImplicitRestNode node
391
+ def ImplicitRestNode(location = Location())
392
+ ImplicitRestNode.new(location)
393
+ end
394
+
395
+ # Create a new InNode node
396
+ def InNode(pattern, statements, in_loc, then_loc, location = Location())
397
+ InNode.new(pattern, statements, in_loc, then_loc, location)
398
+ end
399
+
400
+ # Create a new IndexAndWriteNode node
401
+ def IndexAndWriteNode(flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value, location = Location())
402
+ IndexAndWriteNode.new(flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value, location)
403
+ end
404
+
405
+ # Create a new IndexOperatorWriteNode node
406
+ def IndexOperatorWriteNode(flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator, operator_loc, value, location = Location())
407
+ IndexOperatorWriteNode.new(flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator, operator_loc, value, location)
408
+ end
409
+
410
+ # Create a new IndexOrWriteNode node
411
+ def IndexOrWriteNode(flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value, location = Location())
412
+ IndexOrWriteNode.new(flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value, location)
413
+ end
414
+
415
+ # Create a new IndexTargetNode node
416
+ def IndexTargetNode(flags, receiver, opening_loc, arguments, closing_loc, block, location = Location())
417
+ IndexTargetNode.new(flags, receiver, opening_loc, arguments, closing_loc, block, location)
418
+ end
419
+
420
+ # Create a new InstanceVariableAndWriteNode node
421
+ def InstanceVariableAndWriteNode(name, name_loc, operator_loc, value, location = Location())
422
+ InstanceVariableAndWriteNode.new(name, name_loc, operator_loc, value, location)
423
+ end
424
+
425
+ # Create a new InstanceVariableOperatorWriteNode node
426
+ def InstanceVariableOperatorWriteNode(name, name_loc, operator_loc, value, operator, location = Location())
427
+ InstanceVariableOperatorWriteNode.new(name, name_loc, operator_loc, value, operator, location)
428
+ end
429
+
430
+ # Create a new InstanceVariableOrWriteNode node
431
+ def InstanceVariableOrWriteNode(name, name_loc, operator_loc, value, location = Location())
432
+ InstanceVariableOrWriteNode.new(name, name_loc, operator_loc, value, location)
433
+ end
434
+
435
+ # Create a new InstanceVariableReadNode node
436
+ def InstanceVariableReadNode(name, location = Location())
437
+ InstanceVariableReadNode.new(name, location)
438
+ end
439
+
440
+ # Create a new InstanceVariableTargetNode node
441
+ def InstanceVariableTargetNode(name, location = Location())
442
+ InstanceVariableTargetNode.new(name, location)
443
+ end
444
+
445
+ # Create a new InstanceVariableWriteNode node
446
+ def InstanceVariableWriteNode(name, name_loc, value, operator_loc, location = Location())
447
+ InstanceVariableWriteNode.new(name, name_loc, value, operator_loc, location)
448
+ end
449
+
450
+ # Create a new IntegerNode node
451
+ def IntegerNode(flags, location = Location())
452
+ IntegerNode.new(flags, location)
453
+ end
454
+
455
+ # Create a new InterpolatedMatchLastLineNode node
456
+ def InterpolatedMatchLastLineNode(flags, opening_loc, parts, closing_loc, location = Location())
457
+ InterpolatedMatchLastLineNode.new(flags, opening_loc, parts, closing_loc, location)
458
+ end
459
+
460
+ # Create a new InterpolatedRegularExpressionNode node
461
+ def InterpolatedRegularExpressionNode(flags, opening_loc, parts, closing_loc, location = Location())
462
+ InterpolatedRegularExpressionNode.new(flags, opening_loc, parts, closing_loc, location)
463
+ end
464
+
465
+ # Create a new InterpolatedStringNode node
466
+ def InterpolatedStringNode(opening_loc, parts, closing_loc, location = Location())
467
+ InterpolatedStringNode.new(opening_loc, parts, closing_loc, location)
468
+ end
469
+
470
+ # Create a new InterpolatedSymbolNode node
471
+ def InterpolatedSymbolNode(opening_loc, parts, closing_loc, location = Location())
472
+ InterpolatedSymbolNode.new(opening_loc, parts, closing_loc, location)
473
+ end
474
+
475
+ # Create a new InterpolatedXStringNode node
476
+ def InterpolatedXStringNode(opening_loc, parts, closing_loc, location = Location())
477
+ InterpolatedXStringNode.new(opening_loc, parts, closing_loc, location)
478
+ end
479
+
480
+ # Create a new KeywordHashNode node
481
+ def KeywordHashNode(flags, elements, location = Location())
482
+ KeywordHashNode.new(flags, elements, location)
483
+ end
484
+
485
+ # Create a new KeywordRestParameterNode node
486
+ def KeywordRestParameterNode(flags, name, name_loc, operator_loc, location = Location())
487
+ KeywordRestParameterNode.new(flags, name, name_loc, operator_loc, location)
488
+ end
489
+
490
+ # Create a new LambdaNode node
491
+ def LambdaNode(locals, operator_loc, opening_loc, closing_loc, parameters, body, location = Location())
492
+ LambdaNode.new(locals, operator_loc, opening_loc, closing_loc, parameters, body, location)
493
+ end
494
+
495
+ # Create a new LocalVariableAndWriteNode node
496
+ def LocalVariableAndWriteNode(name_loc, operator_loc, value, name, depth, location = Location())
497
+ LocalVariableAndWriteNode.new(name_loc, operator_loc, value, name, depth, location)
498
+ end
499
+
500
+ # Create a new LocalVariableOperatorWriteNode node
501
+ def LocalVariableOperatorWriteNode(name_loc, operator_loc, value, name, operator, depth, location = Location())
502
+ LocalVariableOperatorWriteNode.new(name_loc, operator_loc, value, name, operator, depth, location)
503
+ end
504
+
505
+ # Create a new LocalVariableOrWriteNode node
506
+ def LocalVariableOrWriteNode(name_loc, operator_loc, value, name, depth, location = Location())
507
+ LocalVariableOrWriteNode.new(name_loc, operator_loc, value, name, depth, location)
508
+ end
509
+
510
+ # Create a new LocalVariableReadNode node
511
+ def LocalVariableReadNode(name, depth, location = Location())
512
+ LocalVariableReadNode.new(name, depth, location)
513
+ end
514
+
515
+ # Create a new LocalVariableTargetNode node
516
+ def LocalVariableTargetNode(name, depth, location = Location())
517
+ LocalVariableTargetNode.new(name, depth, location)
518
+ end
519
+
520
+ # Create a new LocalVariableWriteNode node
521
+ def LocalVariableWriteNode(name, depth, name_loc, value, operator_loc, location = Location())
522
+ LocalVariableWriteNode.new(name, depth, name_loc, value, operator_loc, location)
523
+ end
524
+
525
+ # Create a new MatchLastLineNode node
526
+ def MatchLastLineNode(flags, opening_loc, content_loc, closing_loc, unescaped, location = Location())
527
+ MatchLastLineNode.new(flags, opening_loc, content_loc, closing_loc, unescaped, location)
528
+ end
529
+
530
+ # Create a new MatchPredicateNode node
531
+ def MatchPredicateNode(value, pattern, operator_loc, location = Location())
532
+ MatchPredicateNode.new(value, pattern, operator_loc, location)
533
+ end
534
+
535
+ # Create a new MatchRequiredNode node
536
+ def MatchRequiredNode(value, pattern, operator_loc, location = Location())
537
+ MatchRequiredNode.new(value, pattern, operator_loc, location)
538
+ end
539
+
540
+ # Create a new MatchWriteNode node
541
+ def MatchWriteNode(call, targets, location = Location())
542
+ MatchWriteNode.new(call, targets, location)
543
+ end
544
+
545
+ # Create a new MissingNode node
546
+ def MissingNode(location = Location())
547
+ MissingNode.new(location)
548
+ end
549
+
550
+ # Create a new ModuleNode node
551
+ def ModuleNode(locals, module_keyword_loc, constant_path, body, end_keyword_loc, name, location = Location())
552
+ ModuleNode.new(locals, module_keyword_loc, constant_path, body, end_keyword_loc, name, location)
553
+ end
554
+
555
+ # Create a new MultiTargetNode node
556
+ def MultiTargetNode(lefts, rest, rights, lparen_loc, rparen_loc, location = Location())
557
+ MultiTargetNode.new(lefts, rest, rights, lparen_loc, rparen_loc, location)
558
+ end
559
+
560
+ # Create a new MultiWriteNode node
561
+ def MultiWriteNode(lefts, rest, rights, lparen_loc, rparen_loc, operator_loc, value, location = Location())
562
+ MultiWriteNode.new(lefts, rest, rights, lparen_loc, rparen_loc, operator_loc, value, location)
563
+ end
564
+
565
+ # Create a new NextNode node
566
+ def NextNode(arguments, keyword_loc, location = Location())
567
+ NextNode.new(arguments, keyword_loc, location)
568
+ end
569
+
570
+ # Create a new NilNode node
571
+ def NilNode(location = Location())
572
+ NilNode.new(location)
573
+ end
574
+
575
+ # Create a new NoKeywordsParameterNode node
576
+ def NoKeywordsParameterNode(operator_loc, keyword_loc, location = Location())
577
+ NoKeywordsParameterNode.new(operator_loc, keyword_loc, location)
578
+ end
579
+
580
+ # Create a new NumberedParametersNode node
581
+ def NumberedParametersNode(maximum, location = Location())
582
+ NumberedParametersNode.new(maximum, location)
583
+ end
584
+
585
+ # Create a new NumberedReferenceReadNode node
586
+ def NumberedReferenceReadNode(number, location = Location())
587
+ NumberedReferenceReadNode.new(number, location)
588
+ end
589
+
590
+ # Create a new OptionalKeywordParameterNode node
591
+ def OptionalKeywordParameterNode(flags, name, name_loc, value, location = Location())
592
+ OptionalKeywordParameterNode.new(flags, name, name_loc, value, location)
593
+ end
594
+
595
+ # Create a new OptionalParameterNode node
596
+ def OptionalParameterNode(flags, name, name_loc, operator_loc, value, location = Location())
597
+ OptionalParameterNode.new(flags, name, name_loc, operator_loc, value, location)
598
+ end
599
+
600
+ # Create a new OrNode node
601
+ def OrNode(left, right, operator_loc, location = Location())
602
+ OrNode.new(left, right, operator_loc, location)
603
+ end
604
+
605
+ # Create a new ParametersNode node
606
+ def ParametersNode(requireds, optionals, rest, posts, keywords, keyword_rest, block, location = Location())
607
+ ParametersNode.new(requireds, optionals, rest, posts, keywords, keyword_rest, block, location)
608
+ end
609
+
610
+ # Create a new ParenthesesNode node
611
+ def ParenthesesNode(body, opening_loc, closing_loc, location = Location())
612
+ ParenthesesNode.new(body, opening_loc, closing_loc, location)
613
+ end
614
+
615
+ # Create a new PinnedExpressionNode node
616
+ def PinnedExpressionNode(expression, operator_loc, lparen_loc, rparen_loc, location = Location())
617
+ PinnedExpressionNode.new(expression, operator_loc, lparen_loc, rparen_loc, location)
618
+ end
619
+
620
+ # Create a new PinnedVariableNode node
621
+ def PinnedVariableNode(variable, operator_loc, location = Location())
622
+ PinnedVariableNode.new(variable, operator_loc, location)
623
+ end
624
+
625
+ # Create a new PostExecutionNode node
626
+ def PostExecutionNode(statements, keyword_loc, opening_loc, closing_loc, location = Location())
627
+ PostExecutionNode.new(statements, keyword_loc, opening_loc, closing_loc, location)
628
+ end
629
+
630
+ # Create a new PreExecutionNode node
631
+ def PreExecutionNode(statements, keyword_loc, opening_loc, closing_loc, location = Location())
632
+ PreExecutionNode.new(statements, keyword_loc, opening_loc, closing_loc, location)
633
+ end
634
+
635
+ # Create a new ProgramNode node
636
+ def ProgramNode(locals, statements, location = Location())
637
+ ProgramNode.new(locals, statements, location)
638
+ end
639
+
640
+ # Create a new RangeNode node
641
+ def RangeNode(flags, left, right, operator_loc, location = Location())
642
+ RangeNode.new(flags, left, right, operator_loc, location)
643
+ end
644
+
645
+ # Create a new RationalNode node
646
+ def RationalNode(numeric, location = Location())
647
+ RationalNode.new(numeric, location)
648
+ end
649
+
650
+ # Create a new RedoNode node
651
+ def RedoNode(location = Location())
652
+ RedoNode.new(location)
653
+ end
654
+
655
+ # Create a new RegularExpressionNode node
656
+ def RegularExpressionNode(flags, opening_loc, content_loc, closing_loc, unescaped, location = Location())
657
+ RegularExpressionNode.new(flags, opening_loc, content_loc, closing_loc, unescaped, location)
658
+ end
659
+
660
+ # Create a new RequiredKeywordParameterNode node
661
+ def RequiredKeywordParameterNode(flags, name, name_loc, location = Location())
662
+ RequiredKeywordParameterNode.new(flags, name, name_loc, location)
663
+ end
664
+
665
+ # Create a new RequiredParameterNode node
666
+ def RequiredParameterNode(flags, name, location = Location())
667
+ RequiredParameterNode.new(flags, name, location)
668
+ end
669
+
670
+ # Create a new RescueModifierNode node
671
+ def RescueModifierNode(expression, keyword_loc, rescue_expression, location = Location())
672
+ RescueModifierNode.new(expression, keyword_loc, rescue_expression, location)
673
+ end
674
+
675
+ # Create a new RescueNode node
676
+ def RescueNode(keyword_loc, exceptions, operator_loc, reference, statements, consequent, location = Location())
677
+ RescueNode.new(keyword_loc, exceptions, operator_loc, reference, statements, consequent, location)
678
+ end
679
+
680
+ # Create a new RestParameterNode node
681
+ def RestParameterNode(flags, name, name_loc, operator_loc, location = Location())
682
+ RestParameterNode.new(flags, name, name_loc, operator_loc, location)
683
+ end
684
+
685
+ # Create a new RetryNode node
686
+ def RetryNode(location = Location())
687
+ RetryNode.new(location)
688
+ end
689
+
690
+ # Create a new ReturnNode node
691
+ def ReturnNode(keyword_loc, arguments, location = Location())
692
+ ReturnNode.new(keyword_loc, arguments, location)
693
+ end
694
+
695
+ # Create a new SelfNode node
696
+ def SelfNode(location = Location())
697
+ SelfNode.new(location)
698
+ end
699
+
700
+ # Create a new SingletonClassNode node
701
+ def SingletonClassNode(locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc, location = Location())
702
+ SingletonClassNode.new(locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc, location)
703
+ end
704
+
705
+ # Create a new SourceEncodingNode node
706
+ def SourceEncodingNode(location = Location())
707
+ SourceEncodingNode.new(location)
708
+ end
709
+
710
+ # Create a new SourceFileNode node
711
+ def SourceFileNode(filepath, location = Location())
712
+ SourceFileNode.new(filepath, location)
713
+ end
714
+
715
+ # Create a new SourceLineNode node
716
+ def SourceLineNode(location = Location())
717
+ SourceLineNode.new(location)
718
+ end
719
+
720
+ # Create a new SplatNode node
721
+ def SplatNode(operator_loc, expression, location = Location())
722
+ SplatNode.new(operator_loc, expression, location)
723
+ end
724
+
725
+ # Create a new StatementsNode node
726
+ def StatementsNode(body, location = Location())
727
+ StatementsNode.new(body, location)
728
+ end
729
+
730
+ # Create a new StringNode node
731
+ def StringNode(flags, opening_loc, content_loc, closing_loc, unescaped, location = Location())
732
+ StringNode.new(flags, opening_loc, content_loc, closing_loc, unescaped, location)
733
+ end
734
+
735
+ # Create a new SuperNode node
736
+ def SuperNode(keyword_loc, lparen_loc, arguments, rparen_loc, block, location = Location())
737
+ SuperNode.new(keyword_loc, lparen_loc, arguments, rparen_loc, block, location)
738
+ end
739
+
740
+ # Create a new SymbolNode node
741
+ def SymbolNode(flags, opening_loc, value_loc, closing_loc, unescaped, location = Location())
742
+ SymbolNode.new(flags, opening_loc, value_loc, closing_loc, unescaped, location)
743
+ end
744
+
745
+ # Create a new TrueNode node
746
+ def TrueNode(location = Location())
747
+ TrueNode.new(location)
748
+ end
749
+
750
+ # Create a new UndefNode node
751
+ def UndefNode(names, keyword_loc, location = Location())
752
+ UndefNode.new(names, keyword_loc, location)
753
+ end
754
+
755
+ # Create a new UnlessNode node
756
+ def UnlessNode(keyword_loc, predicate, then_keyword_loc, statements, consequent, end_keyword_loc, location = Location())
757
+ UnlessNode.new(keyword_loc, predicate, then_keyword_loc, statements, consequent, end_keyword_loc, location)
758
+ end
759
+
760
+ # Create a new UntilNode node
761
+ def UntilNode(flags, keyword_loc, closing_loc, predicate, statements, location = Location())
762
+ UntilNode.new(flags, keyword_loc, closing_loc, predicate, statements, location)
763
+ end
764
+
765
+ # Create a new WhenNode node
766
+ def WhenNode(keyword_loc, conditions, statements, location = Location())
767
+ WhenNode.new(keyword_loc, conditions, statements, location)
768
+ end
769
+
770
+ # Create a new WhileNode node
771
+ def WhileNode(flags, keyword_loc, closing_loc, predicate, statements, location = Location())
772
+ WhileNode.new(flags, keyword_loc, closing_loc, predicate, statements, location)
773
+ end
774
+
775
+ # Create a new XStringNode node
776
+ def XStringNode(flags, opening_loc, content_loc, closing_loc, unescaped, location = Location())
777
+ XStringNode.new(flags, opening_loc, content_loc, closing_loc, unescaped, location)
778
+ end
779
+
780
+ # Create a new YieldNode node
781
+ def YieldNode(keyword_loc, lparen_loc, arguments, rparen_loc, location = Location())
782
+ YieldNode.new(keyword_loc, lparen_loc, arguments, rparen_loc, location)
783
+ end
784
+ end
785
+ end