ed-precompiled_prism 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. checksums.yaml +7 -0
  2. data/BSDmakefile +58 -0
  3. data/CHANGELOG.md +723 -0
  4. data/CODE_OF_CONDUCT.md +76 -0
  5. data/CONTRIBUTING.md +58 -0
  6. data/LICENSE.md +7 -0
  7. data/Makefile +110 -0
  8. data/README.md +143 -0
  9. data/config.yml +4714 -0
  10. data/docs/build_system.md +119 -0
  11. data/docs/configuration.md +68 -0
  12. data/docs/cruby_compilation.md +27 -0
  13. data/docs/design.md +53 -0
  14. data/docs/encoding.md +121 -0
  15. data/docs/fuzzing.md +88 -0
  16. data/docs/heredocs.md +36 -0
  17. data/docs/javascript.md +118 -0
  18. data/docs/local_variable_depth.md +229 -0
  19. data/docs/mapping.md +117 -0
  20. data/docs/parser_translation.md +24 -0
  21. data/docs/parsing_rules.md +22 -0
  22. data/docs/releasing.md +98 -0
  23. data/docs/relocation.md +34 -0
  24. data/docs/ripper_translation.md +72 -0
  25. data/docs/ruby_api.md +44 -0
  26. data/docs/ruby_parser_translation.md +19 -0
  27. data/docs/serialization.md +233 -0
  28. data/docs/testing.md +55 -0
  29. data/ext/prism/api_node.c +6941 -0
  30. data/ext/prism/api_pack.c +276 -0
  31. data/ext/prism/extconf.rb +127 -0
  32. data/ext/prism/extension.c +1419 -0
  33. data/ext/prism/extension.h +19 -0
  34. data/include/prism/ast.h +8220 -0
  35. data/include/prism/defines.h +260 -0
  36. data/include/prism/diagnostic.h +456 -0
  37. data/include/prism/encoding.h +283 -0
  38. data/include/prism/node.h +129 -0
  39. data/include/prism/options.h +482 -0
  40. data/include/prism/pack.h +163 -0
  41. data/include/prism/parser.h +933 -0
  42. data/include/prism/prettyprint.h +34 -0
  43. data/include/prism/regexp.h +43 -0
  44. data/include/prism/static_literals.h +121 -0
  45. data/include/prism/util/pm_buffer.h +236 -0
  46. data/include/prism/util/pm_char.h +204 -0
  47. data/include/prism/util/pm_constant_pool.h +218 -0
  48. data/include/prism/util/pm_integer.h +130 -0
  49. data/include/prism/util/pm_list.h +103 -0
  50. data/include/prism/util/pm_memchr.h +29 -0
  51. data/include/prism/util/pm_newline_list.h +113 -0
  52. data/include/prism/util/pm_string.h +200 -0
  53. data/include/prism/util/pm_strncasecmp.h +32 -0
  54. data/include/prism/util/pm_strpbrk.h +46 -0
  55. data/include/prism/version.h +29 -0
  56. data/include/prism.h +408 -0
  57. data/lib/prism/compiler.rb +801 -0
  58. data/lib/prism/desugar_compiler.rb +392 -0
  59. data/lib/prism/dispatcher.rb +2210 -0
  60. data/lib/prism/dot_visitor.rb +4762 -0
  61. data/lib/prism/dsl.rb +1003 -0
  62. data/lib/prism/ffi.rb +570 -0
  63. data/lib/prism/inspect_visitor.rb +2392 -0
  64. data/lib/prism/lex_compat.rb +928 -0
  65. data/lib/prism/mutation_compiler.rb +772 -0
  66. data/lib/prism/node.rb +18816 -0
  67. data/lib/prism/node_ext.rb +511 -0
  68. data/lib/prism/pack.rb +230 -0
  69. data/lib/prism/parse_result/comments.rb +188 -0
  70. data/lib/prism/parse_result/errors.rb +66 -0
  71. data/lib/prism/parse_result/newlines.rb +155 -0
  72. data/lib/prism/parse_result.rb +911 -0
  73. data/lib/prism/pattern.rb +269 -0
  74. data/lib/prism/polyfill/append_as_bytes.rb +15 -0
  75. data/lib/prism/polyfill/byteindex.rb +13 -0
  76. data/lib/prism/polyfill/scan_byte.rb +14 -0
  77. data/lib/prism/polyfill/unpack1.rb +14 -0
  78. data/lib/prism/polyfill/warn.rb +36 -0
  79. data/lib/prism/reflection.rb +416 -0
  80. data/lib/prism/relocation.rb +505 -0
  81. data/lib/prism/serialize.rb +2398 -0
  82. data/lib/prism/string_query.rb +31 -0
  83. data/lib/prism/translation/parser/builder.rb +62 -0
  84. data/lib/prism/translation/parser/compiler.rb +2234 -0
  85. data/lib/prism/translation/parser/lexer.rb +820 -0
  86. data/lib/prism/translation/parser.rb +374 -0
  87. data/lib/prism/translation/parser33.rb +13 -0
  88. data/lib/prism/translation/parser34.rb +13 -0
  89. data/lib/prism/translation/parser35.rb +13 -0
  90. data/lib/prism/translation/parser_current.rb +24 -0
  91. data/lib/prism/translation/ripper/sexp.rb +126 -0
  92. data/lib/prism/translation/ripper/shim.rb +5 -0
  93. data/lib/prism/translation/ripper.rb +3474 -0
  94. data/lib/prism/translation/ruby_parser.rb +1929 -0
  95. data/lib/prism/translation.rb +16 -0
  96. data/lib/prism/visitor.rb +813 -0
  97. data/lib/prism.rb +97 -0
  98. data/prism.gemspec +174 -0
  99. data/rbi/prism/compiler.rbi +12 -0
  100. data/rbi/prism/dsl.rbi +524 -0
  101. data/rbi/prism/inspect_visitor.rbi +12 -0
  102. data/rbi/prism/node.rbi +8734 -0
  103. data/rbi/prism/node_ext.rbi +107 -0
  104. data/rbi/prism/parse_result.rbi +404 -0
  105. data/rbi/prism/reflection.rbi +58 -0
  106. data/rbi/prism/string_query.rbi +12 -0
  107. data/rbi/prism/translation/parser.rbi +11 -0
  108. data/rbi/prism/translation/parser33.rbi +6 -0
  109. data/rbi/prism/translation/parser34.rbi +6 -0
  110. data/rbi/prism/translation/parser35.rbi +6 -0
  111. data/rbi/prism/translation/ripper.rbi +15 -0
  112. data/rbi/prism/visitor.rbi +473 -0
  113. data/rbi/prism.rbi +66 -0
  114. data/sig/prism/compiler.rbs +9 -0
  115. data/sig/prism/dispatcher.rbs +19 -0
  116. data/sig/prism/dot_visitor.rbs +6 -0
  117. data/sig/prism/dsl.rbs +351 -0
  118. data/sig/prism/inspect_visitor.rbs +22 -0
  119. data/sig/prism/lex_compat.rbs +10 -0
  120. data/sig/prism/mutation_compiler.rbs +159 -0
  121. data/sig/prism/node.rbs +4028 -0
  122. data/sig/prism/node_ext.rbs +149 -0
  123. data/sig/prism/pack.rbs +43 -0
  124. data/sig/prism/parse_result/comments.rbs +38 -0
  125. data/sig/prism/parse_result.rbs +196 -0
  126. data/sig/prism/pattern.rbs +13 -0
  127. data/sig/prism/reflection.rbs +50 -0
  128. data/sig/prism/relocation.rbs +185 -0
  129. data/sig/prism/serialize.rbs +8 -0
  130. data/sig/prism/string_query.rbs +11 -0
  131. data/sig/prism/visitor.rbs +169 -0
  132. data/sig/prism.rbs +254 -0
  133. data/src/diagnostic.c +850 -0
  134. data/src/encoding.c +5235 -0
  135. data/src/node.c +8676 -0
  136. data/src/options.c +328 -0
  137. data/src/pack.c +509 -0
  138. data/src/prettyprint.c +8941 -0
  139. data/src/prism.c +23361 -0
  140. data/src/regexp.c +790 -0
  141. data/src/serialize.c +2268 -0
  142. data/src/static_literals.c +617 -0
  143. data/src/token_type.c +703 -0
  144. data/src/util/pm_buffer.c +357 -0
  145. data/src/util/pm_char.c +318 -0
  146. data/src/util/pm_constant_pool.c +342 -0
  147. data/src/util/pm_integer.c +670 -0
  148. data/src/util/pm_list.c +49 -0
  149. data/src/util/pm_memchr.c +35 -0
  150. data/src/util/pm_newline_list.c +125 -0
  151. data/src/util/pm_string.c +381 -0
  152. data/src/util/pm_strncasecmp.c +36 -0
  153. data/src/util/pm_strpbrk.c +206 -0
  154. metadata +195 -0
