prism 0.29.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +115 -1
  3. data/CONTRIBUTING.md +0 -4
  4. data/Makefile +1 -1
  5. data/README.md +4 -0
  6. data/config.yml +920 -148
  7. data/docs/build_system.md +8 -11
  8. data/docs/fuzzing.md +1 -1
  9. data/docs/parsing_rules.md +4 -1
  10. data/docs/relocation.md +34 -0
  11. data/docs/ripper_translation.md +22 -0
  12. data/docs/serialization.md +3 -0
  13. data/ext/prism/api_node.c +2863 -2079
  14. data/ext/prism/extconf.rb +14 -37
  15. data/ext/prism/extension.c +241 -391
  16. data/ext/prism/extension.h +2 -2
  17. data/include/prism/ast.h +2156 -453
  18. data/include/prism/defines.h +58 -7
  19. data/include/prism/diagnostic.h +24 -6
  20. data/include/prism/node.h +0 -21
  21. data/include/prism/options.h +94 -3
  22. data/include/prism/parser.h +82 -40
  23. data/include/prism/regexp.h +18 -8
  24. data/include/prism/static_literals.h +3 -2
  25. data/include/prism/util/pm_char.h +1 -2
  26. data/include/prism/util/pm_constant_pool.h +0 -8
  27. data/include/prism/util/pm_integer.h +22 -15
  28. data/include/prism/util/pm_newline_list.h +11 -0
  29. data/include/prism/util/pm_string.h +28 -12
  30. data/include/prism/version.h +3 -3
  31. data/include/prism.h +47 -11
  32. data/lib/prism/compiler.rb +3 -0
  33. data/lib/prism/desugar_compiler.rb +111 -74
  34. data/lib/prism/dispatcher.rb +16 -1
  35. data/lib/prism/dot_visitor.rb +55 -34
  36. data/lib/prism/dsl.rb +660 -468
  37. data/lib/prism/ffi.rb +113 -8
  38. data/lib/prism/inspect_visitor.rb +296 -64
  39. data/lib/prism/lex_compat.rb +1 -1
  40. data/lib/prism/mutation_compiler.rb +11 -6
  41. data/lib/prism/node.rb +4262 -5023
  42. data/lib/prism/node_ext.rb +91 -14
  43. data/lib/prism/parse_result/comments.rb +0 -7
  44. data/lib/prism/parse_result/errors.rb +65 -0
  45. data/lib/prism/parse_result/newlines.rb +101 -11
  46. data/lib/prism/parse_result.rb +183 -6
  47. data/lib/prism/reflection.rb +12 -10
  48. data/lib/prism/relocation.rb +504 -0
  49. data/lib/prism/serialize.rb +496 -609
  50. data/lib/prism/string_query.rb +30 -0
  51. data/lib/prism/translation/parser/compiler.rb +185 -155
  52. data/lib/prism/translation/parser/lexer.rb +26 -4
  53. data/lib/prism/translation/parser.rb +9 -4
  54. data/lib/prism/translation/ripper.rb +23 -25
  55. data/lib/prism/translation/ruby_parser.rb +86 -17
  56. data/lib/prism/visitor.rb +3 -0
  57. data/lib/prism.rb +6 -8
  58. data/prism.gemspec +9 -5
  59. data/rbi/prism/dsl.rbi +521 -0
  60. data/rbi/prism/node.rbi +1115 -1120
  61. data/rbi/prism/parse_result.rbi +29 -0
  62. data/rbi/prism/string_query.rbi +12 -0
  63. data/rbi/prism/visitor.rbi +3 -0
  64. data/rbi/prism.rbi +36 -30
  65. data/sig/prism/dsl.rbs +190 -303
  66. data/sig/prism/mutation_compiler.rbs +1 -0
  67. data/sig/prism/node.rbs +678 -632
  68. data/sig/prism/parse_result.rbs +22 -0
  69. data/sig/prism/relocation.rbs +185 -0
  70. data/sig/prism/string_query.rbs +11 -0
  71. data/sig/prism/visitor.rbs +1 -0
  72. data/sig/prism.rbs +103 -64
  73. data/src/diagnostic.c +64 -28
  74. data/src/node.c +502 -1739
  75. data/src/options.c +76 -27
  76. data/src/prettyprint.c +188 -112
  77. data/src/prism.c +3376 -2293
  78. data/src/regexp.c +208 -71
  79. data/src/serialize.c +182 -50
  80. data/src/static_literals.c +64 -85
  81. data/src/token_type.c +4 -4
  82. data/src/util/pm_char.c +1 -1
  83. data/src/util/pm_constant_pool.c +0 -8
  84. data/src/util/pm_integer.c +53 -25
  85. data/src/util/pm_newline_list.c +29 -0
  86. data/src/util/pm_string.c +131 -80
  87. data/src/util/pm_strpbrk.c +32 -6
  88. metadata +11 -7
  89. data/include/prism/util/pm_string_list.h +0 -44
  90. data/lib/prism/debug.rb +0 -249
  91. data/lib/prism/translation/parser/rubocop.rb +0 -73
  92. data/src/util/pm_string_list.c +0 -28
@@ -76,6 +76,8 @@ module Prism
76
76
  # Inspect a AliasGlobalVariableNode node.
77
77
  def visit_alias_global_variable_node(node)
78
78
  commands << [inspect_node("AliasGlobalVariableNode", node), indent]
79
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
80
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
79
81
  commands << ["├── new_name:\n", indent]
80
82
  commands << [node.new_name, "#{indent}│ "]
81
83
  commands << ["├── old_name:\n", indent]
@@ -86,6 +88,8 @@ module Prism
86
88
  # Inspect a AliasMethodNode node.
87
89
  def visit_alias_method_node(node)
88
90
  commands << [inspect_node("AliasMethodNode", node), indent]
91
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
92
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
89
93
  commands << ["├── new_name:\n", indent]
90
94
  commands << [node.new_name, "#{indent}│ "]
91
95
  commands << ["├── old_name:\n", indent]
@@ -96,6 +100,8 @@ module Prism
96
100
  # Inspect a AlternationPatternNode node.
97
101
  def visit_alternation_pattern_node(node)
98
102
  commands << [inspect_node("AlternationPatternNode", node), indent]
103
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
104
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
99
105
  commands << ["├── left:\n", indent]
100
106
  commands << [node.left, "#{indent}│ "]
101
107
  commands << ["├── right:\n", indent]
@@ -106,6 +112,8 @@ module Prism
106
112
  # Inspect a AndNode node.
107
113
  def visit_and_node(node)
108
114
  commands << [inspect_node("AndNode", node), indent]
115
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
116
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
109
117
  commands << ["├── left:\n", indent]
110
118
  commands << [node.left, "#{indent}│ "]
111
119
  commands << ["├── right:\n", indent]
@@ -116,7 +124,7 @@ module Prism
116
124
  # Inspect a ArgumentsNode node.
117
125
  def visit_arguments_node(node)
118
126
  commands << [inspect_node("ArgumentsNode", node), indent]
119
- flags = [("contains_keywords" if node.contains_keywords?), ("contains_keyword_splat" if node.contains_keyword_splat?)].compact
127
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("contains_forwarding" if node.contains_forwarding?), ("contains_keywords" if node.contains_keywords?), ("contains_keyword_splat" if node.contains_keyword_splat?), ("contains_splat" if node.contains_splat?), ("contains_multiple_splats" if node.contains_multiple_splats?)].compact
120
128
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
121
129
  commands << ["└── arguments: (length: #{(arguments = node.arguments).length})\n", indent]
122
130
  if arguments.any?
@@ -132,7 +140,7 @@ module Prism
132
140
  # Inspect a ArrayNode node.
133
141
  def visit_array_node(node)
134
142
  commands << [inspect_node("ArrayNode", node), indent]
135
- flags = [("contains_splat" if node.contains_splat?)].compact
143
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("contains_splat" if node.contains_splat?)].compact
136
144
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
137
145
  commands << ["├── elements: (length: #{(elements = node.elements).length})\n", indent]
138
146
  if elements.any?
@@ -150,6 +158,8 @@ module Prism
150
158
  # Inspect a ArrayPatternNode node.
151
159
  def visit_array_pattern_node(node)
152
160
  commands << [inspect_node("ArrayPatternNode", node), indent]
161
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
162
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
153
163
  if (constant = node.constant).nil?
154
164
  commands << ["├── constant: ∅\n", indent]
155
165
  else
@@ -187,6 +197,8 @@ module Prism
187
197
  # Inspect a AssocNode node.
188
198
  def visit_assoc_node(node)
189
199
  commands << [inspect_node("AssocNode", node), indent]
200
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
201
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
190
202
  commands << ["├── key:\n", indent]
191
203
  commands << [node.key, "#{indent}│ "]
192
204
  commands << ["├── value:\n", indent]
@@ -197,6 +209,8 @@ module Prism
197
209
  # Inspect a AssocSplatNode node.
198
210
  def visit_assoc_splat_node(node)
199
211
  commands << [inspect_node("AssocSplatNode", node), indent]
212
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
213
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
200
214
  if (value = node.value).nil?
201
215
  commands << ["├── value: ∅\n", indent]
202
216
  else
@@ -209,12 +223,16 @@ module Prism
209
223
  # Inspect a BackReferenceReadNode node.
210
224
  def visit_back_reference_read_node(node)
211
225
  commands << [inspect_node("BackReferenceReadNode", node), indent]
226
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
227
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
212
228
  commands << ["└── name: #{node.name.inspect}\n", indent]
213
229
  end
214
230
 
215
231
  # Inspect a BeginNode node.
216
232
  def visit_begin_node(node)
217
233
  commands << [inspect_node("BeginNode", node), indent]
234
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
235
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
218
236
  commands << ["├── begin_keyword_loc: #{inspect_location(node.begin_keyword_loc)}\n", indent]
219
237
  if (statements = node.statements).nil?
