prism 0.30.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -1
  3. data/README.md +3 -1
  4. data/config.yml +185 -126
  5. data/docs/serialization.md +3 -0
  6. data/ext/prism/api_node.c +2843 -2085
  7. data/ext/prism/extconf.rb +1 -1
  8. data/ext/prism/extension.c +35 -25
  9. data/ext/prism/extension.h +2 -2
  10. data/include/prism/ast.h +1048 -69
  11. data/include/prism/defines.h +9 -0
  12. data/include/prism/diagnostic.h +11 -3
  13. data/include/prism/options.h +55 -1
  14. data/include/prism/parser.h +27 -3
  15. data/include/prism/regexp.h +2 -1
  16. data/include/prism/util/pm_integer.h +6 -6
  17. data/include/prism/util/pm_newline_list.h +11 -0
  18. data/include/prism/util/pm_string.h +1 -0
  19. data/include/prism/version.h +3 -3
  20. data/lib/prism/desugar_compiler.rb +111 -74
  21. data/lib/prism/dispatcher.rb +2 -1
  22. data/lib/prism/dot_visitor.rb +21 -31
  23. data/lib/prism/dsl.rb +656 -471
  24. data/lib/prism/ffi.rb +3 -0
  25. data/lib/prism/inspect_visitor.rb +285 -57
  26. data/lib/prism/mutation_compiler.rb +5 -5
  27. data/lib/prism/node.rb +2282 -4754
  28. data/lib/prism/node_ext.rb +72 -11
  29. data/lib/prism/parse_result/errors.rb +65 -0
  30. data/lib/prism/parse_result/newlines.rb +28 -28
  31. data/lib/prism/parse_result.rb +25 -2
  32. data/lib/prism/reflection.rb +7 -7
  33. data/lib/prism/serialize.rb +468 -610
  34. data/lib/prism/translation/parser/compiler.rb +18 -18
  35. data/lib/prism/translation/parser/lexer.rb +1 -1
  36. data/lib/prism/translation/parser.rb +3 -3
  37. data/lib/prism/translation/ripper.rb +14 -14
  38. data/lib/prism/translation/ruby_parser.rb +43 -7
  39. data/prism.gemspec +3 -1
  40. data/rbi/prism/dsl.rbi +521 -0
  41. data/rbi/prism/node.rbi +1456 -5616
  42. data/rbi/prism.rbi +16 -16
  43. data/sig/prism/dsl.rbs +189 -305
  44. data/sig/prism/node.rbs +702 -603
  45. data/sig/prism/parse_result.rbs +2 -0
  46. data/src/diagnostic.c +22 -6
  47. data/src/node.c +277 -284
  48. data/src/options.c +18 -0
  49. data/src/prettyprint.c +99 -108
  50. data/src/prism.c +1282 -760
  51. data/src/regexp.c +72 -4
  52. data/src/serialize.c +165 -50
  53. data/src/token_type.c +2 -2
  54. data/src/util/pm_integer.c +14 -14
  55. data/src/util/pm_newline_list.c +29 -0
  56. data/src/util/pm_string.c +9 -5
  57. metadata +4 -2
@@ -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_keywords" if node.contains_keywords?), ("contains_keyword_splat" if node.contains_keyword_splat?), ("contains_splat" if node.contains_splat?)].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?
@@ -1313,17 +1451,21 @@ module Prism
1313
1451
  # Inspect a ItLocalVariableReadNode node.
1314
1452
  def visit_it_local_variable_read_node(node)
1315
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]
1316
1456
  end
1317
1457
 
1318
1458
  # Inspect a ItParametersNode node.
1319
1459
  def visit_it_parameters_node(node)
1320
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]
1321
1463
  end
1322
1464
 
1323
1465
  # Inspect a KeywordHashNode node.
1324
1466
  def visit_keyword_hash_node(node)
1325
1467
  commands << [inspect_node("KeywordHashNode", node), indent]
1326
- 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
1327
1469
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1328
1470
  commands << ["└── elements: (length: #{(elements = node.elements).length})\n", indent]