@@ -0,0 +1,4762 @@
1
+ # frozen_string_literal: true
2
+ # :markup: markdown
3
+
4
+ =begin
5
+ --
6
+ This file is generated by the templates/template.rb script and should not be
7
+ modified manually. See templates/lib/prism/dot_visitor.rb.erb
8
+ if you are looking to modify the template
9
+ ++
10
+ =end
11
+
12
+ require "cgi/escape"
13
+ require "cgi/util" unless defined?(CGI::EscapeExt)
14
+
15
+ module Prism
16
+ # This visitor provides the ability to call Node#to_dot, which converts a
17
+ # subtree into a graphviz dot graph.
18
+ class DotVisitor < Visitor
19
+ class Field # :nodoc:
20
+ attr_reader :name, :value, :port
21
+
22
+ def initialize(name, value, port)
23
+ @name = name
24
+ @value = value
25
+ @port = port
26
+ end
27
+
28
+ def to_dot
29
+ if port
30
+ "<tr><td align=\"left\" colspan=\"2\" port=\"#{name}\">#{name}</td></tr>"
31
+ else
32
+ "<tr><td align=\"left\">#{name}</td><td>#{CGI.escapeHTML(value || raise)}</td></tr>"
33
+ end
34
+ end
35
+ end
36
+
37
+ class Table # :nodoc:
38
+ attr_reader :name, :fields
39
+
40
+ def initialize(name)
41
+ @name = name
42
+ @fields = []
43
+ end
44
+
45
+ def field(name, value = nil, port: false)
46
+ fields << Field.new(name, value, port)
47
+ end
48
+
49
+ def to_dot
50
+ dot = <<~DOT
51
+ <table border="0" cellborder="1" cellspacing="0" cellpadding="4">
52
+ <tr><td colspan="2"><b>#{name}</b></td></tr>
53
+ DOT
54
+
55
+ if fields.any?
56
+ "#{dot} #{fields.map(&:to_dot).join("\n ")}\n</table>"
57
+ else
58
+ "#{dot}</table>"
59
+ end
60
+ end
61
+ end
62
+
63
+ class Digraph # :nodoc:
64
+ attr_reader :nodes, :waypoints, :edges
65
+
66
+ def initialize
67
+ @nodes = []
68
+ @waypoints = []
69
+ @edges = []
70
+ end
71
+
72
+ def node(value)
73
+ nodes << value
74
+ end
75
+
76
+ def waypoint(value)
77
+ waypoints << value
78
+ end
79
+
80
+ def edge(value)
81
+ edges << value
82
+ end
83
+
84
+ def to_dot
85
+ <<~DOT
86
+ digraph "Prism" {
87
+ node [
88
+ fontname=\"Courier New\"
89
+ shape=plain
90
+ style=filled
91
+ fillcolor=gray95
92
+ ];
93
+
94
+ #{nodes.map { |node| node.gsub(/\n/, "\n ") }.join("\n ")}
95
+ node [shape=point];
96
+ #{waypoints.join("\n ")}
97
+
98
+ #{edges.join("\n ")}
99
+ }
100
+ DOT
101
+ end
102
+ end
103
+
104
+ private_constant :Field, :Table, :Digraph
105
+
106
+ # The digraph that is being built.
107
+ attr_reader :digraph
108
+
109
+ # Initialize a new dot visitor.
110
+ def initialize
111
+ @digraph = Digraph.new
112
+ end
113
+
114
+ # Convert this visitor into a graphviz dot graph string.
115
+ def to_dot
116
+ digraph.to_dot
117
+ end
118
+
119
+ # Visit a AliasGlobalVariableNode node.
120
+ def visit_alias_global_variable_node(node)
121
+ table = Table.new("AliasGlobalVariableNode")
122
+ id = node_id(node)
123
+
124
+ # new_name
125
+ table.field("new_name", port: true)
126
+ digraph.edge("#{id}:new_name -> #{node_id(node.new_name)};")
127
+
128
+ # old_name
129
+ table.field("old_name", port: true)
130
+ digraph.edge("#{id}:old_name -> #{node_id(node.old_name)};")
131
+
132
+ # keyword_loc
133
+ table.field("keyword_loc", location_inspect(node.keyword_loc))
134
+
135
+ digraph.nodes << <<~DOT
136
+ #{id} [
137
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
138
+ ];
139
+ DOT
140
+
141
+ super
142
+ end
143
+
144
+ # Visit a AliasMethodNode node.
145
+ def visit_alias_method_node(node)
146
+ table = Table.new("AliasMethodNode")
147
+ id = node_id(node)
148
+
149
+ # new_name
150
+ table.field("new_name", port: true)
151
+ digraph.edge("#{id}:new_name -> #{node_id(node.new_name)};")
152
+
153
+ # old_name
154
+ table.field("old_name", port: true)
155
+ digraph.edge("#{id}:old_name -> #{node_id(node.old_name)};")
156
+
157
+ # keyword_loc
158
+ table.field("keyword_loc", location_inspect(node.keyword_loc))
159
+
160
+ digraph.nodes << <<~DOT
161
+ #{id} [
162
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
163
+ ];
164
+ DOT
165
+
166
+ super
167
+ end
168
+
169
+ # Visit a AlternationPatternNode node.
170
+ def visit_alternation_pattern_node(node)
171
+ table = Table.new("AlternationPatternNode")
172
+ id = node_id(node)
173
+
174
+ # left
175
+ table.field("left", port: true)
176
+ digraph.edge("#{id}:left -> #{node_id(node.left)};")
177
+
178
+ # right
179
+ table.field("right", port: true)
180
+ digraph.edge("#{id}:right -> #{node_id(node.right)};")
181
+
182
+ # operator_loc
183
+ table.field("operator_loc", location_inspect(node.operator_loc))
184
+
185
+ digraph.nodes << <<~DOT
186
+ #{id} [
187
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
188
+ ];
189
+ DOT
190
+
191
+ super
192
+ end
193
+
194
+ # Visit a AndNode node.
195
+ def visit_and_node(node)
196
+ table = Table.new("AndNode")
197
+ id = node_id(node)
198
+
199
+ # left
200
+ table.field("left", port: true)
201
+ digraph.edge("#{id}:left -> #{node_id(node.left)};")
202
+
203
+ # right
204
+ table.field("right", port: true)
205
+ digraph.edge("#{id}:right -> #{node_id(node.right)};")
206
+
207
+ # operator_loc
208
+ table.field("operator_loc", location_inspect(node.operator_loc))
209
+
210
+ digraph.nodes << <<~DOT
211
+ #{id} [
212
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
213
+ ];
214
+ DOT
215
+
216
+ super
217
+ end
218
+
219
+ # Visit a ArgumentsNode node.
220
+ def visit_arguments_node(node)
221
+ table = Table.new("ArgumentsNode")
222
+ id = node_id(node)
223
+
224
+ # flags
225
+ table.field("flags", arguments_node_flags_inspect(node))
226
+
227
+ # arguments
228
+ if node.arguments.any?
229
+ table.field("arguments", port: true)
230
+
231
+ waypoint = "#{id}_arguments"
232
+ digraph.waypoint("#{waypoint};")
233
+
234
+ digraph.edge("#{id}:arguments -> #{waypoint};")
235
+ node.arguments.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
236
+ else
237
+ table.field("arguments", "[]")
238
+ end
239
+
240
+ digraph.nodes << <<~DOT
241
+ #{id} [
242
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
243
+ ];
244
+ DOT
245
+
246
+ super
247
+ end
248
+
249
+ # Visit a ArrayNode node.
250
+ def visit_array_node(node)
251
+ table = Table.new("ArrayNode")
252
+ id = node_id(node)
253
+
254
+ # flags
255
+ table.field("flags", array_node_flags_inspect(node))
256
+
257
+ # elements
258
+ if node.elements.any?
259
+ table.field("elements", port: true)
260
+
261
+ waypoint = "#{id}_elements"
262
+ digraph.waypoint("#{waypoint};")
263
+
264
+ digraph.edge("#{id}:elements -> #{waypoint};")
265
+ node.elements.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
266
+ else
267
+ table.field("elements", "[]")
268
+ end
269
+
270
+ # opening_loc
271
+ unless (opening_loc = node.opening_loc).nil?
272
+ table.field("opening_loc", location_inspect(opening_loc))
273
+ end
274
+
275
+ # closing_loc
276
+ unless (closing_loc = node.closing_loc).nil?
277
+ table.field("closing_loc", location_inspect(closing_loc))
278
+ end
279
+
280
+ digraph.nodes << <<~DOT
281
+ #{id} [
282
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
283
+ ];
284
+ DOT
285
+
286
+ super
287
+ end
288
+
289
+ # Visit a ArrayPatternNode node.
290
+ def visit_array_pattern_node(node)
291
+ table = Table.new("ArrayPatternNode")
292
+ id = node_id(node)
293
+
294
+ # constant
295
+ unless (constant = node.constant).nil?
296
+ table.field("constant", port: true)
297
+ digraph.edge("#{id}:constant -> #{node_id(constant)};")
298
+ end
299
+
300
+ # requireds
301
+ if node.requireds.any?
302
+ table.field("requireds", port: true)
303
+
304
+ waypoint = "#{id}_requireds"
305
+ digraph.waypoint("#{waypoint};")
306
+
307
+ digraph.edge("#{id}:requireds -> #{waypoint};")
308
+ node.requireds.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
309
+ else
310
+ table.field("requireds", "[]")
311
+ end
312
+
313
+ # rest
314
+ unless (rest = node.rest).nil?
315
+ table.field("rest", port: true)
316
+ digraph.edge("#{id}:rest -> #{node_id(rest)};")
317
+ end
318
+
319
+ # posts
320
+ if node.posts.any?
321
+ table.field("posts", port: true)
322
+
323
+ waypoint = "#{id}_posts"
324
+ digraph.waypoint("#{waypoint};")
325
+
326
+ digraph.edge("#{id}:posts -> #{waypoint};")
327
+ node.posts.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
328
+ else
329
+ table.field("posts", "[]")
330
+ end
331
+
332
+ # opening_loc
333
+ unless (opening_loc = node.opening_loc).nil?
334
+ table.field("opening_loc", location_inspect(opening_loc))
335
+ end
336
+
337
+ # closing_loc
338
+ unless (closing_loc = node.closing_loc).nil?
339
+ table.field("closing_loc", location_inspect(closing_loc))
340
+ end
341
+
342
+ digraph.nodes << <<~DOT
343
+ #{id} [
344
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
345
+ ];
346
+ DOT
347
+
348
+ super
349
+ end
350
+
351
+ # Visit a AssocNode node.
352
+ def visit_assoc_node(node)
353
+ table = Table.new("AssocNode")
354
+ id = node_id(node)
355
+
356
+ # key
357
+ table.field("key", port: true)
358
+ digraph.edge("#{id}:key -> #{node_id(node.key)};")
359
+
360
+ # value
361
+ table.field("value", port: true)
362
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
363
+
364
+ # operator_loc
365
+ unless (operator_loc = node.operator_loc).nil?
366
+ table.field("operator_loc", location_inspect(operator_loc))
367
+ end
368
+
369
+ digraph.nodes << <<~DOT
370
+ #{id} [
371
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
372
+ ];
373
+ DOT
374
+
375
+ super
376
+ end
377
+
378
+ # Visit a AssocSplatNode node.
379
+ def visit_assoc_splat_node(node)
380
+ table = Table.new("AssocSplatNode")
381
+ id = node_id(node)
382
+
383
+ # value
384
+ unless (value = node.value).nil?
385
+ table.field("value", port: true)
386
+ digraph.edge("#{id}:value -> #{node_id(value)};")
387
+ end
388
+
389
+ # operator_loc
390
+ table.field("operator_loc", location_inspect(node.operator_loc))
391
+
392
+ digraph.nodes << <<~DOT
393
+ #{id} [
394
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
395
+ ];
396
+ DOT
397
+
398
+ super
399
+ end
400
+
401
+ # Visit a BackReferenceReadNode node.
402
+ def visit_back_reference_read_node(node)
403
+ table = Table.new("BackReferenceReadNode")
404
+ id = node_id(node)
405
+
406
+ # name
407
+ table.field("name", node.name.inspect)
408
+
409
+ digraph.nodes << <<~DOT
410
+ #{id} [
411
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
412
+ ];
413
+ DOT
414
+
415
+ super
416
+ end
417
+
418
+ # Visit a BeginNode node.
419
+ def visit_begin_node(node)
420
+ table = Table.new("BeginNode")
421
+ id = node_id(node)
422
+
423
+ # begin_keyword_loc
424
+ unless (begin_keyword_loc = node.begin_keyword_loc).nil?
425
+ table.field("begin_keyword_loc", location_inspect(begin_keyword_loc))
426
+ end
427
+
428
+ # statements
429
+ unless (statements = node.statements).nil?
430
+ table.field("statements", port: true)
431
+ digraph.edge("#{id}:statements -> #{node_id(statements)};")
432
+ end
433
+
434
+ # rescue_clause
435
+ unless (rescue_clause = node.rescue_clause).nil?
436
+ table.field("rescue_clause", port: true)
437
+ digraph.edge("#{id}:rescue_clause -> #{node_id(rescue_clause)};")
438
+ end
439
+
440
+ # else_clause
441
+ unless (else_clause = node.else_clause).nil?
442
+ table.field("else_clause", port: true)
443
+ digraph.edge("#{id}:else_clause -> #{node_id(else_clause)};")
444
+ end
445
+
446
+ # ensure_clause
447
+ unless (ensure_clause = node.ensure_clause).nil?
448
+ table.field("ensure_clause", port: true)
449
+ digraph.edge("#{id}:ensure_clause -> #{node_id(ensure_clause)};")
450
+ end
451
+
452
+ # end_keyword_loc
453
+ unless (end_keyword_loc = node.end_keyword_loc).nil?
454
+ table.field("end_keyword_loc", location_inspect(end_keyword_loc))
455
+ end
456
+
457
+ digraph.nodes << <<~DOT
458
+ #{id} [
459
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
460
+ ];
461
+ DOT
462
+
463
+ super
464
+ end
465
+
466
+ # Visit a BlockArgumentNode node.
467
+ def visit_block_argument_node(node)
468
+ table = Table.new("BlockArgumentNode")
469
+ id = node_id(node)
470
+
471
+ # expression
472
+ unless (expression = node.expression).nil?
473
+ table.field("expression", port: true)
474
+ digraph.edge("#{id}:expression -> #{node_id(expression)};")
475
+ end
476
+
477
+ # operator_loc
478
+ table.field("operator_loc", location_inspect(node.operator_loc))
479
+
480
+ digraph.nodes << <<~DOT
481
+ #{id} [
482
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
483
+ ];
484
+ DOT
485
+
486
+ super
487
+ end
488
+
489
+ # Visit a BlockLocalVariableNode node.
490
+ def visit_block_local_variable_node(node)
491
+ table = Table.new("BlockLocalVariableNode")
492
+ id = node_id(node)
493
+
494
+ # flags
495
+ table.field("flags", parameter_flags_inspect(node))
496
+
497
+ # name
498
+ table.field("name", node.name.inspect)
499
+
500
+ digraph.nodes << <<~DOT
501
+ #{id} [
502
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
503
+ ];
504
+ DOT
505
+
506
+ super
507
+ end
508
+
509
+ # Visit a BlockNode node.
510
+ def visit_block_node(node)
511
+ table = Table.new("BlockNode")
512
+ id = node_id(node)
513
+
514
+ # locals
515
+ table.field("locals", node.locals.inspect)
516
+
517
+ # parameters
518
+ unless (parameters = node.parameters).nil?
519
+ table.field("parameters", port: true)
520
+ digraph.edge("#{id}:parameters -> #{node_id(parameters)};")
521
+ end
522
+
523
+ # body
524
+ unless (body = node.body).nil?
525
+ table.field("body", port: true)
526
+ digraph.edge("#{id}:body -> #{node_id(body)};")
527
+ end
528
+
529
+ # opening_loc
530
+ table.field("opening_loc", location_inspect(node.opening_loc))
531
+
532
+ # closing_loc
533
+ table.field("closing_loc", location_inspect(node.closing_loc))
534
+
535
+ digraph.nodes << <<~DOT
536
+ #{id} [
537
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
538
+ ];
539
+ DOT
540
+
541
+ super
542
+ end
543
+
544
+ # Visit a BlockParameterNode node.
545
+ def visit_block_parameter_node(node)
546
+ table = Table.new("BlockParameterNode")
547
+ id = node_id(node)
548
+
549
+ # flags
550
+ table.field("flags", parameter_flags_inspect(node))
551
+
552
+ # name
553
+ table.field("name", node.name.inspect)
554
+
555
+ # name_loc
556
+ unless (name_loc = node.name_loc).nil?
557
+ table.field("name_loc", location_inspect(name_loc))
558
+ end
559
+
560
+ # operator_loc
561
+ table.field("operator_loc", location_inspect(node.operator_loc))
562
+
563
+ digraph.nodes << <<~DOT
564
+ #{id} [
565
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
566
+ ];
567
+ DOT
568
+
569
+ super
570
+ end
571
+
572
+ # Visit a BlockParametersNode node.
573
+ def visit_block_parameters_node(node)
574
+ table = Table.new("BlockParametersNode")
575
+ id = node_id(node)
576
+
577
+ # parameters
578
+ unless (parameters = node.parameters).nil?
579
+ table.field("parameters", port: true)
580
+ digraph.edge("#{id}:parameters -> #{node_id(parameters)};")
581
+ end
582
+
583
+ # locals
584
+ if node.locals.any?
585
+ table.field("locals", port: true)
586
+
587
+ waypoint = "#{id}_locals"
588
+ digraph.waypoint("#{waypoint};")
589
+
590
+ digraph.edge("#{id}:locals -> #{waypoint};")
591
+ node.locals.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
592
+ else
593
+ table.field("locals", "[]")
594
+ end
595
+
596
+ # opening_loc
597
+ unless (opening_loc = node.opening_loc).nil?
598
+ table.field("opening_loc", location_inspect(opening_loc))
599
+ end
600
+
601
+ # closing_loc
602
+ unless (closing_loc = node.closing_loc).nil?
603
+ table.field("closing_loc", location_inspect(closing_loc))
604
+ end
605
+
606
+ digraph.nodes << <<~DOT
607
+ #{id} [
608
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
609
+ ];
610
+ DOT
611
+
612
+ super
613
+ end
614
+
615
+ # Visit a BreakNode node.
616
+ def visit_break_node(node)
617
+ table = Table.new("BreakNode")
618
+ id = node_id(node)
619
+
620
+ # arguments
621
+ unless (arguments = node.arguments).nil?
622
+ table.field("arguments", port: true)
623
+ digraph.edge("#{id}:arguments -> #{node_id(arguments)};")
624
+ end
625
+
626
+ # keyword_loc
627
+ table.field("keyword_loc", location_inspect(node.keyword_loc))
628
+
629
+ digraph.nodes << <<~DOT
630
+ #{id} [
631
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
632
+ ];
633
+ DOT
634
+
635
+ super
636
+ end
637
+
638
+ # Visit a CallAndWriteNode node.
639
+ def visit_call_and_write_node(node)
640
+ table = Table.new("CallAndWriteNode")
641
+ id = node_id(node)
642
+
643
+ # flags
644
+ table.field("flags", call_node_flags_inspect(node))
645
+
646
+ # receiver
647
+ unless (receiver = node.receiver).nil?
648
+ table.field("receiver", port: true)
649
+ digraph.edge("#{id}:receiver -> #{node_id(receiver)};")
650
+ end
651
+
652
+ # call_operator_loc
653
+ unless (call_operator_loc = node.call_operator_loc).nil?
654
+ table.field("call_operator_loc", location_inspect(call_operator_loc))
655
+ end
656
+
657
+ # message_loc
658
+ unless (message_loc = node.message_loc).nil?
659
+ table.field("message_loc", location_inspect(message_loc))
660
+ end
661
+
662
+ # read_name
663
+ table.field("read_name", node.read_name.inspect)
664
+
665
+ # write_name
666
+ table.field("write_name", node.write_name.inspect)
667
+
668
+ # operator_loc
669
+ table.field("operator_loc", location_inspect(node.operator_loc))
670
+
671
+ # value
672
+ table.field("value", port: true)
673
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
674
+
675
+ digraph.nodes << <<~DOT
676
+ #{id} [
677
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
678
+ ];
679
+ DOT
680
+
681
+ super
682
+ end
683
+
684
+ # Visit a CallNode node.
685
+ def visit_call_node(node)
686
+ table = Table.new("CallNode")
687
+ id = node_id(node)
688
+
689
+ # flags
690
+ table.field("flags", call_node_flags_inspect(node))
691
+
692
+ # receiver
693
+ unless (receiver = node.receiver).nil?
694
+ table.field("receiver", port: true)
695
+ digraph.edge("#{id}:receiver -> #{node_id(receiver)};")
696
+ end
697
+
698
+ # call_operator_loc
699
+ unless (call_operator_loc = node.call_operator_loc).nil?
700
+ table.field("call_operator_loc", location_inspect(call_operator_loc))
701
+ end
702
+
703
+ # name
704
+ table.field("name", node.name.inspect)
705
+
706
+ # message_loc
707
+ unless (message_loc = node.message_loc).nil?
708
+ table.field("message_loc", location_inspect(message_loc))
709
+ end
710
+
711
+ # opening_loc
712
+ unless (opening_loc = node.opening_loc).nil?
713
+ table.field("opening_loc", location_inspect(opening_loc))
714
+ end
715
+
716
+ # arguments
717
+ unless (arguments = node.arguments).nil?
718
+ table.field("arguments", port: true)
719
+ digraph.edge("#{id}:arguments -> #{node_id(arguments)};")
720
+ end
721
+
722
+ # closing_loc
723
+ unless (closing_loc = node.closing_loc).nil?
724
+ table.field("closing_loc", location_inspect(closing_loc))
725
+ end
726
+
727
+ # block
728
+ unless (block = node.block).nil?
729
+ table.field("block", port: true)
730
+ digraph.edge("#{id}:block -> #{node_id(block)};")
731
+ end
732
+
733
+ digraph.nodes << <<~DOT
734
+ #{id} [
735
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
736
+ ];
737
+ DOT
738
+
739
+ super
740
+ end
741
+
742
+ # Visit a CallOperatorWriteNode node.
743
+ def visit_call_operator_write_node(node)
744
+ table = Table.new("CallOperatorWriteNode")
745
+ id = node_id(node)
746
+
747
+ # flags
748
+ table.field("flags", call_node_flags_inspect(node))
749
+
750
+ # receiver
751
+ unless (receiver = node.receiver).nil?
752
+ table.field("receiver", port: true)
753
+ digraph.edge("#{id}:receiver -> #{node_id(receiver)};")
754
+ end
755
+
756
+ # call_operator_loc
757
+ unless (call_operator_loc = node.call_operator_loc).nil?
758
+ table.field("call_operator_loc", location_inspect(call_operator_loc))
759
+ end
760
+
761
+ # message_loc
762
+ unless (message_loc = node.message_loc).nil?
763
+ table.field("message_loc", location_inspect(message_loc))
764
+ end
765
+
766
+ # read_name
767
+ table.field("read_name", node.read_name.inspect)
768
+
769
+ # write_name
770
+ table.field("write_name", node.write_name.inspect)
771
+
772
+ # binary_operator
773
+ table.field("binary_operator", node.binary_operator.inspect)
774
+
775
+ # binary_operator_loc
776
+ table.field("binary_operator_loc", location_inspect(node.binary_operator_loc))
777
+
778
+ # value
779
+ table.field("value", port: true)
780
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
781
+
782
+ digraph.nodes << <<~DOT
783
+ #{id} [
784
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
785
+ ];
786
+ DOT
787
+
788
+ super
789
+ end
790
+
791
+ # Visit a CallOrWriteNode node.
792
+ def visit_call_or_write_node(node)
793
+ table = Table.new("CallOrWriteNode")
794
+ id = node_id(node)
795
+
796
+ # flags
797
+ table.field("flags", call_node_flags_inspect(node))
798
+
799
+ # receiver
800
+ unless (receiver = node.receiver).nil?
801
+ table.field("receiver", port: true)
802
+ digraph.edge("#{id}:receiver -> #{node_id(receiver)};")
803
+ end
804
+
805
+ # call_operator_loc
806
+ unless (call_operator_loc = node.call_operator_loc).nil?
807
+ table.field("call_operator_loc", location_inspect(call_operator_loc))
808
+ end
809
+
810
+ # message_loc
811
+ unless (message_loc = node.message_loc).nil?
812
+ table.field("message_loc", location_inspect(message_loc))
813
+ end
814
+
815
+ # read_name
816
+ table.field("read_name", node.read_name.inspect)
817
+
818
+ # write_name
819
+ table.field("write_name", node.write_name.inspect)
820
+
821
+ # operator_loc
822
+ table.field("operator_loc", location_inspect(node.operator_loc))
823
+
824
+ # value
825
+ table.field("value", port: true)
826
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
827
+
828
+ digraph.nodes << <<~DOT
829
+ #{id} [
830
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
831
+ ];
832
+ DOT
833
+
834
+ super
835
+ end
836
+
837
+ # Visit a CallTargetNode node.
838
+ def visit_call_target_node(node)
839
+ table = Table.new("CallTargetNode")
840
+ id = node_id(node)
841
+
842
+ # flags
843
+ table.field("flags", call_node_flags_inspect(node))
844
+
845
+ # receiver
846
+ table.field("receiver", port: true)
847
+ digraph.edge("#{id}:receiver -> #{node_id(node.receiver)};")
848
+
849
+ # call_operator_loc
850
+ table.field("call_operator_loc", location_inspect(node.call_operator_loc))
851
+
852
+ # name
853
+ table.field("name", node.name.inspect)
854
+
855
+ # message_loc
856
+ table.field("message_loc", location_inspect(node.message_loc))
857
+
858
+ digraph.nodes << <<~DOT
859
+ #{id} [
860
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
861
+ ];
862
+ DOT
863
+
864
+ super
865
+ end
866
+
867
+ # Visit a CapturePatternNode node.
868
+ def visit_capture_pattern_node(node)
869
+ table = Table.new("CapturePatternNode")
870
+ id = node_id(node)
871
+
872
+ # value
873
+ table.field("value", port: true)
874
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
875
+
876
+ # target
877
+ table.field("target", port: true)
878
+ digraph.edge("#{id}:target -> #{node_id(node.target)};")
879
+
880
+ # operator_loc
881
+ table.field("operator_loc", location_inspect(node.operator_loc))
882
+
883
+ digraph.nodes << <<~DOT
884
+ #{id} [
885
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
886
+ ];
887
+ DOT
888
+
889
+ super
890
+ end
891
+
892
+ # Visit a CaseMatchNode node.
893
+ def visit_case_match_node(node)
894
+ table = Table.new("CaseMatchNode")
895
+ id = node_id(node)
896
+
897
+ # predicate
898
+ unless (predicate = node.predicate).nil?
899
+ table.field("predicate", port: true)
900
+ digraph.edge("#{id}:predicate -> #{node_id(predicate)};")
901
+ end
902
+
903
+ # conditions
904
+ if node.conditions.any?
905
+ table.field("conditions", port: true)
906
+
907
+ waypoint = "#{id}_conditions"
908
+ digraph.waypoint("#{waypoint};")
909
+
910
+ digraph.edge("#{id}:conditions -> #{waypoint};")
911
+ node.conditions.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
912
+ else
913
+ table.field("conditions", "[]")
914
+ end
915
+
916
+ # else_clause
917
+ unless (else_clause = node.else_clause).nil?
918
+ table.field("else_clause", port: true)
919
+ digraph.edge("#{id}:else_clause -> #{node_id(else_clause)};")
920
+ end
921
+
922
+ # case_keyword_loc
923
+ table.field("case_keyword_loc", location_inspect(node.case_keyword_loc))
924
+
925
+ # end_keyword_loc
926
+ table.field("end_keyword_loc", location_inspect(node.end_keyword_loc))
927
+
928
+ digraph.nodes << <<~DOT
929
+ #{id} [
930
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
931
+ ];
932
+ DOT
933
+
934
+ super
935
+ end
936
+
937
+ # Visit a CaseNode node.
938
+ def visit_case_node(node)
939
+ table = Table.new("CaseNode")
940
+ id = node_id(node)
941
+
942
+ # predicate
943
+ unless (predicate = node.predicate).nil?
944
+ table.field("predicate", port: true)
945
+ digraph.edge("#{id}:predicate -> #{node_id(predicate)};")
946
+ end
947
+
948
+ # conditions
949
+ if node.conditions.any?
950
+ table.field("conditions", port: true)
951
+
952
+ waypoint = "#{id}_conditions"
953
+ digraph.waypoint("#{waypoint};")
954
+
955
+ digraph.edge("#{id}:conditions -> #{waypoint};")
956
+ node.conditions.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
957
+ else
958
+ table.field("conditions", "[]")
959
+ end
960
+
961
+ # else_clause
962
+ unless (else_clause = node.else_clause).nil?
963
+ table.field("else_clause", port: true)
964
+ digraph.edge("#{id}:else_clause -> #{node_id(else_clause)};")
965
+ end
966
+
967
+ # case_keyword_loc
968
+ table.field("case_keyword_loc", location_inspect(node.case_keyword_loc))
969
+
970
+ # end_keyword_loc
971
+ table.field("end_keyword_loc", location_inspect(node.end_keyword_loc))
972
+
973
+ digraph.nodes << <<~DOT
974
+ #{id} [
975
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
976
+ ];
977
+ DOT
978
+
979
+ super
980
+ end
981
+
982
+ # Visit a ClassNode node.
983
+ def visit_class_node(node)
984
+ table = Table.new("ClassNode")
985
+ id = node_id(node)
986
+
987
+ # locals
988
+ table.field("locals", node.locals.inspect)
989
+
990
+ # class_keyword_loc
991
+ table.field("class_keyword_loc", location_inspect(node.class_keyword_loc))
992
+
993
+ # constant_path
994
+ table.field("constant_path", port: true)
995
+ digraph.edge("#{id}:constant_path -> #{node_id(node.constant_path)};")
996
+
997
+ # inheritance_operator_loc
998
+ unless (inheritance_operator_loc = node.inheritance_operator_loc).nil?
999
+ table.field("inheritance_operator_loc", location_inspect(inheritance_operator_loc))
1000
+ end
1001
+
1002
+ # superclass
1003
+ unless (superclass = node.superclass).nil?
1004
+ table.field("superclass", port: true)
1005
+ digraph.edge("#{id}:superclass -> #{node_id(superclass)};")
1006
+ end
1007
+
1008
+ # body
1009
+ unless (body = node.body).nil?
1010
+ table.field("body", port: true)
1011
+ digraph.edge("#{id}:body -> #{node_id(body)};")
1012
+ end
1013
+
1014
+ # end_keyword_loc
1015
+ table.field("end_keyword_loc", location_inspect(node.end_keyword_loc))
1016
+
1017
+ # name
1018
+ table.field("name", node.name.inspect)
1019
+
1020
+ digraph.nodes << <<~DOT
1021
+ #{id} [
1022
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1023
+ ];
1024
+ DOT
1025
+
1026
+ super
1027
+ end
1028
+
1029
+ # Visit a ClassVariableAndWriteNode node.
1030
+ def visit_class_variable_and_write_node(node)
1031
+ table = Table.new("ClassVariableAndWriteNode")
1032
+ id = node_id(node)
1033
+
1034
+ # name
1035
+ table.field("name", node.name.inspect)
1036
+
1037
+ # name_loc
1038
+ table.field("name_loc", location_inspect(node.name_loc))
1039
+
1040
+ # operator_loc
1041
+ table.field("operator_loc", location_inspect(node.operator_loc))
1042
+
1043
+ # value
1044
+ table.field("value", port: true)
1045
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
1046
+
1047
+ digraph.nodes << <<~DOT
1048
+ #{id} [
1049
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1050
+ ];
1051
+ DOT
1052
+
1053
+ super
1054
+ end
1055
+
1056
+ # Visit a ClassVariableOperatorWriteNode node.
1057
+ def visit_class_variable_operator_write_node(node)
1058
+ table = Table.new("ClassVariableOperatorWriteNode")
1059
+ id = node_id(node)
1060
+
1061
+ # name
1062
+ table.field("name", node.name.inspect)
1063
+
1064
+ # name_loc
1065
+ table.field("name_loc", location_inspect(node.name_loc))
1066
+
1067
+ # binary_operator_loc
1068
+ table.field("binary_operator_loc", location_inspect(node.binary_operator_loc))
1069
+
1070
+ # value
1071
+ table.field("value", port: true)
1072
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
1073
+
1074
+ # binary_operator
1075
+ table.field("binary_operator", node.binary_operator.inspect)
1076
+
1077
+ digraph.nodes << <<~DOT
1078
+ #{id} [
1079
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1080
+ ];
1081
+ DOT
1082
+
1083
+ super
1084
+ end
1085
+
1086
+ # Visit a ClassVariableOrWriteNode node.
1087
+ def visit_class_variable_or_write_node(node)
1088
+ table = Table.new("ClassVariableOrWriteNode")
1089
+ id = node_id(node)
1090
+
1091
+ # name
1092
+ table.field("name", node.name.inspect)
1093
+
1094
+ # name_loc
1095
+ table.field("name_loc", location_inspect(node.name_loc))
1096
+
1097
+ # operator_loc
1098
+ table.field("operator_loc", location_inspect(node.operator_loc))
1099
+
1100
+ # value
1101
+ table.field("value", port: true)
1102
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
1103
+
1104
+ digraph.nodes << <<~DOT
1105
+ #{id} [
1106
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1107
+ ];
1108
+ DOT
1109
+
1110
+ super
1111
+ end
1112
+
1113
+ # Visit a ClassVariableReadNode node.
1114
+ def visit_class_variable_read_node(node)
1115
+ table = Table.new("ClassVariableReadNode")
1116
+ id = node_id(node)
1117
+
1118
+ # name
1119
+ table.field("name", node.name.inspect)
1120
+
1121
+ digraph.nodes << <<~DOT
1122
+ #{id} [
1123
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1124
+ ];
1125
+ DOT
1126
+
1127
+ super
1128
+ end
1129
+
1130
+ # Visit a ClassVariableTargetNode node.
1131
+ def visit_class_variable_target_node(node)
1132
+ table = Table.new("ClassVariableTargetNode")
1133
+ id = node_id(node)
1134
+
1135
+ # name
1136
+ table.field("name", node.name.inspect)
1137
+
1138
+ digraph.nodes << <<~DOT
1139
+ #{id} [
1140
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1141
+ ];
1142
+ DOT
1143
+
1144
+ super
1145
+ end
1146
+
1147
+ # Visit a ClassVariableWriteNode node.
1148
+ def visit_class_variable_write_node(node)
1149
+ table = Table.new("ClassVariableWriteNode")
1150
+ id = node_id(node)
1151
+
1152
+ # name
1153
+ table.field("name", node.name.inspect)
1154
+
1155
+ # name_loc
1156
+ table.field("name_loc", location_inspect(node.name_loc))
1157
+
1158
+ # value
1159
+ table.field("value", port: true)
1160
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
1161
+
1162
+ # operator_loc
1163
+ table.field("operator_loc", location_inspect(node.operator_loc))
1164
+
1165
+ digraph.nodes << <<~DOT
1166
+ #{id} [
1167
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1168
+ ];
1169
+ DOT
1170
+
1171
+ super
1172
+ end
1173
+
1174
+ # Visit a ConstantAndWriteNode node.
1175
+ def visit_constant_and_write_node(node)
1176
+ table = Table.new("ConstantAndWriteNode")
1177
+ id = node_id(node)
1178
+
1179
+ # name
1180
+ table.field("name", node.name.inspect)
1181
+
1182
+ # name_loc
1183
+ table.field("name_loc", location_inspect(node.name_loc))
1184
+
1185
+ # operator_loc
1186
+ table.field("operator_loc", location_inspect(node.operator_loc))
1187
+
1188
+ # value
1189
+ table.field("value", port: true)
1190
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
1191
+
1192
+ digraph.nodes << <<~DOT
1193
+ #{id} [
1194
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1195
+ ];
1196
+ DOT
1197
+
1198
+ super
1199
+ end
1200
+
1201
+ # Visit a ConstantOperatorWriteNode node.
1202
+ def visit_constant_operator_write_node(node)
1203
+ table = Table.new("ConstantOperatorWriteNode")
1204
+ id = node_id(node)
1205
+
1206
+ # name
1207
+ table.field("name", node.name.inspect)
1208
+
1209
+ # name_loc
1210
+ table.field("name_loc", location_inspect(node.name_loc))
1211
+
1212
+ # binary_operator_loc
1213
+ table.field("binary_operator_loc", location_inspect(node.binary_operator_loc))
1214
+
1215
+ # value
1216
+ table.field("value", port: true)
1217
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
1218
+
1219
+ # binary_operator
1220
+ table.field("binary_operator", node.binary_operator.inspect)
1221
+
1222
+ digraph.nodes << <<~DOT
1223
+ #{id} [
1224
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1225
+ ];
1226
+ DOT
1227
+
1228
+ super
1229
+ end
1230
+
1231
+ # Visit a ConstantOrWriteNode node.
1232
+ def visit_constant_or_write_node(node)
1233
+ table = Table.new("ConstantOrWriteNode")
1234
+ id = node_id(node)
1235
+
1236
+ # name
1237
+ table.field("name", node.name.inspect)
1238
+
1239
+ # name_loc
1240
+ table.field("name_loc", location_inspect(node.name_loc))
1241
+
1242
+ # operator_loc
1243
+ table.field("operator_loc", location_inspect(node.operator_loc))
1244
+
1245
+ # value
1246
+ table.field("value", port: true)
1247
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
1248
+
1249
+ digraph.nodes << <<~DOT
1250
+ #{id} [
1251
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1252
+ ];
1253
+ DOT
1254
+
1255
+ super
1256
+ end
1257
+
1258
+ # Visit a ConstantPathAndWriteNode node.
1259
+ def visit_constant_path_and_write_node(node)
1260
+ table = Table.new("ConstantPathAndWriteNode")
1261
+ id = node_id(node)
1262
+
1263
+ # target
1264
+ table.field("target", port: true)
1265
+ digraph.edge("#{id}:target -> #{node_id(node.target)};")
1266
+
1267
+ # operator_loc
1268
+ table.field("operator_loc", location_inspect(node.operator_loc))
1269
+
1270
+ # value
1271
+ table.field("value", port: true)
1272
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
1273
+
1274
+ digraph.nodes << <<~DOT
1275
+ #{id} [
1276
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1277
+ ];
1278
+ DOT
1279
+
1280
+ super
1281
+ end
1282
+
1283
+ # Visit a ConstantPathNode node.
1284
+ def visit_constant_path_node(node)
1285
+ table = Table.new("ConstantPathNode")
1286
+ id = node_id(node)
1287
+
1288
+ # parent
1289
+ unless (parent = node.parent).nil?
1290
+ table.field("parent", port: true)
1291
+ digraph.edge("#{id}:parent -> #{node_id(parent)};")
1292
+ end
1293
+
1294
+ # name
1295
+ table.field("name", node.name.inspect)
1296
+
1297
+ # delimiter_loc
1298
+ table.field("delimiter_loc", location_inspect(node.delimiter_loc))
1299
+
1300
+ # name_loc
1301
+ table.field("name_loc", location_inspect(node.name_loc))
1302
+
1303
+ digraph.nodes << <<~DOT
1304
+ #{id} [
1305
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1306
+ ];
1307
+ DOT
1308
+
1309
+ super
1310
+ end
1311
+
1312
+ # Visit a ConstantPathOperatorWriteNode node.
1313
+ def visit_constant_path_operator_write_node(node)
1314
+ table = Table.new("ConstantPathOperatorWriteNode")
1315
+ id = node_id(node)
1316
+
1317
+ # target
1318
+ table.field("target", port: true)
1319
+ digraph.edge("#{id}:target -> #{node_id(node.target)};")
1320
+
1321
+ # binary_operator_loc
1322
+ table.field("binary_operator_loc", location_inspect(node.binary_operator_loc))
1323
+
1324
+ # value
1325
+ table.field("value", port: true)
1326
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
1327
+
1328
+ # binary_operator
1329
+ table.field("binary_operator", node.binary_operator.inspect)
1330
+
1331
+ digraph.nodes << <<~DOT
1332
+ #{id} [
1333
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1334
+ ];
1335
+ DOT
1336
+
1337
+ super
1338
+ end
1339
+
1340
+ # Visit a ConstantPathOrWriteNode node.
1341
+ def visit_constant_path_or_write_node(node)
1342
+ table = Table.new("ConstantPathOrWriteNode")
1343
+ id = node_id(node)
1344
+
1345
+ # target
1346
+ table.field("target", port: true)
1347
+ digraph.edge("#{id}:target -> #{node_id(node.target)};")
1348
+
1349
+ # operator_loc
1350
+ table.field("operator_loc", location_inspect(node.operator_loc))
1351
+
1352
+ # value
1353
+ table.field("value", port: true)
1354
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
1355
+
1356
+ digraph.nodes << <<~DOT
1357
+ #{id} [
1358
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1359
+ ];
1360
+ DOT
1361
+
1362
+ super
1363
+ end
1364
+
1365
+ # Visit a ConstantPathTargetNode node.
1366
+ def visit_constant_path_target_node(node)
1367
+ table = Table.new("ConstantPathTargetNode")
1368
+ id = node_id(node)
1369
+
1370
+ # parent
1371
+ unless (parent = node.parent).nil?
1372
+ table.field("parent", port: true)
1373
+ digraph.edge("#{id}:parent -> #{node_id(parent)};")
1374
+ end
1375
+
1376
+ # name
1377
+ table.field("name", node.name.inspect)
1378
+
1379
+ # delimiter_loc
1380
+ table.field("delimiter_loc", location_inspect(node.delimiter_loc))
1381
+
1382
+ # name_loc
1383
+ table.field("name_loc", location_inspect(node.name_loc))
1384
+
1385
+ digraph.nodes << <<~DOT
1386
+ #{id} [
1387
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1388
+ ];
1389
+ DOT
1390
+
1391
+ super
1392
+ end
1393
+
1394
+ # Visit a ConstantPathWriteNode node.
1395
+ def visit_constant_path_write_node(node)
1396
+ table = Table.new("ConstantPathWriteNode")
1397
+ id = node_id(node)
1398
+
1399
+ # target
1400
+ table.field("target", port: true)
1401
+ digraph.edge("#{id}:target -> #{node_id(node.target)};")
1402
+
1403
+ # operator_loc
1404
+ table.field("operator_loc", location_inspect(node.operator_loc))
1405
+
1406
+ # value
1407
+ table.field("value", port: true)
1408
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
1409
+
1410
+ digraph.nodes << <<~DOT
1411
+ #{id} [
1412
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1413
+ ];
1414
+ DOT
1415
+
1416
+ super
1417
+ end
1418
+
1419
+ # Visit a ConstantReadNode node.
1420
+ def visit_constant_read_node(node)
1421
+ table = Table.new("ConstantReadNode")
1422
+ id = node_id(node)
1423
+
1424
+ # name
1425
+ table.field("name", node.name.inspect)
1426
+
1427
+ digraph.nodes << <<~DOT
1428
+ #{id} [
1429
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1430
+ ];
1431
+ DOT
1432
+
1433
+ super
1434
+ end
1435
+
1436
+ # Visit a ConstantTargetNode node.
1437
+ def visit_constant_target_node(node)
1438
+ table = Table.new("ConstantTargetNode")
1439
+ id = node_id(node)
1440
+
1441
+ # name
1442
+ table.field("name", node.name.inspect)
1443
+
1444
+ digraph.nodes << <<~DOT
1445
+ #{id} [
1446
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1447
+ ];
1448
+ DOT
1449
+
1450
+ super
1451
+ end
1452
+
1453
+ # Visit a ConstantWriteNode node.
1454
+ def visit_constant_write_node(node)
1455
+ table = Table.new("ConstantWriteNode")
1456
+ id = node_id(node)
1457
+
1458
+ # name
1459
+ table.field("name", node.name.inspect)
1460
+
1461
+ # name_loc
1462
+ table.field("name_loc", location_inspect(node.name_loc))
1463
+
1464
+ # value
1465
+ table.field("value", port: true)
1466
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
1467
+
1468
+ # operator_loc
1469
+ table.field("operator_loc", location_inspect(node.operator_loc))
1470
+
1471
+ digraph.nodes << <<~DOT
1472
+ #{id} [
1473
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1474
+ ];
1475
+ DOT
1476
+
1477
+ super
1478
+ end
1479
+
1480
+ # Visit a DefNode node.
1481
+ def visit_def_node(node)
1482
+ table = Table.new("DefNode")
1483
+ id = node_id(node)
1484
+
1485
+ # name
1486
+ table.field("name", node.name.inspect)
1487
+
1488
+ # name_loc
1489
+ table.field("name_loc", location_inspect(node.name_loc))
1490
+
1491
+ # receiver
1492
+ unless (receiver = node.receiver).nil?
1493
+ table.field("receiver", port: true)
1494
+ digraph.edge("#{id}:receiver -> #{node_id(receiver)};")
1495
+ end
1496
+
1497
+ # parameters
1498
+ unless (parameters = node.parameters).nil?
1499
+ table.field("parameters", port: true)
1500
+ digraph.edge("#{id}:parameters -> #{node_id(parameters)};")
1501
+ end
1502
+
1503
+ # body
1504
+ unless (body = node.body).nil?
1505
+ table.field("body", port: true)
1506
+ digraph.edge("#{id}:body -> #{node_id(body)};")
1507
+ end
1508
+
1509
+ # locals
1510
+ table.field("locals", node.locals.inspect)
1511
+
1512
+ # def_keyword_loc
1513
+ table.field("def_keyword_loc", location_inspect(node.def_keyword_loc))
1514
+
1515
+ # operator_loc
1516
+ unless (operator_loc = node.operator_loc).nil?
1517
+ table.field("operator_loc", location_inspect(operator_loc))
1518
+ end
1519
+
1520
+ # lparen_loc
1521
+ unless (lparen_loc = node.lparen_loc).nil?
1522
+ table.field("lparen_loc", location_inspect(lparen_loc))
1523
+ end
1524
+
1525
+ # rparen_loc
1526
+ unless (rparen_loc = node.rparen_loc).nil?
1527
+ table.field("rparen_loc", location_inspect(rparen_loc))
1528
+ end
1529
+
1530
+ # equal_loc
1531
+ unless (equal_loc = node.equal_loc).nil?
1532
+ table.field("equal_loc", location_inspect(equal_loc))
1533
+ end
1534
+
1535
+ # end_keyword_loc
1536
+ unless (end_keyword_loc = node.end_keyword_loc).nil?
1537
+ table.field("end_keyword_loc", location_inspect(end_keyword_loc))
1538
+ end
1539
+
1540
+ digraph.nodes << <<~DOT
1541
+ #{id} [
1542
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1543
+ ];
1544
+ DOT
1545
+
1546
+ super
1547
+ end
1548
+
1549
+ # Visit a DefinedNode node.
1550
+ def visit_defined_node(node)
1551
+ table = Table.new("DefinedNode")
1552
+ id = node_id(node)
1553
+
1554
+ # lparen_loc
1555
+ unless (lparen_loc = node.lparen_loc).nil?
1556
+ table.field("lparen_loc", location_inspect(lparen_loc))
1557
+ end
1558
+
1559
+ # value
1560
+ table.field("value", port: true)
1561
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
1562
+
1563
+ # rparen_loc
1564
+ unless (rparen_loc = node.rparen_loc).nil?
1565
+ table.field("rparen_loc", location_inspect(rparen_loc))
1566
+ end
1567
+
1568
+ # keyword_loc
1569
+ table.field("keyword_loc", location_inspect(node.keyword_loc))
1570
+
1571
+ digraph.nodes << <<~DOT
1572
+ #{id} [
1573
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1574
+ ];
1575
+ DOT
1576
+
1577
+ super
1578
+ end
1579
+
1580
+ # Visit a ElseNode node.
1581
+ def visit_else_node(node)
1582
+ table = Table.new("ElseNode")
1583
+ id = node_id(node)
1584
+
1585
+ # else_keyword_loc
1586
+ table.field("else_keyword_loc", location_inspect(node.else_keyword_loc))
1587
+
1588
+ # statements
1589
+ unless (statements = node.statements).nil?
1590
+ table.field("statements", port: true)
1591
+ digraph.edge("#{id}:statements -> #{node_id(statements)};")
1592
+ end
1593
+
1594
+ # end_keyword_loc
1595
+ unless (end_keyword_loc = node.end_keyword_loc).nil?
1596
+ table.field("end_keyword_loc", location_inspect(end_keyword_loc))
1597
+ end
1598
+
1599
+ digraph.nodes << <<~DOT
1600
+ #{id} [
1601
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1602
+ ];
1603
+ DOT
1604
+
1605
+ super
1606
+ end
1607
+
1608
+ # Visit a EmbeddedStatementsNode node.
1609
+ def visit_embedded_statements_node(node)
1610
+ table = Table.new("EmbeddedStatementsNode")
1611
+ id = node_id(node)
1612
+
1613
+ # opening_loc
1614
+ table.field("opening_loc", location_inspect(node.opening_loc))
1615
+
1616
+ # statements
1617
+ unless (statements = node.statements).nil?
1618
+ table.field("statements", port: true)
1619
+ digraph.edge("#{id}:statements -> #{node_id(statements)};")
1620
+ end
1621
+
1622
+ # closing_loc
1623
+ table.field("closing_loc", location_inspect(node.closing_loc))
1624
+
1625
+ digraph.nodes << <<~DOT
1626
+ #{id} [
1627
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1628
+ ];
1629
+ DOT
1630
+
1631
+ super
1632
+ end
1633
+
1634
+ # Visit a EmbeddedVariableNode node.
1635
+ def visit_embedded_variable_node(node)
1636
+ table = Table.new("EmbeddedVariableNode")
1637
+ id = node_id(node)
1638
+
1639
+ # operator_loc
1640
+ table.field("operator_loc", location_inspect(node.operator_loc))
1641
+
1642
+ # variable
1643
+ table.field("variable", port: true)
1644
+ digraph.edge("#{id}:variable -> #{node_id(node.variable)};")
1645
+
1646
+ digraph.nodes << <<~DOT
1647
+ #{id} [
1648
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1649
+ ];
1650
+ DOT
1651
+
1652
+ super
1653
+ end
1654
+
1655
+ # Visit a EnsureNode node.
1656
+ def visit_ensure_node(node)
1657
+ table = Table.new("EnsureNode")
1658
+ id = node_id(node)
1659
+
1660
+ # ensure_keyword_loc
1661
+ table.field("ensure_keyword_loc", location_inspect(node.ensure_keyword_loc))
1662
+
1663
+ # statements
1664
+ unless (statements = node.statements).nil?
1665
+ table.field("statements", port: true)
1666
+ digraph.edge("#{id}:statements -> #{node_id(statements)};")
1667
+ end
1668
+
1669
+ # end_keyword_loc
1670
+ table.field("end_keyword_loc", location_inspect(node.end_keyword_loc))
1671
+
1672
+ digraph.nodes << <<~DOT
1673
+ #{id} [
1674
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1675
+ ];
1676
+ DOT
1677
+
1678
+ super
1679
+ end
1680
+
1681
+ # Visit a FalseNode node.
1682
+ def visit_false_node(node)
1683
+ table = Table.new("FalseNode")
1684
+ id = node_id(node)
1685
+
1686
+ digraph.nodes << <<~DOT
1687
+ #{id} [
1688
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1689
+ ];
1690
+ DOT
1691
+
1692
+ super
1693
+ end
1694
+
1695
+ # Visit a FindPatternNode node.
1696
+ def visit_find_pattern_node(node)
1697
+ table = Table.new("FindPatternNode")
1698
+ id = node_id(node)
1699
+
1700
+ # constant
1701
+ unless (constant = node.constant).nil?
1702
+ table.field("constant", port: true)
1703
+ digraph.edge("#{id}:constant -> #{node_id(constant)};")
1704
+ end
1705
+
1706
+ # left
1707
+ table.field("left", port: true)
1708
+ digraph.edge("#{id}:left -> #{node_id(node.left)};")
1709
+
1710
+ # requireds
1711
+ if node.requireds.any?
1712
+ table.field("requireds", port: true)
1713
+
1714
+ waypoint = "#{id}_requireds"
1715
+ digraph.waypoint("#{waypoint};")
1716
+
1717
+ digraph.edge("#{id}:requireds -> #{waypoint};")
1718
+ node.requireds.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
1719
+ else
1720
+ table.field("requireds", "[]")
1721
+ end
1722
+
1723
+ # right
1724
+ table.field("right", port: true)
1725
+ digraph.edge("#{id}:right -> #{node_id(node.right)};")
1726
+
1727
+ # opening_loc
1728
+ unless (opening_loc = node.opening_loc).nil?
1729
+ table.field("opening_loc", location_inspect(opening_loc))
1730
+ end
1731
+
1732
+ # closing_loc
1733
+ unless (closing_loc = node.closing_loc).nil?
1734
+ table.field("closing_loc", location_inspect(closing_loc))
1735
+ end
1736
+
1737
+ digraph.nodes << <<~DOT
1738
+ #{id} [
1739
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1740
+ ];
1741
+ DOT
1742
+
1743
+ super
1744
+ end
1745
+
1746
+ # Visit a FlipFlopNode node.
1747
+ def visit_flip_flop_node(node)
1748
+ table = Table.new("FlipFlopNode")
1749
+ id = node_id(node)
1750
+
1751
+ # flags
1752
+ table.field("flags", range_flags_inspect(node))
1753
+
1754
+ # left
1755
+ unless (left = node.left).nil?
1756
+ table.field("left", port: true)
1757
+ digraph.edge("#{id}:left -> #{node_id(left)};")
1758
+ end
1759
+
1760
+ # right
1761
+ unless (right = node.right).nil?
1762
+ table.field("right", port: true)
1763
+ digraph.edge("#{id}:right -> #{node_id(right)};")
1764
+ end
1765
+
1766
+ # operator_loc
1767
+ table.field("operator_loc", location_inspect(node.operator_loc))
1768
+
1769
+ digraph.nodes << <<~DOT
1770
+ #{id} [
1771
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1772
+ ];
1773
+ DOT
1774
+
1775
+ super
1776
+ end
1777
+
1778
+ # Visit a FloatNode node.
1779
+ def visit_float_node(node)
1780
+ table = Table.new("FloatNode")
1781
+ id = node_id(node)
1782
+
1783
+ # value
1784
+ table.field("value", node.value.inspect)
1785
+
1786
+ digraph.nodes << <<~DOT
1787
+ #{id} [
1788
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1789
+ ];
1790
+ DOT
1791
+
1792
+ super
1793
+ end
1794
+
1795
+ # Visit a ForNode node.
1796
+ def visit_for_node(node)
1797
+ table = Table.new("ForNode")
1798
+ id = node_id(node)
1799
+
1800
+ # index
1801
+ table.field("index", port: true)
1802
+ digraph.edge("#{id}:index -> #{node_id(node.index)};")
1803
+
1804
+ # collection
1805
+ table.field("collection", port: true)
1806
+ digraph.edge("#{id}:collection -> #{node_id(node.collection)};")
1807
+
1808
+ # statements
1809
+ unless (statements = node.statements).nil?
1810
+ table.field("statements", port: true)
1811
+ digraph.edge("#{id}:statements -> #{node_id(statements)};")
1812
+ end
1813
+
1814
+ # for_keyword_loc
1815
+ table.field("for_keyword_loc", location_inspect(node.for_keyword_loc))
1816
+
1817
+ # in_keyword_loc
1818
+ table.field("in_keyword_loc", location_inspect(node.in_keyword_loc))
1819
+
1820
+ # do_keyword_loc
1821
+ unless (do_keyword_loc = node.do_keyword_loc).nil?
1822
+ table.field("do_keyword_loc", location_inspect(do_keyword_loc))
1823
+ end
1824
+
1825
+ # end_keyword_loc
1826
+ table.field("end_keyword_loc", location_inspect(node.end_keyword_loc))
1827
+
1828
+ digraph.nodes << <<~DOT
1829
+ #{id} [
1830
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1831
+ ];
1832
+ DOT
1833
+
1834
+ super
1835
+ end
1836
+
1837
+ # Visit a ForwardingArgumentsNode node.
1838
+ def visit_forwarding_arguments_node(node)
1839
+ table = Table.new("ForwardingArgumentsNode")
1840
+ id = node_id(node)
1841
+
1842
+ digraph.nodes << <<~DOT
1843
+ #{id} [
1844
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1845
+ ];
1846
+ DOT
1847
+
1848
+ super
1849
+ end
1850
+
1851
+ # Visit a ForwardingParameterNode node.
1852
+ def visit_forwarding_parameter_node(node)
1853
+ table = Table.new("ForwardingParameterNode")
1854
+ id = node_id(node)
1855
+
1856
+ digraph.nodes << <<~DOT
1857
+ #{id} [
1858
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1859
+ ];
1860
+ DOT
1861
+
1862
+ super
1863
+ end
1864
+
1865
+ # Visit a ForwardingSuperNode node.
1866
+ def visit_forwarding_super_node(node)
1867
+ table = Table.new("ForwardingSuperNode")
1868
+ id = node_id(node)
1869
+
1870
+ # block
1871
+ unless (block = node.block).nil?
1872
+ table.field("block", port: true)
1873
+ digraph.edge("#{id}:block -> #{node_id(block)};")
1874
+ end
1875
+
1876
+ digraph.nodes << <<~DOT
1877
+ #{id} [
1878
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1879
+ ];
1880
+ DOT
1881
+
1882
+ super
1883
+ end
1884
+
1885
+ # Visit a GlobalVariableAndWriteNode node.
1886
+ def visit_global_variable_and_write_node(node)
1887
+ table = Table.new("GlobalVariableAndWriteNode")
1888
+ id = node_id(node)
1889
+
1890
+ # name
1891
+ table.field("name", node.name.inspect)
1892
+
1893
+ # name_loc
1894
+ table.field("name_loc", location_inspect(node.name_loc))
1895
+
1896
+ # operator_loc
1897
+ table.field("operator_loc", location_inspect(node.operator_loc))
1898
+
1899
+ # value
1900
+ table.field("value", port: true)
1901
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
1902
+
1903
+ digraph.nodes << <<~DOT
1904
+ #{id} [
1905
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1906
+ ];
1907
+ DOT
1908
+
1909
+ super
1910
+ end
1911
+
1912
+ # Visit a GlobalVariableOperatorWriteNode node.
1913
+ def visit_global_variable_operator_write_node(node)
1914
+ table = Table.new("GlobalVariableOperatorWriteNode")
1915
+ id = node_id(node)
1916
+
1917
+ # name
1918
+ table.field("name", node.name.inspect)
1919
+
1920
+ # name_loc
1921
+ table.field("name_loc", location_inspect(node.name_loc))
1922
+
1923
+ # binary_operator_loc
1924
+ table.field("binary_operator_loc", location_inspect(node.binary_operator_loc))
1925
+
1926
+ # value
1927
+ table.field("value", port: true)
1928
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
1929
+
1930
+ # binary_operator
1931
+ table.field("binary_operator", node.binary_operator.inspect)
1932
+
1933
+ digraph.nodes << <<~DOT
1934
+ #{id} [
1935
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1936
+ ];
1937
+ DOT
1938
+
1939
+ super
1940
+ end
1941
+
1942
+ # Visit a GlobalVariableOrWriteNode node.
1943
+ def visit_global_variable_or_write_node(node)
1944
+ table = Table.new("GlobalVariableOrWriteNode")
1945
+ id = node_id(node)
1946
+
1947
+ # name
1948
+ table.field("name", node.name.inspect)
1949
+
1950
+ # name_loc
1951
+ table.field("name_loc", location_inspect(node.name_loc))
1952
+
1953
+ # operator_loc
1954
+ table.field("operator_loc", location_inspect(node.operator_loc))
1955
+
1956
+ # value
1957
+ table.field("value", port: true)
1958
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
1959
+
1960
+ digraph.nodes << <<~DOT
1961
+ #{id} [
1962
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1963
+ ];
1964
+ DOT
1965
+
1966
+ super
1967
+ end
1968
+
1969
+ # Visit a GlobalVariableReadNode node.
1970
+ def visit_global_variable_read_node(node)
1971
+ table = Table.new("GlobalVariableReadNode")
1972
+ id = node_id(node)
1973
+
1974
+ # name
1975
+ table.field("name", node.name.inspect)
1976
+
1977
+ digraph.nodes << <<~DOT
1978
+ #{id} [
1979
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1980
+ ];
1981
+ DOT
1982
+
1983
+ super
1984
+ end
1985
+
1986
+ # Visit a GlobalVariableTargetNode node.
1987
+ def visit_global_variable_target_node(node)
1988
+ table = Table.new("GlobalVariableTargetNode")
1989
+ id = node_id(node)
1990
+
1991
+ # name
1992
+ table.field("name", node.name.inspect)
1993
+
1994
+ digraph.nodes << <<~DOT
1995
+ #{id} [
1996
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
1997
+ ];
1998
+ DOT
1999
+
2000
+ super
2001
+ end
2002
+
2003
+ # Visit a GlobalVariableWriteNode node.
2004
+ def visit_global_variable_write_node(node)
2005
+ table = Table.new("GlobalVariableWriteNode")
2006
+ id = node_id(node)
2007
+
2008
+ # name
2009
+ table.field("name", node.name.inspect)
2010
+
2011
+ # name_loc
2012
+ table.field("name_loc", location_inspect(node.name_loc))
2013
+
2014
+ # value
2015
+ table.field("value", port: true)
2016
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
2017
+
2018
+ # operator_loc
2019
+ table.field("operator_loc", location_inspect(node.operator_loc))
2020
+
2021
+ digraph.nodes << <<~DOT
2022
+ #{id} [
2023
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2024
+ ];
2025
+ DOT
2026
+
2027
+ super
2028
+ end
2029
+
2030
+ # Visit a HashNode node.
2031
+ def visit_hash_node(node)
2032
+ table = Table.new("HashNode")
2033
+ id = node_id(node)
2034
+
2035
+ # opening_loc
2036
+ table.field("opening_loc", location_inspect(node.opening_loc))
2037
+
2038
+ # elements
2039
+ if node.elements.any?
2040
+ table.field("elements", port: true)
2041
+
2042
+ waypoint = "#{id}_elements"
2043
+ digraph.waypoint("#{waypoint};")
2044
+
2045
+ digraph.edge("#{id}:elements -> #{waypoint};")
2046
+ node.elements.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
2047
+ else
2048
+ table.field("elements", "[]")
2049
+ end
2050
+
2051
+ # closing_loc
2052
+ table.field("closing_loc", location_inspect(node.closing_loc))
2053
+
2054
+ digraph.nodes << <<~DOT
2055
+ #{id} [
2056
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2057
+ ];
2058
+ DOT
2059
+
2060
+ super
2061
+ end
2062
+
2063
+ # Visit a HashPatternNode node.
2064
+ def visit_hash_pattern_node(node)
2065
+ table = Table.new("HashPatternNode")
2066
+ id = node_id(node)
2067
+
2068
+ # constant
2069
+ unless (constant = node.constant).nil?
2070
+ table.field("constant", port: true)
2071
+ digraph.edge("#{id}:constant -> #{node_id(constant)};")
2072
+ end
2073
+
2074
+ # elements
2075
+ if node.elements.any?
2076
+ table.field("elements", port: true)
2077
+
2078
+ waypoint = "#{id}_elements"
2079
+ digraph.waypoint("#{waypoint};")
2080
+
2081
+ digraph.edge("#{id}:elements -> #{waypoint};")
2082
+ node.elements.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
2083
+ else
2084
+ table.field("elements", "[]")
2085
+ end
2086
+
2087
+ # rest
2088
+ unless (rest = node.rest).nil?
2089
+ table.field("rest", port: true)
2090
+ digraph.edge("#{id}:rest -> #{node_id(rest)};")
2091
+ end
2092
+
2093
+ # opening_loc
2094
+ unless (opening_loc = node.opening_loc).nil?
2095
+ table.field("opening_loc", location_inspect(opening_loc))
2096
+ end
2097
+
2098
+ # closing_loc
2099
+ unless (closing_loc = node.closing_loc).nil?
2100
+ table.field("closing_loc", location_inspect(closing_loc))
2101
+ end
2102
+
2103
+ digraph.nodes << <<~DOT
2104
+ #{id} [
2105
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2106
+ ];
2107
+ DOT
2108
+
2109
+ super
2110
+ end
2111
+
2112
+ # Visit a IfNode node.
2113
+ def visit_if_node(node)
2114
+ table = Table.new("IfNode")
2115
+ id = node_id(node)
2116
+
2117
+ # if_keyword_loc
2118
+ unless (if_keyword_loc = node.if_keyword_loc).nil?
2119
+ table.field("if_keyword_loc", location_inspect(if_keyword_loc))
2120
+ end
2121
+
2122
+ # predicate
2123
+ table.field("predicate", port: true)
2124
+ digraph.edge("#{id}:predicate -> #{node_id(node.predicate)};")
2125
+
2126
+ # then_keyword_loc
2127
+ unless (then_keyword_loc = node.then_keyword_loc).nil?
2128
+ table.field("then_keyword_loc", location_inspect(then_keyword_loc))
2129
+ end
2130
+
2131
+ # statements
2132
+ unless (statements = node.statements).nil?
2133
+ table.field("statements", port: true)
2134
+ digraph.edge("#{id}:statements -> #{node_id(statements)};")
2135
+ end
2136
+
2137
+ # subsequent
2138
+ unless (subsequent = node.subsequent).nil?
2139
+ table.field("subsequent", port: true)
2140
+ digraph.edge("#{id}:subsequent -> #{node_id(subsequent)};")
2141
+ end
2142
+
2143
+ # end_keyword_loc
2144
+ unless (end_keyword_loc = node.end_keyword_loc).nil?
2145
+ table.field("end_keyword_loc", location_inspect(end_keyword_loc))
2146
+ end
2147
+
2148
+ digraph.nodes << <<~DOT
2149
+ #{id} [
2150
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2151
+ ];
2152
+ DOT
2153
+
2154
+ super
2155
+ end
2156
+
2157
+ # Visit a ImaginaryNode node.
2158
+ def visit_imaginary_node(node)
2159
+ table = Table.new("ImaginaryNode")
2160
+ id = node_id(node)
2161
+
2162
+ # numeric
2163
+ table.field("numeric", port: true)
2164
+ digraph.edge("#{id}:numeric -> #{node_id(node.numeric)};")
2165
+
2166
+ digraph.nodes << <<~DOT
2167
+ #{id} [
2168
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2169
+ ];
2170
+ DOT
2171
+
2172
+ super
2173
+ end
2174
+
2175
+ # Visit a ImplicitNode node.
2176
+ def visit_implicit_node(node)
2177
+ table = Table.new("ImplicitNode")
2178
+ id = node_id(node)
2179
+
2180
+ # value
2181
+ table.field("value", port: true)
2182
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
2183
+
2184
+ digraph.nodes << <<~DOT
2185
+ #{id} [
2186
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2187
+ ];
2188
+ DOT
2189
+
2190
+ super
2191
+ end
2192
+
2193
+ # Visit a ImplicitRestNode node.
2194
+ def visit_implicit_rest_node(node)
2195
+ table = Table.new("ImplicitRestNode")
2196
+ id = node_id(node)
2197
+
2198
+ digraph.nodes << <<~DOT
2199
+ #{id} [
2200
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2201
+ ];
2202
+ DOT
2203
+
2204
+ super
2205
+ end
2206
+
2207
+ # Visit a InNode node.
2208
+ def visit_in_node(node)
2209
+ table = Table.new("InNode")
2210
+ id = node_id(node)
2211
+
2212
+ # pattern
2213
+ table.field("pattern", port: true)
2214
+ digraph.edge("#{id}:pattern -> #{node_id(node.pattern)};")
2215
+
2216
+ # statements
2217
+ unless (statements = node.statements).nil?
2218
+ table.field("statements", port: true)
2219
+ digraph.edge("#{id}:statements -> #{node_id(statements)};")
2220
+ end
2221
+
2222
+ # in_loc
2223
+ table.field("in_loc", location_inspect(node.in_loc))
2224
+
2225
+ # then_loc
2226
+ unless (then_loc = node.then_loc).nil?
2227
+ table.field("then_loc", location_inspect(then_loc))
2228
+ end
2229
+
2230
+ digraph.nodes << <<~DOT
2231
+ #{id} [
2232
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2233
+ ];
2234
+ DOT
2235
+
2236
+ super
2237
+ end
2238
+
2239
+ # Visit a IndexAndWriteNode node.
2240
+ def visit_index_and_write_node(node)
2241
+ table = Table.new("IndexAndWriteNode")
2242
+ id = node_id(node)
2243
+
2244
+ # flags
2245
+ table.field("flags", call_node_flags_inspect(node))
2246
+
2247
+ # receiver
2248
+ unless (receiver = node.receiver).nil?
2249
+ table.field("receiver", port: true)
2250
+ digraph.edge("#{id}:receiver -> #{node_id(receiver)};")
2251
+ end
2252
+
2253
+ # call_operator_loc
2254
+ unless (call_operator_loc = node.call_operator_loc).nil?
2255
+ table.field("call_operator_loc", location_inspect(call_operator_loc))
2256
+ end
2257
+
2258
+ # opening_loc
2259
+ table.field("opening_loc", location_inspect(node.opening_loc))
2260
+
2261
+ # arguments
2262
+ unless (arguments = node.arguments).nil?
2263
+ table.field("arguments", port: true)
2264
+ digraph.edge("#{id}:arguments -> #{node_id(arguments)};")
2265
+ end
2266
+
2267
+ # closing_loc
2268
+ table.field("closing_loc", location_inspect(node.closing_loc))
2269
+
2270
+ # block
2271
+ unless (block = node.block).nil?
2272
+ table.field("block", port: true)
2273
+ digraph.edge("#{id}:block -> #{node_id(block)};")
2274
+ end
2275
+
2276
+ # operator_loc
2277
+ table.field("operator_loc", location_inspect(node.operator_loc))
2278
+
2279
+ # value
2280
+ table.field("value", port: true)
2281
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
2282
+
2283
+ digraph.nodes << <<~DOT
2284
+ #{id} [
2285
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2286
+ ];
2287
+ DOT
2288
+
2289
+ super
2290
+ end
2291
+
2292
+ # Visit a IndexOperatorWriteNode node.
2293
+ def visit_index_operator_write_node(node)
2294
+ table = Table.new("IndexOperatorWriteNode")
2295
+ id = node_id(node)
2296
+
2297
+ # flags
2298
+ table.field("flags", call_node_flags_inspect(node))
2299
+
2300
+ # receiver
2301
+ unless (receiver = node.receiver).nil?
2302
+ table.field("receiver", port: true)
2303
+ digraph.edge("#{id}:receiver -> #{node_id(receiver)};")
2304
+ end
2305
+
2306
+ # call_operator_loc
2307
+ unless (call_operator_loc = node.call_operator_loc).nil?
2308
+ table.field("call_operator_loc", location_inspect(call_operator_loc))
2309
+ end
2310
+
2311
+ # opening_loc
2312
+ table.field("opening_loc", location_inspect(node.opening_loc))
2313
+
2314
+ # arguments
2315
+ unless (arguments = node.arguments).nil?
2316
+ table.field("arguments", port: true)
2317
+ digraph.edge("#{id}:arguments -> #{node_id(arguments)};")
2318
+ end
2319
+
2320
+ # closing_loc
2321
+ table.field("closing_loc", location_inspect(node.closing_loc))
2322
+
2323
+ # block
2324
+ unless (block = node.block).nil?
2325
+ table.field("block", port: true)
2326
+ digraph.edge("#{id}:block -> #{node_id(block)};")
2327
+ end
2328
+
2329
+ # binary_operator
2330
+ table.field("binary_operator", node.binary_operator.inspect)
2331
+
2332
+ # binary_operator_loc
2333
+ table.field("binary_operator_loc", location_inspect(node.binary_operator_loc))
2334
+
2335
+ # value
2336
+ table.field("value", port: true)
2337
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
2338
+
2339
+ digraph.nodes << <<~DOT
2340
+ #{id} [
2341
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2342
+ ];
2343
+ DOT
2344
+
2345
+ super
2346
+ end
2347
+
2348
+ # Visit a IndexOrWriteNode node.
2349
+ def visit_index_or_write_node(node)
2350
+ table = Table.new("IndexOrWriteNode")
2351
+ id = node_id(node)
2352
+
2353
+ # flags
2354
+ table.field("flags", call_node_flags_inspect(node))
2355
+
2356
+ # receiver
2357
+ unless (receiver = node.receiver).nil?
2358
+ table.field("receiver", port: true)
2359
+ digraph.edge("#{id}:receiver -> #{node_id(receiver)};")
2360
+ end
2361
+
2362
+ # call_operator_loc
2363
+ unless (call_operator_loc = node.call_operator_loc).nil?
2364
+ table.field("call_operator_loc", location_inspect(call_operator_loc))
2365
+ end
2366
+
2367
+ # opening_loc
2368
+ table.field("opening_loc", location_inspect(node.opening_loc))
2369
+
2370
+ # arguments
2371
+ unless (arguments = node.arguments).nil?
2372
+ table.field("arguments", port: true)
2373
+ digraph.edge("#{id}:arguments -> #{node_id(arguments)};")
2374
+ end
2375
+
2376
+ # closing_loc
2377
+ table.field("closing_loc", location_inspect(node.closing_loc))
2378
+
2379
+ # block
2380
+ unless (block = node.block).nil?
2381
+ table.field("block", port: true)
2382
+ digraph.edge("#{id}:block -> #{node_id(block)};")
2383
+ end
2384
+
2385
+ # operator_loc
2386
+ table.field("operator_loc", location_inspect(node.operator_loc))
2387
+
2388
+ # value
2389
+ table.field("value", port: true)
2390
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
2391
+
2392
+ digraph.nodes << <<~DOT
2393
+ #{id} [
2394
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2395
+ ];
2396
+ DOT
2397
+
2398
+ super
2399
+ end
2400
+
2401
+ # Visit a IndexTargetNode node.
2402
+ def visit_index_target_node(node)
2403
+ table = Table.new("IndexTargetNode")
2404
+ id = node_id(node)
2405
+
2406
+ # flags
2407
+ table.field("flags", call_node_flags_inspect(node))
2408
+
2409
+ # receiver
2410
+ table.field("receiver", port: true)
2411
+ digraph.edge("#{id}:receiver -> #{node_id(node.receiver)};")
2412
+
2413
+ # opening_loc
2414
+ table.field("opening_loc", location_inspect(node.opening_loc))
2415
+
2416
+ # arguments
2417
+ unless (arguments = node.arguments).nil?
2418
+ table.field("arguments", port: true)
2419
+ digraph.edge("#{id}:arguments -> #{node_id(arguments)};")
2420
+ end
2421
+
2422
+ # closing_loc
2423
+ table.field("closing_loc", location_inspect(node.closing_loc))
2424
+
2425
+ # block
2426
+ unless (block = node.block).nil?
2427
+ table.field("block", port: true)
2428
+ digraph.edge("#{id}:block -> #{node_id(block)};")
2429
+ end
2430
+
2431
+ digraph.nodes << <<~DOT
2432
+ #{id} [
2433
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2434
+ ];
2435
+ DOT
2436
+
2437
+ super
2438
+ end
2439
+
2440
+ # Visit a InstanceVariableAndWriteNode node.
2441
+ def visit_instance_variable_and_write_node(node)
2442
+ table = Table.new("InstanceVariableAndWriteNode")
2443
+ id = node_id(node)
2444
+
2445
+ # name
2446
+ table.field("name", node.name.inspect)
2447
+
2448
+ # name_loc
2449
+ table.field("name_loc", location_inspect(node.name_loc))
2450
+
2451
+ # operator_loc
2452
+ table.field("operator_loc", location_inspect(node.operator_loc))
2453
+
2454
+ # value
2455
+ table.field("value", port: true)
2456
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
2457
+
2458
+ digraph.nodes << <<~DOT
2459
+ #{id} [
2460
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2461
+ ];
2462
+ DOT
2463
+
2464
+ super
2465
+ end
2466
+
2467
+ # Visit a InstanceVariableOperatorWriteNode node.
2468
+ def visit_instance_variable_operator_write_node(node)
2469
+ table = Table.new("InstanceVariableOperatorWriteNode")
2470
+ id = node_id(node)
2471
+
2472
+ # name
2473
+ table.field("name", node.name.inspect)
2474
+
2475
+ # name_loc
2476
+ table.field("name_loc", location_inspect(node.name_loc))
2477
+
2478
+ # binary_operator_loc
2479
+ table.field("binary_operator_loc", location_inspect(node.binary_operator_loc))
2480
+
2481
+ # value
2482
+ table.field("value", port: true)
2483
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
2484
+
2485
+ # binary_operator
2486
+ table.field("binary_operator", node.binary_operator.inspect)
2487
+
2488
+ digraph.nodes << <<~DOT
2489
+ #{id} [
2490
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2491
+ ];
2492
+ DOT
2493
+
2494
+ super
2495
+ end
2496
+
2497
+ # Visit a InstanceVariableOrWriteNode node.
2498
+ def visit_instance_variable_or_write_node(node)
2499
+ table = Table.new("InstanceVariableOrWriteNode")
2500
+ id = node_id(node)
2501
+
2502
+ # name
2503
+ table.field("name", node.name.inspect)
2504
+
2505
+ # name_loc
2506
+ table.field("name_loc", location_inspect(node.name_loc))
2507
+
2508
+ # operator_loc
2509
+ table.field("operator_loc", location_inspect(node.operator_loc))
2510
+
2511
+ # value
2512
+ table.field("value", port: true)
2513
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
2514
+
2515
+ digraph.nodes << <<~DOT
2516
+ #{id} [
2517
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2518
+ ];
2519
+ DOT
2520
+
2521
+ super
2522
+ end
2523
+
2524
+ # Visit a InstanceVariableReadNode node.
2525
+ def visit_instance_variable_read_node(node)
2526
+ table = Table.new("InstanceVariableReadNode")
2527
+ id = node_id(node)
2528
+
2529
+ # name
2530
+ table.field("name", node.name.inspect)
2531
+
2532
+ digraph.nodes << <<~DOT
2533
+ #{id} [
2534
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2535
+ ];
2536
+ DOT
2537
+
2538
+ super
2539
+ end
2540
+
2541
+ # Visit a InstanceVariableTargetNode node.
2542
+ def visit_instance_variable_target_node(node)
2543
+ table = Table.new("InstanceVariableTargetNode")
2544
+ id = node_id(node)
2545
+
2546
+ # name
2547
+ table.field("name", node.name.inspect)
2548
+
2549
+ digraph.nodes << <<~DOT
2550
+ #{id} [
2551
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2552
+ ];
2553
+ DOT
2554
+
2555
+ super
2556
+ end
2557
+
2558
+ # Visit a InstanceVariableWriteNode node.
2559
+ def visit_instance_variable_write_node(node)
2560
+ table = Table.new("InstanceVariableWriteNode")
2561
+ id = node_id(node)
2562
+
2563
+ # name
2564
+ table.field("name", node.name.inspect)
2565
+
2566
+ # name_loc
2567
+ table.field("name_loc", location_inspect(node.name_loc))
2568
+
2569
+ # value
2570
+ table.field("value", port: true)
2571
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
2572
+
2573
+ # operator_loc
2574
+ table.field("operator_loc", location_inspect(node.operator_loc))
2575
+
2576
+ digraph.nodes << <<~DOT
2577
+ #{id} [
2578
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2579
+ ];
2580
+ DOT
2581
+
2582
+ super
2583
+ end
2584
+
2585
+ # Visit a IntegerNode node.
2586
+ def visit_integer_node(node)
2587
+ table = Table.new("IntegerNode")
2588
+ id = node_id(node)
2589
+
2590
+ # flags
2591
+ table.field("flags", integer_base_flags_inspect(node))
2592
+
2593
+ # value
2594
+ table.field("value", node.value.inspect)
2595
+
2596
+ digraph.nodes << <<~DOT
2597
+ #{id} [
2598
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2599
+ ];
2600
+ DOT
2601
+
2602
+ super
2603
+ end
2604
+
2605
+ # Visit a InterpolatedMatchLastLineNode node.
2606
+ def visit_interpolated_match_last_line_node(node)
2607
+ table = Table.new("InterpolatedMatchLastLineNode")
2608
+ id = node_id(node)
2609
+
2610
+ # flags
2611
+ table.field("flags", regular_expression_flags_inspect(node))
2612
+
2613
+ # opening_loc
2614
+ table.field("opening_loc", location_inspect(node.opening_loc))
2615
+
2616
+ # parts
2617
+ if node.parts.any?
2618
+ table.field("parts", port: true)
2619
+
2620
+ waypoint = "#{id}_parts"
2621
+ digraph.waypoint("#{waypoint};")
2622
+
2623
+ digraph.edge("#{id}:parts -> #{waypoint};")
2624
+ node.parts.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
2625
+ else
2626
+ table.field("parts", "[]")
2627
+ end
2628
+
2629
+ # closing_loc
2630
+ table.field("closing_loc", location_inspect(node.closing_loc))
2631
+
2632
+ digraph.nodes << <<~DOT
2633
+ #{id} [
2634
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2635
+ ];
2636
+ DOT
2637
+
2638
+ super
2639
+ end
2640
+
2641
+ # Visit a InterpolatedRegularExpressionNode node.
2642
+ def visit_interpolated_regular_expression_node(node)
2643
+ table = Table.new("InterpolatedRegularExpressionNode")
2644
+ id = node_id(node)
2645
+
2646
+ # flags
2647
+ table.field("flags", regular_expression_flags_inspect(node))
2648
+
2649
+ # opening_loc
2650
+ table.field("opening_loc", location_inspect(node.opening_loc))
2651
+
2652
+ # parts
2653
+ if node.parts.any?
2654
+ table.field("parts", port: true)
2655
+
2656
+ waypoint = "#{id}_parts"
2657
+ digraph.waypoint("#{waypoint};")
2658
+
2659
+ digraph.edge("#{id}:parts -> #{waypoint};")
2660
+ node.parts.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
2661
+ else
2662
+ table.field("parts", "[]")
2663
+ end
2664
+
2665
+ # closing_loc
2666
+ table.field("closing_loc", location_inspect(node.closing_loc))
2667
+
2668
+ digraph.nodes << <<~DOT
2669
+ #{id} [
2670
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2671
+ ];
2672
+ DOT
2673
+
2674
+ super
2675
+ end
2676
+
2677
+ # Visit a InterpolatedStringNode node.
2678
+ def visit_interpolated_string_node(node)
2679
+ table = Table.new("InterpolatedStringNode")
2680
+ id = node_id(node)
2681
+
2682
+ # flags
2683
+ table.field("flags", interpolated_string_node_flags_inspect(node))
2684
+
2685
+ # opening_loc
2686
+ unless (opening_loc = node.opening_loc).nil?
2687
+ table.field("opening_loc", location_inspect(opening_loc))
2688
+ end
2689
+
2690
+ # parts
2691
+ if node.parts.any?
2692
+ table.field("parts", port: true)
2693
+
2694
+ waypoint = "#{id}_parts"
2695
+ digraph.waypoint("#{waypoint};")
2696
+
2697
+ digraph.edge("#{id}:parts -> #{waypoint};")
2698
+ node.parts.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
2699
+ else
2700
+ table.field("parts", "[]")
2701
+ end
2702
+
2703
+ # closing_loc
2704
+ unless (closing_loc = node.closing_loc).nil?
2705
+ table.field("closing_loc", location_inspect(closing_loc))
2706
+ end
2707
+
2708
+ digraph.nodes << <<~DOT
2709
+ #{id} [
2710
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2711
+ ];
2712
+ DOT
2713
+
2714
+ super
2715
+ end
2716
+
2717
+ # Visit a InterpolatedSymbolNode node.
2718
+ def visit_interpolated_symbol_node(node)
2719
+ table = Table.new("InterpolatedSymbolNode")
2720
+ id = node_id(node)
2721
+
2722
+ # opening_loc
2723
+ unless (opening_loc = node.opening_loc).nil?
2724
+ table.field("opening_loc", location_inspect(opening_loc))
2725
+ end
2726
+
2727
+ # parts
2728
+ if node.parts.any?
2729
+ table.field("parts", port: true)
2730
+
2731
+ waypoint = "#{id}_parts"
2732
+ digraph.waypoint("#{waypoint};")
2733
+
2734
+ digraph.edge("#{id}:parts -> #{waypoint};")
2735
+ node.parts.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
2736
+ else
2737
+ table.field("parts", "[]")
2738
+ end
2739
+
2740
+ # closing_loc
2741
+ unless (closing_loc = node.closing_loc).nil?
2742
+ table.field("closing_loc", location_inspect(closing_loc))
2743
+ end
2744
+
2745
+ digraph.nodes << <<~DOT
2746
+ #{id} [
2747
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2748
+ ];
2749
+ DOT
2750
+
2751
+ super
2752
+ end
2753
+
2754
+ # Visit a InterpolatedXStringNode node.
2755
+ def visit_interpolated_x_string_node(node)
2756
+ table = Table.new("InterpolatedXStringNode")
2757
+ id = node_id(node)
2758
+
2759
+ # opening_loc
2760
+ table.field("opening_loc", location_inspect(node.opening_loc))
2761
+
2762
+ # parts
2763
+ if node.parts.any?
2764
+ table.field("parts", port: true)
2765
+
2766
+ waypoint = "#{id}_parts"
2767
+ digraph.waypoint("#{waypoint};")
2768
+
2769
+ digraph.edge("#{id}:parts -> #{waypoint};")
2770
+ node.parts.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
2771
+ else
2772
+ table.field("parts", "[]")
2773
+ end
2774
+
2775
+ # closing_loc
2776
+ table.field("closing_loc", location_inspect(node.closing_loc))
2777
+
2778
+ digraph.nodes << <<~DOT
2779
+ #{id} [
2780
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2781
+ ];
2782
+ DOT
2783
+
2784
+ super
2785
+ end
2786
+
2787
+ # Visit a ItLocalVariableReadNode node.
2788
+ def visit_it_local_variable_read_node(node)
2789
+ table = Table.new("ItLocalVariableReadNode")
2790
+ id = node_id(node)
2791
+
2792
+ digraph.nodes << <<~DOT
2793
+ #{id} [
2794
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2795
+ ];
2796
+ DOT
2797
+
2798
+ super
2799
+ end
2800
+
2801
+ # Visit a ItParametersNode node.
2802
+ def visit_it_parameters_node(node)
2803
+ table = Table.new("ItParametersNode")
2804
+ id = node_id(node)
2805
+
2806
+ digraph.nodes << <<~DOT
2807
+ #{id} [
2808
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2809
+ ];
2810
+ DOT
2811
+
2812
+ super
2813
+ end
2814
+
2815
+ # Visit a KeywordHashNode node.
2816
+ def visit_keyword_hash_node(node)
2817
+ table = Table.new("KeywordHashNode")
2818
+ id = node_id(node)
2819
+
2820
+ # flags
2821
+ table.field("flags", keyword_hash_node_flags_inspect(node))
2822
+
2823
+ # elements
2824
+ if node.elements.any?
2825
+ table.field("elements", port: true)
2826
+
2827
+ waypoint = "#{id}_elements"
2828
+ digraph.waypoint("#{waypoint};")
2829
+
2830
+ digraph.edge("#{id}:elements -> #{waypoint};")
2831
+ node.elements.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
2832
+ else
2833
+ table.field("elements", "[]")
2834
+ end
2835
+
2836
+ digraph.nodes << <<~DOT
2837
+ #{id} [
2838
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2839
+ ];
2840
+ DOT
2841
+
2842
+ super
2843
+ end
2844
+
2845
+ # Visit a KeywordRestParameterNode node.
2846
+ def visit_keyword_rest_parameter_node(node)
2847
+ table = Table.new("KeywordRestParameterNode")
2848
+ id = node_id(node)
2849
+
2850
+ # flags
2851
+ table.field("flags", parameter_flags_inspect(node))
2852
+
2853
+ # name
2854
+ table.field("name", node.name.inspect)
2855
+
2856
+ # name_loc
2857
+ unless (name_loc = node.name_loc).nil?
2858
+ table.field("name_loc", location_inspect(name_loc))
2859
+ end
2860
+
2861
+ # operator_loc
2862
+ table.field("operator_loc", location_inspect(node.operator_loc))
2863
+
2864
+ digraph.nodes << <<~DOT
2865
+ #{id} [
2866
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2867
+ ];
2868
+ DOT
2869
+
2870
+ super
2871
+ end
2872
+
2873
+ # Visit a LambdaNode node.
2874
+ def visit_lambda_node(node)
2875
+ table = Table.new("LambdaNode")
2876
+ id = node_id(node)
2877
+
2878
+ # locals
2879
+ table.field("locals", node.locals.inspect)
2880
+
2881
+ # operator_loc
2882
+ table.field("operator_loc", location_inspect(node.operator_loc))
2883
+
2884
+ # opening_loc
2885
+ table.field("opening_loc", location_inspect(node.opening_loc))
2886
+
2887
+ # closing_loc
2888
+ table.field("closing_loc", location_inspect(node.closing_loc))
2889
+
2890
+ # parameters
2891
+ unless (parameters = node.parameters).nil?
2892
+ table.field("parameters", port: true)
2893
+ digraph.edge("#{id}:parameters -> #{node_id(parameters)};")
2894
+ end
2895
+
2896
+ # body
2897
+ unless (body = node.body).nil?
2898
+ table.field("body", port: true)
2899
+ digraph.edge("#{id}:body -> #{node_id(body)};")
2900
+ end
2901
+
2902
+ digraph.nodes << <<~DOT
2903
+ #{id} [
2904
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2905
+ ];
2906
+ DOT
2907
+
2908
+ super
2909
+ end
2910
+
2911
+ # Visit a LocalVariableAndWriteNode node.
2912
+ def visit_local_variable_and_write_node(node)
2913
+ table = Table.new("LocalVariableAndWriteNode")
2914
+ id = node_id(node)
2915
+
2916
+ # name_loc
2917
+ table.field("name_loc", location_inspect(node.name_loc))
2918
+
2919
+ # operator_loc
2920
+ table.field("operator_loc", location_inspect(node.operator_loc))
2921
+
2922
+ # value
2923
+ table.field("value", port: true)
2924
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
2925
+
2926
+ # name
2927
+ table.field("name", node.name.inspect)
2928
+
2929
+ # depth
2930
+ table.field("depth", node.depth.inspect)
2931
+
2932
+ digraph.nodes << <<~DOT
2933
+ #{id} [
2934
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2935
+ ];
2936
+ DOT
2937
+
2938
+ super
2939
+ end
2940
+
2941
+ # Visit a LocalVariableOperatorWriteNode node.
2942
+ def visit_local_variable_operator_write_node(node)
2943
+ table = Table.new("LocalVariableOperatorWriteNode")
2944
+ id = node_id(node)
2945
+
2946
+ # name_loc
2947
+ table.field("name_loc", location_inspect(node.name_loc))
2948
+
2949
+ # binary_operator_loc
2950
+ table.field("binary_operator_loc", location_inspect(node.binary_operator_loc))
2951
+
2952
+ # value
2953
+ table.field("value", port: true)
2954
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
2955
+
2956
+ # name
2957
+ table.field("name", node.name.inspect)
2958
+
2959
+ # binary_operator
2960
+ table.field("binary_operator", node.binary_operator.inspect)
2961
+
2962
+ # depth
2963
+ table.field("depth", node.depth.inspect)
2964
+
2965
+ digraph.nodes << <<~DOT
2966
+ #{id} [
2967
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2968
+ ];
2969
+ DOT
2970
+
2971
+ super
2972
+ end
2973
+
2974
+ # Visit a LocalVariableOrWriteNode node.
2975
+ def visit_local_variable_or_write_node(node)
2976
+ table = Table.new("LocalVariableOrWriteNode")
2977
+ id = node_id(node)
2978
+
2979
+ # name_loc
2980
+ table.field("name_loc", location_inspect(node.name_loc))
2981
+
2982
+ # operator_loc
2983
+ table.field("operator_loc", location_inspect(node.operator_loc))
2984
+
2985
+ # value
2986
+ table.field("value", port: true)
2987
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
2988
+
2989
+ # name
2990
+ table.field("name", node.name.inspect)
2991
+
2992
+ # depth
2993
+ table.field("depth", node.depth.inspect)
2994
+
2995
+ digraph.nodes << <<~DOT
2996
+ #{id} [
2997
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
2998
+ ];
2999
+ DOT
3000
+
3001
+ super
3002
+ end
3003
+
3004
+ # Visit a LocalVariableReadNode node.
3005
+ def visit_local_variable_read_node(node)
3006
+ table = Table.new("LocalVariableReadNode")
3007
+ id = node_id(node)
3008
+
3009
+ # name
3010
+ table.field("name", node.name.inspect)
3011
+
3012
+ # depth
3013
+ table.field("depth", node.depth.inspect)
3014
+
3015
+ digraph.nodes << <<~DOT
3016
+ #{id} [
3017
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3018
+ ];
3019
+ DOT
3020
+
3021
+ super
3022
+ end
3023
+
3024
+ # Visit a LocalVariableTargetNode node.
3025
+ def visit_local_variable_target_node(node)
3026
+ table = Table.new("LocalVariableTargetNode")
3027
+ id = node_id(node)
3028
+
3029
+ # name
3030
+ table.field("name", node.name.inspect)
3031
+
3032
+ # depth
3033
+ table.field("depth", node.depth.inspect)
3034
+
3035
+ digraph.nodes << <<~DOT
3036
+ #{id} [
3037
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3038
+ ];
3039
+ DOT
3040
+
3041
+ super
3042
+ end
3043
+
3044
+ # Visit a LocalVariableWriteNode node.
3045
+ def visit_local_variable_write_node(node)
3046
+ table = Table.new("LocalVariableWriteNode")
3047
+ id = node_id(node)
3048
+
3049
+ # name
3050
+ table.field("name", node.name.inspect)
3051
+
3052
+ # depth
3053
+ table.field("depth", node.depth.inspect)
3054
+
3055
+ # name_loc
3056
+ table.field("name_loc", location_inspect(node.name_loc))
3057
+
3058
+ # value
3059
+ table.field("value", port: true)
3060
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
3061
+
3062
+ # operator_loc
3063
+ table.field("operator_loc", location_inspect(node.operator_loc))
3064
+
3065
+ digraph.nodes << <<~DOT
3066
+ #{id} [
3067
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3068
+ ];
3069
+ DOT
3070
+
3071
+ super
3072
+ end
3073
+
3074
+ # Visit a MatchLastLineNode node.
3075
+ def visit_match_last_line_node(node)
3076
+ table = Table.new("MatchLastLineNode")
3077
+ id = node_id(node)
3078
+
3079
+ # flags
3080
+ table.field("flags", regular_expression_flags_inspect(node))
3081
+
3082
+ # opening_loc
3083
+ table.field("opening_loc", location_inspect(node.opening_loc))
3084
+
3085
+ # content_loc
3086
+ table.field("content_loc", location_inspect(node.content_loc))
3087
+
3088
+ # closing_loc
3089
+ table.field("closing_loc", location_inspect(node.closing_loc))
3090
+
3091
+ # unescaped
3092
+ table.field("unescaped", node.unescaped.inspect)
3093
+
3094
+ digraph.nodes << <<~DOT
3095
+ #{id} [
3096
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3097
+ ];
3098
+ DOT
3099
+
3100
+ super
3101
+ end
3102
+
3103
+ # Visit a MatchPredicateNode node.
3104
+ def visit_match_predicate_node(node)
3105
+ table = Table.new("MatchPredicateNode")
3106
+ id = node_id(node)
3107
+
3108
+ # value
3109
+ table.field("value", port: true)
3110
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
3111
+
3112
+ # pattern
3113
+ table.field("pattern", port: true)
3114
+ digraph.edge("#{id}:pattern -> #{node_id(node.pattern)};")
3115
+
3116
+ # operator_loc
3117
+ table.field("operator_loc", location_inspect(node.operator_loc))
3118
+
3119
+ digraph.nodes << <<~DOT
3120
+ #{id} [
3121
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3122
+ ];
3123
+ DOT
3124
+
3125
+ super
3126
+ end
3127
+
3128
+ # Visit a MatchRequiredNode node.
3129
+ def visit_match_required_node(node)
3130
+ table = Table.new("MatchRequiredNode")
3131
+ id = node_id(node)
3132
+
3133
+ # value
3134
+ table.field("value", port: true)
3135
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
3136
+
3137
+ # pattern
3138
+ table.field("pattern", port: true)
3139
+ digraph.edge("#{id}:pattern -> #{node_id(node.pattern)};")
3140
+
3141
+ # operator_loc
3142
+ table.field("operator_loc", location_inspect(node.operator_loc))
3143
+
3144
+ digraph.nodes << <<~DOT
3145
+ #{id} [
3146
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3147
+ ];
3148
+ DOT
3149
+
3150
+ super
3151
+ end
3152
+
3153
+ # Visit a MatchWriteNode node.
3154
+ def visit_match_write_node(node)
3155
+ table = Table.new("MatchWriteNode")
3156
+ id = node_id(node)
3157
+
3158
+ # call
3159
+ table.field("call", port: true)
3160
+ digraph.edge("#{id}:call -> #{node_id(node.call)};")
3161
+
3162
+ # targets
3163
+ if node.targets.any?
3164
+ table.field("targets", port: true)
3165
+
3166
+ waypoint = "#{id}_targets"
3167
+ digraph.waypoint("#{waypoint};")
3168
+
3169
+ digraph.edge("#{id}:targets -> #{waypoint};")
3170
+ node.targets.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
3171
+ else
3172
+ table.field("targets", "[]")
3173
+ end
3174
+
3175
+ digraph.nodes << <<~DOT
3176
+ #{id} [
3177
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3178
+ ];
3179
+ DOT
3180
+
3181
+ super
3182
+ end
3183
+
3184
+ # Visit a MissingNode node.
3185
+ def visit_missing_node(node)
3186
+ table = Table.new("MissingNode")
3187
+ id = node_id(node)
3188
+
3189
+ digraph.nodes << <<~DOT
3190
+ #{id} [
3191
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3192
+ ];
3193
+ DOT
3194
+
3195
+ super
3196
+ end
3197
+
3198
+ # Visit a ModuleNode node.
3199
+ def visit_module_node(node)
3200
+ table = Table.new("ModuleNode")
3201
+ id = node_id(node)
3202
+
3203
+ # locals
3204
+ table.field("locals", node.locals.inspect)
3205
+
3206
+ # module_keyword_loc
3207
+ table.field("module_keyword_loc", location_inspect(node.module_keyword_loc))
3208
+
3209
+ # constant_path
3210
+ table.field("constant_path", port: true)
3211
+ digraph.edge("#{id}:constant_path -> #{node_id(node.constant_path)};")
3212
+
3213
+ # body
3214
+ unless (body = node.body).nil?
3215
+ table.field("body", port: true)
3216
+ digraph.edge("#{id}:body -> #{node_id(body)};")
3217
+ end
3218
+
3219
+ # end_keyword_loc
3220
+ table.field("end_keyword_loc", location_inspect(node.end_keyword_loc))
3221
+
3222
+ # name
3223
+ table.field("name", node.name.inspect)
3224
+
3225
+ digraph.nodes << <<~DOT
3226
+ #{id} [
3227
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3228
+ ];
3229
+ DOT
3230
+
3231
+ super
3232
+ end
3233
+
3234
+ # Visit a MultiTargetNode node.
3235
+ def visit_multi_target_node(node)
3236
+ table = Table.new("MultiTargetNode")
3237
+ id = node_id(node)
3238
+
3239
+ # lefts
3240
+ if node.lefts.any?
3241
+ table.field("lefts", port: true)
3242
+
3243
+ waypoint = "#{id}_lefts"
3244
+ digraph.waypoint("#{waypoint};")
3245
+
3246
+ digraph.edge("#{id}:lefts -> #{waypoint};")
3247
+ node.lefts.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
3248
+ else
3249
+ table.field("lefts", "[]")
3250
+ end
3251
+
3252
+ # rest
3253
+ unless (rest = node.rest).nil?
3254
+ table.field("rest", port: true)
3255
+ digraph.edge("#{id}:rest -> #{node_id(rest)};")
3256
+ end
3257
+
3258
+ # rights
3259
+ if node.rights.any?
3260
+ table.field("rights", port: true)
3261
+
3262
+ waypoint = "#{id}_rights"
3263
+ digraph.waypoint("#{waypoint};")
3264
+
3265
+ digraph.edge("#{id}:rights -> #{waypoint};")
3266
+ node.rights.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
3267
+ else
3268
+ table.field("rights", "[]")
3269
+ end
3270
+
3271
+ # lparen_loc
3272
+ unless (lparen_loc = node.lparen_loc).nil?
3273
+ table.field("lparen_loc", location_inspect(lparen_loc))
3274
+ end
3275
+
3276
+ # rparen_loc
3277
+ unless (rparen_loc = node.rparen_loc).nil?
3278
+ table.field("rparen_loc", location_inspect(rparen_loc))
3279
+ end
3280
+
3281
+ digraph.nodes << <<~DOT
3282
+ #{id} [
3283
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3284
+ ];
3285
+ DOT
3286
+
3287
+ super
3288
+ end
3289
+
3290
+ # Visit a MultiWriteNode node.
3291
+ def visit_multi_write_node(node)
3292
+ table = Table.new("MultiWriteNode")
3293
+ id = node_id(node)
3294
+
3295
+ # lefts
3296
+ if node.lefts.any?
3297
+ table.field("lefts", port: true)
3298
+
3299
+ waypoint = "#{id}_lefts"
3300
+ digraph.waypoint("#{waypoint};")
3301
+
3302
+ digraph.edge("#{id}:lefts -> #{waypoint};")
3303
+ node.lefts.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
3304
+ else
3305
+ table.field("lefts", "[]")
3306
+ end
3307
+
3308
+ # rest
3309
+ unless (rest = node.rest).nil?
3310
+ table.field("rest", port: true)
3311
+ digraph.edge("#{id}:rest -> #{node_id(rest)};")
3312
+ end
3313
+
3314
+ # rights
3315
+ if node.rights.any?
3316
+ table.field("rights", port: true)
3317
+
3318
+ waypoint = "#{id}_rights"
3319
+ digraph.waypoint("#{waypoint};")
3320
+
3321
+ digraph.edge("#{id}:rights -> #{waypoint};")
3322
+ node.rights.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
3323
+ else
3324
+ table.field("rights", "[]")
3325
+ end
3326
+
3327
+ # lparen_loc
3328
+ unless (lparen_loc = node.lparen_loc).nil?
3329
+ table.field("lparen_loc", location_inspect(lparen_loc))
3330
+ end
3331
+
3332
+ # rparen_loc
3333
+ unless (rparen_loc = node.rparen_loc).nil?
3334
+ table.field("rparen_loc", location_inspect(rparen_loc))
3335
+ end
3336
+
3337
+ # operator_loc
3338
+ table.field("operator_loc", location_inspect(node.operator_loc))
3339
+
3340
+ # value
3341
+ table.field("value", port: true)
3342
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
3343
+
3344
+ digraph.nodes << <<~DOT
3345
+ #{id} [
3346
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3347
+ ];
3348
+ DOT
3349
+
3350
+ super
3351
+ end
3352
+
3353
+ # Visit a NextNode node.
3354
+ def visit_next_node(node)
3355
+ table = Table.new("NextNode")
3356
+ id = node_id(node)
3357
+
3358
+ # arguments
3359
+ unless (arguments = node.arguments).nil?
3360
+ table.field("arguments", port: true)
3361
+ digraph.edge("#{id}:arguments -> #{node_id(arguments)};")
3362
+ end
3363
+
3364
+ # keyword_loc
3365
+ table.field("keyword_loc", location_inspect(node.keyword_loc))
3366
+
3367
+ digraph.nodes << <<~DOT
3368
+ #{id} [
3369
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3370
+ ];
3371
+ DOT
3372
+
3373
+ super
3374
+ end
3375
+
3376
+ # Visit a NilNode node.
3377
+ def visit_nil_node(node)
3378
+ table = Table.new("NilNode")
3379
+ id = node_id(node)
3380
+
3381
+ digraph.nodes << <<~DOT
3382
+ #{id} [
3383
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3384
+ ];
3385
+ DOT
3386
+
3387
+ super
3388
+ end
3389
+
3390
+ # Visit a NoKeywordsParameterNode node.
3391
+ def visit_no_keywords_parameter_node(node)
3392
+ table = Table.new("NoKeywordsParameterNode")
3393
+ id = node_id(node)
3394
+
3395
+ # operator_loc
3396
+ table.field("operator_loc", location_inspect(node.operator_loc))
3397
+
3398
+ # keyword_loc
3399
+ table.field("keyword_loc", location_inspect(node.keyword_loc))
3400
+
3401
+ digraph.nodes << <<~DOT
3402
+ #{id} [
3403
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3404
+ ];
3405
+ DOT
3406
+
3407
+ super
3408
+ end
3409
+
3410
+ # Visit a NumberedParametersNode node.
3411
+ def visit_numbered_parameters_node(node)
3412
+ table = Table.new("NumberedParametersNode")
3413
+ id = node_id(node)
3414
+
3415
+ # maximum
3416
+ table.field("maximum", node.maximum.inspect)
3417
+
3418
+ digraph.nodes << <<~DOT
3419
+ #{id} [
3420
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3421
+ ];
3422
+ DOT
3423
+
3424
+ super
3425
+ end
3426
+
3427
+ # Visit a NumberedReferenceReadNode node.
3428
+ def visit_numbered_reference_read_node(node)
3429
+ table = Table.new("NumberedReferenceReadNode")
3430
+ id = node_id(node)
3431
+
3432
+ # number
3433
+ table.field("number", node.number.inspect)
3434
+
3435
+ digraph.nodes << <<~DOT
3436
+ #{id} [
3437
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3438
+ ];
3439
+ DOT
3440
+
3441
+ super
3442
+ end
3443
+
3444
+ # Visit a OptionalKeywordParameterNode node.
3445
+ def visit_optional_keyword_parameter_node(node)
3446
+ table = Table.new("OptionalKeywordParameterNode")
3447
+ id = node_id(node)
3448
+
3449
+ # flags
3450
+ table.field("flags", parameter_flags_inspect(node))
3451
+
3452
+ # name
3453
+ table.field("name", node.name.inspect)
3454
+
3455
+ # name_loc
3456
+ table.field("name_loc", location_inspect(node.name_loc))
3457
+
3458
+ # value
3459
+ table.field("value", port: true)
3460
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
3461
+
3462
+ digraph.nodes << <<~DOT
3463
+ #{id} [
3464
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3465
+ ];
3466
+ DOT
3467
+
3468
+ super
3469
+ end
3470
+
3471
+ # Visit a OptionalParameterNode node.
3472
+ def visit_optional_parameter_node(node)
3473
+ table = Table.new("OptionalParameterNode")
3474
+ id = node_id(node)
3475
+
3476
+ # flags
3477
+ table.field("flags", parameter_flags_inspect(node))
3478
+
3479
+ # name
3480
+ table.field("name", node.name.inspect)
3481
+
3482
+ # name_loc
3483
+ table.field("name_loc", location_inspect(node.name_loc))
3484
+
3485
+ # operator_loc
3486
+ table.field("operator_loc", location_inspect(node.operator_loc))
3487
+
3488
+ # value
3489
+ table.field("value", port: true)
3490
+ digraph.edge("#{id}:value -> #{node_id(node.value)};")
3491
+
3492
+ digraph.nodes << <<~DOT
3493
+ #{id} [
3494
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3495
+ ];
3496
+ DOT
3497
+
3498
+ super
3499
+ end
3500
+
3501
+ # Visit a OrNode node.
3502
+ def visit_or_node(node)
3503
+ table = Table.new("OrNode")
3504
+ id = node_id(node)
3505
+
3506
+ # left
3507
+ table.field("left", port: true)
3508
+ digraph.edge("#{id}:left -> #{node_id(node.left)};")
3509
+
3510
+ # right
3511
+ table.field("right", port: true)
3512
+ digraph.edge("#{id}:right -> #{node_id(node.right)};")
3513
+
3514
+ # operator_loc
3515
+ table.field("operator_loc", location_inspect(node.operator_loc))
3516
+
3517
+ digraph.nodes << <<~DOT
3518
+ #{id} [
3519
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3520
+ ];
3521
+ DOT
3522
+
3523
+ super
3524
+ end
3525
+
3526
+ # Visit a ParametersNode node.
3527
+ def visit_parameters_node(node)
3528
+ table = Table.new("ParametersNode")
3529
+ id = node_id(node)
3530
+
3531
+ # requireds
3532
+ if node.requireds.any?
3533
+ table.field("requireds", port: true)
3534
+
3535
+ waypoint = "#{id}_requireds"
3536
+ digraph.waypoint("#{waypoint};")
3537
+
3538
+ digraph.edge("#{id}:requireds -> #{waypoint};")
3539
+ node.requireds.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
3540
+ else
3541
+ table.field("requireds", "[]")
3542
+ end
3543
+
3544
+ # optionals
3545
+ if node.optionals.any?
3546
+ table.field("optionals", port: true)
3547
+
3548
+ waypoint = "#{id}_optionals"
3549
+ digraph.waypoint("#{waypoint};")
3550
+
3551
+ digraph.edge("#{id}:optionals -> #{waypoint};")
3552
+ node.optionals.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
3553
+ else
3554
+ table.field("optionals", "[]")
3555
+ end
3556
+
3557
+ # rest
3558
+ unless (rest = node.rest).nil?
3559
+ table.field("rest", port: true)
3560
+ digraph.edge("#{id}:rest -> #{node_id(rest)};")
3561
+ end
3562
+
3563
+ # posts
3564
+ if node.posts.any?
3565
+ table.field("posts", port: true)
3566
+
3567
+ waypoint = "#{id}_posts"
3568
+ digraph.waypoint("#{waypoint};")
3569
+
3570
+ digraph.edge("#{id}:posts -> #{waypoint};")
3571
+ node.posts.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
3572
+ else
3573
+ table.field("posts", "[]")
3574
+ end
3575
+
3576
+ # keywords
3577
+ if node.keywords.any?
3578
+ table.field("keywords", port: true)
3579
+
3580
+ waypoint = "#{id}_keywords"
3581
+ digraph.waypoint("#{waypoint};")
3582
+
3583
+ digraph.edge("#{id}:keywords -> #{waypoint};")
3584
+ node.keywords.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
3585
+ else
3586
+ table.field("keywords", "[]")
3587
+ end
3588
+
3589
+ # keyword_rest
3590
+ unless (keyword_rest = node.keyword_rest).nil?
3591
+ table.field("keyword_rest", port: true)
3592
+ digraph.edge("#{id}:keyword_rest -> #{node_id(keyword_rest)};")
3593
+ end
3594
+
3595
+ # block
3596
+ unless (block = node.block).nil?
3597
+ table.field("block", port: true)
3598
+ digraph.edge("#{id}:block -> #{node_id(block)};")
3599
+ end
3600
+
3601
+ digraph.nodes << <<~DOT
3602
+ #{id} [
3603
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3604
+ ];
3605
+ DOT
3606
+
3607
+ super
3608
+ end
3609
+
3610
+ # Visit a ParenthesesNode node.
3611
+ def visit_parentheses_node(node)
3612
+ table = Table.new("ParenthesesNode")
3613
+ id = node_id(node)
3614
+
3615
+ # flags
3616
+ table.field("flags", parentheses_node_flags_inspect(node))
3617
+
3618
+ # body
3619
+ unless (body = node.body).nil?
3620
+ table.field("body", port: true)
3621
+ digraph.edge("#{id}:body -> #{node_id(body)};")
3622
+ end
3623
+
3624
+ # opening_loc
3625
+ table.field("opening_loc", location_inspect(node.opening_loc))
3626
+
3627
+ # closing_loc
3628
+ table.field("closing_loc", location_inspect(node.closing_loc))
3629
+
3630
+ digraph.nodes << <<~DOT
3631
+ #{id} [
3632
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3633
+ ];
3634
+ DOT
3635
+
3636
+ super
3637
+ end
3638
+
3639
+ # Visit a PinnedExpressionNode node.
3640
+ def visit_pinned_expression_node(node)
3641
+ table = Table.new("PinnedExpressionNode")
3642
+ id = node_id(node)
3643
+
3644
+ # expression
3645
+ table.field("expression", port: true)
3646
+ digraph.edge("#{id}:expression -> #{node_id(node.expression)};")
3647
+
3648
+ # operator_loc
3649
+ table.field("operator_loc", location_inspect(node.operator_loc))
3650
+
3651
+ # lparen_loc
3652
+ table.field("lparen_loc", location_inspect(node.lparen_loc))
3653
+
3654
+ # rparen_loc
3655
+ table.field("rparen_loc", location_inspect(node.rparen_loc))
3656
+
3657
+ digraph.nodes << <<~DOT
3658
+ #{id} [
3659
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3660
+ ];
3661
+ DOT
3662
+
3663
+ super
3664
+ end
3665
+
3666
+ # Visit a PinnedVariableNode node.
3667
+ def visit_pinned_variable_node(node)
3668
+ table = Table.new("PinnedVariableNode")
3669
+ id = node_id(node)
3670
+
3671
+ # variable
3672
+ table.field("variable", port: true)
3673
+ digraph.edge("#{id}:variable -> #{node_id(node.variable)};")
3674
+
3675
+ # operator_loc
3676
+ table.field("operator_loc", location_inspect(node.operator_loc))
3677
+
3678
+ digraph.nodes << <<~DOT
3679
+ #{id} [
3680
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3681
+ ];
3682
+ DOT
3683
+
3684
+ super
3685
+ end
3686
+
3687
+ # Visit a PostExecutionNode node.
3688
+ def visit_post_execution_node(node)
3689
+ table = Table.new("PostExecutionNode")
3690
+ id = node_id(node)
3691
+
3692
+ # statements
3693
+ unless (statements = node.statements).nil?
3694
+ table.field("statements", port: true)
3695
+ digraph.edge("#{id}:statements -> #{node_id(statements)};")
3696
+ end
3697
+
3698
+ # keyword_loc
3699
+ table.field("keyword_loc", location_inspect(node.keyword_loc))
3700
+
3701
+ # opening_loc
3702
+ table.field("opening_loc", location_inspect(node.opening_loc))
3703
+
3704
+ # closing_loc
3705
+ table.field("closing_loc", location_inspect(node.closing_loc))
3706
+
3707
+ digraph.nodes << <<~DOT
3708
+ #{id} [
3709
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3710
+ ];
3711
+ DOT
3712
+
3713
+ super
3714
+ end
3715
+
3716
+ # Visit a PreExecutionNode node.
3717
+ def visit_pre_execution_node(node)
3718
+ table = Table.new("PreExecutionNode")
3719
+ id = node_id(node)
3720
+
3721
+ # statements
3722
+ unless (statements = node.statements).nil?
3723
+ table.field("statements", port: true)
3724
+ digraph.edge("#{id}:statements -> #{node_id(statements)};")
3725
+ end
3726
+
3727
+ # keyword_loc
3728
+ table.field("keyword_loc", location_inspect(node.keyword_loc))
3729
+
3730
+ # opening_loc
3731
+ table.field("opening_loc", location_inspect(node.opening_loc))
3732
+
3733
+ # closing_loc
3734
+ table.field("closing_loc", location_inspect(node.closing_loc))
3735
+
3736
+ digraph.nodes << <<~DOT
3737
+ #{id} [
3738
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3739
+ ];
3740
+ DOT
3741
+
3742
+ super
3743
+ end
3744
+
3745
+ # Visit a ProgramNode node.
3746
+ def visit_program_node(node)
3747
+ table = Table.new("ProgramNode")
3748
+ id = node_id(node)
3749
+
3750
+ # locals
3751
+ table.field("locals", node.locals.inspect)
3752
+
3753
+ # statements
3754
+ table.field("statements", port: true)
3755
+ digraph.edge("#{id}:statements -> #{node_id(node.statements)};")
3756
+
3757
+ digraph.nodes << <<~DOT
3758
+ #{id} [
3759
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3760
+ ];
3761
+ DOT
3762
+
3763
+ super
3764
+ end
3765
+
3766
+ # Visit a RangeNode node.
3767
+ def visit_range_node(node)
3768
+ table = Table.new("RangeNode")
3769
+ id = node_id(node)
3770
+
3771
+ # flags
3772
+ table.field("flags", range_flags_inspect(node))
3773
+
3774
+ # left
3775
+ unless (left = node.left).nil?
3776
+ table.field("left", port: true)
3777
+ digraph.edge("#{id}:left -> #{node_id(left)};")
3778
+ end
3779
+
3780
+ # right
3781
+ unless (right = node.right).nil?
3782
+ table.field("right", port: true)
3783
+ digraph.edge("#{id}:right -> #{node_id(right)};")
3784
+ end
3785
+
3786
+ # operator_loc
3787
+ table.field("operator_loc", location_inspect(node.operator_loc))
3788
+
3789
+ digraph.nodes << <<~DOT
3790
+ #{id} [
3791
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3792
+ ];
3793
+ DOT
3794
+
3795
+ super
3796
+ end
3797
+
3798
+ # Visit a RationalNode node.
3799
+ def visit_rational_node(node)
3800
+ table = Table.new("RationalNode")
3801
+ id = node_id(node)
3802
+
3803
+ # flags
3804
+ table.field("flags", integer_base_flags_inspect(node))
3805
+
3806
+ # numerator
3807
+ table.field("numerator", node.numerator.inspect)
3808
+
3809
+ # denominator
3810
+ table.field("denominator", node.denominator.inspect)
3811
+
3812
+ digraph.nodes << <<~DOT
3813
+ #{id} [
3814
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3815
+ ];
3816
+ DOT
3817
+
3818
+ super
3819
+ end
3820
+
3821
+ # Visit a RedoNode node.
3822
+ def visit_redo_node(node)
3823
+ table = Table.new("RedoNode")
3824
+ id = node_id(node)
3825
+
3826
+ digraph.nodes << <<~DOT
3827
+ #{id} [
3828
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3829
+ ];
3830
+ DOT
3831
+
3832
+ super
3833
+ end
3834
+
3835
+ # Visit a RegularExpressionNode node.
3836
+ def visit_regular_expression_node(node)
3837
+ table = Table.new("RegularExpressionNode")
3838
+ id = node_id(node)
3839
+
3840
+ # flags
3841
+ table.field("flags", regular_expression_flags_inspect(node))
3842
+
3843
+ # opening_loc
3844
+ table.field("opening_loc", location_inspect(node.opening_loc))
3845
+
3846
+ # content_loc
3847
+ table.field("content_loc", location_inspect(node.content_loc))
3848
+
3849
+ # closing_loc
3850
+ table.field("closing_loc", location_inspect(node.closing_loc))
3851
+
3852
+ # unescaped
3853
+ table.field("unescaped", node.unescaped.inspect)
3854
+
3855
+ digraph.nodes << <<~DOT
3856
+ #{id} [
3857
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3858
+ ];
3859
+ DOT
3860
+
3861
+ super
3862
+ end
3863
+
3864
+ # Visit a RequiredKeywordParameterNode node.
3865
+ def visit_required_keyword_parameter_node(node)
3866
+ table = Table.new("RequiredKeywordParameterNode")
3867
+ id = node_id(node)
3868
+
3869
+ # flags
3870
+ table.field("flags", parameter_flags_inspect(node))
3871
+
3872
+ # name
3873
+ table.field("name", node.name.inspect)
3874
+
3875
+ # name_loc
3876
+ table.field("name_loc", location_inspect(node.name_loc))
3877
+
3878
+ digraph.nodes << <<~DOT
3879
+ #{id} [
3880
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3881
+ ];
3882
+ DOT
3883
+
3884
+ super
3885
+ end
3886
+
3887
+ # Visit a RequiredParameterNode node.
3888
+ def visit_required_parameter_node(node)
3889
+ table = Table.new("RequiredParameterNode")
3890
+ id = node_id(node)
3891
+
3892
+ # flags
3893
+ table.field("flags", parameter_flags_inspect(node))
3894
+
3895
+ # name
3896
+ table.field("name", node.name.inspect)
3897
+
3898
+ digraph.nodes << <<~DOT
3899
+ #{id} [
3900
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3901
+ ];
3902
+ DOT
3903
+
3904
+ super
3905
+ end
3906
+
3907
+ # Visit a RescueModifierNode node.
3908
+ def visit_rescue_modifier_node(node)
3909
+ table = Table.new("RescueModifierNode")
3910
+ id = node_id(node)
3911
+
3912
+ # expression
3913
+ table.field("expression", port: true)
3914
+ digraph.edge("#{id}:expression -> #{node_id(node.expression)};")
3915
+
3916
+ # keyword_loc
3917
+ table.field("keyword_loc", location_inspect(node.keyword_loc))
3918
+
3919
+ # rescue_expression
3920
+ table.field("rescue_expression", port: true)
3921
+ digraph.edge("#{id}:rescue_expression -> #{node_id(node.rescue_expression)};")
3922
+
3923
+ digraph.nodes << <<~DOT
3924
+ #{id} [
3925
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3926
+ ];
3927
+ DOT
3928
+
3929
+ super
3930
+ end
3931
+
3932
+ # Visit a RescueNode node.
3933
+ def visit_rescue_node(node)
3934
+ table = Table.new("RescueNode")
3935
+ id = node_id(node)
3936
+
3937
+ # keyword_loc
3938
+ table.field("keyword_loc", location_inspect(node.keyword_loc))
3939
+
3940
+ # exceptions
3941
+ if node.exceptions.any?
3942
+ table.field("exceptions", port: true)
3943
+
3944
+ waypoint = "#{id}_exceptions"
3945
+ digraph.waypoint("#{waypoint};")
3946
+
3947
+ digraph.edge("#{id}:exceptions -> #{waypoint};")
3948
+ node.exceptions.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
3949
+ else
3950
+ table.field("exceptions", "[]")
3951
+ end
3952
+
3953
+ # operator_loc
3954
+ unless (operator_loc = node.operator_loc).nil?
3955
+ table.field("operator_loc", location_inspect(operator_loc))
3956
+ end
3957
+
3958
+ # reference
3959
+ unless (reference = node.reference).nil?
3960
+ table.field("reference", port: true)
3961
+ digraph.edge("#{id}:reference -> #{node_id(reference)};")
3962
+ end
3963
+
3964
+ # then_keyword_loc
3965
+ unless (then_keyword_loc = node.then_keyword_loc).nil?
3966
+ table.field("then_keyword_loc", location_inspect(then_keyword_loc))
3967
+ end
3968
+
3969
+ # statements
3970
+ unless (statements = node.statements).nil?
3971
+ table.field("statements", port: true)
3972
+ digraph.edge("#{id}:statements -> #{node_id(statements)};")
3973
+ end
3974
+
3975
+ # subsequent
3976
+ unless (subsequent = node.subsequent).nil?
3977
+ table.field("subsequent", port: true)
3978
+ digraph.edge("#{id}:subsequent -> #{node_id(subsequent)};")
3979
+ end
3980
+
3981
+ digraph.nodes << <<~DOT
3982
+ #{id} [
3983
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
3984
+ ];
3985
+ DOT
3986
+
3987
+ super
3988
+ end
3989
+
3990
+ # Visit a RestParameterNode node.
3991
+ def visit_rest_parameter_node(node)
3992
+ table = Table.new("RestParameterNode")
3993
+ id = node_id(node)
3994
+
3995
+ # flags
3996
+ table.field("flags", parameter_flags_inspect(node))
3997
+
3998
+ # name
3999
+ table.field("name", node.name.inspect)
4000
+
4001
+ # name_loc
4002
+ unless (name_loc = node.name_loc).nil?
4003
+ table.field("name_loc", location_inspect(name_loc))
4004
+ end
4005
+
4006
+ # operator_loc
4007
+ table.field("operator_loc", location_inspect(node.operator_loc))
4008
+
4009
+ digraph.nodes << <<~DOT
4010
+ #{id} [
4011
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4012
+ ];
4013
+ DOT
4014
+
4015
+ super
4016
+ end
4017
+
4018
+ # Visit a RetryNode node.
4019
+ def visit_retry_node(node)
4020
+ table = Table.new("RetryNode")
4021
+ id = node_id(node)
4022
+
4023
+ digraph.nodes << <<~DOT
4024
+ #{id} [
4025
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4026
+ ];
4027
+ DOT
4028
+
4029
+ super
4030
+ end
4031
+
4032
+ # Visit a ReturnNode node.
4033
+ def visit_return_node(node)
4034
+ table = Table.new("ReturnNode")
4035
+ id = node_id(node)
4036
+
4037
+ # keyword_loc
4038
+ table.field("keyword_loc", location_inspect(node.keyword_loc))
4039
+
4040
+ # arguments
4041
+ unless (arguments = node.arguments).nil?
4042
+ table.field("arguments", port: true)
4043
+ digraph.edge("#{id}:arguments -> #{node_id(arguments)};")
4044
+ end
4045
+
4046
+ digraph.nodes << <<~DOT
4047
+ #{id} [
4048
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4049
+ ];
4050
+ DOT
4051
+
4052
+ super
4053
+ end
4054
+
4055
+ # Visit a SelfNode node.
4056
+ def visit_self_node(node)
4057
+ table = Table.new("SelfNode")
4058
+ id = node_id(node)
4059
+
4060
+ digraph.nodes << <<~DOT
4061
+ #{id} [
4062
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4063
+ ];
4064
+ DOT
4065
+
4066
+ super
4067
+ end
4068
+
4069
+ # Visit a ShareableConstantNode node.
4070
+ def visit_shareable_constant_node(node)
4071
+ table = Table.new("ShareableConstantNode")
4072
+ id = node_id(node)
4073
+
4074
+ # flags
4075
+ table.field("flags", shareable_constant_node_flags_inspect(node))
4076
+
4077
+ # write
4078
+ table.field("write", port: true)
4079
+ digraph.edge("#{id}:write -> #{node_id(node.write)};")
4080
+
4081
+ digraph.nodes << <<~DOT
4082
+ #{id} [
4083
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4084
+ ];
4085
+ DOT
4086
+
4087
+ super
4088
+ end
4089
+
4090
+ # Visit a SingletonClassNode node.
4091
+ def visit_singleton_class_node(node)
4092
+ table = Table.new("SingletonClassNode")
4093
+ id = node_id(node)
4094
+
4095
+ # locals
4096
+ table.field("locals", node.locals.inspect)
4097
+
4098
+ # class_keyword_loc
4099
+ table.field("class_keyword_loc", location_inspect(node.class_keyword_loc))
4100
+
4101
+ # operator_loc
4102
+ table.field("operator_loc", location_inspect(node.operator_loc))
4103
+
4104
+ # expression
4105
+ table.field("expression", port: true)
4106
+ digraph.edge("#{id}:expression -> #{node_id(node.expression)};")
4107
+
4108
+ # body
4109
+ unless (body = node.body).nil?
4110
+ table.field("body", port: true)
4111
+ digraph.edge("#{id}:body -> #{node_id(body)};")
4112
+ end
4113
+
4114
+ # end_keyword_loc
4115
+ table.field("end_keyword_loc", location_inspect(node.end_keyword_loc))
4116
+
4117
+ digraph.nodes << <<~DOT
4118
+ #{id} [
4119
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4120
+ ];
4121
+ DOT
4122
+
4123
+ super
4124
+ end
4125
+
4126
+ # Visit a SourceEncodingNode node.
4127
+ def visit_source_encoding_node(node)
4128
+ table = Table.new("SourceEncodingNode")
4129
+ id = node_id(node)
4130
+
4131
+ digraph.nodes << <<~DOT
4132
+ #{id} [
4133
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4134
+ ];
4135
+ DOT
4136
+
4137
+ super
4138
+ end
4139
+
4140
+ # Visit a SourceFileNode node.
4141
+ def visit_source_file_node(node)
4142
+ table = Table.new("SourceFileNode")
4143
+ id = node_id(node)
4144
+
4145
+ # flags
4146
+ table.field("flags", string_flags_inspect(node))
4147
+
4148
+ # filepath
4149
+ table.field("filepath", node.filepath.inspect)
4150
+
4151
+ digraph.nodes << <<~DOT
4152
+ #{id} [
4153
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4154
+ ];
4155
+ DOT
4156
+
4157
+ super
4158
+ end
4159
+
4160
+ # Visit a SourceLineNode node.
4161
+ def visit_source_line_node(node)
4162
+ table = Table.new("SourceLineNode")
4163
+ id = node_id(node)
4164
+
4165
+ digraph.nodes << <<~DOT
4166
+ #{id} [
4167
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4168
+ ];
4169
+ DOT
4170
+
4171
+ super
4172
+ end
4173
+
4174
+ # Visit a SplatNode node.
4175
+ def visit_splat_node(node)
4176
+ table = Table.new("SplatNode")
4177
+ id = node_id(node)
4178
+
4179
+ # operator_loc
4180
+ table.field("operator_loc", location_inspect(node.operator_loc))
4181
+
4182
+ # expression
4183
+ unless (expression = node.expression).nil?
4184
+ table.field("expression", port: true)
4185
+ digraph.edge("#{id}:expression -> #{node_id(expression)};")
4186
+ end
4187
+
4188
+ digraph.nodes << <<~DOT
4189
+ #{id} [
4190
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4191
+ ];
4192
+ DOT
4193
+
4194
+ super
4195
+ end
4196
+
4197
+ # Visit a StatementsNode node.
4198
+ def visit_statements_node(node)
4199
+ table = Table.new("StatementsNode")
4200
+ id = node_id(node)
4201
+
4202
+ # body
4203
+ if node.body.any?
4204
+ table.field("body", port: true)
4205
+
4206
+ waypoint = "#{id}_body"
4207
+ digraph.waypoint("#{waypoint};")
4208
+
4209
+ digraph.edge("#{id}:body -> #{waypoint};")
4210
+ node.body.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
4211
+ else
4212
+ table.field("body", "[]")
4213
+ end
4214
+
4215
+ digraph.nodes << <<~DOT
4216
+ #{id} [
4217
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4218
+ ];
4219
+ DOT
4220
+
4221
+ super
4222
+ end
4223
+
4224
+ # Visit a StringNode node.
4225
+ def visit_string_node(node)
4226
+ table = Table.new("StringNode")
4227
+ id = node_id(node)
4228
+
4229
+ # flags
4230
+ table.field("flags", string_flags_inspect(node))
4231
+
4232
+ # opening_loc
4233
+ unless (opening_loc = node.opening_loc).nil?
4234
+ table.field("opening_loc", location_inspect(opening_loc))
4235
+ end
4236
+
4237
+ # content_loc
4238
+ table.field("content_loc", location_inspect(node.content_loc))
4239
+
4240
+ # closing_loc
4241
+ unless (closing_loc = node.closing_loc).nil?
4242
+ table.field("closing_loc", location_inspect(closing_loc))
4243
+ end
4244
+
4245
+ # unescaped
4246
+ table.field("unescaped", node.unescaped.inspect)
4247
+
4248
+ digraph.nodes << <<~DOT
4249
+ #{id} [
4250
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4251
+ ];
4252
+ DOT
4253
+
4254
+ super
4255
+ end
4256
+
4257
+ # Visit a SuperNode node.
4258
+ def visit_super_node(node)
4259
+ table = Table.new("SuperNode")
4260
+ id = node_id(node)
4261
+
4262
+ # keyword_loc
4263
+ table.field("keyword_loc", location_inspect(node.keyword_loc))
4264
+
4265
+ # lparen_loc
4266
+ unless (lparen_loc = node.lparen_loc).nil?
4267
+ table.field("lparen_loc", location_inspect(lparen_loc))
4268
+ end
4269
+
4270
+ # arguments
4271
+ unless (arguments = node.arguments).nil?
4272
+ table.field("arguments", port: true)
4273
+ digraph.edge("#{id}:arguments -> #{node_id(arguments)};")
4274
+ end
4275
+
4276
+ # rparen_loc
4277
+ unless (rparen_loc = node.rparen_loc).nil?
4278
+ table.field("rparen_loc", location_inspect(rparen_loc))
4279
+ end
4280
+
4281
+ # block
4282
+ unless (block = node.block).nil?
4283
+ table.field("block", port: true)
4284
+ digraph.edge("#{id}:block -> #{node_id(block)};")
4285
+ end
4286
+
4287
+ digraph.nodes << <<~DOT
4288
+ #{id} [
4289
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4290
+ ];
4291
+ DOT
4292
+
4293
+ super
4294
+ end
4295
+
4296
+ # Visit a SymbolNode node.
4297
+ def visit_symbol_node(node)
4298
+ table = Table.new("SymbolNode")
4299
+ id = node_id(node)
4300
+
4301
+ # flags
4302
+ table.field("flags", symbol_flags_inspect(node))
4303
+
4304
+ # opening_loc
4305
+ unless (opening_loc = node.opening_loc).nil?
4306
+ table.field("opening_loc", location_inspect(opening_loc))
4307
+ end
4308
+
4309
+ # value_loc
4310
+ unless (value_loc = node.value_loc).nil?
4311
+ table.field("value_loc", location_inspect(value_loc))
4312
+ end
4313
+
4314
+ # closing_loc
4315
+ unless (closing_loc = node.closing_loc).nil?
4316
+ table.field("closing_loc", location_inspect(closing_loc))
4317
+ end
4318
+
4319
+ # unescaped
4320
+ table.field("unescaped", node.unescaped.inspect)
4321
+
4322
+ digraph.nodes << <<~DOT
4323
+ #{id} [
4324
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4325
+ ];
4326
+ DOT
4327
+
4328
+ super
4329
+ end
4330
+
4331
+ # Visit a TrueNode node.
4332
+ def visit_true_node(node)
4333
+ table = Table.new("TrueNode")
4334
+ id = node_id(node)
4335
+
4336
+ digraph.nodes << <<~DOT
4337
+ #{id} [
4338
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4339
+ ];
4340
+ DOT
4341
+
4342
+ super
4343
+ end
4344
+
4345
+ # Visit a UndefNode node.
4346
+ def visit_undef_node(node)
4347
+ table = Table.new("UndefNode")
4348
+ id = node_id(node)
4349
+
4350
+ # names
4351
+ if node.names.any?
4352
+ table.field("names", port: true)
4353
+
4354
+ waypoint = "#{id}_names"
4355
+ digraph.waypoint("#{waypoint};")
4356
+
4357
+ digraph.edge("#{id}:names -> #{waypoint};")
4358
+ node.names.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
4359
+ else
4360
+ table.field("names", "[]")
4361
+ end
4362
+
4363
+ # keyword_loc
4364
+ table.field("keyword_loc", location_inspect(node.keyword_loc))
4365
+
4366
+ digraph.nodes << <<~DOT
4367
+ #{id} [
4368
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4369
+ ];
4370
+ DOT
4371
+
4372
+ super
4373
+ end
4374
+
4375
+ # Visit a UnlessNode node.
4376
+ def visit_unless_node(node)
4377
+ table = Table.new("UnlessNode")
4378
+ id = node_id(node)
4379
+
4380
+ # keyword_loc
4381
+ table.field("keyword_loc", location_inspect(node.keyword_loc))
4382
+
4383
+ # predicate
4384
+ table.field("predicate", port: true)
4385
+ digraph.edge("#{id}:predicate -> #{node_id(node.predicate)};")
4386
+
4387
+ # then_keyword_loc
4388
+ unless (then_keyword_loc = node.then_keyword_loc).nil?
4389
+ table.field("then_keyword_loc", location_inspect(then_keyword_loc))
4390
+ end
4391
+
4392
+ # statements
4393
+ unless (statements = node.statements).nil?
4394
+ table.field("statements", port: true)
4395
+ digraph.edge("#{id}:statements -> #{node_id(statements)};")
4396
+ end
4397
+
4398
+ # else_clause
4399
+ unless (else_clause = node.else_clause).nil?
4400
+ table.field("else_clause", port: true)
4401
+ digraph.edge("#{id}:else_clause -> #{node_id(else_clause)};")
4402
+ end
4403
+
4404
+ # end_keyword_loc
4405
+ unless (end_keyword_loc = node.end_keyword_loc).nil?
4406
+ table.field("end_keyword_loc", location_inspect(end_keyword_loc))
4407
+ end
4408
+
4409
+ digraph.nodes << <<~DOT
4410
+ #{id} [
4411
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4412
+ ];
4413
+ DOT
4414
+
4415
+ super
4416
+ end
4417
+
4418
+ # Visit a UntilNode node.
4419
+ def visit_until_node(node)
4420
+ table = Table.new("UntilNode")
4421
+ id = node_id(node)
4422
+
4423
+ # flags
4424
+ table.field("flags", loop_flags_inspect(node))
4425
+
4426
+ # keyword_loc
4427
+ table.field("keyword_loc", location_inspect(node.keyword_loc))
4428
+
4429
+ # do_keyword_loc
4430
+ unless (do_keyword_loc = node.do_keyword_loc).nil?
4431
+ table.field("do_keyword_loc", location_inspect(do_keyword_loc))
4432
+ end
4433
+
4434
+ # closing_loc
4435
+ unless (closing_loc = node.closing_loc).nil?
4436
+ table.field("closing_loc", location_inspect(closing_loc))
4437
+ end
4438
+
4439
+ # predicate
4440
+ table.field("predicate", port: true)
4441
+ digraph.edge("#{id}:predicate -> #{node_id(node.predicate)};")
4442
+
4443
+ # statements
4444
+ unless (statements = node.statements).nil?
4445
+ table.field("statements", port: true)
4446
+ digraph.edge("#{id}:statements -> #{node_id(statements)};")
4447
+ end
4448
+
4449
+ digraph.nodes << <<~DOT
4450
+ #{id} [
4451
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4452
+ ];
4453
+ DOT
4454
+
4455
+ super
4456
+ end
4457
+
4458
+ # Visit a WhenNode node.
4459
+ def visit_when_node(node)
4460
+ table = Table.new("WhenNode")
4461
+ id = node_id(node)
4462
+
4463
+ # keyword_loc
4464
+ table.field("keyword_loc", location_inspect(node.keyword_loc))
4465
+
4466
+ # conditions
4467
+ if node.conditions.any?
4468
+ table.field("conditions", port: true)
4469
+
4470
+ waypoint = "#{id}_conditions"
4471
+ digraph.waypoint("#{waypoint};")
4472
+
4473
+ digraph.edge("#{id}:conditions -> #{waypoint};")
4474
+ node.conditions.each { |child| digraph.edge("#{waypoint} -> #{node_id(child)};") }
4475
+ else
4476
+ table.field("conditions", "[]")
4477
+ end
4478
+
4479
+ # then_keyword_loc
4480
+ unless (then_keyword_loc = node.then_keyword_loc).nil?
4481
+ table.field("then_keyword_loc", location_inspect(then_keyword_loc))
4482
+ end
4483
+
4484
+ # statements
4485
+ unless (statements = node.statements).nil?
4486
+ table.field("statements", port: true)
4487
+ digraph.edge("#{id}:statements -> #{node_id(statements)};")
4488
+ end
4489
+
4490
+ digraph.nodes << <<~DOT
4491
+ #{id} [
4492
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4493
+ ];
4494
+ DOT
4495
+
4496
+ super
4497
+ end
4498
+
4499
+ # Visit a WhileNode node.
4500
+ def visit_while_node(node)
4501
+ table = Table.new("WhileNode")
4502
+ id = node_id(node)
4503
+
4504
+ # flags
4505
+ table.field("flags", loop_flags_inspect(node))
4506
+
4507
+ # keyword_loc
4508
+ table.field("keyword_loc", location_inspect(node.keyword_loc))
4509
+
4510
+ # do_keyword_loc
4511
+ unless (do_keyword_loc = node.do_keyword_loc).nil?
4512
+ table.field("do_keyword_loc", location_inspect(do_keyword_loc))
4513
+ end
4514
+
4515
+ # closing_loc
4516
+ unless (closing_loc = node.closing_loc).nil?
4517
+ table.field("closing_loc", location_inspect(closing_loc))
4518
+ end
4519
+
4520
+ # predicate
4521
+ table.field("predicate", port: true)
4522
+ digraph.edge("#{id}:predicate -> #{node_id(node.predicate)};")
4523
+
4524
+ # statements
4525
+ unless (statements = node.statements).nil?
4526
+ table.field("statements", port: true)
4527
+ digraph.edge("#{id}:statements -> #{node_id(statements)};")
4528
+ end
4529
+
4530
+ digraph.nodes << <<~DOT
4531
+ #{id} [
4532
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4533
+ ];
4534
+ DOT
4535
+
4536
+ super
4537
+ end
4538
+
4539
+ # Visit a XStringNode node.
4540
+ def visit_x_string_node(node)
4541
+ table = Table.new("XStringNode")
4542
+ id = node_id(node)
4543
+
4544
+ # flags
4545
+ table.field("flags", encoding_flags_inspect(node))
4546
+
4547
+ # opening_loc
4548
+ table.field("opening_loc", location_inspect(node.opening_loc))
4549
+
4550
+ # content_loc
4551
+ table.field("content_loc", location_inspect(node.content_loc))
4552
+
4553
+ # closing_loc
4554
+ table.field("closing_loc", location_inspect(node.closing_loc))
4555
+
4556
+ # unescaped
4557
+ table.field("unescaped", node.unescaped.inspect)
4558
+
4559
+ digraph.nodes << <<~DOT
4560
+ #{id} [
4561
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4562
+ ];
4563
+ DOT
4564
+
4565
+ super
4566
+ end
4567
+
4568
+ # Visit a YieldNode node.
4569
+ def visit_yield_node(node)
4570
+ table = Table.new("YieldNode")
4571
+ id = node_id(node)
4572
+
4573
+ # keyword_loc
4574
+ table.field("keyword_loc", location_inspect(node.keyword_loc))
4575
+
4576
+ # lparen_loc
4577
+ unless (lparen_loc = node.lparen_loc).nil?
4578
+ table.field("lparen_loc", location_inspect(lparen_loc))
4579
+ end
4580
+
4581
+ # arguments
4582
+ unless (arguments = node.arguments).nil?
4583
+ table.field("arguments", port: true)
4584
+ digraph.edge("#{id}:arguments -> #{node_id(arguments)};")
4585
+ end
4586
+
4587
+ # rparen_loc
4588
+ unless (rparen_loc = node.rparen_loc).nil?
4589
+ table.field("rparen_loc", location_inspect(rparen_loc))
4590
+ end
4591
+
4592
+ digraph.nodes << <<~DOT
4593
+ #{id} [
4594
+ label=<#{table.to_dot.gsub(/\n/, "\n ")}>
4595
+ ];
4596
+ DOT
4597
+
4598
+ super
4599
+ end
4600
+
4601
+ private
4602
+
4603
+ # Generate a unique node ID for a node throughout the digraph.
4604
+ def node_id(node)
4605
+ "Node_#{node.object_id}"
4606
+ end
4607
+
4608
+ # Inspect a location to display the start and end line and column numbers.
4609
+ def location_inspect(location)
4610
+ "(#{location.start_line},#{location.start_column})-(#{location.end_line},#{location.end_column})"
4611
+ end
4612
+
4613
+ # Inspect a node that has arguments_node_flags flags to display the flags as a
4614
+ # comma-separated list.
4615
+ def arguments_node_flags_inspect(node)
4616
+ flags = [] #: Array[String]
4617
+ flags << "contains_forwarding" if node.contains_forwarding?
4618
+ flags << "contains_keywords" if node.contains_keywords?
4619
+ flags << "contains_keyword_splat" if node.contains_keyword_splat?
4620
+ flags << "contains_splat" if node.contains_splat?
4621
+ flags << "contains_multiple_splats" if node.contains_multiple_splats?
4622
+ flags.join(", ")
4623
+ end
4624
+
4625
+ # Inspect a node that has array_node_flags flags to display the flags as a
4626
+ # comma-separated list.
4627
+ def array_node_flags_inspect(node)
4628
+ flags = [] #: Array[String]
4629
+ flags << "contains_splat" if node.contains_splat?
4630
+ flags.join(", ")
4631
+ end
4632
+
4633
+ # Inspect a node that has call_node_flags flags to display the flags as a
4634
+ # comma-separated list.
4635
+ def call_node_flags_inspect(node)
4636
+ flags = [] #: Array[String]
4637
+ flags << "safe_navigation" if node.safe_navigation?
4638
+ flags << "variable_call" if node.variable_call?
4639
+ flags << "attribute_write" if node.attribute_write?
4640
+ flags << "ignore_visibility" if node.ignore_visibility?
4641
+ flags.join(", ")
4642
+ end
4643
+
4644
+ # Inspect a node that has encoding_flags flags to display the flags as a
4645
+ # comma-separated list.
4646
+ def encoding_flags_inspect(node)
4647
+ flags = [] #: Array[String]
4648
+ flags << "forced_utf8_encoding" if node.forced_utf8_encoding?
4649
+ flags << "forced_binary_encoding" if node.forced_binary_encoding?
4650
+ flags.join(", ")
4651
+ end
4652
+
4653
+ # Inspect a node that has integer_base_flags flags to display the flags as a
4654
+ # comma-separated list.
4655
+ def integer_base_flags_inspect(node)
4656
+ flags = [] #: Array[String]
4657
+ flags << "binary" if node.binary?
4658
+ flags << "decimal" if node.decimal?
4659
+ flags << "octal" if node.octal?
4660
+ flags << "hexadecimal" if node.hexadecimal?
4661
+ flags.join(", ")
4662
+ end
4663
+
4664
+ # Inspect a node that has interpolated_string_node_flags flags to display the flags as a
4665
+ # comma-separated list.
4666
+ def interpolated_string_node_flags_inspect(node)
4667
+ flags = [] #: Array[String]
4668
+ flags << "frozen" if node.frozen?
4669
+ flags << "mutable" if node.mutable?
4670
+ flags.join(", ")
4671
+ end
4672
+
4673
+ # Inspect a node that has keyword_hash_node_flags flags to display the flags as a
4674
+ # comma-separated list.
4675
+ def keyword_hash_node_flags_inspect(node)
4676
+ flags = [] #: Array[String]
4677
+ flags << "symbol_keys" if node.symbol_keys?
4678
+ flags.join(", ")
4679
+ end
4680
+
4681
+ # Inspect a node that has loop_flags flags to display the flags as a
4682
+ # comma-separated list.
4683
+ def loop_flags_inspect(node)
4684
+ flags = [] #: Array[String]
4685
+ flags << "begin_modifier" if node.begin_modifier?
4686
+ flags.join(", ")
4687
+ end
4688
+
4689
+ # Inspect a node that has parameter_flags flags to display the flags as a
4690
+ # comma-separated list.
4691
+ def parameter_flags_inspect(node)
4692
+ flags = [] #: Array[String]
4693
+ flags << "repeated_parameter" if node.repeated_parameter?
4694
+ flags.join(", ")
4695
+ end
4696
+
4697
+ # Inspect a node that has parentheses_node_flags flags to display the flags as a
4698
+ # comma-separated list.
4699
+ def parentheses_node_flags_inspect(node)
4700
+ flags = [] #: Array[String]
4701
+ flags << "multiple_statements" if node.multiple_statements?
4702
+ flags.join(", ")
4703
+ end
4704
+
4705
+ # Inspect a node that has range_flags flags to display the flags as a
4706
+ # comma-separated list.
4707
+ def range_flags_inspect(node)
4708
+ flags = [] #: Array[String]
4709
+ flags << "exclude_end" if node.exclude_end?
4710
+ flags.join(", ")
4711
+ end
4712
+
4713
+ # Inspect a node that has regular_expression_flags flags to display the flags as a
4714
+ # comma-separated list.
4715
+ def regular_expression_flags_inspect(node)
4716
+ flags = [] #: Array[String]
4717
+ flags << "ignore_case" if node.ignore_case?
4718
+ flags << "extended" if node.extended?
4719
+ flags << "multi_line" if node.multi_line?
4720
+ flags << "once" if node.once?
4721
+ flags << "euc_jp" if node.euc_jp?
4722
+ flags << "ascii_8bit" if node.ascii_8bit?
4723
+ flags << "windows_31j" if node.windows_31j?
4724
+ flags << "utf_8" if node.utf_8?
4725
+ flags << "forced_utf8_encoding" if node.forced_utf8_encoding?
4726
+ flags << "forced_binary_encoding" if node.forced_binary_encoding?
4727
+ flags << "forced_us_ascii_encoding" if node.forced_us_ascii_encoding?
4728
+ flags.join(", ")
4729
+ end
4730
+
4731
+ # Inspect a node that has shareable_constant_node_flags flags to display the flags as a
4732
+ # comma-separated list.
4733
+ def shareable_constant_node_flags_inspect(node)
4734
+ flags = [] #: Array[String]
4735
+ flags << "literal" if node.literal?
4736
+ flags << "experimental_everything" if node.experimental_everything?
4737
+ flags << "experimental_copy" if node.experimental_copy?
4738
+ flags.join(", ")
4739
+ end
4740
+
4741
+ # Inspect a node that has string_flags flags to display the flags as a
4742
+ # comma-separated list.
4743
+ def string_flags_inspect(node)
4744
+ flags = [] #: Array[String]
4745
+ flags << "forced_utf8_encoding" if node.forced_utf8_encoding?
4746
+ flags << "forced_binary_encoding" if node.forced_binary_encoding?
4747
+ flags << "frozen" if node.frozen?
4748
+ flags << "mutable" if node.mutable?
4749
+ flags.join(", ")
4750
+ end
4751
+
4752
+ # Inspect a node that has symbol_flags flags to display the flags as a
4753
+ # comma-separated list.
4754
+ def symbol_flags_inspect(node)
4755
+ flags = [] #: Array[String]
4756
+ flags << "forced_utf8_encoding" if node.forced_utf8_encoding?
4757
+ flags << "forced_binary_encoding" if node.forced_binary_encoding?
4758
+ flags << "forced_us_ascii_encoding" if node.forced_us_ascii_encoding?
4759
+ flags.join(", ")
4760
+ end
4761
+ end
4762
+ end