prism 2.0.0.rc1-x86_64-linux-gnu

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