1329
1471
  if elements.any?
@@ -1339,7 +1481,7 @@ module Prism
1339
1481
  # Inspect a KeywordRestParameterNode node.
1340
1482
  def visit_keyword_rest_parameter_node(node)
1341
1483
  commands << [inspect_node("KeywordRestParameterNode", node), indent]
1342
- 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
1343
1485
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1344
1486
  if (name = node.name).nil?
1345
1487
  commands << ["├── name: ∅\n", indent]
@@ -1353,6 +1495,8 @@ module Prism
1353
1495
  # Inspect a LambdaNode node.
1354
1496
  def visit_lambda_node(node)
1355
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]
1356
1500
  commands << ["├── locals: #{node.locals.inspect}\n", indent]
1357
1501
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
1358
1502
  commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent]
@@ -1374,6 +1518,8 @@ module Prism
1374
1518
  # Inspect a LocalVariableAndWriteNode node.
1375
1519
  def visit_local_variable_and_write_node(node)
1376
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]
1377
1523
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
1378
1524
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
1379
1525
  commands << ["├── value:\n", indent]
@@ -1385,6 +1531,8 @@ module Prism
1385
1531
  # Inspect a LocalVariableOperatorWriteNode node.
1386
1532
  def visit_local_variable_operator_write_node(node)
1387
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]
1388
1536
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
1389
1537
  commands << ["├── binary_operator_loc: #{inspect_location(node.binary_operator_loc)}\n", indent]
1390
1538
  commands << ["├── value:\n", indent]
@@ -1397,6 +1545,8 @@ module Prism
1397
1545
  # Inspect a LocalVariableOrWriteNode node.
1398
1546
  def visit_local_variable_or_write_node(node)
1399
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]
1400
1550
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
1401
1551
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
1402
1552
  commands << ["├── value:\n", indent]
@@ -1408,6 +1558,8 @@ module Prism
1408
1558
  # Inspect a LocalVariableReadNode node.
1409
1559
  def visit_local_variable_read_node(node)
1410
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]
1411
1563
  commands << ["├── name: #{node.name.inspect}\n", indent]
1412
1564
  commands << ["└── depth: #{node.depth.inspect}\n", indent]
1413
1565
  end
@@ -1415,6 +1567,8 @@ module Prism
1415
1567
  # Inspect a LocalVariableTargetNode node.
1416
1568
  def visit_local_variable_target_node(node)
1417
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]
1418
1572
  commands << ["├── name: #{node.name.inspect}\n", indent]
1419
1573
  commands << ["└── depth: #{node.depth.inspect}\n", indent]
1420
1574
  end
@@ -1422,6 +1576,8 @@ module Prism
1422
1576
  # Inspect a LocalVariableWriteNode node.
1423
1577
  def visit_local_variable_write_node(node)
1424
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]
1425
1581
  commands << ["├── name: #{node.name.inspect}\n", indent]
1426
1582
  commands << ["├── depth: #{node.depth.inspect}\n", indent]
1427
1583
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
@@ -1433,7 +1589,7 @@ module Prism
1433
1589
  # Inspect a MatchLastLineNode node.
1434
1590
  def visit_match_last_line_node(node)
1435
1591
  commands << [inspect_node("MatchLastLineNode", node), indent]
1436
- 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
1437
1593
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1438
1594
  commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent]
1439
1595
  commands << ["├── content_loc: #{inspect_location(node.content_loc)}\n", indent]
@@ -1444,6 +1600,8 @@ module Prism
1444
1600
  # Inspect a MatchPredicateNode node.
1445
1601
  def visit_match_predicate_node(node)
1446
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]
1447
1605
  commands << ["├── value:\n", indent]
1448
1606
  commands << [node.value, "#{indent}│ "]
1449
1607
  commands << ["├── pattern:\n", indent]
@@ -1454,6 +1612,8 @@ module Prism
1454
1612
  # Inspect a MatchRequiredNode node.