220
238
  commands << ["├── statements: ∅\n", indent]
@@ -246,6 +264,8 @@ module Prism
246
264
  # Inspect a BlockArgumentNode node.
247
265
  def visit_block_argument_node(node)
248
266
  commands << [inspect_node("BlockArgumentNode", node), indent]
267
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
268
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
249
269
  if (expression = node.expression).nil?
250
270
  commands << ["├── expression: ∅\n", indent]
251
271
  else
@@ -258,7 +278,7 @@ module Prism
258
278
  # Inspect a BlockLocalVariableNode node.
259
279
  def visit_block_local_variable_node(node)
260
280
  commands << [inspect_node("BlockLocalVariableNode", node), indent]
261
- flags = [("repeated_parameter" if node.repeated_parameter?)].compact
281
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("repeated_parameter" if node.repeated_parameter?)].compact
262
282
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
263
283
  commands << ["└── name: #{node.name.inspect}\n", indent]
264
284
  end
@@ -266,6 +286,8 @@ module Prism
266
286
  # Inspect a BlockNode node.
267
287
  def visit_block_node(node)
268
288
  commands << [inspect_node("BlockNode", node), indent]
289
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
290
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
269
291
  commands << ["├── locals: #{node.locals.inspect}\n", indent]
270
292
  if (parameters = node.parameters).nil?
271
293
  commands << ["├── parameters: ∅\n", indent]
@@ -286,7 +308,7 @@ module Prism
286
308
  # Inspect a BlockParameterNode node.
287
309
  def visit_block_parameter_node(node)
288
310
  commands << [inspect_node("BlockParameterNode", node), indent]
289
- flags = [("repeated_parameter" if node.repeated_parameter?)].compact
311
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("repeated_parameter" if node.repeated_parameter?)].compact
290
312
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
291
313
  if (name = node.name).nil?
292
314
  commands << ["├── name: ∅\n", indent]
@@ -300,6 +322,8 @@ module Prism
300
322
  # Inspect a BlockParametersNode node.
301
323
  def visit_block_parameters_node(node)
302
324
  commands << [inspect_node("BlockParametersNode", node), indent]
325
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
326
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
303
327
  if (parameters = node.parameters).nil?
304
328
  commands << ["├── parameters: ∅\n", indent]
305
329
  else
@@ -322,6 +346,8 @@ module Prism
322
346
  # Inspect a BreakNode node.
323
347
  def visit_break_node(node)
324
348
  commands << [inspect_node("BreakNode", node), indent]
349
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
350
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
325
351
  if (arguments = node.arguments).nil?
326
352
  commands << ["├── arguments: ∅\n", indent]
327
353
  else
@@ -334,7 +360,7 @@ module Prism
334
360
  # Inspect a CallAndWriteNode node.
335
361
  def visit_call_and_write_node(node)
336
362
  commands << [inspect_node("CallAndWriteNode", node), indent]