1455
1613
  def visit_match_required_node(node)
1456
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]
1457
1617
  commands << ["├── value:\n", indent]
1458
1618
  commands << [node.value, "#{indent}│ "]
1459
1619
  commands << ["├── pattern:\n", indent]
@@ -1464,6 +1624,8 @@ module Prism
1464
1624
  # Inspect a MatchWriteNode node.
1465
1625
  def visit_match_write_node(node)
1466
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]
1467
1629
  commands << ["├── call:\n", indent]
1468
1630
  commands << [node.call, "#{indent}│ "]
1469
1631
  commands << ["└── targets: (length: #{(targets = node.targets).length})\n", indent]
@@ -1480,11 +1642,15 @@ module Prism
1480
1642
  # Inspect a MissingNode node.
1481
1643
  def visit_missing_node(node)
1482
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]
1483
1647
  end
1484
1648
 
1485
1649
  # Inspect a ModuleNode node.
1486
1650
  def visit_module_node(node)
1487
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]
1488
1654
  commands << ["├── locals: #{node.locals.inspect}\n", indent]
1489
1655
  commands << ["├── module_keyword_loc: #{inspect_location(node.module_keyword_loc)}\n", indent]
1490
1656
  commands << ["├── constant_path:\n", indent]
@@ -1502,6 +1668,8 @@ module Prism
1502
1668
  # Inspect a MultiTargetNode node.
1503
1669
  def visit_multi_target_node(node)
1504
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]
1505
1673
  commands << ["├── lefts: (length: #{(lefts = node.lefts).length})\n", indent]
1506
1674
  if lefts.any?
1507
1675
  lefts[0...-1].each do |child|
@@ -1533,6 +1701,8 @@ module Prism
1533
1701
  # Inspect a MultiWriteNode node.
1534
1702
  def visit_multi_write_node(node)
1535
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]
1536
1706
  commands << ["├── lefts: (length: #{(lefts = node.lefts).length})\n", indent]
1537
1707
  if lefts.any?
1538
1708
  lefts[0...-1].each do |child|
@@ -1567,6 +1737,8 @@ module Prism
1567
1737
  # Inspect a NextNode node.
1568
1738
  def visit_next_node(node)
1569
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]
1570
1742
  if (arguments = node.arguments).nil?
1571
1743
  commands << ["├── arguments: ∅\n", indent]
1572
1744
  else
@@ -1579,11 +1751,15 @@ module Prism
1579
1751
  # Inspect a NilNode node.
1580
1752
  def visit_nil_node(node)
1581
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]
1582
1756
  end
1583
1757
 
1584
1758
  # Inspect a NoKeywordsParameterNode node.
1585
1759
  def visit_no_keywords_parameter_node(node)
1586
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]
1587
1763
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
1588
1764
  commands << ["└── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
1589
1765
  end
@@ -1591,19 +1767,23 @@ module Prism
1591
1767
  # Inspect a NumberedParametersNode node.
1592
1768
  def visit_numbered_parameters_node(node)
1593
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]
1594
1772
  commands << ["└── maximum: #{node.maximum.inspect}\n", indent]
1595
1773
  end
1596
1774
 
1597
1775
  # Inspect a NumberedReferenceReadNode node.
1598
1776
  def visit_numbered_reference_read_node(node)
1599
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]
1600
1780
  commands << ["└── number: #{node.number.inspect}\n", indent]
1601
1781
  end
1602
1782
 
1603
1783
  # Inspect a OptionalKeywordParameterNode node.
1604
1784
  def visit_optional_keyword_parameter_node(node)
1605
1785
  commands << [inspect_node("OptionalKeywordParameterNode", node), indent]
1606
- 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
1607
1787
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1608
1788
  commands << ["├── name: #{node.name.inspect}\n", indent]
1609
1789
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
@@ -1614,7 +1794,7 @@ module Prism
1614
1794
  # Inspect a OptionalParameterNode node.
1615
1795
  def visit_optional_parameter_node(node)