337
- flags = [("safe_navigation" if node.safe_navigation?), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact
363
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("safe_navigation" if node.safe_navigation?), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact
338
364
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
339
365
  if (receiver = node.receiver).nil?
340
366
  commands << ["├── receiver: ∅\n", indent]
@@ -354,7 +380,7 @@ module Prism
354
380
  # Inspect a CallNode node.
355
381
  def visit_call_node(node)
356
382
  commands << [inspect_node("CallNode", node), indent]
357
- flags = [("safe_navigation" if node.safe_navigation?), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact
383
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("safe_navigation" if node.safe_navigation?), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact
358
384
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
359
385
  if (receiver = node.receiver).nil?
360
386
  commands << ["├── receiver: ∅\n", indent]
@@ -384,7 +410,7 @@ module Prism
384
410
  # Inspect a CallOperatorWriteNode node.
385
411
  def visit_call_operator_write_node(node)
386
412
  commands << [inspect_node("CallOperatorWriteNode", node), indent]
387
- flags = [("safe_navigation" if node.safe_navigation?), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact
413
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("safe_navigation" if node.safe_navigation?), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact
388
414
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
389
415
  if (receiver = node.receiver).nil?
390
416
  commands << ["├── receiver: ∅\n", indent]
@@ -405,7 +431,7 @@ module Prism
405
431
  # Inspect a CallOrWriteNode node.
406
432
  def visit_call_or_write_node(node)
407
433
  commands << [inspect_node("CallOrWriteNode", node), indent]
408
- flags = [("safe_navigation" if node.safe_navigation?), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact
434
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("safe_navigation" if node.safe_navigation?), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact
409
435
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
410
436
  if (receiver = node.receiver).nil?
411
437
  commands << ["├── receiver: ∅\n", indent]
@@ -425,7 +451,7 @@ module Prism
425
451
  # Inspect a CallTargetNode node.
426
452
  def visit_call_target_node(node)
427
453
  commands << [inspect_node("CallTargetNode", node), indent]
428
- flags = [("safe_navigation" if node.safe_navigation?), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact
454
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("safe_navigation" if node.safe_navigation?), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact
429
455
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
430
456
  commands << ["├── receiver:\n", indent]
431
457
  commands << [node.receiver, "#{indent}│ "]
@@ -437,6 +463,8 @@ module Prism
437
463
  # Inspect a CapturePatternNode node.
438
464
  def visit_capture_pattern_node(node)
439
465
  commands << [inspect_node("CapturePatternNode", node), indent]
466
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
467
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
440
468
  commands << ["├── value:\n", indent]
441
469
  commands << [node.value, "#{indent}│ "]
442
470
  commands << ["├── target:\n", indent]
@@ -447,6 +475,8 @@ module Prism
447
475
  # Inspect a CaseMatchNode node.
448
476
  def visit_case_match_node(node)
449
477
  commands << [inspect_node("CaseMatchNode", node), indent]
478
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
479
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
450
480
  if (predicate = node.predicate).nil?
451
481
  commands << ["├── predicate: ∅\n", indent]
452
482
  else
@@ -462,11 +492,11 @@ module Prism
462
492
  commands << [Replace.new("#{indent}│ └── "), indent]
463
493
  commands << [conditions[-1], "#{indent}│ "]
464
494
  end
465
- if (consequent = node.consequent).nil?
466
- commands << ["├── consequent: ∅\n", indent]
495
+ if (else_clause = node.else_clause).nil?
496
+ commands << ["├── else_clause: ∅\n", indent]
467
497
  else
468
- commands << ["├── consequent:\n", indent]
469
- commands << [consequent, "#{indent}│ "]
498
+ commands << ["├── else_clause:\n", indent]
499
+ commands << [else_clause, "#{indent}│ "]
470
500
  end
471
501
  commands << ["├── case_keyword_loc: #{inspect_location(node.case_keyword_loc)}\n", indent]
472
502
  commands << ["└── end_keyword_loc: #{inspect_location(node.end_keyword_loc)}\n", indent]
@@ -475,6 +505,8 @@ module Prism
475
505
  # Inspect a CaseNode node.
476
506
  def visit_case_node(node)
477
507
  commands << [inspect_node("CaseNode", node), indent]
508
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
509
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
478
510
  if (predicate = node.predicate).nil?
479
511
  commands << ["├── predicate: ∅\n", indent]
480
512
  else
@@ -490,11 +522,11 @@ module Prism
490
522
  commands << [Replace.new("#{indent}│ └── "), indent]
491
523
  commands << [conditions[-1], "#{indent}│ "]
492
524
  end
493
- if (consequent = node.consequent).nil?
494
- commands << ["├── consequent: ∅\n", indent]
525
+ if (else_clause = node.else_clause).nil?
526
+ commands << ["├── else_clause: ∅\n", indent]
495
527
  else
496
- commands << ["├── consequent:\n", indent]
497
- commands << [consequent, "#{indent}│ "]
528
+ commands << ["├── else_clause:\n", indent]
529
+ commands << [else_clause, "#{indent}│ "]
498
530
  end
499
531
  commands << ["├── case_keyword_loc: #{inspect_location(node.case_keyword_loc)}\n", indent]
500
532
  commands << ["└── end_keyword_loc: #{inspect_location(node.end_keyword_loc)}\n", indent]
@@ -503,6 +535,8 @@ module Prism
503
535
  # Inspect a ClassNode node.
504
536
  def visit_class_node(node)
505
537
  commands << [inspect_node("ClassNode", node), indent]
538
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
539
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
506
540
  commands << ["├── locals: #{node.locals.inspect}\n", indent]
507
541
  commands << ["├── class_keyword_loc: #{inspect_location(node.class_keyword_loc)}\n", indent]
508
542
  commands << ["├── constant_path:\n", indent]
@@ -527,6 +561,8 @@ module Prism
527
561
  # Inspect a ClassVariableAndWriteNode node.
528
562
  def visit_class_variable_and_write_node(node)
529
563
  commands << [inspect_node("ClassVariableAndWriteNode", node), indent]
564
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
565
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
530
566
  commands << ["├── name: #{node.name.inspect}\n", indent]
531
567
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
532
568
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
@@ -537,6 +573,8 @@ module Prism
537
573
  # Inspect a ClassVariableOperatorWriteNode node.
538
574
  def visit_class_variable_operator_write_node(node)
539
575
  commands << [inspect_node("ClassVariableOperatorWriteNode", node), indent]
576
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
577
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
540
578
  commands << ["├── name: #{node.name.inspect}\n", indent]
541
579
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
542
580
  commands << ["├── binary_operator_loc: #{inspect_location(node.binary_operator_loc)}\n", indent]
@@ -548,6 +586,8 @@ module Prism
548
586
  # Inspect a ClassVariableOrWriteNode node.
549
587
  def visit_class_variable_or_write_node(node)
550
588
  commands << [inspect_node("ClassVariableOrWriteNode", node), indent]
589
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
590
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
551
591
  commands << ["├── name: #{node.name.inspect}\n", indent]
552
592
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
553
593
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
@@ -558,18 +598,24 @@ module Prism
558
598
  # Inspect a ClassVariableReadNode node.
559
599
  def visit_class_variable_read_node(node)
560
600
  commands << [inspect_node("ClassVariableReadNode", node), indent]
601
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
602
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
561
603
  commands << ["└── name: #{node.name.inspect}\n", indent]
562
604
  end
563
605
 
564
606
  # Inspect a ClassVariableTargetNode node.
565
607
  def visit_class_variable_target_node(node)
566
608
  commands << [inspect_node("ClassVariableTargetNode", node), indent]
609
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
610
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
567
611
  commands << ["└── name: #{node.name.inspect}\n", indent]
568
612
  end
569
613
 
570
614
  # Inspect a ClassVariableWriteNode node.
571
615
  def visit_class_variable_write_node(node)
572
616
  commands << [inspect_node("ClassVariableWriteNode", node), indent]
617
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
618
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
573
619
  commands << ["├── name: #{node.name.inspect}\n", indent]
574
620
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
575
621
  commands << ["├── value:\n", indent]
@@ -580,6 +626,8 @@ module Prism
580
626
  # Inspect a ConstantAndWriteNode node.
581
627
  def visit_constant_and_write_node(node)
582
628
  commands << [inspect_node("ConstantAndWriteNode", node), indent]
629
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
630
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
583
631
  commands << ["├── name: #{node.name.inspect}\n", indent]
584
632
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
585
633
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
@@ -590,6 +638,8 @@ module Prism
590
638
  # Inspect a ConstantOperatorWriteNode node.
591
639
  def visit_constant_operator_write_node(node)
592
640
  commands << [inspect_node("ConstantOperatorWriteNode", node), indent]
641
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
642
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
593
643
  commands << ["├── name: #{node.name.inspect}\n", indent]
594
644
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
595
645
  commands << ["├── binary_operator_loc: #{inspect_location(node.binary_operator_loc)}\n", indent]
@@ -601,6 +651,8 @@ module Prism
601
651
  # Inspect a ConstantOrWriteNode node.
602
652
  def visit_constant_or_write_node(node)
603
653
  commands << [inspect_node("ConstantOrWriteNode", node), indent]
654
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
655
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
604
656
  commands << ["├── name: #{node.name.inspect}\n", indent]
605
657
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
606
658
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
@@ -611,6 +663,8 @@ module Prism
611
663
  # Inspect a ConstantPathAndWriteNode node.
612
664
  def visit_constant_path_and_write_node(node)
613
665
  commands << [inspect_node("ConstantPathAndWriteNode", node), indent]
666
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
667
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
614
668
  commands << ["├── target:\n", indent]
615
669
  commands << [node.target, "#{indent}│ "]
616
670
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
@@ -621,6 +675,8 @@ module Prism
621
675
  # Inspect a ConstantPathNode node.
622
676
  def visit_constant_path_node(node)
623
677
  commands << [inspect_node("ConstantPathNode", node), indent]
678
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
679
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
624
680
  if (parent = node.parent).nil?
625
681
  commands << ["├── parent: ∅\n", indent]
626
682
  else
@@ -639,6 +695,8 @@ module Prism
639
695
  # Inspect a ConstantPathOperatorWriteNode node.
640
696
  def visit_constant_path_operator_write_node(node)
641
697
  commands << [inspect_node("ConstantPathOperatorWriteNode", node), indent]
698
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
699
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
642
700
  commands << ["├── target:\n", indent]
643
701
  commands << [node.target, "#{indent}│ "]
644
702
  commands << ["├── binary_operator_loc: #{inspect_location(node.binary_operator_loc)}\n", indent]
@@ -650,6 +708,8 @@ module Prism
650
708
  # Inspect a ConstantPathOrWriteNode node.
651
709
  def visit_constant_path_or_write_node(node)
652
710
  commands << [inspect_node("ConstantPathOrWriteNode", node), indent]
711
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
712
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
653
713
  commands << ["├── target:\n", indent]
654
714
  commands << [node.target, "#{indent}│ "]
655
715
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
@@ -660,6 +720,8 @@ module Prism
660
720
  # Inspect a ConstantPathTargetNode node.
661
721
  def visit_constant_path_target_node(node)
662
722
  commands << [inspect_node("ConstantPathTargetNode", node), indent]
723
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
724
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
663
725
  if (parent = node.parent).nil?
664
726
  commands << ["├── parent: ∅\n", indent]
665
727
  else
@@ -678,6 +740,8 @@ module Prism
678
740
  # Inspect a ConstantPathWriteNode node.
679
741
  def visit_constant_path_write_node(node)
680
742
  commands << [inspect_node("ConstantPathWriteNode", node), indent]
743
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
744
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
681
745
  commands << ["├── target:\n", indent]
682
746
  commands << [node.target, "#{indent}│ "]
683
747
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
@@ -688,18 +752,24 @@ module Prism
688
752
  # Inspect a ConstantReadNode node.
689
753
  def visit_constant_read_node(node)
690
754
  commands << [inspect_node("ConstantReadNode", node), indent]
755
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
756
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
691
757
  commands << ["└── name: #{node.name.inspect}\n", indent]
692
758
  end
693
759
 
694
760
  # Inspect a ConstantTargetNode node.
695
761
  def visit_constant_target_node(node)
696
762
  commands << [inspect_node("ConstantTargetNode", node), indent]
763
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
764
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
697
765
  commands << ["└── name: #{node.name.inspect}\n", indent]
698
766
  end
699
767
 
700
768
  # Inspect a ConstantWriteNode node.
701
769
  def visit_constant_write_node(node)
702
770
  commands << [inspect_node("ConstantWriteNode", node), indent]
771
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
772
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
703
773
  commands << ["├── name: #{node.name.inspect}\n", indent]
704
774
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
705
775
  commands << ["├── value:\n", indent]
@@ -710,6 +780,8 @@ module Prism
710
780
  # Inspect a DefNode node.
711
781
  def visit_def_node(node)
712
782
  commands << [inspect_node("DefNode", node), indent]
783
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
784
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
713
785
  commands << ["├── name: #{node.name.inspect}\n", indent]
714
786
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
715
787
  if (receiver = node.receiver).nil?
@@ -742,6 +814,8 @@ module Prism
742
814
  # Inspect a DefinedNode node.
743
815
  def visit_defined_node(node)
744
816
  commands << [inspect_node("DefinedNode", node), indent]
817
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
818
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
745
819
  commands << ["├── lparen_loc: #{inspect_location(node.lparen_loc)}\n", indent]
746
820
  commands << ["├── value:\n", indent]
747
821
  commands << [node.value, "#{indent}│ "]
@@ -752,6 +826,8 @@ module Prism
752
826
  # Inspect a ElseNode node.
753
827
  def visit_else_node(node)
754
828
  commands << [inspect_node("ElseNode", node), indent]
829
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
830
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
755
831
  commands << ["├── else_keyword_loc: #{inspect_location(node.else_keyword_loc)}\n", indent]
756
832
  if (statements = node.statements).nil?
757
833
  commands << ["├── statements: ∅\n", indent]
@@ -765,6 +841,8 @@ module Prism
765
841
  # Inspect a EmbeddedStatementsNode node.
766
842
  def visit_embedded_statements_node(node)
767
843
  commands << [inspect_node("EmbeddedStatementsNode", node), indent]
844
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
845
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
768
846
  commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent]
769
847
  if (statements = node.statements).nil?
770
848
  commands << ["├── statements: ∅\n", indent]
@@ -778,6 +856,8 @@ module Prism
778
856
  # Inspect a EmbeddedVariableNode node.
779
857
  def visit_embedded_variable_node(node)
780
858
  commands << [inspect_node("EmbeddedVariableNode", node), indent]
859
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
860
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
781
861
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
782
862
  commands << ["└── variable:\n", indent]
783
863
  commands << [node.variable, "#{indent} "]
@@ -786,6 +866,8 @@ module Prism
786
866
  # Inspect a EnsureNode node.
787
867
  def visit_ensure_node(node)
788
868
  commands << [inspect_node("EnsureNode", node), indent]
869
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
870
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
789
871
  commands << ["├── ensure_keyword_loc: #{inspect_location(node.ensure_keyword_loc)}\n", indent]
790
872
  if (statements = node.statements).nil?
791
873
  commands << ["├── statements: ∅\n", indent]
@@ -799,11 +881,15 @@ module Prism
799
881
  # Inspect a FalseNode node.
800
882
  def visit_false_node(node)
801
883
  commands << [inspect_node("FalseNode", node), indent]
884
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
885
+ commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
802
886
  end
803
887
 
804
888
  # Inspect a FindPatternNode node.
805
889
  def visit_find_pattern_node(node)
806
890
  commands << [inspect_node("FindPatternNode", node), indent]
891
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
892
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
807
893
  if (constant = node.constant).nil?
808
894
  commands << ["├── constant: ∅\n", indent]
809
895
  else
@@ -830,7 +916,7 @@ module Prism
830
916
  # Inspect a FlipFlopNode node.
831
917
  def visit_flip_flop_node(node)
832
918
  commands << [inspect_node("FlipFlopNode", node), indent]
833
- flags = [("exclude_end" if node.exclude_end?)].compact
919
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("exclude_end" if node.exclude_end?)].compact
834
920
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
835
921
  if (left = node.left).nil?
836
922
  commands << ["├── left: ∅\n", indent]
@@ -850,12 +936,16 @@ module Prism
850
936
  # Inspect a FloatNode node.
851
937
  def visit_float_node(node)
852
938
  commands << [inspect_node("FloatNode", node), indent]
939
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
940
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
853
941
  commands << ["└── value: #{node.value.inspect}\n", indent]
854
942
  end
855
943
 
856
944
  # Inspect a ForNode node.
857
945
  def visit_for_node(node)
858
946
  commands << [inspect_node("ForNode", node), indent]
947
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
948
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
859
949
  commands << ["├── index:\n", indent]
860
950
  commands << [node.index, "#{indent}│ "]
861
951
  commands << ["├── collection:\n", indent]
@@ -875,16 +965,22 @@ module Prism
875
965
  # Inspect a ForwardingArgumentsNode node.
876
966
  def visit_forwarding_arguments_node(node)
877
967
  commands << [inspect_node("ForwardingArgumentsNode", node), indent]
968
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
969
+ commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
878
970
  end
879
971
 
880
972
  # Inspect a ForwardingParameterNode node.
881
973
  def visit_forwarding_parameter_node(node)
882
974
  commands << [inspect_node("ForwardingParameterNode", node), indent]
975
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
976
+ commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
883
977
  end
884
978
 
885
979
  # Inspect a ForwardingSuperNode node.
886
980
  def visit_forwarding_super_node(node)
887
981
  commands << [inspect_node("ForwardingSuperNode", node), indent]
982
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
983
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
888
984
  if (block = node.block).nil?
889
985
  commands << ["└── block: ∅\n", indent]
890
986
  else
@@ -896,6 +992,8 @@ module Prism
896
992
  # Inspect a GlobalVariableAndWriteNode node.
897
993
  def visit_global_variable_and_write_node(node)
898
994
  commands << [inspect_node("GlobalVariableAndWriteNode", node), indent]
995
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
996
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
899
997
  commands << ["├── name: #{node.name.inspect}\n", indent]
900
998
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
901
999
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
@@ -906,6 +1004,8 @@ module Prism
906
1004
  # Inspect a GlobalVariableOperatorWriteNode node.
907
1005
  def visit_global_variable_operator_write_node(node)
908
1006
  commands << [inspect_node("GlobalVariableOperatorWriteNode", node), indent]
1007
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1008
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
909
1009
  commands << ["├── name: #{node.name.inspect}\n", indent]
910
1010
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
911
1011
  commands << ["├── binary_operator_loc: #{inspect_location(node.binary_operator_loc)}\n", indent]
@@ -917,6 +1017,8 @@ module Prism
917
1017
  # Inspect a GlobalVariableOrWriteNode node.
918
1018
  def visit_global_variable_or_write_node(node)
919
1019
  commands << [inspect_node("GlobalVariableOrWriteNode", node), indent]
1020
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1021
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
920
1022
  commands << ["├── name: #{node.name.inspect}\n", indent]
921
1023
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
922
1024
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
@@ -927,18 +1029,24 @@ module Prism
927
1029
  # Inspect a GlobalVariableReadNode node.
928
1030
  def visit_global_variable_read_node(node)
929
1031
  commands << [inspect_node("GlobalVariableReadNode", node), indent]
1032
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1033
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
930
1034
  commands << ["└── name: #{node.name.inspect}\n", indent]
931
1035
  end
932
1036
 
933
1037
  # Inspect a GlobalVariableTargetNode node.
934
1038
  def visit_global_variable_target_node(node)
935
1039
  commands << [inspect_node("GlobalVariableTargetNode", node), indent]
1040
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1041
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
936
1042
  commands << ["└── name: #{node.name.inspect}\n", indent]
937
1043
  end
938
1044
 
939
1045
  # Inspect a GlobalVariableWriteNode node.
940
1046
  def visit_global_variable_write_node(node)
941
1047
  commands << [inspect_node("GlobalVariableWriteNode", node), indent]
1048
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1049
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
942
1050
  commands << ["├── name: #{node.name.inspect}\n", indent]
943
1051
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
944
1052
  commands << ["├── value:\n", indent]
@@ -949,6 +1057,8 @@ module Prism
949
1057
  # Inspect a HashNode node.
950
1058
  def visit_hash_node(node)
951
1059
  commands << [inspect_node("HashNode", node), indent]
1060
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1061
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
952
1062
  commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent]
953
1063
  commands << ["├── elements: (length: #{(elements = node.elements).length})\n", indent]
954
1064
  if elements.any?
@@ -965,6 +1075,8 @@ module Prism
965
1075
  # Inspect a HashPatternNode node.
966
1076
  def visit_hash_pattern_node(node)
967
1077
  commands << [inspect_node("HashPatternNode", node), indent]
1078
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1079
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
968
1080
  if (constant = node.constant).nil?
969
1081
  commands << ["├── constant: ∅\n", indent]
970
1082
  else
@@ -993,6 +1105,8 @@ module Prism
993
1105
  # Inspect a IfNode node.
994
1106
  def visit_if_node(node)
995
1107
  commands << [inspect_node("IfNode", node), indent]
1108
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1109
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
996
1110
  commands << ["├── if_keyword_loc: #{inspect_location(node.if_keyword_loc)}\n", indent]
997
1111
  commands << ["├── predicate:\n", indent]
998
1112
  commands << [node.predicate, "#{indent}│ "]
@@ -1003,11 +1117,11 @@ module Prism
1003
1117
  commands << ["├── statements:\n", indent]
1004
1118
  commands << [statements, "#{indent}│ "]
1005
1119
  end
1006
- if (consequent = node.consequent).nil?
1007
- commands << ["├── consequent: ∅\n", indent]
1120
+ if (subsequent = node.subsequent).nil?
1121
+ commands << ["├── subsequent: ∅\n", indent]
1008
1122
  else
1009
- commands << ["├── consequent:\n", indent]
1010
- commands << [consequent, "#{indent}│ "]
1123
+ commands << ["├── subsequent:\n", indent]
1124
+ commands << [subsequent, "#{indent}│ "]
1011
1125
  end
1012
1126
  commands << ["└── end_keyword_loc: #{inspect_location(node.end_keyword_loc)}\n", indent]
1013
1127
  end
@@ -1015,6 +1129,8 @@ module Prism
1015
1129
  # Inspect a ImaginaryNode node.
1016
1130
  def visit_imaginary_node(node)
1017
1131
  commands << [inspect_node("ImaginaryNode", node), indent]
1132
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1133
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1018
1134
  commands << ["└── numeric:\n", indent]
1019
1135
  commands << [node.numeric, "#{indent} "]
1020
1136
  end
@@ -1022,6 +1138,8 @@ module Prism
1022
1138
  # Inspect a ImplicitNode node.
1023
1139
  def visit_implicit_node(node)
1024
1140
  commands << [inspect_node("ImplicitNode", node), indent]
1141
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1142
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1025
1143
  commands << ["└── value:\n", indent]
1026
1144
  commands << [node.value, "#{indent} "]
1027
1145
  end
@@ -1029,11 +1147,15 @@ module Prism
1029
1147
  # Inspect a ImplicitRestNode node.
1030
1148
  def visit_implicit_rest_node(node)
1031
1149
  commands << [inspect_node("ImplicitRestNode", node), indent]
1150
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1151
+ commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1032
1152
  end
1033
1153
 
1034
1154
  # Inspect a InNode node.
1035
1155
  def visit_in_node(node)
1036
1156
  commands << [inspect_node("InNode", node), indent]
1157
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1158
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1037
1159
  commands << ["├── pattern:\n", indent]
1038
1160
  commands << [node.pattern, "#{indent}│ "]
1039
1161
  if (statements = node.statements).nil?
@@ -1049,7 +1171,7 @@ module Prism
1049
1171
  # Inspect a IndexAndWriteNode node.
1050
1172
  def visit_index_and_write_node(node)
1051
1173
  commands << [inspect_node("IndexAndWriteNode", node), indent]
1052
- flags = [("safe_navigation" if node.safe_navigation?), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact
1174
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("safe_navigation" if node.safe_navigation?), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact
1053
1175
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1054
1176
  if (receiver = node.receiver).nil?
1055
1177
  commands << ["├── receiver: ∅\n", indent]
@@ -1080,7 +1202,7 @@ module Prism
1080
1202
  # Inspect a IndexOperatorWriteNode node.
1081
1203
  def visit_index_operator_write_node(node)
1082
1204
  commands << [inspect_node("IndexOperatorWriteNode", node), indent]
1083
- flags = [("safe_navigation" if node.safe_navigation?), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact
1205
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("safe_navigation" if node.safe_navigation?), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact
1084
1206
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1085
1207
  if (receiver = node.receiver).nil?
1086
1208
  commands << ["├── receiver: ∅\n", indent]
@@ -1112,7 +1234,7 @@ module Prism
1112
1234
  # Inspect a IndexOrWriteNode node.
1113
1235
  def visit_index_or_write_node(node)
1114
1236
  commands << [inspect_node("IndexOrWriteNode", node), indent]
1115
- flags = [("safe_navigation" if node.safe_navigation?), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact
1237
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("safe_navigation" if node.safe_navigation?), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact
1116
1238
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1117
1239
  if (receiver = node.receiver).nil?
1118
1240
  commands << ["├── receiver: ∅\n", indent]
@@ -1143,7 +1265,7 @@ module Prism
1143
1265
  # Inspect a IndexTargetNode node.
1144
1266
  def visit_index_target_node(node)
1145
1267
  commands << [inspect_node("IndexTargetNode", node), indent]
1146
- flags = [("safe_navigation" if node.safe_navigation?), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact
1268
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("safe_navigation" if node.safe_navigation?), ("variable_call" if node.variable_call?), ("attribute_write" if node.attribute_write?), ("ignore_visibility" if node.ignore_visibility?)].compact
1147
1269
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1148
1270
  commands << ["├── receiver:\n", indent]
1149
1271
  commands << [node.receiver, "#{indent}│ "]
@@ -1166,6 +1288,8 @@ module Prism
1166
1288
  # Inspect a InstanceVariableAndWriteNode node.
1167
1289
  def visit_instance_variable_and_write_node(node)
1168
1290
  commands << [inspect_node("InstanceVariableAndWriteNode", node), indent]
1291
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1292
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1169
1293
  commands << ["├── name: #{node.name.inspect}\n", indent]
1170
1294
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
1171
1295
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
@@ -1176,6 +1300,8 @@ module Prism
1176
1300
  # Inspect a InstanceVariableOperatorWriteNode node.
1177
1301
  def visit_instance_variable_operator_write_node(node)
1178
1302
  commands << [inspect_node("InstanceVariableOperatorWriteNode", node), indent]
1303
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1304
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1179
1305
  commands << ["├── name: #{node.name.inspect}\n", indent]
1180
1306
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
1181
1307
  commands << ["├── binary_operator_loc: #{inspect_location(node.binary_operator_loc)}\n", indent]
@@ -1187,6 +1313,8 @@ module Prism
1187
1313
  # Inspect a InstanceVariableOrWriteNode node.
1188
1314
  def visit_instance_variable_or_write_node(node)
1189
1315
  commands << [inspect_node("InstanceVariableOrWriteNode", node), indent]
1316
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1317
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1190
1318
  commands << ["├── name: #{node.name.inspect}\n", indent]
1191
1319
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
1192
1320
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
@@ -1197,18 +1325,24 @@ module Prism
1197
1325
  # Inspect a InstanceVariableReadNode node.
1198
1326
  def visit_instance_variable_read_node(node)
1199
1327
  commands << [inspect_node("InstanceVariableReadNode", node), indent]
1328
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1329
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1200
1330
  commands << ["└── name: #{node.name.inspect}\n", indent]
1201
1331
  end
1202
1332
 
1203
1333
  # Inspect a InstanceVariableTargetNode node.
1204
1334
  def visit_instance_variable_target_node(node)
1205
1335
  commands << [inspect_node("InstanceVariableTargetNode", node), indent]
1336
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1337
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1206
1338
  commands << ["└── name: #{node.name.inspect}\n", indent]
1207
1339
  end
1208
1340
 
1209
1341
  # Inspect a InstanceVariableWriteNode node.
1210
1342
  def visit_instance_variable_write_node(node)
1211
1343
  commands << [inspect_node("InstanceVariableWriteNode", node), indent]
1344
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1345
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1212
1346
  commands << ["├── name: #{node.name.inspect}\n", indent]
1213
1347
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
1214
1348
  commands << ["├── value:\n", indent]
@@ -1219,7 +1353,7 @@ module Prism
1219
1353
  # Inspect a IntegerNode node.
1220
1354
  def visit_integer_node(node)
1221
1355
  commands << [inspect_node("IntegerNode", node), indent]
1222
- flags = [("binary" if node.binary?), ("decimal" if node.decimal?), ("octal" if node.octal?), ("hexadecimal" if node.hexadecimal?)].compact
1356
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("binary" if node.binary?), ("decimal" if node.decimal?), ("octal" if node.octal?), ("hexadecimal" if node.hexadecimal?)].compact
1223
1357
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1224
1358
  commands << ["└── value: #{node.value.inspect}\n", indent]
1225
1359
  end
@@ -1227,7 +1361,7 @@ module Prism
1227
1361
  # Inspect a InterpolatedMatchLastLineNode node.
1228
1362
  def visit_interpolated_match_last_line_node(node)
1229
1363
  commands << [inspect_node("InterpolatedMatchLastLineNode", node), indent]
1230
- flags = [("ignore_case" if node.ignore_case?), ("extended" if node.extended?), ("multi_line" if node.multi_line?), ("once" if node.once?), ("euc_jp" if node.euc_jp?), ("ascii_8bit" if node.ascii_8bit?), ("windows_31j" if node.windows_31j?), ("utf_8" if node.utf_8?), ("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("forced_us_ascii_encoding" if node.forced_us_ascii_encoding?)].compact
1364
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("ignore_case" if node.ignore_case?), ("extended" if node.extended?), ("multi_line" if node.multi_line?), ("once" if node.once?), ("euc_jp" if node.euc_jp?), ("ascii_8bit" if node.ascii_8bit?), ("windows_31j" if node.windows_31j?), ("utf_8" if node.utf_8?), ("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("forced_us_ascii_encoding" if node.forced_us_ascii_encoding?)].compact
1231
1365
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1232
1366
  commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent]
1233
1367
  commands << ["├── parts: (length: #{(parts = node.parts).length})\n", indent]
@@ -1245,7 +1379,7 @@ module Prism
1245
1379
  # Inspect a InterpolatedRegularExpressionNode node.
1246
1380
  def visit_interpolated_regular_expression_node(node)
1247
1381
  commands << [inspect_node("InterpolatedRegularExpressionNode", node), indent]
1248
- flags = [("ignore_case" if node.ignore_case?), ("extended" if node.extended?), ("multi_line" if node.multi_line?), ("once" if node.once?), ("euc_jp" if node.euc_jp?), ("ascii_8bit" if node.ascii_8bit?), ("windows_31j" if node.windows_31j?), ("utf_8" if node.utf_8?), ("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("forced_us_ascii_encoding" if node.forced_us_ascii_encoding?)].compact
1382
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("ignore_case" if node.ignore_case?), ("extended" if node.extended?), ("multi_line" if node.multi_line?), ("once" if node.once?), ("euc_jp" if node.euc_jp?), ("ascii_8bit" if node.ascii_8bit?), ("windows_31j" if node.windows_31j?), ("utf_8" if node.utf_8?), ("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("forced_us_ascii_encoding" if node.forced_us_ascii_encoding?)].compact
1249
1383
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1250
1384
  commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent]
1251
1385
  commands << ["├── parts: (length: #{(parts = node.parts).length})\n", indent]
@@ -1263,7 +1397,7 @@ module Prism
1263
1397
  # Inspect a InterpolatedStringNode node.
1264
1398
  def visit_interpolated_string_node(node)
1265
1399
  commands << [inspect_node("InterpolatedStringNode", node), indent]
1266
- flags = [("frozen" if node.frozen?), ("mutable" if node.mutable?)].compact
1400
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("frozen" if node.frozen?), ("mutable" if node.mutable?)].compact
1267
1401
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1268
1402
  commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent]
1269
1403
  commands << ["├── parts: (length: #{(parts = node.parts).length})\n", indent]
@@ -1281,6 +1415,8 @@ module Prism
1281
1415
  # Inspect a InterpolatedSymbolNode node.
1282
1416
  def visit_interpolated_symbol_node(node)
1283
1417
  commands << [inspect_node("InterpolatedSymbolNode", node), indent]
1418
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1419
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1284
1420
  commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent]
1285
1421
  commands << ["├── parts: (length: #{(parts = node.parts).length})\n", indent]
1286
1422
  if parts.any?
@@ -1297,6 +1433,8 @@ module Prism
1297
1433
  # Inspect a InterpolatedXStringNode node.
1298
1434
  def visit_interpolated_x_string_node(node)
1299
1435
  commands << [inspect_node("InterpolatedXStringNode", node), indent]
1436
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1437
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1300
1438
  commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent]
1301
1439
  commands << ["├── parts: (length: #{(parts = node.parts).length})\n", indent]
1302
1440
  if parts.any?
@@ -1310,15 +1448,24 @@ module Prism
1310
1448
  commands << ["└── closing_loc: #{inspect_location(node.closing_loc)}\n", indent]
1311
1449
  end
1312
1450
 
1451
+ # Inspect a ItLocalVariableReadNode node.
1452
+ def visit_it_local_variable_read_node(node)
1453
+ commands << [inspect_node("ItLocalVariableReadNode", node), indent]
1454
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1455
+ commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1456
+ end
1457
+
1313
1458
  # Inspect a ItParametersNode node.
1314
1459
  def visit_it_parameters_node(node)
1315
1460
  commands << [inspect_node("ItParametersNode", node), indent]
1461
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1462
+ commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1316
1463
  end
1317
1464
 
1318
1465
  # Inspect a KeywordHashNode node.
1319
1466
  def visit_keyword_hash_node(node)
1320
1467
  commands << [inspect_node("KeywordHashNode", node), indent]
1321
- flags = [("symbol_keys" if node.symbol_keys?)].compact
1468
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("symbol_keys" if node.symbol_keys?)].compact
1322
1469
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1323
1470
  commands << ["└── elements: (length: #{(elements = node.elements).length})\n", indent]
1324
1471
  if elements.any?
@@ -1334,7 +1481,7 @@ module Prism
1334
1481
  # Inspect a KeywordRestParameterNode node.
1335
1482
  def visit_keyword_rest_parameter_node(node)
1336
1483
  commands << [inspect_node("KeywordRestParameterNode", node), indent]
1337
- flags = [("repeated_parameter" if node.repeated_parameter?)].compact
1484
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("repeated_parameter" if node.repeated_parameter?)].compact
1338
1485
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1339
1486
  if (name = node.name).nil?
1340
1487
  commands << ["├── name: ∅\n", indent]
@@ -1348,6 +1495,8 @@ module Prism
1348
1495
  # Inspect a LambdaNode node.
1349
1496
  def visit_lambda_node(node)
1350
1497
  commands << [inspect_node("LambdaNode", node), indent]
1498
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1499
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1351
1500
  commands << ["├── locals: #{node.locals.inspect}\n", indent]
1352
1501
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
1353
1502
  commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent]
@@ -1369,6 +1518,8 @@ module Prism
1369
1518
  # Inspect a LocalVariableAndWriteNode node.
1370
1519
  def visit_local_variable_and_write_node(node)
1371
1520
  commands << [inspect_node("LocalVariableAndWriteNode", node), indent]
1521
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1522
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1372
1523
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
1373
1524
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
1374
1525
  commands << ["├── value:\n", indent]
@@ -1380,6 +1531,8 @@ module Prism
1380
1531
  # Inspect a LocalVariableOperatorWriteNode node.
1381
1532
  def visit_local_variable_operator_write_node(node)
1382
1533
  commands << [inspect_node("LocalVariableOperatorWriteNode", node), indent]
1534
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1535
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1383
1536
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
1384
1537
  commands << ["├── binary_operator_loc: #{inspect_location(node.binary_operator_loc)}\n", indent]
1385
1538
  commands << ["├── value:\n", indent]
@@ -1392,6 +1545,8 @@ module Prism
1392
1545
  # Inspect a LocalVariableOrWriteNode node.
1393
1546
  def visit_local_variable_or_write_node(node)
1394
1547
  commands << [inspect_node("LocalVariableOrWriteNode", node), indent]
1548
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1549
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1395
1550
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
1396
1551
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
1397
1552
  commands << ["├── value:\n", indent]
@@ -1403,6 +1558,8 @@ module Prism
1403
1558
  # Inspect a LocalVariableReadNode node.
1404
1559
  def visit_local_variable_read_node(node)
1405
1560
  commands << [inspect_node("LocalVariableReadNode", node), indent]
1561
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1562
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1406
1563
  commands << ["├── name: #{node.name.inspect}\n", indent]
1407
1564
  commands << ["└── depth: #{node.depth.inspect}\n", indent]
1408
1565
  end
@@ -1410,6 +1567,8 @@ module Prism
1410
1567
  # Inspect a LocalVariableTargetNode node.
1411
1568
  def visit_local_variable_target_node(node)
1412
1569
  commands << [inspect_node("LocalVariableTargetNode", node), indent]
1570
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1571
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1413
1572
  commands << ["├── name: #{node.name.inspect}\n", indent]
1414
1573
  commands << ["└── depth: #{node.depth.inspect}\n", indent]
1415
1574
  end
@@ -1417,6 +1576,8 @@ module Prism
1417
1576
  # Inspect a LocalVariableWriteNode node.
1418
1577
  def visit_local_variable_write_node(node)
1419
1578
  commands << [inspect_node("LocalVariableWriteNode", node), indent]
1579
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1580
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1420
1581
  commands << ["├── name: #{node.name.inspect}\n", indent]
1421
1582
  commands << ["├── depth: #{node.depth.inspect}\n", indent]
1422
1583
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
@@ -1428,7 +1589,7 @@ module Prism
1428
1589
  # Inspect a MatchLastLineNode node.
1429
1590
  def visit_match_last_line_node(node)
1430
1591
  commands << [inspect_node("MatchLastLineNode", node), indent]
1431
- flags = [("ignore_case" if node.ignore_case?), ("extended" if node.extended?), ("multi_line" if node.multi_line?), ("once" if node.once?), ("euc_jp" if node.euc_jp?), ("ascii_8bit" if node.ascii_8bit?), ("windows_31j" if node.windows_31j?), ("utf_8" if node.utf_8?), ("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("forced_us_ascii_encoding" if node.forced_us_ascii_encoding?)].compact
1592
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("ignore_case" if node.ignore_case?), ("extended" if node.extended?), ("multi_line" if node.multi_line?), ("once" if node.once?), ("euc_jp" if node.euc_jp?), ("ascii_8bit" if node.ascii_8bit?), ("windows_31j" if node.windows_31j?), ("utf_8" if node.utf_8?), ("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("forced_us_ascii_encoding" if node.forced_us_ascii_encoding?)].compact
1432
1593
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1433
1594
  commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent]
1434
1595
  commands << ["├── content_loc: #{inspect_location(node.content_loc)}\n", indent]
@@ -1439,6 +1600,8 @@ module Prism
1439
1600
  # Inspect a MatchPredicateNode node.
1440
1601
  def visit_match_predicate_node(node)
1441
1602
  commands << [inspect_node("MatchPredicateNode", node), indent]
1603
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1604
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1442
1605
  commands << ["├── value:\n", indent]
1443
1606
  commands << [node.value, "#{indent}│ "]
1444
1607
  commands << ["├── pattern:\n", indent]
@@ -1449,6 +1612,8 @@ module Prism
1449
1612
  # Inspect a MatchRequiredNode node.
1450
1613
  def visit_match_required_node(node)
1451
1614
  commands << [inspect_node("MatchRequiredNode", node), indent]
1615
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1616
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1452
1617
  commands << ["├── value:\n", indent]
1453
1618
  commands << [node.value, "#{indent}│ "]
1454
1619
  commands << ["├── pattern:\n", indent]
@@ -1459,6 +1624,8 @@ module Prism
1459
1624
  # Inspect a MatchWriteNode node.
1460
1625
  def visit_match_write_node(node)
1461
1626
  commands << [inspect_node("MatchWriteNode", node), indent]
1627
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1628
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1462
1629
  commands << ["├── call:\n", indent]
1463
1630
  commands << [node.call, "#{indent}│ "]
1464
1631
  commands << ["└── targets: (length: #{(targets = node.targets).length})\n", indent]
@@ -1475,11 +1642,15 @@ module Prism
1475
1642
  # Inspect a MissingNode node.
1476
1643
  def visit_missing_node(node)
1477
1644
  commands << [inspect_node("MissingNode", node), indent]
1645
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1646
+ commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1478
1647
  end
1479
1648
 
1480
1649
  # Inspect a ModuleNode node.
1481
1650
  def visit_module_node(node)
1482
1651
  commands << [inspect_node("ModuleNode", node), indent]
1652
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1653
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1483
1654
  commands << ["├── locals: #{node.locals.inspect}\n", indent]
1484
1655
  commands << ["├── module_keyword_loc: #{inspect_location(node.module_keyword_loc)}\n", indent]
1485
1656
  commands << ["├── constant_path:\n", indent]
@@ -1497,6 +1668,8 @@ module Prism
1497
1668
  # Inspect a MultiTargetNode node.
1498
1669
  def visit_multi_target_node(node)
1499
1670
  commands << [inspect_node("MultiTargetNode", node), indent]
1671
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1672
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1500
1673
  commands << ["├── lefts: (length: #{(lefts = node.lefts).length})\n", indent]
1501
1674
  if lefts.any?
1502
1675
  lefts[0...-1].each do |child|
@@ -1528,6 +1701,8 @@ module Prism
1528
1701
  # Inspect a MultiWriteNode node.
1529
1702
  def visit_multi_write_node(node)
1530
1703
  commands << [inspect_node("MultiWriteNode", node), indent]
1704
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1705
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1531
1706
  commands << ["├── lefts: (length: #{(lefts = node.lefts).length})\n", indent]
1532
1707
  if lefts.any?
1533
1708
  lefts[0...-1].each do |child|
@@ -1562,6 +1737,8 @@ module Prism
1562
1737
  # Inspect a NextNode node.
1563
1738
  def visit_next_node(node)
1564
1739
  commands << [inspect_node("NextNode", node), indent]
1740
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1741
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1565
1742
  if (arguments = node.arguments).nil?
1566
1743
  commands << ["├── arguments: ∅\n", indent]
1567
1744
  else
@@ -1574,11 +1751,15 @@ module Prism
1574
1751
  # Inspect a NilNode node.
1575
1752
  def visit_nil_node(node)
1576
1753
  commands << [inspect_node("NilNode", node), indent]
1754
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1755
+ commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1577
1756
  end
1578
1757
 
1579
1758
  # Inspect a NoKeywordsParameterNode node.
1580
1759
  def visit_no_keywords_parameter_node(node)
1581
1760
  commands << [inspect_node("NoKeywordsParameterNode", node), indent]
1761
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1762
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1582
1763
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
1583
1764
  commands << ["└── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
1584
1765
  end
@@ -1586,19 +1767,23 @@ module Prism
1586
1767
  # Inspect a NumberedParametersNode node.
1587
1768
  def visit_numbered_parameters_node(node)
1588
1769
  commands << [inspect_node("NumberedParametersNode", node), indent]
1770
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1771
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1589
1772
  commands << ["└── maximum: #{node.maximum.inspect}\n", indent]
1590
1773
  end
1591
1774
 
1592
1775
  # Inspect a NumberedReferenceReadNode node.
1593
1776
  def visit_numbered_reference_read_node(node)
1594
1777
  commands << [inspect_node("NumberedReferenceReadNode", node), indent]
1778
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1779
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1595
1780
  commands << ["└── number: #{node.number.inspect}\n", indent]
1596
1781
  end
1597
1782
 
1598
1783
  # Inspect a OptionalKeywordParameterNode node.
1599
1784
  def visit_optional_keyword_parameter_node(node)
1600
1785
  commands << [inspect_node("OptionalKeywordParameterNode", node), indent]
1601
- flags = [("repeated_parameter" if node.repeated_parameter?)].compact
1786
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("repeated_parameter" if node.repeated_parameter?)].compact
1602
1787
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1603
1788
  commands << ["├── name: #{node.name.inspect}\n", indent]
1604
1789
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
@@ -1609,7 +1794,7 @@ module Prism
1609
1794
  # Inspect a OptionalParameterNode node.
1610
1795
  def visit_optional_parameter_node(node)
1611
1796
  commands << [inspect_node("OptionalParameterNode", node), indent]
1612
- flags = [("repeated_parameter" if node.repeated_parameter?)].compact
1797
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("repeated_parameter" if node.repeated_parameter?)].compact
1613
1798
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1614
1799
  commands << ["├── name: #{node.name.inspect}\n", indent]
1615
1800
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
@@ -1621,6 +1806,8 @@ module Prism
1621
1806
  # Inspect a OrNode node.
1622
1807
  def visit_or_node(node)
1623
1808
  commands << [inspect_node("OrNode", node), indent]
1809
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1810
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1624
1811
  commands << ["├── left:\n", indent]
1625
1812
  commands << [node.left, "#{indent}│ "]
1626
1813
  commands << ["├── right:\n", indent]
@@ -1631,6 +1818,8 @@ module Prism
1631
1818
  # Inspect a ParametersNode node.
1632
1819
  def visit_parameters_node(node)
1633
1820
  commands << [inspect_node("ParametersNode", node), indent]
1821
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1822
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1634
1823
  commands << ["├── requireds: (length: #{(requireds = node.requireds).length})\n", indent]
1635
1824
  if requireds.any?
1636
1825
  requireds[0...-1].each do |child|
@@ -1690,6 +1879,8 @@ module Prism
1690
1879
  # Inspect a ParenthesesNode node.
1691
1880
  def visit_parentheses_node(node)
1692
1881
  commands << [inspect_node("ParenthesesNode", node), indent]
1882
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1883
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1693
1884
  if (body = node.body).nil?
1694
1885
  commands << ["├── body: ∅\n", indent]
1695
1886
  else
@@ -1703,6 +1894,8 @@ module Prism
1703
1894
  # Inspect a PinnedExpressionNode node.
1704
1895
  def visit_pinned_expression_node(node)
1705
1896
  commands << [inspect_node("PinnedExpressionNode", node), indent]
1897
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1898
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1706
1899
  commands << ["├── expression:\n", indent]
1707
1900
  commands << [node.expression, "#{indent}│ "]
1708
1901
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
@@ -1713,6 +1906,8 @@ module Prism
1713
1906
  # Inspect a PinnedVariableNode node.
1714
1907
  def visit_pinned_variable_node(node)
1715
1908
  commands << [inspect_node("PinnedVariableNode", node), indent]
1909
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1910
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1716
1911
  commands << ["├── variable:\n", indent]
1717
1912
  commands << [node.variable, "#{indent}│ "]
1718
1913
  commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
@@ -1721,6 +1916,8 @@ module Prism
1721
1916
  # Inspect a PostExecutionNode node.
1722
1917
  def visit_post_execution_node(node)
1723
1918
  commands << [inspect_node("PostExecutionNode", node), indent]
1919
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1920
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1724
1921
  if (statements = node.statements).nil?
1725
1922
  commands << ["├── statements: ∅\n", indent]
1726
1923
  else
@@ -1735,6 +1932,8 @@ module Prism
1735
1932
  # Inspect a PreExecutionNode node.
1736
1933
  def visit_pre_execution_node(node)
1737
1934
  commands << [inspect_node("PreExecutionNode", node), indent]
1935
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1936
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1738
1937
  if (statements = node.statements).nil?
1739
1938
  commands << ["├── statements: ∅\n", indent]
1740
1939
  else
@@ -1749,6 +1948,8 @@ module Prism
1749
1948
  # Inspect a ProgramNode node.
1750
1949
  def visit_program_node(node)
1751
1950
  commands << [inspect_node("ProgramNode", node), indent]
1951
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1952
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1752
1953
  commands << ["├── locals: #{node.locals.inspect}\n", indent]
1753
1954
  commands << ["└── statements:\n", indent]
1754
1955
  commands << [node.statements, "#{indent} "]
@@ -1757,7 +1958,7 @@ module Prism
1757
1958
  # Inspect a RangeNode node.
1758
1959
  def visit_range_node(node)
1759
1960
  commands << [inspect_node("RangeNode", node), indent]
1760
- flags = [("exclude_end" if node.exclude_end?)].compact
1961
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("exclude_end" if node.exclude_end?)].compact
1761
1962
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1762
1963
  if (left = node.left).nil?
1763
1964
  commands << ["├── left: ∅\n", indent]
@@ -1777,19 +1978,23 @@ module Prism
1777
1978
  # Inspect a RationalNode node.
1778
1979
  def visit_rational_node(node)
1779
1980
  commands << [inspect_node("RationalNode", node), indent]
1780
- commands << ["└── numeric:\n", indent]
1781
- commands << [node.numeric, "#{indent} "]
1981
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("binary" if node.binary?), ("decimal" if node.decimal?), ("octal" if node.octal?), ("hexadecimal" if node.hexadecimal?)].compact
1982
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1983
+ commands << ["├── numerator: #{node.numerator.inspect}\n", indent]
1984
+ commands << ["└── denominator: #{node.denominator.inspect}\n", indent]
1782
1985
  end