1616
1796
  commands << [inspect_node("OptionalParameterNode", node), indent]
1617
- 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
1618
1798
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1619
1799
  commands << ["├── name: #{node.name.inspect}\n", indent]
1620
1800
  commands << ["├── name_loc: #{inspect_location(node.name_loc)}\n", indent]
@@ -1626,6 +1806,8 @@ module Prism
1626
1806
  # Inspect a OrNode node.
1627
1807
  def visit_or_node(node)
1628
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]
1629
1811
  commands << ["├── left:\n", indent]
1630
1812
  commands << [node.left, "#{indent}│ "]
1631
1813
  commands << ["├── right:\n", indent]
@@ -1636,6 +1818,8 @@ module Prism
1636
1818
  # Inspect a ParametersNode node.
1637
1819
  def visit_parameters_node(node)
1638
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]
1639
1823
  commands << ["├── requireds: (length: #{(requireds = node.requireds).length})\n", indent]
1640
1824
  if requireds.any?
1641
1825
  requireds[0...-1].each do |child|
@@ -1695,6 +1879,8 @@ module Prism
1695
1879
  # Inspect a ParenthesesNode node.
1696
1880
  def visit_parentheses_node(node)
1697
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]
1698
1884
  if (body = node.body).nil?
1699
1885
  commands << ["├── body: ∅\n", indent]
1700
1886
  else
@@ -1708,6 +1894,8 @@ module Prism
1708
1894
  # Inspect a PinnedExpressionNode node.
1709
1895
  def visit_pinned_expression_node(node)
1710
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]
1711
1899
  commands << ["├── expression:\n", indent]
1712
1900
  commands << [node.expression, "#{indent}│ "]
1713
1901
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
@@ -1718,6 +1906,8 @@ module Prism
1718
1906
  # Inspect a PinnedVariableNode node.
1719
1907
  def visit_pinned_variable_node(node)
1720
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]
1721
1911
  commands << ["├── variable:\n", indent]
1722
1912
  commands << [node.variable, "#{indent}│ "]
1723
1913
  commands << ["└── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
@@ -1726,6 +1916,8 @@ module Prism
1726
1916
  # Inspect a PostExecutionNode node.
1727
1917
  def visit_post_execution_node(node)
1728
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]
1729
1921
  if (statements = node.statements).nil?
1730
1922
  commands << ["├── statements: ∅\n", indent]
1731
1923
  else
@@ -1740,6 +1932,8 @@ module Prism
1740
1932
  # Inspect a PreExecutionNode node.
1741
1933
  def visit_pre_execution_node(node)
1742
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]
1743
1937
  if (statements = node.statements).nil?
1744
1938
  commands << ["├── statements: ∅\n", indent]
1745
1939
  else
@@ -1754,6 +1948,8 @@ module Prism
1754
1948
  # Inspect a ProgramNode node.
1755
1949
  def visit_program_node(node)
1756
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]
1757
1953
  commands << ["├── locals: #{node.locals.inspect}\n", indent]
1758
1954
  commands << ["└── statements:\n", indent]
1759
1955
  commands << [node.statements, "#{indent} "]
@@ -1762,7 +1958,7 @@ module Prism
1762
1958
  # Inspect a RangeNode node.
1763
1959
  def visit_range_node(node)
1764
1960
  commands << [inspect_node("RangeNode", node), indent]
1765
- 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
1766
1962
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1767
1963
  if (left = node.left).nil?
1768
1964
  commands << ["├── left: ∅\n", indent]
@@ -1782,7 +1978,7 @@ module Prism
1782
1978
  # Inspect a RationalNode node.
1783
1979
  def visit_rational_node(node)
1784
1980
  commands << [inspect_node("RationalNode", node), indent]
1785
- flags = [("binary" if node.binary?), ("decimal" if node.decimal?), ("octal" if node.octal?), ("hexadecimal" if node.hexadecimal?)].compact
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
1786
1982
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1787
1983
  commands << ["├── numerator: #{node.numerator.inspect}\n", indent]
1788
1984
  commands << ["└── denominator: #{node.denominator.inspect}\n", indent]
@@ -1791,12 +1987,14 @@ module Prism
1791
1987
  # Inspect a RedoNode node.
1792
1988
  def visit_redo_node(node)
1793
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]
1794
1992
  end
1795
1993
 
1796
1994
  # Inspect a RegularExpressionNode node.
1797
1995
  def visit_regular_expression_node(node)
1798
1996
  commands << [inspect_node("RegularExpressionNode", node), indent]
1799
- 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
1800
1998
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1801
1999
  commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent]
1802
2000
  commands << ["├── content_loc: #{inspect_location(node.content_loc)}\n", indent]
@@ -1807,7 +2005,7 @@ module Prism
1807
2005
  # Inspect a RequiredKeywordParameterNode node.
1808
2006
  def visit_required_keyword_parameter_node(node)
1809
2007
  commands << [inspect_node("RequiredKeywordParameterNode", node), indent]
1810
- 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
1811
2009
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1812
2010
  commands << ["├── name: #{node.name.inspect}\n", indent]
1813
2011
  commands << ["└── name_loc: #{inspect_location(node.name_loc)}\n", indent]
@@ -1816,7 +2014,7 @@ module Prism
1816
2014
  # Inspect a RequiredParameterNode node.
1817
2015
  def visit_required_parameter_node(node)
1818
2016
  commands << [inspect_node("RequiredParameterNode", node), indent]
1819
- 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
1820
2018
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1821
2019
  commands << ["└── name: #{node.name.inspect}\n", indent]
1822
2020
  end
@@ -1824,6 +2022,8 @@ module Prism
1824
2022
  # Inspect a RescueModifierNode node.
1825
2023
  def visit_rescue_modifier_node(node)
1826
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]
1827
2027
  commands << ["├── expression:\n", indent]
1828
2028
  commands << [node.expression, "#{indent}│ "]
1829
2029
  commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
@@ -1834,6 +2034,8 @@ module Prism
1834
2034
  # Inspect a RescueNode node.
1835
2035
  def visit_rescue_node(node)
1836
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]
1837
2039
  commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
1838
2040
  commands << ["├── exceptions: (length: #{(exceptions = node.exceptions).length})\n", indent]
1839
2041
  if exceptions.any?
@@ -1857,18 +2059,18 @@ module Prism
1857
2059
  commands << ["├── statements:\n", indent]
1858
2060
  commands << [statements, "#{indent}│ "]
1859
2061
  end
1860
- if (consequent = node.consequent).nil?
1861
- commands << ["└── consequent: ∅\n", indent]
2062
+ if (subsequent = node.subsequent).nil?
2063
+ commands << ["└── subsequent: ∅\n", indent]
1862
2064
  else
1863
- commands << ["└── consequent:\n", indent]
1864
- commands << [consequent, "#{indent} "]
2065
+ commands << ["└── subsequent:\n", indent]
2066
+ commands << [subsequent, "#{indent} "]
1865
2067
  end
1866
2068
  end
1867
2069
 
1868
2070
  # Inspect a RestParameterNode node.
1869
2071
  def visit_rest_parameter_node(node)
1870
2072
  commands << [inspect_node("RestParameterNode", node), indent]
1871
- 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
1872
2074
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1873
2075
  if (name = node.name).nil?
1874
2076
  commands << ["├── name: ∅\n", indent]
@@ -1882,12 +2084,14 @@ module Prism
1882
2084
  # Inspect a RetryNode node.
1883
2085
  def visit_retry_node(node)
1884
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]
1885
2089
  end
1886
2090
 
1887
2091
  # Inspect a ReturnNode node.
1888
2092
  def visit_return_node(node)
1889
2093
  commands << [inspect_node("ReturnNode", node), indent]
1890
- flags = [("redundant" if node.redundant?)].compact
2094
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
1891
2095
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1892
2096
  commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
1893
2097
  if (arguments = node.arguments).nil?