1783
1986
 
1784
1987
  # Inspect a RedoNode node.
1785
1988
  def visit_redo_node(node)
1786
1989
  commands << [inspect_node("RedoNode", node), indent]
1990
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1991
+ commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1787
1992
  end
1788
1993
 
1789
1994
  # Inspect a RegularExpressionNode node.
1790
1995
  def visit_regular_expression_node(node)
1791
1996
  commands << [inspect_node("RegularExpressionNode", node), indent]
1792
- flags = [("ignore_case" if node.ignore_case?), ("extended" if node.extended?), ("multi_line" if node.multi_line?), ("once" if node.once?), ("euc_jp" if node.euc_jp?), ("ascii_8bit" if node.ascii_8bit?), ("windows_31j" if node.windows_31j?), ("utf_8" if node.utf_8?), ("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("forced_us_ascii_encoding" if node.forced_us_ascii_encoding?)].compact
1997
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("ignore_case" if node.ignore_case?), ("extended" if node.extended?), ("multi_line" if node.multi_line?), ("once" if node.once?), ("euc_jp" if node.euc_jp?), ("ascii_8bit" if node.ascii_8bit?), ("windows_31j" if node.windows_31j?), ("utf_8" if node.utf_8?), ("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("forced_us_ascii_encoding" if node.forced_us_ascii_encoding?)].compact
1793
1998
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1794
1999
  commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent]
1795
2000
  commands << ["├── content_loc: #{inspect_location(node.content_loc)}\n", indent]
@@ -1800,7 +2005,7 @@ module Prism
1800
2005
  # Inspect a RequiredKeywordParameterNode node.
1801
2006
  def visit_required_keyword_parameter_node(node)
1802
2007
  commands << [inspect_node("RequiredKeywordParameterNode", node), indent]
1803
- flags = [("repeated_parameter" if node.repeated_parameter?)].compact
2008
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("repeated_parameter" if node.repeated_parameter?)].compact
1804
2009
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1805
2010
  commands << ["├── name: #{node.name.inspect}\n", indent]
1806
2011
  commands << ["└── name_loc: #{inspect_location(node.name_loc)}\n", indent]
@@ -1809,7 +2014,7 @@ module Prism
1809
2014
  # Inspect a RequiredParameterNode node.
1810
2015
  def visit_required_parameter_node(node)
1811
2016
  commands << [inspect_node("RequiredParameterNode", node), indent]
1812
- flags = [("repeated_parameter" if node.repeated_parameter?)].compact
2017
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("repeated_parameter" if node.repeated_parameter?)].compact
1813
2018
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1814
2019
  commands << ["└── name: #{node.name.inspect}\n", indent]