@@ -1901,12 +2105,14 @@ module Prism
1901
2105
  # Inspect a SelfNode node.
1902
2106
  def visit_self_node(node)
1903
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]
1904
2110
  end
1905
2111
 
1906
2112
  # Inspect a ShareableConstantNode node.
1907
2113
  def visit_shareable_constant_node(node)
1908
2114
  commands << [inspect_node("ShareableConstantNode", node), indent]
1909
- 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
1910
2116
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1911
2117
  commands << ["└── write:\n", indent]
1912
2118
  commands << [node.write, "#{indent} "]
@@ -1915,6 +2121,8 @@ module Prism
1915
2121
  # Inspect a SingletonClassNode node.
1916
2122
  def visit_singleton_class_node(node)
1917
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]
1918
2126
  commands << ["├── locals: #{node.locals.inspect}\n", indent]
1919
2127
  commands << ["├── class_keyword_loc: #{inspect_location(node.class_keyword_loc)}\n", indent]
1920
2128
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
@@ -1932,12 +2140,14 @@ module Prism
1932
2140
  # Inspect a SourceEncodingNode node.
1933
2141
  def visit_source_encoding_node(node)
1934
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]
1935
2145
  end
1936
2146
 
1937
2147
  # Inspect a SourceFileNode node.
1938
2148
  def visit_source_file_node(node)
1939
2149
  commands << [inspect_node("SourceFileNode", node), indent]
1940
- 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
1941
2151
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1942
2152
  commands << ["└── filepath: #{node.filepath.inspect}\n", indent]
1943
2153
  end
@@ -1945,11 +2155,15 @@ module Prism
1945
2155
  # Inspect a SourceLineNode node.
1946
2156
  def visit_source_line_node(node)
1947
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]
1948
2160
  end
1949
2161
 
1950
2162
  # Inspect a SplatNode node.
1951
2163
  def visit_splat_node(node)
1952
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]
1953
2167
  commands << ["├── operator_loc: #{inspect_location(node.operator_loc)}\n", indent]
1954
2168
  if (expression = node.expression).nil?
1955
2169
  commands << ["└── expression: ∅\n", indent]
@@ -1962,6 +2176,8 @@ module Prism
1962
2176
  # Inspect a StatementsNode node.
1963
2177
  def visit_statements_node(node)
1964
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]
1965
2181
  commands << ["└── body: (length: #{(body = node.body).length})\n", indent]
1966
2182
  if body.any?
1967
2183
  body[0...-1].each do |child|
@@ -1976,7 +2192,7 @@ module Prism
1976
2192
  # Inspect a StringNode node.
1977
2193
  def visit_string_node(node)
1978
2194
  commands << [inspect_node("StringNode", node), indent]
1979
- 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
1980
2196
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
1981
2197
  commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent]
1982
2198
  commands << ["├── content_loc: #{inspect_location(node.content_loc)}\n", indent]
@@ -1987,6 +2203,8 @@ module Prism
1987
2203
  # Inspect a SuperNode node.
1988
2204
  def visit_super_node(node)
1989
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]
1990
2208
  commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
1991
2209
  commands << ["├── lparen_loc: #{inspect_location(node.lparen_loc)}\n", indent]
1992
2210
  if (arguments = node.arguments).nil?
@@ -2007,7 +2225,7 @@ module Prism
2007
2225
  # Inspect a SymbolNode node.
2008
2226
  def visit_symbol_node(node)
2009
2227
  commands << [inspect_node("SymbolNode", node), indent]
2010
- 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
2011
2229
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
2012
2230
  commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent]
2013
2231
  commands << ["├── value_loc: #{inspect_location(node.value_loc)}\n", indent]
@@ -2018,11 +2236,15 @@ module Prism
2018
2236
  # Inspect a TrueNode node.
2019
2237
  def visit_true_node(node)
2020
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]
2021
2241
  end
2022
2242
 
2023
2243
  # Inspect a UndefNode node.
2024
2244
  def visit_undef_node(node)