1815
2020
  end
@@ -1817,6 +2022,8 @@ module Prism
1817
2022
  # Inspect a RescueModifierNode node.
1818
2023
  def visit_rescue_modifier_node(node)
1819
2024
  commands << [inspect_node("RescueModifierNode", node), indent]
2025
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
2026
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1820
2027
  commands << ["├── expression:\n", indent]
1821
2028
  commands << [node.expression, "#{indent}│ "]
1822
2029
  commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
@@ -1827,6 +2034,8 @@ module Prism
1827
2034
  # Inspect a RescueNode node.
1828
2035
  def visit_rescue_node(node)
1829
2036
  commands << [inspect_node("RescueNode", node), indent]
2037
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
2038
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1830
2039
  commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
1831
2040
  commands << ["├── exceptions: (length: #{(exceptions = node.exceptions).length})\n", indent]
1832
2041
  if exceptions.any?
@@ -1850,18 +2059,18 @@ module Prism
1850
2059
  commands << ["├── statements:\n", indent]
1851
2060
  commands << [statements, "#{indent}│ "]
1852
2061
  end
1853
- if (consequent = node.consequent).nil?
1854
- commands << ["└── consequent: ∅\n", indent]
2062
+ if (subsequent = node.subsequent).nil?
2063
+ commands << ["└── subsequent: ∅\n", indent]
1855
2064
  else
1856
- commands << ["└── consequent:\n", indent]
1857
- commands << [consequent, "#{indent} "]
2065
+ commands << ["└── subsequent:\n", indent]
2066
+ commands << [subsequent, "#{indent} "]
1858
2067
  end
1859
2068
  end
1860
2069
 
1861
2070
  # Inspect a RestParameterNode node.
1862
2071
  def visit_rest_parameter_node(node)
1863
2072
  commands << [inspect_node("RestParameterNode", node), indent]
1864
- flags = [("repeated_parameter" if node.repeated_parameter?)].compact
2073
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("repeated_parameter" if node.repeated_parameter?)].compact
1865
2074
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1866
2075
  if (name = node.name).nil?
1867
2076
  commands << ["├── name: ∅\n", indent]
@@ -1875,12 +2084,14 @@ module Prism
1875
2084
  # Inspect a RetryNode node.
1876
2085
  def visit_retry_node(node)
1877
2086
  commands << [inspect_node("RetryNode", node), indent]
2087
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
2088
+ commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1878
2089
  end
1879
2090
 
1880
2091
  # Inspect a ReturnNode node.
1881
2092
  def visit_return_node(node)
1882
2093
  commands << [inspect_node("ReturnNode", node), indent]
1883
- flags = [("redundant" if node.redundant?)].compact
2094
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1884
2095
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1885
2096
  commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