2025
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]
2026
2248
  commands << ["├── names: (length: #{(names = node.names).length})\n", indent]
2027
2249
  if names.any?
2028
2250
  names[0...-1].each do |child|
@@ -2038,6 +2260,8 @@ module Prism
2038
2260
  # Inspect a UnlessNode node.
2039
2261
  def visit_unless_node(node)
2040
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]
2041
2265
  commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
2042
2266
  commands << ["├── predicate:\n", indent]
2043
2267
  commands << [node.predicate, "#{indent}│ "]
@@ -2048,11 +2272,11 @@ module Prism
2048
2272
  commands << ["├── statements:\n", indent]
2049
2273
  commands << [statements, "#{indent}│ "]
2050
2274
  end
2051
- if (consequent = node.consequent).nil?
2052
- commands << ["├── consequent: ∅\n", indent]
2275
+ if (else_clause = node.else_clause).nil?
2276
+ commands << ["├── else_clause: ∅\n", indent]
2053
2277
  else
2054
- commands << ["├── consequent:\n", indent]
2055
- commands << [consequent, "#{indent}│ "]
2278
+ commands << ["├── else_clause:\n", indent]
2279
+ commands << [else_clause, "#{indent}│ "]
2056
2280
  end
2057
2281
  commands << ["└── end_keyword_loc: #{inspect_location(node.end_keyword_loc)}\n", indent]
2058
2282
  end
@@ -2060,7 +2284,7 @@ module Prism
2060
2284
  # Inspect a UntilNode node.
2061
2285
  def visit_until_node(node)
2062
2286
  commands << [inspect_node("UntilNode", node), indent]
2063
- 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
2064
2288
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
2065
2289
  commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
2066
2290
  commands << ["├── closing_loc: #{inspect_location(node.closing_loc)}\n", indent]
@@ -2077,6 +2301,8 @@ module Prism
2077
2301
  # Inspect a WhenNode node.
2078
2302
  def visit_when_node(node)
2079
2303
  commands << [inspect_node("WhenNode", node), indent]
2304
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
2305
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
2080
2306
  commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
2081
2307
  commands << ["├── conditions: (length: #{(conditions = node.conditions).length})\n", indent]
2082
2308
  if conditions.any?
@@ -2099,7 +2325,7 @@ module Prism
2099
2325
  # Inspect a WhileNode node.
2100
2326
  def visit_while_node(node)
2101
2327
  commands << [inspect_node("WhileNode", node), indent]
2102
- flags = [("begin_modifier" if node.begin_modifier?)].compact
2328
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ("begin_modifier" if node.begin_modifier?)].compact
2103
2329
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
2104
2330
  commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
2105
2331
  commands << ["├── closing_loc: #{inspect_location(node.closing_loc)}\n", indent]
@@ -2116,7 +2342,7 @@ module Prism
2116
2342
  # Inspect a XStringNode node.
2117
2343
  def visit_x_string_node(node)
2118
2344
  commands << [inspect_node("XStringNode", node), indent]
2119
- flags = [("forced_utf8_encoding" if node.forced_utf8_encoding?), ("forced_binary_encoding" if node.forced_binary_encoding?)].compact
2345
+ 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
2120
2346
  commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
2121
2347
  commands << ["├── opening_loc: #{inspect_location(node.opening_loc)}\n", indent]
2122
2348
  commands << ["├── content_loc: #{inspect_location(node.content_loc)}\n", indent]
@@ -2127,6 +2353,8 @@ module Prism
2127
2353
  # Inspect a YieldNode node.
2128
2354
  def visit_yield_node(node)
2129
2355
  commands << [inspect_node("YieldNode", node), indent]
2356
+ flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
2357
+ commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
2130
2358
  commands << ["├── keyword_loc: #{inspect_location(node.keyword_loc)}\n", indent]
2131
2359
  commands << ["├── lparen_loc: #{inspect_location(node.lparen_loc)}\n", indent]
2132
2360
  if (arguments = node.arguments).nil?