1886
2097
  if (arguments = node.arguments).nil?
@@ -1894,12 +2105,14 @@ module Prism
1894
2105
  # Inspect a SelfNode node.
1895
2106
  def visit_self_node(node)
1896
2107
  commands << [inspect_node("SelfNode", node), indent]
2108
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
2109
+ commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1897
2110
  end
1898
2111
 
1899
2112
  # Inspect a ShareableConstantNode node.
1900
2113
  def visit_shareable_constant_node(node)
1901
2114
  commands << [inspect_node("ShareableConstantNode", node), indent]
1902
- flags = [("literal" if node.literal?), ("experimental_everything" if node.experimental_everything?), ("experimental_copy" if node.experimental_copy?)].compact
2115
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("literal" if node.literal?), ("experimental_everything" if node.experimental_everything?), ("experimental_copy" if node.experimental_copy?)].compact
1903
2116
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1904
2117
  commands << ["└── write:\n", indent]
1905
2118
  commands << [node.write, "#{indent} "]
@@ -1908,6 +2121,8 @@ module Prism
1908
2121
  # Inspect a SingletonClassNode node.
1909
2122
  def visit_singleton_class_node(node)
1910
2123
  commands << [inspect_node("SingletonClassNode", node), indent]
2124
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
2125
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1911
2126
  commands << ["├── locals: #{node.locals.inspect}\n", indent]
1912
2127
  commands << ["├── class_keyword_loc: #{inspect_location(node.class_keyword_loc)}\n", indent]
1913
2128
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
@@ -1925,12 +2140,14 @@ module Prism
1925
2140
  # Inspect a SourceEncodingNode node.
1926
2141
  def visit_source_encoding_node(node)
1927
2142
  commands << [inspect_node("SourceEncodingNode", node), indent]
2143
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
2144
+ commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1928
2145
  end
1929
2146
 
1930
2147
  # Inspect a SourceFileNode node.
1931
2148
  def visit_source_file_node(node)
1932
2149
  commands << [inspect_node("SourceFileNode", node), indent]
1933
- flags = [("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("frozen" if node.frozen?), ("mutable" if node.mutable?)].compact
2150
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("frozen" if node.frozen?), ("mutable" if node.mutable?)].compact
1934
2151
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1935
2152
  commands << ["└── filepath: #{node.filepath.inspect}\n", indent]
1936
2153
  end
@@ -1938,11 +2155,15 @@ module Prism
1938
2155
  # Inspect a SourceLineNode node.
1939
2156
  def visit_source_line_node(node)
1940
2157
  commands << [inspect_node("SourceLineNode", node), indent]
2158
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
2159
+ commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1941
2160
  end
1942
2161
 
1943
2162
  # Inspect a SplatNode node.
1944
2163
  def visit_splat_node(node)
1945
2164
  commands << [inspect_node("SplatNode", node), indent]
2165
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
2166
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1946
2167
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
1947
2168
  if (expression = node.expression).nil?
1948
2169
  commands << ["└── expression: ∅\n", indent]
@@ -1955,6 +2176,8 @@ module Prism
1955
2176
  # Inspect a StatementsNode node.
1956
2177
  def visit_statements_node(node)
1957
2178
  commands << [inspect_node("StatementsNode", node), indent]
2179
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
2180
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1958
2181
  commands << ["└── body: (length: #{(body = node.body).length})\n", indent]
1959
2182
  if body.any?
1960
2183
  body[0...-1].each do |child|
@@ -1969,7 +2192,7 @@ module Prism
1969
2192
  # Inspect a StringNode node.
1970
2193
  def visit_string_node(node)
1971
2194
  commands << [inspect_node("StringNode", node), indent]
1972
- flags = [("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("frozen" if node.frozen?), ("mutable" if node.mutable?)].compact
2195
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("frozen" if node.frozen?), ("mutable" if node.mutable?)].compact
1973
2196
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1974
2197
  commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent]
1975
2198
  commands << ["├── content_loc: #{inspect_location(node.content_loc)}\n", indent]
@@ -1980,6 +2203,8 @@ module Prism
1980
2203
  # Inspect a SuperNode node.
1981
2204
  def visit_super_node(node)
1982
2205
  commands << [inspect_node("SuperNode", node), indent]
2206
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
2207
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1983
2208
  commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
1984
2209
  commands << ["├── lparen_loc: #{inspect_location(node.lparen_loc)}\n", indent]
1985
2210
  if (arguments = node.arguments).nil?
@@ -2000,7 +2225,7 @@ module Prism
2000
2225
  # Inspect a SymbolNode node.
2001
2226
  def visit_symbol_node(node)
2002
2227
  commands << [inspect_node("SymbolNode", node), indent]
2003
- flags = [("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("forced_us_ascii_encoding" if node.forced_us_ascii_encoding?)].compact
2228
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?), ("forced_us_ascii_encoding" if node.forced_us_ascii_encoding?)].compact
2004
2229
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
2005
2230
  commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent]
2006
2231
  commands << ["├── value_loc: #{inspect_location(node.value_loc)}\n", indent]
@@ -2011,11 +2236,15 @@ module Prism
2011
2236
  # Inspect a TrueNode node.
2012
2237
  def visit_true_node(node)
2013
2238
  commands << [inspect_node("TrueNode", node), indent]
2239
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
2240
+ commands << ["└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
2014
2241
  end
2015
2242
 
2016
2243
  # Inspect a UndefNode node.
2017
2244
  def visit_undef_node(node)
2018
2245
  commands << [inspect_node("UndefNode", node), indent]
2246
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
2247
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
2019
2248
  commands << ["├── names: (length: #{(names = node.names).length})\n", indent]
2020
2249
  if names.any?
2021
2250
  names[0...-1].each do |child|
@@ -2031,6 +2260,8 @@ module Prism
2031
2260
  # Inspect a UnlessNode node.
2032
2261
  def visit_unless_node(node)
2033
2262
  commands << [inspect_node("UnlessNode", node), indent]
2263
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
2264
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
2034
2265
  commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
2035
2266
  commands << ["├── predicate:\n", indent]
2036
2267
  commands << [node.predicate, "#{indent}│ "]
@@ -2041,11 +2272,11 @@ module Prism
2041
2272
  commands << ["├── statements:\n", indent]
2042
2273
  commands << [statements, "#{indent}│ "]
2043
2274
  end
2044
- if (consequent = node.consequent).nil?
2045
- commands << ["├── consequent: ∅\n", indent]
2275
+ if (else_clause = node.else_clause).nil?
2276
+ commands << ["├── else_clause: ∅\n", indent]
2046
2277
  else
2047
- commands << ["├── consequent:\n", indent]
2048
- commands << [consequent, "#{indent}│ "]
2278
+ commands << ["├── else_clause:\n", indent]
2279
+ commands << [else_clause, "#{indent}│ "]
2049
2280
  end
2050
2281
  commands << ["└── end_keyword_loc: #{inspect_location(node.end_keyword_loc)}\n", indent]
2051
2282
  end
@@ -2053,9 +2284,10 @@ module Prism
2053
2284
  # Inspect a UntilNode node.
2054
2285
  def visit_until_node(node)
2055
2286
  commands << [inspect_node("UntilNode", node), indent]
2056
- flags = [("begin_modifier" if node.begin_modifier?)].compact
2287
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("begin_modifier" if node.begin_modifier?)].compact
2057
2288
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
2058
2289
  commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
2290
+ commands << ["├── do_keyword_loc: #{inspect_location(node.do_keyword_loc)}\n", indent]
2059
2291
  commands << ["├── closing_loc: #{inspect_location(node.closing_loc)}\n", indent]
2060
2292
  commands << ["├── predicate:\n", indent]
2061
2293
  commands << [node.predicate, "#{indent}│ "]
@@ -2070,6 +2302,8 @@ module Prism
2070
2302
  # Inspect a WhenNode node.
2071
2303
  def visit_when_node(node)
2072
2304
  commands << [inspect_node("WhenNode", node), indent]
2305
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
2306
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
2073
2307
  commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
2074
2308
  commands << ["├── conditions: (length: #{(conditions = node.conditions).length})\n", indent]
2075
2309
  if conditions.any?
@@ -2092,9 +2326,10 @@ module Prism
2092
2326
  # Inspect a WhileNode node.
2093
2327
  def visit_while_node(node)
2094
2328
  commands << [inspect_node("WhileNode", node), indent]
2095
- flags = [("begin_modifier" if node.begin_modifier?)].compact
2329
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("begin_modifier" if node.begin_modifier?)].compact
2096
2330
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
2097
2331
  commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
2332
+ commands << ["├── do_keyword_loc: #{inspect_location(node.do_keyword_loc)}\n", indent]
2098
2333
  commands << ["├── closing_loc: #{inspect_location(node.closing_loc)}\n", indent]
2099
2334
  commands << ["├── predicate:\n", indent]
2100
2335
  commands << [node.predicate, "#{indent}│ "]
@@ -2109,7 +2344,7 @@ module Prism
2109
2344
  # Inspect a XStringNode node.
2110
2345
  def visit_x_string_node(node)
2111
2346
  commands << [inspect_node("XStringNode", node), indent]
2112
- flags = [("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?)].compact
2347
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?)].compact
2113
2348
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
2114
2349
  commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent]
2115
2350
  commands << ["├── content_loc: #{inspect_location(node.content_loc)}\n", indent]
@@ -2120,6 +2355,8 @@ module Prism
2120
2355
  # Inspect a YieldNode node.
2121
2356
  def visit_yield_node(node)
2122
2357
  commands << [inspect_node("YieldNode", node), indent]
2358
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
2359
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
2123
2360
  commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
2124
2361
  commands << ["├── lparen_loc: #{inspect_location(node.lparen_loc)}\n", indent]
2125
2362
  if (arguments = node.arguments).nil?
@@ -2135,13 +2372,8 @@ module Prism
2135
2372
 
2136
2373
  # Compose a header for the given node.
2137
2374
  def inspect_node(name, node)
2138
- result = +"@ #{name} ("
2139
-
2140
2375
  location = node.location
2141
- result << "location: (#{location.start_line},#{location.start_column})-(#{location.end_line},#{location.end_column})"
2142
- result << ", newline: true" if node.newline?
2143
-
2144
- result << ")\n"
2376
+ "@ #{name} (location: (#{location.start_line},#{location.start_column})-(#{location.end_line},#{location.end_column}))\n"
2145
2377
  end
2146
2378
 
2147
2379
  # Compose a string representing the given inner location field.