prism 1.9.0 → 2.0.0.rc2

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 (244) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +88 -0
  3. data/CODE_OF_CONDUCT.md +1 -1
  4. data/LICENSE.md +1 -1
  5. data/Makefile +41 -12
  6. data/README.md +35 -97
  7. data/config.yml +174 -161
  8. data/docs/build_system.md +2 -2
  9. data/docs/configuration.md +5 -4
  10. data/docs/encoding.md +2 -2
  11. data/docs/fuzzing.md +4 -11
  12. data/docs/javascript.md +19 -4
  13. data/docs/mapping.md +1 -1
  14. data/docs/releasing.md +77 -5
  15. data/docs/relocation.md +2 -4
  16. data/docs/serialization.md +22 -24
  17. data/docs/testing.md +46 -29
  18. data/ext/prism/api_node.c +1461 -1401
  19. data/ext/prism/extconf.rb +3 -4
  20. data/ext/prism/extension.c +796 -422
  21. data/ext/prism/extension.h +3 -3
  22. data/include/prism/arena.h +37 -0
  23. data/include/prism/ast.h +2727 -610
  24. data/include/prism/buffer.h +52 -0
  25. data/include/prism/comments.h +55 -0
  26. data/include/prism/compiler/accel.h +26 -0
  27. data/include/prism/compiler/align.h +36 -0
  28. data/include/prism/compiler/assume.h +25 -0
  29. data/include/prism/compiler/bswap.h +46 -0
  30. data/include/prism/compiler/endianness.h +34 -0
  31. data/include/prism/compiler/exported.h +24 -0
  32. data/include/prism/compiler/fallthrough.h +22 -0
  33. data/include/prism/compiler/filesystem.h +32 -0
  34. data/include/prism/compiler/flex_array.h +19 -0
  35. data/include/prism/compiler/force_inline.h +21 -0
  36. data/include/prism/compiler/format.h +25 -0
  37. data/include/prism/compiler/inline.h +17 -0
  38. data/include/prism/compiler/nodiscard.h +22 -0
  39. data/include/prism/compiler/nonnull.h +18 -0
  40. data/include/prism/compiler/unused.h +18 -0
  41. data/include/prism/constant_pool.h +81 -0
  42. data/include/prism/diagnostic.h +38 -403
  43. data/include/prism/errors_format.h +53 -0
  44. data/include/prism/excludes.h +29 -0
  45. data/include/prism/integer.h +41 -0
  46. data/include/prism/internal/allocator.h +68 -0
  47. data/include/prism/internal/allocator_debug.h +88 -0
  48. data/include/prism/internal/arena.h +108 -0
  49. data/include/prism/internal/bit.h +42 -0
  50. data/include/prism/internal/buffer.h +94 -0
  51. data/include/prism/internal/char.h +145 -0
  52. data/include/prism/internal/comments.h +53 -0
  53. data/include/prism/internal/constant_pool.h +152 -0
  54. data/include/prism/internal/diagnostic.h +389 -0
  55. data/include/prism/{encoding.h → internal/encoding.h} +27 -68
  56. data/include/prism/internal/integer.h +68 -0
  57. data/include/prism/internal/isinf.h +16 -0
  58. data/include/prism/internal/line_offset_list.h +34 -0
  59. data/include/prism/{util/pm_list.h → internal/list.h} +11 -52
  60. data/include/prism/internal/magic_comments.h +23 -0
  61. data/include/prism/internal/memchr.h +15 -0
  62. data/include/prism/internal/node.h +38 -0
  63. data/include/prism/internal/options.h +232 -0
  64. data/include/prism/internal/parser.h +1004 -0
  65. data/include/prism/internal/regexp.h +26 -0
  66. data/include/prism/internal/serialize.h +39 -0
  67. data/include/prism/internal/source.h +72 -0
  68. data/include/prism/{static_literals.h → internal/static_literals.h} +26 -47
  69. data/include/prism/internal/stringy.h +35 -0
  70. data/include/prism/{util/pm_strncasecmp.h → internal/strncasecmp.h} +3 -17
  71. data/include/prism/{util/pm_strpbrk.h → internal/strpbrk.h} +7 -20
  72. data/include/prism/internal/tokens.h +11 -0
  73. data/include/prism/internal/xxh3.h +16 -0
  74. data/include/prism/json.h +32 -0
  75. data/include/prism/line_offset_list.h +61 -0
  76. data/include/prism/magic_comments.h +35 -0
  77. data/include/prism/node.h +18 -53
  78. data/include/prism/options.h +146 -280
  79. data/include/prism/parser.h +356 -867
  80. data/include/prism/prettyprint.h +6 -9
  81. data/include/prism/serialize.h +115 -0
  82. data/include/prism/source.h +155 -0
  83. data/include/prism/stream.h +28 -0
  84. data/include/prism/string_query.h +74 -0
  85. data/include/prism/stringy.h +72 -0
  86. data/include/prism/version.h +12 -3
  87. data/include/prism.h +43 -320
  88. data/lib/prism/compiler.rb +319 -305
  89. data/lib/prism/desugar_compiler.rb +105 -34
  90. data/lib/prism/dispatcher.rb +646 -473
  91. data/lib/prism/dot_visitor.rb +592 -511
  92. data/lib/prism/dsl.rb +391 -25
  93. data/lib/prism/ffi.rb +258 -90
  94. data/lib/prism/inspect_visitor.rb +357 -325
  95. data/lib/prism/lex_compat.rb +254 -212
  96. data/lib/prism/mutation_compiler.rb +313 -305
  97. data/lib/prism/node.rb +20966 -6992
  98. data/lib/prism/node_ext.rb +180 -187
  99. data/lib/prism/node_find.rb +215 -0
  100. data/lib/prism/parse_result/errors.rb +7 -1
  101. data/lib/prism/parse_result/newlines.rb +276 -8
  102. data/lib/prism/parse_result.rb +468 -139
  103. data/lib/prism/pattern.rb +65 -20
  104. data/lib/prism/reflection.rb +23 -12
  105. data/lib/prism/relocation.rb +149 -87
  106. data/lib/prism/serialize.rb +3460 -539
  107. data/lib/prism/string_query.rb +24 -1
  108. data/lib/prism/translation/parser/builder.rb +10 -2
  109. data/lib/prism/translation/parser/compiler.rb +44 -52
  110. data/lib/prism/translation/parser/lexer.rb +41 -92
  111. data/lib/prism/translation/parser.rb +1 -1
  112. data/lib/prism/translation/parser_current.rb +1 -1
  113. data/lib/prism/translation/ripper/lexer.rb +8 -10
  114. data/lib/prism/translation/ripper/sexp.rb +2 -10
  115. data/lib/prism/translation/ripper/shim.rb +2 -0
  116. data/lib/prism/translation/ripper.rb +967 -209
  117. data/lib/prism/translation/ruby_parser.rb +73 -316
  118. data/lib/prism/translation.rb +2 -0
  119. data/lib/prism/visitor.rb +632 -5
  120. data/lib/prism.rb +79 -9
  121. data/prism.gemspec +128 -62
  122. data/rbi/generated/prism/compiler.rbi +489 -0
  123. data/rbi/generated/prism/desugar_compiler.rbi +306 -0
  124. data/rbi/generated/prism/dispatcher.rbi +1138 -0
  125. data/rbi/generated/prism/dot_visitor.rbi +618 -0
  126. data/rbi/generated/prism/dsl.rbi +751 -0
  127. data/rbi/generated/prism/inspect_visitor.rbi +503 -0
  128. data/rbi/generated/prism/lex_compat.rbi +162 -0
  129. data/rbi/generated/prism/mutation_compiler.rbi +464 -0
  130. data/rbi/generated/prism/node.rbi +14407 -0
  131. data/rbi/generated/prism/node_ext.rbi +259 -0
  132. data/rbi/generated/prism/node_find.rbi +79 -0
  133. data/rbi/generated/prism/parse_result/errors.rbi +21 -0
  134. data/rbi/generated/prism/parse_result/newlines.rbi +208 -0
  135. data/rbi/generated/prism/parse_result.rbi +776 -0
  136. data/rbi/generated/prism/pattern.rbi +134 -0
  137. data/rbi/generated/prism/reflection.rbi +89 -0
  138. data/rbi/generated/prism/relocation.rbi +329 -0
  139. data/rbi/generated/prism/serialize.rbi +184 -0
  140. data/rbi/generated/prism/string_query.rbi +43 -0
  141. data/rbi/generated/prism/translation.rbi +7 -0
  142. data/rbi/generated/prism/visitor.rbi +650 -0
  143. data/rbi/generated/prism.rbi +86 -0
  144. data/rbi/prism/translation/parser_versions.rbi +5 -0
  145. data/rbi/rubyvm/node_find.rbi +14 -0
  146. data/sig/generated/prism/compiler.rbs +492 -0
  147. data/sig/generated/prism/desugar_compiler.rbs +305 -0
  148. data/sig/generated/prism/dispatcher.rbs +1292 -0
  149. data/sig/generated/prism/dot_visitor.rbs +635 -0
  150. data/sig/generated/prism/dsl.rbs +928 -0
  151. data/sig/generated/prism/inspect_visitor.rbs +509 -0
  152. data/sig/generated/prism/lex_compat.rbs +166 -0
  153. data/sig/{prism → generated/prism}/mutation_compiler.rbs +309 -4
  154. data/sig/generated/prism/node.rbs +20896 -0
  155. data/sig/generated/prism/node_ext.rbs +290 -0
  156. data/sig/generated/prism/node_find.rbs +90 -0
  157. data/sig/generated/prism/parse_result/errors.rbs +22 -0
  158. data/sig/generated/prism/parse_result/newlines.rbs +223 -0
  159. data/sig/generated/prism/parse_result.rbs +871 -0
  160. data/sig/generated/prism/pattern.rbs +156 -0
  161. data/sig/generated/prism/reflection.rbs +101 -0
  162. data/sig/generated/prism/relocation.rbs +428 -0
  163. data/sig/generated/prism/serialize.rbs +198 -0
  164. data/sig/generated/prism/string_query.rbs +43 -0
  165. data/sig/generated/prism/translation.rbs +8 -0
  166. data/sig/generated/prism/visitor.rbs +1111 -0
  167. data/sig/generated/prism.rbs +84 -0
  168. data/sig/manifest.yaml +2 -0
  169. data/src/arena.c +117 -0
  170. data/src/{util/pm_buffer.c → buffer.c} +53 -21
  171. data/src/{util/pm_char.c → char.c} +28 -57
  172. data/src/comments.c +454 -0
  173. data/src/constant_pool.c +406 -0
  174. data/src/diagnostic.c +97 -65
  175. data/src/encoding.c +8 -3
  176. data/src/errors_format.c +519 -0
  177. data/src/{util/pm_integer.c → integer.c} +33 -22
  178. data/src/json.c +5733 -0
  179. data/src/line_offset_list.c +100 -0
  180. data/src/list.c +24 -0
  181. data/src/{util/pm_memchr.c → memchr.c} +8 -6
  182. data/src/node.c +3504 -7674
  183. data/src/options.c +162 -49
  184. data/src/parser.c +367 -0
  185. data/src/prettyprint.c +421 -354
  186. data/src/prism.c +8402 -7161
  187. data/src/regexp.c +961 -45
  188. data/src/serialize.c +460 -424
  189. data/src/source.c +518 -0
  190. data/src/static_literals.c +111 -43
  191. data/src/string_query.c +180 -0
  192. data/src/stringy.c +91 -0
  193. data/src/{util/pm_strncasecmp.c → strncasecmp.c} +5 -4
  194. data/src/strpbrk.c +447 -0
  195. data/src/{token_type.c → tokens.c} +39 -18
  196. data/src/xxh3.c +292 -0
  197. metadata +128 -63
  198. data/ext/prism/api_pack.c +0 -276
  199. data/include/prism/defines.h +0 -260
  200. data/include/prism/pack.h +0 -163
  201. data/include/prism/regexp.h +0 -43
  202. data/include/prism/util/pm_buffer.h +0 -236
  203. data/include/prism/util/pm_char.h +0 -204
  204. data/include/prism/util/pm_constant_pool.h +0 -218
  205. data/include/prism/util/pm_integer.h +0 -130
  206. data/include/prism/util/pm_memchr.h +0 -29
  207. data/include/prism/util/pm_newline_list.h +0 -113
  208. data/include/prism/util/pm_string.h +0 -200
  209. data/lib/prism/pack.rb +0 -230
  210. data/lib/prism/parse_result/comments.rb +0 -188
  211. data/rbi/prism/compiler.rbi +0 -12
  212. data/rbi/prism/dsl.rbi +0 -524
  213. data/rbi/prism/inspect_visitor.rbi +0 -12
  214. data/rbi/prism/node.rbi +0 -8750
  215. data/rbi/prism/node_ext.rbi +0 -107
  216. data/rbi/prism/parse_result.rbi +0 -404
  217. data/rbi/prism/reflection.rbi +0 -58
  218. data/rbi/prism/string_query.rbi +0 -12
  219. data/rbi/prism/visitor.rbi +0 -473
  220. data/rbi/prism.rbi +0 -63
  221. data/sig/prism/compiler.rbs +0 -9
  222. data/sig/prism/dispatcher.rbs +0 -19
  223. data/sig/prism/dot_visitor.rbs +0 -6
  224. data/sig/prism/dsl.rbs +0 -351
  225. data/sig/prism/inspect_visitor.rbs +0 -22
  226. data/sig/prism/lex_compat.rbs +0 -10
  227. data/sig/prism/node.rbs +0 -4042
  228. data/sig/prism/node_ext.rbs +0 -149
  229. data/sig/prism/pack.rbs +0 -43
  230. data/sig/prism/parse_result/comments.rbs +0 -38
  231. data/sig/prism/parse_result.rbs +0 -197
  232. data/sig/prism/pattern.rbs +0 -13
  233. data/sig/prism/reflection.rbs +0 -50
  234. data/sig/prism/relocation.rbs +0 -185
  235. data/sig/prism/serialize.rbs +0 -8
  236. data/sig/prism/string_query.rbs +0 -11
  237. data/sig/prism/visitor.rbs +0 -169
  238. data/sig/prism.rbs +0 -272
  239. data/src/pack.c +0 -509
  240. data/src/util/pm_constant_pool.c +0 -342
  241. data/src/util/pm_list.c +0 -49
  242. data/src/util/pm_newline_list.c +0 -125
  243. data/src/util/pm_string.c +0 -381
  244. data/src/util/pm_strpbrk.c +0 -206
data/lib/prism/dsl.rb CHANGED
@@ -9,11 +9,14 @@ if you are looking to modify the template
9
9
  ++
10
10
  =end
11
11
 
12
+ #--
13
+ # rbs_inline: enabled
14
+
12
15
  module Prism
13
16
  # The DSL module provides a set of methods that can be used to create prism
14
17
  # nodes in a more concise manner. For example, instead of writing:
15
18
  #
16
- # source = Prism::Source.for("[1]")
19
+ # source = Prism::Source.for("[1]", 1, [0])
17
20
  #
18
21
  # Prism::ArrayNode.new(
19
22
  # source,
@@ -67,771 +70,1086 @@ module Prism
67
70
  extend self
68
71
 
69
72
  # Create a new Source object.
73
+ #
74
+ #: (String string) -> Source
70
75
  def source(string)
71
- Source.for(string)
76
+ Source.for(string, 1, build_offsets(string))
72
77
  end
73
78
 
74
79
  # Create a new Location object.
80
+ #
81
+ #: (?source: Source, ?start_offset: Integer, ?length: Integer) -> Location
75
82
  def location(source: default_source, start_offset: 0, length: 0)
76
83
  Location.new(source, start_offset, length)
77
84
  end
78
85
 
79
86
  # Create a new AliasGlobalVariableNode node.
87
+ #
88
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?new_name: (GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode), ?old_name: (GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode), ?keyword_loc: Location) -> AliasGlobalVariableNode
80
89
  def alias_global_variable_node(source: default_source, node_id: 0, location: default_location, flags: 0, new_name: global_variable_read_node(source: source), old_name: global_variable_read_node(source: source), keyword_loc: location)
81
90
  AliasGlobalVariableNode.new(source, node_id, location, flags, new_name, old_name, keyword_loc)
82
91
  end
83
92
 
84
93
  # Create a new AliasMethodNode node.
94
+ #
95
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?new_name: (SymbolNode | InterpolatedSymbolNode), ?old_name: (SymbolNode | InterpolatedSymbolNode), ?keyword_loc: Location) -> AliasMethodNode
85
96
  def alias_method_node(source: default_source, node_id: 0, location: default_location, flags: 0, new_name: symbol_node(source: source), old_name: symbol_node(source: source), keyword_loc: location)
86
97
  AliasMethodNode.new(source, node_id, location, flags, new_name, old_name, keyword_loc)
87
98
  end
88
99
 
89
100
  # Create a new AlternationPatternNode node.
101
+ #
102
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> AlternationPatternNode
90
103
  def alternation_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: default_node(source, location), right: default_node(source, location), operator_loc: location)
91
104
  AlternationPatternNode.new(source, node_id, location, flags, left, right, operator_loc)
92
105
  end
93
106
 
94
107
  # Create a new AndNode node.
108
+ #
109
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> AndNode
95
110
  def and_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: default_node(source, location), right: default_node(source, location), operator_loc: location)
96
111
  AndNode.new(source, node_id, location, flags, left, right, operator_loc)
97
112
  end
98
113
 
99
114
  # Create a new ArgumentsNode node.
115
+ #
116
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?arguments: Array[Prism::node]) -> ArgumentsNode
100
117
  def arguments_node(source: default_source, node_id: 0, location: default_location, flags: 0, arguments: [])
101
118
  ArgumentsNode.new(source, node_id, location, flags, arguments)
102
119
  end
103
120
 
104
121
  # Create a new ArrayNode node.
122
+ #
123
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?elements: Array[Prism::node], ?opening_loc: Location?, ?closing_loc: Location?) -> ArrayNode
105
124
  def array_node(source: default_source, node_id: 0, location: default_location, flags: 0, elements: [], opening_loc: nil, closing_loc: nil)
106
125
  ArrayNode.new(source, node_id, location, flags, elements, opening_loc, closing_loc)
107
126
  end
108
127
 
109
128
  # Create a new ArrayPatternNode node.
129
+ #
130
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?constant: (ConstantPathNode | ConstantReadNode)?, ?requireds: Array[Prism::node], ?rest: (ImplicitRestNode | SplatNode)?, ?posts: Array[Prism::node], ?opening_loc: Location?, ?closing_loc: Location?) -> ArrayPatternNode
110
131
  def array_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, constant: nil, requireds: [], rest: nil, posts: [], opening_loc: nil, closing_loc: nil)
111
132
  ArrayPatternNode.new(source, node_id, location, flags, constant, requireds, rest, posts, opening_loc, closing_loc)
112
133
  end
113
134
 
114
135
  # Create a new AssocNode node.
136
+ #
137
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?key: Prism::node, ?value: Prism::node, ?operator_loc: Location?) -> AssocNode
115
138
  def assoc_node(source: default_source, node_id: 0, location: default_location, flags: 0, key: default_node(source, location), value: default_node(source, location), operator_loc: nil)
116
139
  AssocNode.new(source, node_id, location, flags, key, value, operator_loc)
117
140
  end
118
141
 
119
142
  # Create a new AssocSplatNode node.
143
+ #
144
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Prism::node?, ?operator_loc: Location) -> AssocSplatNode
120
145
  def assoc_splat_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: nil, operator_loc: location)
121
146
  AssocSplatNode.new(source, node_id, location, flags, value, operator_loc)
122
147
  end
123
148
 
124
149
  # Create a new BackReferenceReadNode node.
150
+ #
151
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> BackReferenceReadNode
125
152
  def back_reference_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
126
153
  BackReferenceReadNode.new(source, node_id, location, flags, name)
127
154
  end
128
155
 
129
156
  # Create a new BeginNode node.
157
+ #
158
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?begin_keyword_loc: Location?, ?statements: StatementsNode?, ?rescue_clause: RescueNode?, ?else_clause: ElseNode?, ?ensure_clause: EnsureNode?, ?end_keyword_loc: Location?) -> BeginNode
130
159
  def begin_node(source: default_source, node_id: 0, location: default_location, flags: 0, begin_keyword_loc: nil, statements: nil, rescue_clause: nil, else_clause: nil, ensure_clause: nil, end_keyword_loc: nil)
131
160
  BeginNode.new(source, node_id, location, flags, begin_keyword_loc, statements, rescue_clause, else_clause, ensure_clause, end_keyword_loc)
132
161
  end
133
162
 
134
163
  # Create a new BlockArgumentNode node.
164
+ #
165
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?expression: Prism::node?, ?operator_loc: Location) -> BlockArgumentNode
135
166
  def block_argument_node(source: default_source, node_id: 0, location: default_location, flags: 0, expression: nil, operator_loc: location)
136
167
  BlockArgumentNode.new(source, node_id, location, flags, expression, operator_loc)
137
168
  end
138
169
 
139
170
  # Create a new BlockLocalVariableNode node.
171
+ #
172
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> BlockLocalVariableNode
140
173
  def block_local_variable_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
141
174
  BlockLocalVariableNode.new(source, node_id, location, flags, name)
142
175
  end
143
176
 
144
177
  # Create a new BlockNode node.
178
+ #
179
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?parameters: (BlockParametersNode | NumberedParametersNode | ItParametersNode)?, ?body: (StatementsNode | BeginNode)?, ?opening_loc: Location, ?closing_loc: Location) -> BlockNode
145
180
  def block_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], parameters: nil, body: nil, opening_loc: location, closing_loc: location)
146
181
  BlockNode.new(source, node_id, location, flags, locals, parameters, body, opening_loc, closing_loc)
147
182
  end
148
183
 
149
184
  # Create a new BlockParameterNode node.
185
+ #
186
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location) -> BlockParameterNode
150
187
  def block_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: nil, name_loc: nil, operator_loc: location)
151
188
  BlockParameterNode.new(source, node_id, location, flags, name, name_loc, operator_loc)
152
189
  end
153
190
 
154
191
  # Create a new BlockParametersNode node.
192
+ #
193
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?parameters: ParametersNode?, ?locals: Array[BlockLocalVariableNode], ?opening_loc: Location?, ?closing_loc: Location?) -> BlockParametersNode
155
194
  def block_parameters_node(source: default_source, node_id: 0, location: default_location, flags: 0, parameters: nil, locals: [], opening_loc: nil, closing_loc: nil)
156
195
  BlockParametersNode.new(source, node_id, location, flags, parameters, locals, opening_loc, closing_loc)
157
196
  end
158
197
 
159
198
  # Create a new BreakNode node.
199
+ #
200
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?arguments: ArgumentsNode?, ?keyword_loc: Location) -> BreakNode
160
201
  def break_node(source: default_source, node_id: 0, location: default_location, flags: 0, arguments: nil, keyword_loc: location)
161
202
  BreakNode.new(source, node_id, location, flags, arguments, keyword_loc)
162
203
  end
163
204
 
164
205
  # Create a new CallAndWriteNode node.
206
+ #
207
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?operator_loc: Location, ?value: Prism::node) -> CallAndWriteNode
165
208
  def call_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, message_loc: nil, read_name: :"", write_name: :"", operator_loc: location, value: default_node(source, location))
166
209
  CallAndWriteNode.new(source, node_id, location, flags, receiver, call_operator_loc, message_loc, read_name, write_name, operator_loc, value)
167
210
  end
168
211
 
169
212
  # Create a new CallNode node.
213
+ #
214
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?name: Symbol, ?message_loc: Location?, ?opening_loc: Location?, ?arguments: ArgumentsNode?, ?closing_loc: Location?, ?equal_loc: Location?, ?block: (BlockNode | BlockArgumentNode)?) -> CallNode
170
215
  def call_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, name: :"", message_loc: nil, opening_loc: nil, arguments: nil, closing_loc: nil, equal_loc: nil, block: nil)
171
216
  CallNode.new(source, node_id, location, flags, receiver, call_operator_loc, name, message_loc, opening_loc, arguments, closing_loc, equal_loc, block)
172
217
  end
173
218
 
174
219
  # Create a new CallOperatorWriteNode node.
220
+ #
221
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?binary_operator: Symbol, ?binary_operator_loc: Location, ?value: Prism::node) -> CallOperatorWriteNode
175
222
  def call_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, message_loc: nil, read_name: :"", write_name: :"", binary_operator: :"", binary_operator_loc: location, value: default_node(source, location))
176
223
  CallOperatorWriteNode.new(source, node_id, location, flags, receiver, call_operator_loc, message_loc, read_name, write_name, binary_operator, binary_operator_loc, value)
177
224
  end
178
225
 
179
226
  # Create a new CallOrWriteNode node.
227
+ #
228
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?message_loc: Location?, ?read_name: Symbol, ?write_name: Symbol, ?operator_loc: Location, ?value: Prism::node) -> CallOrWriteNode
180
229
  def call_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, message_loc: nil, read_name: :"", write_name: :"", operator_loc: location, value: default_node(source, location))
181
230
  CallOrWriteNode.new(source, node_id, location, flags, receiver, call_operator_loc, message_loc, read_name, write_name, operator_loc, value)
182
231
  end
183
232
 
184
233
  # Create a new CallTargetNode node.
234
+ #
235
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node, ?call_operator_loc: Location, ?name: Symbol, ?message_loc: Location) -> CallTargetNode
185
236
  def call_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: default_node(source, location), call_operator_loc: location, name: :"", message_loc: location)
186
237
  CallTargetNode.new(source, node_id, location, flags, receiver, call_operator_loc, name, message_loc)
187
238
  end
188
239
 
189
240
  # Create a new CapturePatternNode node.
241
+ #
242
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Prism::node, ?target: LocalVariableTargetNode, ?operator_loc: Location) -> CapturePatternNode
190
243
  def capture_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: default_node(source, location), target: local_variable_target_node(source: source), operator_loc: location)
191
244
  CapturePatternNode.new(source, node_id, location, flags, value, target, operator_loc)
192
245
  end
193
246
 
194
247
  # Create a new CaseMatchNode node.
248
+ #
249
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?predicate: Prism::node?, ?conditions: Array[InNode], ?else_clause: ElseNode?, ?case_keyword_loc: Location, ?end_keyword_loc: Location) -> CaseMatchNode
195
250
  def case_match_node(source: default_source, node_id: 0, location: default_location, flags: 0, predicate: nil, conditions: [], else_clause: nil, case_keyword_loc: location, end_keyword_loc: location)
196
251
  CaseMatchNode.new(source, node_id, location, flags, predicate, conditions, else_clause, case_keyword_loc, end_keyword_loc)
197
252
  end
198
253
 
199
254
  # Create a new CaseNode node.
255
+ #
256
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?predicate: Prism::node?, ?conditions: Array[WhenNode], ?else_clause: ElseNode?, ?case_keyword_loc: Location, ?end_keyword_loc: Location) -> CaseNode
200
257
  def case_node(source: default_source, node_id: 0, location: default_location, flags: 0, predicate: nil, conditions: [], else_clause: nil, case_keyword_loc: location, end_keyword_loc: location)
201
258
  CaseNode.new(source, node_id, location, flags, predicate, conditions, else_clause, case_keyword_loc, end_keyword_loc)
202
259
  end
203
260
 
204
261
  # Create a new ClassNode node.
262
+ #
263
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?class_keyword_loc: Location, ?constant_path: (ConstantReadNode | ConstantPathNode), ?inheritance_operator_loc: Location?, ?superclass: Prism::node?, ?body: (StatementsNode | BeginNode)?, ?end_keyword_loc: Location, ?name: Symbol) -> ClassNode
205
264
  def class_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], class_keyword_loc: location, constant_path: constant_read_node(source: source), inheritance_operator_loc: nil, superclass: nil, body: nil, end_keyword_loc: location, name: :"")
206
265
  ClassNode.new(source, node_id, location, flags, locals, class_keyword_loc, constant_path, inheritance_operator_loc, superclass, body, end_keyword_loc, name)
207
266
  end
208
267
 
209
268
  # Create a new ClassVariableAndWriteNode node.
269
+ #
270
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ClassVariableAndWriteNode
210
271
  def class_variable_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location))
211
272
  ClassVariableAndWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value)
212
273
  end
213
274
 
214
275
  # Create a new ClassVariableOperatorWriteNode node.
276
+ #
277
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ClassVariableOperatorWriteNode
215
278
  def class_variable_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, binary_operator_loc: location, value: default_node(source, location), binary_operator: :"")
216
279
  ClassVariableOperatorWriteNode.new(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator)
217
280
  end
218
281
 
219
282
  # Create a new ClassVariableOrWriteNode node.
283
+ #
284
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ClassVariableOrWriteNode
220
285
  def class_variable_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location))
221
286
  ClassVariableOrWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value)
222
287
  end
223
288
 
224
289
  # Create a new ClassVariableReadNode node.
290
+ #
291
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ClassVariableReadNode
225
292
  def class_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
226
293
  ClassVariableReadNode.new(source, node_id, location, flags, name)
227
294
  end
228
295
 
229
296
  # Create a new ClassVariableTargetNode node.
297
+ #
298
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ClassVariableTargetNode
230
299
  def class_variable_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
231
300
  ClassVariableTargetNode.new(source, node_id, location, flags, name)
232
301
  end
233
302
 
234
303
  # Create a new ClassVariableWriteNode node.
304
+ #
305
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> ClassVariableWriteNode
235
306
  def class_variable_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location), operator_loc: location)
236
307
  ClassVariableWriteNode.new(source, node_id, location, flags, name, name_loc, value, operator_loc)
237
308
  end
238
309
 
239
310
  # Create a new ConstantAndWriteNode node.
311
+ #
312
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ConstantAndWriteNode
240
313
  def constant_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location))
241
314
  ConstantAndWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value)
242
315
  end
243
316
 
244
317
  # Create a new ConstantOperatorWriteNode node.
318
+ #
319
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ConstantOperatorWriteNode
245
320
  def constant_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, binary_operator_loc: location, value: default_node(source, location), binary_operator: :"")
246
321
  ConstantOperatorWriteNode.new(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator)
247
322
  end
248
323
 
249
324
  # Create a new ConstantOrWriteNode node.
325
+ #
326
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> ConstantOrWriteNode
250
327
  def constant_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location))
251
328
  ConstantOrWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value)
252
329
  end
253
330
 
254
331
  # Create a new ConstantPathAndWriteNode node.
332
+ #
333
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathAndWriteNode
255
334
  def constant_path_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, target: constant_path_node(source: source), operator_loc: location, value: default_node(source, location))
256
335
  ConstantPathAndWriteNode.new(source, node_id, location, flags, target, operator_loc, value)
257
336
  end
258
337
 
259
338
  # Create a new ConstantPathNode node.
339
+ #
340
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?parent: Prism::node?, ?name: Symbol?, ?delimiter_loc: Location, ?name_loc: Location) -> ConstantPathNode
260
341
  def constant_path_node(source: default_source, node_id: 0, location: default_location, flags: 0, parent: nil, name: nil, delimiter_loc: location, name_loc: location)
261
342
  ConstantPathNode.new(source, node_id, location, flags, parent, name, delimiter_loc, name_loc)
262
343
  end
263
344
 
264
345
  # Create a new ConstantPathOperatorWriteNode node.
346
+ #
347
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ConstantPathOperatorWriteNode
265
348
  def constant_path_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, target: constant_path_node(source: source), binary_operator_loc: location, value: default_node(source, location), binary_operator: :"")
266
349
  ConstantPathOperatorWriteNode.new(source, node_id, location, flags, target, binary_operator_loc, value, binary_operator)
267
350
  end
268
351
 
269
352
  # Create a new ConstantPathOrWriteNode node.
353
+ #
354
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathOrWriteNode
270
355
  def constant_path_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, target: constant_path_node(source: source), operator_loc: location, value: default_node(source, location))
271
356
  ConstantPathOrWriteNode.new(source, node_id, location, flags, target, operator_loc, value)
272
357
  end
273
358
 
274
359
  # Create a new ConstantPathTargetNode node.
360
+ #
361
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?parent: Prism::node?, ?name: Symbol?, ?delimiter_loc: Location, ?name_loc: Location) -> ConstantPathTargetNode
275
362
  def constant_path_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, parent: nil, name: nil, delimiter_loc: location, name_loc: location)
276
363
  ConstantPathTargetNode.new(source, node_id, location, flags, parent, name, delimiter_loc, name_loc)
277
364
  end
278
365
 
279
366
  # Create a new ConstantPathWriteNode node.
367
+ #
368
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?operator_loc: Location, ?value: Prism::node) -> ConstantPathWriteNode
280
369
  def constant_path_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, target: constant_path_node(source: source), operator_loc: location, value: default_node(source, location))
281
370
  ConstantPathWriteNode.new(source, node_id, location, flags, target, operator_loc, value)
282
371
  end
283
372
 
284
373
  # Create a new ConstantReadNode node.
374
+ #
375
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ConstantReadNode
285
376
  def constant_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
286
377
  ConstantReadNode.new(source, node_id, location, flags, name)
287
378
  end
288
379
 
289
380
  # Create a new ConstantTargetNode node.
381
+ #
382
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ConstantTargetNode
290
383
  def constant_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
291
384
  ConstantTargetNode.new(source, node_id, location, flags, name)
292
385
  end
293
386
 
294
387
  # Create a new ConstantWriteNode node.
388
+ #
389
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> ConstantWriteNode
295
390
  def constant_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location), operator_loc: location)
296
391
  ConstantWriteNode.new(source, node_id, location, flags, name, name_loc, value, operator_loc)
297
392
  end
298
393
 
299
394
  # Create a new DefNode node.
395
+ #
396
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?receiver: Prism::node?, ?parameters: ParametersNode?, ?body: (StatementsNode | BeginNode)?, ?locals: Array[Symbol], ?def_keyword_loc: Location, ?operator_loc: Location?, ?lparen_loc: Location?, ?rparen_loc: Location?, ?equal_loc: Location?, ?end_keyword_loc: Location?) -> DefNode
300
397
  def def_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, receiver: nil, parameters: nil, body: nil, locals: [], def_keyword_loc: location, operator_loc: nil, lparen_loc: nil, rparen_loc: nil, equal_loc: nil, end_keyword_loc: nil)
301
398
  DefNode.new(source, node_id, location, flags, name, name_loc, receiver, parameters, body, locals, def_keyword_loc, operator_loc, lparen_loc, rparen_loc, equal_loc, end_keyword_loc)
302
399
  end
303
400
 
304
401
  # Create a new DefinedNode node.
402
+ #
403
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?lparen_loc: Location?, ?value: Prism::node, ?rparen_loc: Location?, ?keyword_loc: Location) -> DefinedNode
305
404
  def defined_node(source: default_source, node_id: 0, location: default_location, flags: 0, lparen_loc: nil, value: default_node(source, location), rparen_loc: nil, keyword_loc: location)
306
405
  DefinedNode.new(source, node_id, location, flags, lparen_loc, value, rparen_loc, keyword_loc)
307
406
  end
308
407
 
309
408
  # Create a new ElseNode node.
409
+ #
410
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?else_keyword_loc: Location, ?statements: StatementsNode?, ?end_keyword_loc: Location?) -> ElseNode
310
411
  def else_node(source: default_source, node_id: 0, location: default_location, flags: 0, else_keyword_loc: location, statements: nil, end_keyword_loc: nil)
311
412
  ElseNode.new(source, node_id, location, flags, else_keyword_loc, statements, end_keyword_loc)
312
413
  end
313
414
 
314
415
  # Create a new EmbeddedStatementsNode node.
416
+ #
417
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?statements: StatementsNode?, ?closing_loc: Location) -> EmbeddedStatementsNode
315
418
  def embedded_statements_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, statements: nil, closing_loc: location)
316
419
  EmbeddedStatementsNode.new(source, node_id, location, flags, opening_loc, statements, closing_loc)
317
420
  end
318
421
 
319
422
  # Create a new EmbeddedVariableNode node.
423
+ #
424
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?variable: (InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode)) -> EmbeddedVariableNode
320
425
  def embedded_variable_node(source: default_source, node_id: 0, location: default_location, flags: 0, operator_loc: location, variable: instance_variable_read_node(source: source))
321
426
  EmbeddedVariableNode.new(source, node_id, location, flags, operator_loc, variable)
322
427
  end
323
428
 
324
429
  # Create a new EnsureNode node.
430
+ #
431
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?ensure_keyword_loc: Location, ?statements: StatementsNode?, ?end_keyword_loc: Location) -> EnsureNode
325
432
  def ensure_node(source: default_source, node_id: 0, location: default_location, flags: 0, ensure_keyword_loc: location, statements: nil, end_keyword_loc: location)
326
433
  EnsureNode.new(source, node_id, location, flags, ensure_keyword_loc, statements, end_keyword_loc)
327
434
  end
328
435
 
436
+ # Create a new ErrorRecoveryNode node.
437
+ #
438
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?unexpected: Prism::node?) -> ErrorRecoveryNode
439
+ def error_recovery_node(source: default_source, node_id: 0, location: default_location, flags: 0, unexpected: nil)
440
+ ErrorRecoveryNode.new(source, node_id, location, flags, unexpected)
441
+ end
442
+
329
443
  # Create a new FalseNode node.
444
+ #
445
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer) -> FalseNode
330
446
  def false_node(source: default_source, node_id: 0, location: default_location, flags: 0)
331
447
  FalseNode.new(source, node_id, location, flags)
332
448
  end
333
449
 
334
450
  # Create a new FindPatternNode node.
451
+ #
452
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?constant: (ConstantPathNode | ConstantReadNode)?, ?left: SplatNode, ?requireds: Array[Prism::node], ?right: SplatNode, ?opening_loc: Location?, ?closing_loc: Location?) -> FindPatternNode
335
453
  def find_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, constant: nil, left: splat_node(source: source), requireds: [], right: splat_node(source: source), opening_loc: nil, closing_loc: nil)
336
454
  FindPatternNode.new(source, node_id, location, flags, constant, left, requireds, right, opening_loc, closing_loc)
337
455
  end
338
456
 
339
457
  # Create a new FlipFlopNode node.
458
+ #
459
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node?, ?right: Prism::node?, ?operator_loc: Location) -> FlipFlopNode
340
460
  def flip_flop_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: nil, right: nil, operator_loc: location)
341
461
  FlipFlopNode.new(source, node_id, location, flags, left, right, operator_loc)
342
462
  end
343
463
 
344
464
  # Create a new FloatNode node.
465
+ #
466
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Float) -> FloatNode
345
467
  def float_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: 0.0)
346
468
  FloatNode.new(source, node_id, location, flags, value)
347
469
  end
348
470
 
349
471
  # Create a new ForNode node.
472
+ #
473
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?index: (LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode), ?collection: Prism::node, ?statements: StatementsNode?, ?for_keyword_loc: Location, ?in_keyword_loc: Location, ?do_keyword_loc: Location?, ?end_keyword_loc: Location) -> ForNode
350
474
  def for_node(source: default_source, node_id: 0, location: default_location, flags: 0, index: local_variable_target_node(source: source), collection: default_node(source, location), statements: nil, for_keyword_loc: location, in_keyword_loc: location, do_keyword_loc: nil, end_keyword_loc: location)
351
475
  ForNode.new(source, node_id, location, flags, index, collection, statements, for_keyword_loc, in_keyword_loc, do_keyword_loc, end_keyword_loc)
352
476
  end
353
477
 
354
478
  # Create a new ForwardingArgumentsNode node.
479
+ #
480
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer) -> ForwardingArgumentsNode
355
481
  def forwarding_arguments_node(source: default_source, node_id: 0, location: default_location, flags: 0)
356
482
  ForwardingArgumentsNode.new(source, node_id, location, flags)
357
483
  end
358
484
 
359
485
  # Create a new ForwardingParameterNode node.
486
+ #
487
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer) -> ForwardingParameterNode
360
488
  def forwarding_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0)
361
489
  ForwardingParameterNode.new(source, node_id, location, flags)
362
490
  end
363
491
 
364
492
  # Create a new ForwardingSuperNode node.
365
- def forwarding_super_node(source: default_source, node_id: 0, location: default_location, flags: 0, block: nil)
366
- ForwardingSuperNode.new(source, node_id, location, flags, block)
493
+ #
494
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?block: BlockNode?) -> ForwardingSuperNode
495
+ def forwarding_super_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, block: nil)
496
+ ForwardingSuperNode.new(source, node_id, location, flags, keyword_loc, block)
367
497
  end
368
498
 
369
499
  # Create a new GlobalVariableAndWriteNode node.
500
+ #
501
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> GlobalVariableAndWriteNode
370
502
  def global_variable_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location))
371
503
  GlobalVariableAndWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value)
372
504
  end
373
505
 
374
506
  # Create a new GlobalVariableOperatorWriteNode node.
507
+ #
508
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> GlobalVariableOperatorWriteNode
375
509
  def global_variable_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, binary_operator_loc: location, value: default_node(source, location), binary_operator: :"")
376
510
  GlobalVariableOperatorWriteNode.new(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator)
377
511
  end
378
512
 
379
513
  # Create a new GlobalVariableOrWriteNode node.
514
+ #
515
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> GlobalVariableOrWriteNode
380
516
  def global_variable_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location))
381
517
  GlobalVariableOrWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value)
382
518
  end
383
519
 
384
520
  # Create a new GlobalVariableReadNode node.
521
+ #
522
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> GlobalVariableReadNode
385
523
  def global_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
386
524
  GlobalVariableReadNode.new(source, node_id, location, flags, name)
387
525
  end
388
526
 
389
527
  # Create a new GlobalVariableTargetNode node.
528
+ #
529
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> GlobalVariableTargetNode
390
530
  def global_variable_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
391
531
  GlobalVariableTargetNode.new(source, node_id, location, flags, name)
392
532
  end
393
533
 
394
534
  # Create a new GlobalVariableWriteNode node.
535
+ #
536
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> GlobalVariableWriteNode
395
537
  def global_variable_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location), operator_loc: location)
396
538
  GlobalVariableWriteNode.new(source, node_id, location, flags, name, name_loc, value, operator_loc)
397
539
  end
398
540
 
399
541
  # Create a new HashNode node.
542
+ #
543
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?elements: Array[AssocNode | AssocSplatNode], ?closing_loc: Location) -> HashNode
400
544
  def hash_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, elements: [], closing_loc: location)
401
545
  HashNode.new(source, node_id, location, flags, opening_loc, elements, closing_loc)
402
546
  end
403
547
 
404
548
  # Create a new HashPatternNode node.
549
+ #
550
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?constant: (ConstantPathNode | ConstantReadNode)?, ?elements: Array[AssocNode], ?rest: (AssocSplatNode | NoKeywordsParameterNode)?, ?opening_loc: Location?, ?closing_loc: Location?) -> HashPatternNode
405
551
  def hash_pattern_node(source: default_source, node_id: 0, location: default_location, flags: 0, constant: nil, elements: [], rest: nil, opening_loc: nil, closing_loc: nil)
406
552
  HashPatternNode.new(source, node_id, location, flags, constant, elements, rest, opening_loc, closing_loc)
407
553
  end
408
554
 
409
555
  # Create a new IfNode node.
556
+ #
557
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?if_keyword_loc: Location?, ?predicate: Prism::node, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?subsequent: (ElseNode | IfNode)?, ?end_keyword_loc: Location?) -> IfNode
410
558
  def if_node(source: default_source, node_id: 0, location: default_location, flags: 0, if_keyword_loc: nil, predicate: default_node(source, location), then_keyword_loc: nil, statements: nil, subsequent: nil, end_keyword_loc: nil)
411
559
  IfNode.new(source, node_id, location, flags, if_keyword_loc, predicate, then_keyword_loc, statements, subsequent, end_keyword_loc)
412
560
  end
413
561
 
414
562
  # Create a new ImaginaryNode node.
563
+ #
564
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?numeric: (FloatNode | IntegerNode | RationalNode)) -> ImaginaryNode
415
565
  def imaginary_node(source: default_source, node_id: 0, location: default_location, flags: 0, numeric: float_node(source: source))
416
566
  ImaginaryNode.new(source, node_id, location, flags, numeric)
417
567
  end
418
568
 
419
569
  # Create a new ImplicitNode node.
570
+ #
571
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?value: (LocalVariableReadNode | CallNode | ConstantReadNode | LocalVariableTargetNode)) -> ImplicitNode
420
572
  def implicit_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: local_variable_read_node(source: source))
421
573
  ImplicitNode.new(source, node_id, location, flags, value)
422
574
  end
423
575
 
424
576
  # Create a new ImplicitRestNode node.
577
+ #
578
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer) -> ImplicitRestNode
425
579
  def implicit_rest_node(source: default_source, node_id: 0, location: default_location, flags: 0)
426
580
  ImplicitRestNode.new(source, node_id, location, flags)
427
581
  end
428
582
 
429
583
  # Create a new InNode node.
430
- def in_node(source: default_source, node_id: 0, location: default_location, flags: 0, pattern: default_node(source, location), statements: nil, in_loc: location, then_loc: nil)
431
- InNode.new(source, node_id, location, flags, pattern, statements, in_loc, then_loc)
584
+ #
585
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?pattern: Prism::node, ?statements: StatementsNode?, ?in_keyword_loc: Location, ?then_keyword_loc: Location?) -> InNode
586
+ def in_node(source: default_source, node_id: 0, location: default_location, flags: 0, pattern: default_node(source, location), statements: nil, in_keyword_loc: location, then_keyword_loc: nil)
587
+ InNode.new(source, node_id, location, flags, pattern, statements, in_keyword_loc, then_keyword_loc)
432
588
  end
433
589
 
434
590
  # Create a new IndexAndWriteNode node.
591
+ #
592
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?, ?operator_loc: Location, ?value: Prism::node) -> IndexAndWriteNode
435
593
  def index_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, opening_loc: location, arguments: nil, closing_loc: location, block: nil, operator_loc: location, value: default_node(source, location))
436
594
  IndexAndWriteNode.new(source, node_id, location, flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value)
437
595
  end
438
596
 
439
597
  # Create a new IndexOperatorWriteNode node.
598
+ #
599
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?, ?binary_operator: Symbol, ?binary_operator_loc: Location, ?value: Prism::node) -> IndexOperatorWriteNode
440
600
  def index_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, opening_loc: location, arguments: nil, closing_loc: location, block: nil, binary_operator: :"", binary_operator_loc: location, value: default_node(source, location))
441
601
  IndexOperatorWriteNode.new(source, node_id, location, flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, binary_operator, binary_operator_loc, value)
442
602
  end
443
603
 
444
604
  # Create a new IndexOrWriteNode node.
605
+ #
606
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node?, ?call_operator_loc: Location?, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?, ?operator_loc: Location, ?value: Prism::node) -> IndexOrWriteNode
445
607
  def index_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: nil, call_operator_loc: nil, opening_loc: location, arguments: nil, closing_loc: location, block: nil, operator_loc: location, value: default_node(source, location))
446
608
  IndexOrWriteNode.new(source, node_id, location, flags, receiver, call_operator_loc, opening_loc, arguments, closing_loc, block, operator_loc, value)
447
609
  end
448
610
 
449
611
  # Create a new IndexTargetNode node.
612
+ #
613
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?receiver: Prism::node, ?opening_loc: Location, ?arguments: ArgumentsNode?, ?closing_loc: Location, ?block: BlockArgumentNode?) -> IndexTargetNode
450
614
  def index_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, receiver: default_node(source, location), opening_loc: location, arguments: nil, closing_loc: location, block: nil)
451
615
  IndexTargetNode.new(source, node_id, location, flags, receiver, opening_loc, arguments, closing_loc, block)
452
616
  end
453
617
 
454
618
  # Create a new InstanceVariableAndWriteNode node.
619
+ #
620
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> InstanceVariableAndWriteNode
455
621
  def instance_variable_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location))
456
622
  InstanceVariableAndWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value)
457
623
  end
458
624
 
459
625
  # Create a new InstanceVariableOperatorWriteNode node.
626
+ #
627
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> InstanceVariableOperatorWriteNode
460
628
  def instance_variable_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, binary_operator_loc: location, value: default_node(source, location), binary_operator: :"")
461
629
  InstanceVariableOperatorWriteNode.new(source, node_id, location, flags, name, name_loc, binary_operator_loc, value, binary_operator)
462
630
  end
463
631
 
464
632
  # Create a new InstanceVariableOrWriteNode node.
633
+ #
634
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> InstanceVariableOrWriteNode
465
635
  def instance_variable_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location))
466
636
  InstanceVariableOrWriteNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value)
467
637
  end
468
638
 
469
639
  # Create a new InstanceVariableReadNode node.
640
+ #
641
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> InstanceVariableReadNode
470
642
  def instance_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
471
643
  InstanceVariableReadNode.new(source, node_id, location, flags, name)
472
644
  end
473
645
 
474
646
  # Create a new InstanceVariableTargetNode node.
647
+ #
648
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> InstanceVariableTargetNode
475
649
  def instance_variable_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
476
650
  InstanceVariableTargetNode.new(source, node_id, location, flags, name)
477
651
  end
478
652
 
479
653
  # Create a new InstanceVariableWriteNode node.
654
+ #
655
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> InstanceVariableWriteNode
480
656
  def instance_variable_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location), operator_loc: location)
481
657
  InstanceVariableWriteNode.new(source, node_id, location, flags, name, name_loc, value, operator_loc)
482
658
  end
483
659
 
484
660
  # Create a new IntegerNode node.
661
+ #
662
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Integer) -> IntegerNode
485
663
  def integer_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: 0)
486
664
  IntegerNode.new(source, node_id, location, flags, value)
487
665
  end
488
666
 
489
667
  # Create a new InterpolatedMatchLastLineNode node.
668
+ #
669
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location) -> InterpolatedMatchLastLineNode
490
670
  def interpolated_match_last_line_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, parts: [], closing_loc: location)
491
671
  InterpolatedMatchLastLineNode.new(source, node_id, location, flags, opening_loc, parts, closing_loc)
492
672
  end
493
673
 
494
674
  # Create a new InterpolatedRegularExpressionNode node.
675
+ #
676
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location) -> InterpolatedRegularExpressionNode
495
677
  def interpolated_regular_expression_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, parts: [], closing_loc: location)
496
678
  InterpolatedRegularExpressionNode.new(source, node_id, location, flags, opening_loc, parts, closing_loc)
497
679
  end
498
680
 
499
681
  # Create a new InterpolatedStringNode node.
682
+ #
683
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location?, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode | InterpolatedStringNode], ?closing_loc: Location?) -> InterpolatedStringNode
500
684
  def interpolated_string_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, parts: [], closing_loc: nil)
501
685
  InterpolatedStringNode.new(source, node_id, location, flags, opening_loc, parts, closing_loc)
502
686
  end
503
687
 
504
688
  # Create a new InterpolatedSymbolNode node.
689
+ #
690
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location?, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location?) -> InterpolatedSymbolNode
505
691
  def interpolated_symbol_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, parts: [], closing_loc: nil)
506
692
  InterpolatedSymbolNode.new(source, node_id, location, flags, opening_loc, parts, closing_loc)
507
693
  end
508
694
 
509
695
  # Create a new InterpolatedXStringNode node.
696
+ #
697
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?parts: Array[StringNode | EmbeddedStatementsNode | EmbeddedVariableNode], ?closing_loc: Location) -> InterpolatedXStringNode
510
698
  def interpolated_x_string_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, parts: [], closing_loc: location)
511
699
  InterpolatedXStringNode.new(source, node_id, location, flags, opening_loc, parts, closing_loc)
512
700
  end
513
701
 
514
702
  # Create a new ItLocalVariableReadNode node.
703
+ #
704
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer) -> ItLocalVariableReadNode
515
705
  def it_local_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0)
516
706
  ItLocalVariableReadNode.new(source, node_id, location, flags)
517
707
  end
518
708
 
519
709
  # Create a new ItParametersNode node.
710
+ #
711
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer) -> ItParametersNode
520
712
  def it_parameters_node(source: default_source, node_id: 0, location: default_location, flags: 0)
521
713
  ItParametersNode.new(source, node_id, location, flags)
522
714
  end
523
715
 
524
716
  # Create a new KeywordHashNode node.
717
+ #
718
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?elements: Array[AssocNode | AssocSplatNode]) -> KeywordHashNode
525
719
  def keyword_hash_node(source: default_source, node_id: 0, location: default_location, flags: 0, elements: [])
526
720
  KeywordHashNode.new(source, node_id, location, flags, elements)
527
721
  end
528
722
 
529
723
  # Create a new KeywordRestParameterNode node.
724
+ #
725
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location) -> KeywordRestParameterNode
530
726
  def keyword_rest_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: nil, name_loc: nil, operator_loc: location)
531
727
  KeywordRestParameterNode.new(source, node_id, location, flags, name, name_loc, operator_loc)
532
728
  end
533
729
 
534
730
  # Create a new LambdaNode node.
731
+ #
732
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?operator_loc: Location, ?opening_loc: Location, ?closing_loc: Location, ?parameters: (BlockParametersNode | NumberedParametersNode | ItParametersNode)?, ?body: (StatementsNode | BeginNode)?) -> LambdaNode
535
733
  def lambda_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], operator_loc: location, opening_loc: location, closing_loc: location, parameters: nil, body: nil)
536
734
  LambdaNode.new(source, node_id, location, flags, locals, operator_loc, opening_loc, closing_loc, parameters, body)
537
735
  end
538
736
 
539
737
  # Create a new LocalVariableAndWriteNode node.
738
+ #
739
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?depth: Integer) -> LocalVariableAndWriteNode
540
740
  def local_variable_and_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name_loc: location, operator_loc: location, value: default_node(source, location), name: :"", depth: 0)
541
741
  LocalVariableAndWriteNode.new(source, node_id, location, flags, name_loc, operator_loc, value, name, depth)
542
742
  end
543
743
 
544
744
  # Create a new LocalVariableOperatorWriteNode node.
745
+ #
746
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name_loc: Location, ?binary_operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?binary_operator: Symbol, ?depth: Integer) -> LocalVariableOperatorWriteNode
545
747
  def local_variable_operator_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name_loc: location, binary_operator_loc: location, value: default_node(source, location), name: :"", binary_operator: :"", depth: 0)
546
748
  LocalVariableOperatorWriteNode.new(source, node_id, location, flags, name_loc, binary_operator_loc, value, name, binary_operator, depth)
547
749
  end
548
750
 
549
751
  # Create a new LocalVariableOrWriteNode node.
752
+ #
753
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node, ?name: Symbol, ?depth: Integer) -> LocalVariableOrWriteNode
550
754
  def local_variable_or_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name_loc: location, operator_loc: location, value: default_node(source, location), name: :"", depth: 0)
551
755
  LocalVariableOrWriteNode.new(source, node_id, location, flags, name_loc, operator_loc, value, name, depth)
552
756
  end
553
757
 
554
758
  # Create a new LocalVariableReadNode node.
759
+ #
760
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?depth: Integer) -> LocalVariableReadNode
555
761
  def local_variable_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", depth: 0)
556
762
  LocalVariableReadNode.new(source, node_id, location, flags, name, depth)
557
763
  end
558
764
 
559
765
  # Create a new LocalVariableTargetNode node.
766
+ #
767
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?depth: Integer) -> LocalVariableTargetNode
560
768
  def local_variable_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", depth: 0)
561
769
  LocalVariableTargetNode.new(source, node_id, location, flags, name, depth)
562
770
  end
563
771
 
564
772
  # Create a new LocalVariableWriteNode node.
773
+ #
774
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?depth: Integer, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> LocalVariableWriteNode
565
775
  def local_variable_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", depth: 0, name_loc: location, value: default_node(source, location), operator_loc: location)
566
776
  LocalVariableWriteNode.new(source, node_id, location, flags, name, depth, name_loc, value, operator_loc)
567
777
  end
568
778
 
569
779
  # Create a new MatchLastLineNode node.
780
+ #
781
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String) -> MatchLastLineNode
570
782
  def match_last_line_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, content_loc: location, closing_loc: location, unescaped: "")
571
783
  MatchLastLineNode.new(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped)
572
784
  end
573
785
 
574
786
  # Create a new MatchPredicateNode node.
575
- def match_predicate_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: default_node(source, location), pattern: default_node(source, location), operator_loc: location)
576
- MatchPredicateNode.new(source, node_id, location, flags, value, pattern, operator_loc)
787
+ #
788
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Prism::node, ?pattern: Prism::node, ?keyword_loc: Location) -> MatchPredicateNode
789
+ def match_predicate_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: default_node(source, location), pattern: default_node(source, location), keyword_loc: location)
790
+ MatchPredicateNode.new(source, node_id, location, flags, value, pattern, keyword_loc)
577
791
  end
578
792
 
579
793
  # Create a new MatchRequiredNode node.
794
+ #
795
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Prism::node, ?pattern: Prism::node, ?operator_loc: Location) -> MatchRequiredNode
580
796
  def match_required_node(source: default_source, node_id: 0, location: default_location, flags: 0, value: default_node(source, location), pattern: default_node(source, location), operator_loc: location)
581
797
  MatchRequiredNode.new(source, node_id, location, flags, value, pattern, operator_loc)
582
798
  end
583
799
 
584
800
  # Create a new MatchWriteNode node.
801
+ #
802
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?call: CallNode, ?targets: Array[LocalVariableTargetNode]) -> MatchWriteNode
585
803
  def match_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, call: call_node(source: source), targets: [])
586
804
  MatchWriteNode.new(source, node_id, location, flags, call, targets)
587
805
  end
588
806
 
589
- # Create a new MissingNode node.
590
- def missing_node(source: default_source, node_id: 0, location: default_location, flags: 0)
591
- MissingNode.new(source, node_id, location, flags)
592
- end
593
-
594
807
  # Create a new ModuleNode node.
808
+ #
809
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?module_keyword_loc: Location, ?constant_path: (ConstantReadNode | ConstantPathNode), ?body: (StatementsNode | BeginNode)?, ?end_keyword_loc: Location, ?name: Symbol) -> ModuleNode
595
810
  def module_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], module_keyword_loc: location, constant_path: constant_read_node(source: source), body: nil, end_keyword_loc: location, name: :"")
596
811
  ModuleNode.new(source, node_id, location, flags, locals, module_keyword_loc, constant_path, body, end_keyword_loc, name)
597
812
  end
598
813
 
599
814
  # Create a new MultiTargetNode node.
815
+ #
816
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode], ?rest: (ImplicitRestNode | SplatNode)?, ?rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode | RequiredParameterNode], ?lparen_loc: Location?, ?rparen_loc: Location?) -> MultiTargetNode
600
817
  def multi_target_node(source: default_source, node_id: 0, location: default_location, flags: 0, lefts: [], rest: nil, rights: [], lparen_loc: nil, rparen_loc: nil)
601
818
  MultiTargetNode.new(source, node_id, location, flags, lefts, rest, rights, lparen_loc, rparen_loc)
602
819
  end
603
820
 
604
821
  # Create a new MultiWriteNode node.
822
+ #
823
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?lefts: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode], ?rest: (ImplicitRestNode | SplatNode)?, ?rights: Array[LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode | MultiTargetNode], ?lparen_loc: Location?, ?rparen_loc: Location?, ?operator_loc: Location, ?value: Prism::node) -> MultiWriteNode
605
824
  def multi_write_node(source: default_source, node_id: 0, location: default_location, flags: 0, lefts: [], rest: nil, rights: [], lparen_loc: nil, rparen_loc: nil, operator_loc: location, value: default_node(source, location))
606
825
  MultiWriteNode.new(source, node_id, location, flags, lefts, rest, rights, lparen_loc, rparen_loc, operator_loc, value)
607
826
  end
608
827
 
609
828
  # Create a new NextNode node.
829
+ #
830
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?arguments: ArgumentsNode?, ?keyword_loc: Location) -> NextNode
610
831
  def next_node(source: default_source, node_id: 0, location: default_location, flags: 0, arguments: nil, keyword_loc: location)
611
832
  NextNode.new(source, node_id, location, flags, arguments, keyword_loc)
612
833
  end
613
834
 
614
835
  # Create a new NilNode node.
836
+ #
837
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer) -> NilNode
615
838
  def nil_node(source: default_source, node_id: 0, location: default_location, flags: 0)
616
839
  NilNode.new(source, node_id, location, flags)
617
840
  end
618
841
 
842
+ # Create a new NoBlockParameterNode node.
843
+ #
844
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?keyword_loc: Location) -> NoBlockParameterNode
845
+ def no_block_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, operator_loc: location, keyword_loc: location)
846
+ NoBlockParameterNode.new(source, node_id, location, flags, operator_loc, keyword_loc)
847
+ end
848
+
619
849
  # Create a new NoKeywordsParameterNode node.
850
+ #
851
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?keyword_loc: Location) -> NoKeywordsParameterNode
620
852
  def no_keywords_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, operator_loc: location, keyword_loc: location)
621
853
  NoKeywordsParameterNode.new(source, node_id, location, flags, operator_loc, keyword_loc)
622
854
  end
623
855
 
624
856
  # Create a new NumberedParametersNode node.
857
+ #
858
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?maximum: Integer) -> NumberedParametersNode
625
859
  def numbered_parameters_node(source: default_source, node_id: 0, location: default_location, flags: 0, maximum: 0)
626
860
  NumberedParametersNode.new(source, node_id, location, flags, maximum)
627
861
  end
628
862
 
629
863
  # Create a new NumberedReferenceReadNode node.
864
+ #
865
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?number: Integer) -> NumberedReferenceReadNode
630
866
  def numbered_reference_read_node(source: default_source, node_id: 0, location: default_location, flags: 0, number: 0)
631
867
  NumberedReferenceReadNode.new(source, node_id, location, flags, number)
632
868
  end
633
869
 
634
870
  # Create a new OptionalKeywordParameterNode node.
871
+ #
872
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node) -> OptionalKeywordParameterNode
635
873
  def optional_keyword_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, value: default_node(source, location))
636
874
  OptionalKeywordParameterNode.new(source, node_id, location, flags, name, name_loc, value)
637
875
  end
638
876
 
639
877
  # Create a new OptionalParameterNode node.
878
+ #
879
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?operator_loc: Location, ?value: Prism::node) -> OptionalParameterNode
640
880
  def optional_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location, operator_loc: location, value: default_node(source, location))
641
881
  OptionalParameterNode.new(source, node_id, location, flags, name, name_loc, operator_loc, value)
642
882
  end
643
883
 
644
884
  # Create a new OrNode node.
885
+ #
886
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node, ?right: Prism::node, ?operator_loc: Location) -> OrNode
645
887
  def or_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: default_node(source, location), right: default_node(source, location), operator_loc: location)
646
888
  OrNode.new(source, node_id, location, flags, left, right, operator_loc)
647
889
  end
648
890
 
649
891
  # Create a new ParametersNode node.
892
+ #
893
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?requireds: Array[RequiredParameterNode | MultiTargetNode], ?optionals: Array[OptionalParameterNode], ?rest: (RestParameterNode | ImplicitRestNode)?, ?posts: Array[RequiredParameterNode | MultiTargetNode], ?keywords: Array[RequiredKeywordParameterNode | OptionalKeywordParameterNode], ?keyword_rest: (KeywordRestParameterNode | ForwardingParameterNode | NoKeywordsParameterNode)?, ?block: (BlockParameterNode | NoBlockParameterNode)?) -> ParametersNode
650
894
  def parameters_node(source: default_source, node_id: 0, location: default_location, flags: 0, requireds: [], optionals: [], rest: nil, posts: [], keywords: [], keyword_rest: nil, block: nil)
651
895
  ParametersNode.new(source, node_id, location, flags, requireds, optionals, rest, posts, keywords, keyword_rest, block)
652
896
  end
653
897
 
654
898
  # Create a new ParenthesesNode node.
899
+ #
900
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?body: Prism::node?, ?opening_loc: Location, ?closing_loc: Location) -> ParenthesesNode
655
901
  def parentheses_node(source: default_source, node_id: 0, location: default_location, flags: 0, body: nil, opening_loc: location, closing_loc: location)
656
902
  ParenthesesNode.new(source, node_id, location, flags, body, opening_loc, closing_loc)
657
903
  end
658
904
 
659
905
  # Create a new PinnedExpressionNode node.
906
+ #
907
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?expression: Prism::node, ?operator_loc: Location, ?lparen_loc: Location, ?rparen_loc: Location) -> PinnedExpressionNode
660
908
  def pinned_expression_node(source: default_source, node_id: 0, location: default_location, flags: 0, expression: default_node(source, location), operator_loc: location, lparen_loc: location, rparen_loc: location)
661
909
  PinnedExpressionNode.new(source, node_id, location, flags, expression, operator_loc, lparen_loc, rparen_loc)
662
910
  end
663
911
 
664
912
  # Create a new PinnedVariableNode node.
913
+ #
914
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?variable: (LocalVariableReadNode | InstanceVariableReadNode | ClassVariableReadNode | GlobalVariableReadNode | BackReferenceReadNode | NumberedReferenceReadNode | ItLocalVariableReadNode), ?operator_loc: Location) -> PinnedVariableNode
665
915
  def pinned_variable_node(source: default_source, node_id: 0, location: default_location, flags: 0, variable: local_variable_read_node(source: source), operator_loc: location)
666
916
  PinnedVariableNode.new(source, node_id, location, flags, variable, operator_loc)
667
917
  end
668
918
 
669
919
  # Create a new PostExecutionNode node.
920
+ #
921
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?statements: StatementsNode?, ?keyword_loc: Location, ?opening_loc: Location, ?closing_loc: Location) -> PostExecutionNode
670
922
  def post_execution_node(source: default_source, node_id: 0, location: default_location, flags: 0, statements: nil, keyword_loc: location, opening_loc: location, closing_loc: location)
671
923
  PostExecutionNode.new(source, node_id, location, flags, statements, keyword_loc, opening_loc, closing_loc)
672
924
  end
673
925
 
674
926
  # Create a new PreExecutionNode node.
927
+ #
928
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?statements: StatementsNode?, ?keyword_loc: Location, ?opening_loc: Location, ?closing_loc: Location) -> PreExecutionNode
675
929
  def pre_execution_node(source: default_source, node_id: 0, location: default_location, flags: 0, statements: nil, keyword_loc: location, opening_loc: location, closing_loc: location)
676
930
  PreExecutionNode.new(source, node_id, location, flags, statements, keyword_loc, opening_loc, closing_loc)
677
931
  end
678
932
 
679
933
  # Create a new ProgramNode node.
934
+ #
935
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?statements: StatementsNode) -> ProgramNode
680
936
  def program_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], statements: statements_node(source: source))
681
937
  ProgramNode.new(source, node_id, location, flags, locals, statements)
682
938
  end
683
939
 
684
940
  # Create a new RangeNode node.
941
+ #
942
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?left: Prism::node?, ?right: Prism::node?, ?operator_loc: Location) -> RangeNode
685
943
  def range_node(source: default_source, node_id: 0, location: default_location, flags: 0, left: nil, right: nil, operator_loc: location)
686
944
  RangeNode.new(source, node_id, location, flags, left, right, operator_loc)
687
945
  end
688
946
 
689
947
  # Create a new RationalNode node.
948
+ #
949
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?numerator: Integer, ?denominator: Integer) -> RationalNode
690
950
  def rational_node(source: default_source, node_id: 0, location: default_location, flags: 0, numerator: 0, denominator: 0)
691
951
  RationalNode.new(source, node_id, location, flags, numerator, denominator)
692
952
  end
693
953
 
694
954
  # Create a new RedoNode node.
955
+ #
956
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer) -> RedoNode
695
957
  def redo_node(source: default_source, node_id: 0, location: default_location, flags: 0)
696
958
  RedoNode.new(source, node_id, location, flags)
697
959
  end
698
960
 
699
961
  # Create a new RegularExpressionNode node.
962
+ #
963
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String) -> RegularExpressionNode
700
964
  def regular_expression_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, content_loc: location, closing_loc: location, unescaped: "")
701
965
  RegularExpressionNode.new(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped)
702
966
  end
703
967
 
704
968
  # Create a new RequiredKeywordParameterNode node.
969
+ #
970
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location) -> RequiredKeywordParameterNode
705
971
  def required_keyword_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"", name_loc: location)
706
972
  RequiredKeywordParameterNode.new(source, node_id, location, flags, name, name_loc)
707
973
  end
708
974
 
709
975
  # Create a new RequiredParameterNode node.
976
+ #
977
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> RequiredParameterNode
710
978
  def required_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: :"")
711
979
  RequiredParameterNode.new(source, node_id, location, flags, name)
712
980
  end
713
981
 
714
982
  # Create a new RescueModifierNode node.
983
+ #
984
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?expression: Prism::node, ?keyword_loc: Location, ?rescue_expression: Prism::node) -> RescueModifierNode
715
985
  def rescue_modifier_node(source: default_source, node_id: 0, location: default_location, flags: 0, expression: default_node(source, location), keyword_loc: location, rescue_expression: default_node(source, location))
716
986
  RescueModifierNode.new(source, node_id, location, flags, expression, keyword_loc, rescue_expression)
717
987
  end
718
988
 
719
989
  # Create a new RescueNode node.
990
+ #
991
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?exceptions: Array[Prism::node], ?operator_loc: Location?, ?reference: (LocalVariableTargetNode | InstanceVariableTargetNode | ClassVariableTargetNode | GlobalVariableTargetNode | ConstantTargetNode | ConstantPathTargetNode | CallTargetNode | IndexTargetNode)?, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?subsequent: RescueNode?) -> RescueNode
720
992
  def rescue_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, exceptions: [], operator_loc: nil, reference: nil, then_keyword_loc: nil, statements: nil, subsequent: nil)
721
993
  RescueNode.new(source, node_id, location, flags, keyword_loc, exceptions, operator_loc, reference, then_keyword_loc, statements, subsequent)
722
994
  end
723
995
 
724
996
  # Create a new RestParameterNode node.
997
+ #
998
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol?, ?name_loc: Location?, ?operator_loc: Location) -> RestParameterNode
725
999
  def rest_parameter_node(source: default_source, node_id: 0, location: default_location, flags: 0, name: nil, name_loc: nil, operator_loc: location)
726
1000
  RestParameterNode.new(source, node_id, location, flags, name, name_loc, operator_loc)
727
1001
  end
728
1002
 
729
1003
  # Create a new RetryNode node.
1004
+ #
1005
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer) -> RetryNode
730
1006
  def retry_node(source: default_source, node_id: 0, location: default_location, flags: 0)
731
1007
  RetryNode.new(source, node_id, location, flags)
732
1008
  end
733
1009
 
734
1010
  # Create a new ReturnNode node.
1011
+ #
1012
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?arguments: ArgumentsNode?) -> ReturnNode
735
1013
  def return_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, arguments: nil)
736
1014
  ReturnNode.new(source, node_id, location, flags, keyword_loc, arguments)
737
1015
  end
738
1016
 
739
1017
  # Create a new SelfNode node.
1018
+ #
1019
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer) -> SelfNode
740
1020
  def self_node(source: default_source, node_id: 0, location: default_location, flags: 0)
741
1021
  SelfNode.new(source, node_id, location, flags)
742
1022
  end
743
1023
 
744
1024
  # Create a new ShareableConstantNode node.
1025
+ #
1026
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?write: (ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode)) -> ShareableConstantNode
745
1027
  def shareable_constant_node(source: default_source, node_id: 0, location: default_location, flags: 0, write: constant_write_node(source: source))
746
1028
  ShareableConstantNode.new(source, node_id, location, flags, write)
747
1029
  end
748
1030
 
749
1031
  # Create a new SingletonClassNode node.
1032
+ #
1033
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?locals: Array[Symbol], ?class_keyword_loc: Location, ?operator_loc: Location, ?expression: Prism::node, ?body: (StatementsNode | BeginNode)?, ?end_keyword_loc: Location) -> SingletonClassNode
750
1034
  def singleton_class_node(source: default_source, node_id: 0, location: default_location, flags: 0, locals: [], class_keyword_loc: location, operator_loc: location, expression: default_node(source, location), body: nil, end_keyword_loc: location)
751
1035
  SingletonClassNode.new(source, node_id, location, flags, locals, class_keyword_loc, operator_loc, expression, body, end_keyword_loc)
752
1036
  end
753
1037
 
754
1038
  # Create a new SourceEncodingNode node.
1039
+ #
1040
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer) -> SourceEncodingNode
755
1041
  def source_encoding_node(source: default_source, node_id: 0, location: default_location, flags: 0)
756
1042
  SourceEncodingNode.new(source, node_id, location, flags)
757
1043
  end
758
1044
 
759
1045
  # Create a new SourceFileNode node.
1046
+ #
1047
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?filepath: String) -> SourceFileNode
760
1048
  def source_file_node(source: default_source, node_id: 0, location: default_location, flags: 0, filepath: "")
761
1049
  SourceFileNode.new(source, node_id, location, flags, filepath)
762
1050
  end
763
1051
 
764
1052
  # Create a new SourceLineNode node.
1053
+ #
1054
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer) -> SourceLineNode
765
1055
  def source_line_node(source: default_source, node_id: 0, location: default_location, flags: 0)
766
1056
  SourceLineNode.new(source, node_id, location, flags)
767
1057
  end
768
1058
 
769
1059
  # Create a new SplatNode node.
1060
+ #
1061
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?operator_loc: Location, ?expression: Prism::node?) -> SplatNode
770
1062
  def splat_node(source: default_source, node_id: 0, location: default_location, flags: 0, operator_loc: location, expression: nil)
771
1063
  SplatNode.new(source, node_id, location, flags, operator_loc, expression)
772
1064
  end
773
1065
 
774
1066
  # Create a new StatementsNode node.
1067
+ #
1068
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?body: Array[Prism::node]) -> StatementsNode
775
1069
  def statements_node(source: default_source, node_id: 0, location: default_location, flags: 0, body: [])
776
1070
  StatementsNode.new(source, node_id, location, flags, body)
777
1071
  end
778
1072
 
779
1073
  # Create a new StringNode node.
1074
+ #
1075
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location?, ?content_loc: Location, ?closing_loc: Location?, ?unescaped: String) -> StringNode
780
1076
  def string_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, content_loc: location, closing_loc: nil, unescaped: "")
781
1077
  StringNode.new(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped)
782
1078
  end
783
1079
 
784
1080
  # Create a new SuperNode node.
1081
+ #
1082
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?lparen_loc: Location?, ?arguments: ArgumentsNode?, ?rparen_loc: Location?, ?block: (BlockNode | BlockArgumentNode)?) -> SuperNode
785
1083
  def super_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, lparen_loc: nil, arguments: nil, rparen_loc: nil, block: nil)
786
1084
  SuperNode.new(source, node_id, location, flags, keyword_loc, lparen_loc, arguments, rparen_loc, block)
787
1085
  end
788
1086
 
789
1087
  # Create a new SymbolNode node.
790
- def symbol_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, value_loc: nil, closing_loc: nil, unescaped: "")
791
- SymbolNode.new(source, node_id, location, flags, opening_loc, value_loc, closing_loc, unescaped)
1088
+ #
1089
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location?, ?content_loc: Location, ?closing_loc: Location?, ?unescaped: String) -> SymbolNode
1090
+ def symbol_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: nil, content_loc: location, closing_loc: nil, unescaped: "")
1091
+ SymbolNode.new(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped)
792
1092
  end
793
1093
 
794
1094
  # Create a new TrueNode node.
1095
+ #
1096
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer) -> TrueNode
795
1097
  def true_node(source: default_source, node_id: 0, location: default_location, flags: 0)
796
1098
  TrueNode.new(source, node_id, location, flags)
797
1099
  end
798
1100
 
799
1101
  # Create a new UndefNode node.
1102
+ #
1103
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?names: Array[SymbolNode | InterpolatedSymbolNode], ?keyword_loc: Location) -> UndefNode
800
1104
  def undef_node(source: default_source, node_id: 0, location: default_location, flags: 0, names: [], keyword_loc: location)
801
1105
  UndefNode.new(source, node_id, location, flags, names, keyword_loc)
802
1106
  end
803
1107
 
804
1108
  # Create a new UnlessNode node.
805
- def unless_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, predicate: default_node(source, location), then_keyword_loc: nil, statements: nil, else_clause: nil, end_keyword_loc: nil)
806
- UnlessNode.new(source, node_id, location, flags, keyword_loc, predicate, then_keyword_loc, statements, else_clause, end_keyword_loc)
1109
+ #
1110
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?unless_keyword_loc: Location, ?predicate: Prism::node, ?then_keyword_loc: Location?, ?statements: StatementsNode?, ?else_clause: ElseNode?, ?end_keyword_loc: Location?) -> UnlessNode
1111
+ def unless_node(source: default_source, node_id: 0, location: default_location, flags: 0, unless_keyword_loc: location, predicate: default_node(source, location), then_keyword_loc: nil, statements: nil, else_clause: nil, end_keyword_loc: nil)
1112
+ UnlessNode.new(source, node_id, location, flags, unless_keyword_loc, predicate, then_keyword_loc, statements, else_clause, end_keyword_loc)
807
1113
  end
808
1114
 
809
1115
  # Create a new UntilNode node.
810
- def until_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, do_keyword_loc: nil, closing_loc: nil, predicate: default_node(source, location), statements: nil)
811
- UntilNode.new(source, node_id, location, flags, keyword_loc, do_keyword_loc, closing_loc, predicate, statements)
1116
+ #
1117
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?until_keyword_loc: Location, ?do_keyword_loc: Location?, ?end_keyword_loc: Location?, ?predicate: Prism::node, ?statements: StatementsNode?) -> UntilNode
1118
+ def until_node(source: default_source, node_id: 0, location: default_location, flags: 0, until_keyword_loc: location, do_keyword_loc: nil, end_keyword_loc: nil, predicate: default_node(source, location), statements: nil)
1119
+ UntilNode.new(source, node_id, location, flags, until_keyword_loc, do_keyword_loc, end_keyword_loc, predicate, statements)
812
1120
  end
813
1121
 
814
1122
  # Create a new WhenNode node.
815
- def when_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, conditions: [], then_keyword_loc: nil, statements: nil)
816
- WhenNode.new(source, node_id, location, flags, keyword_loc, conditions, then_keyword_loc, statements)
1123
+ #
1124
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?when_keyword_loc: Location, ?conditions: Array[Prism::node], ?then_keyword_loc: Location?, ?statements: StatementsNode?) -> WhenNode
1125
+ def when_node(source: default_source, node_id: 0, location: default_location, flags: 0, when_keyword_loc: location, conditions: [], then_keyword_loc: nil, statements: nil)
1126
+ WhenNode.new(source, node_id, location, flags, when_keyword_loc, conditions, then_keyword_loc, statements)
817
1127
  end
818
1128
 
819
1129
  # Create a new WhileNode node.
820
- def while_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, do_keyword_loc: nil, closing_loc: nil, predicate: default_node(source, location), statements: nil)
821
- WhileNode.new(source, node_id, location, flags, keyword_loc, do_keyword_loc, closing_loc, predicate, statements)
1130
+ #
1131
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?while_keyword_loc: Location, ?do_keyword_loc: Location?, ?end_keyword_loc: Location?, ?predicate: Prism::node, ?statements: StatementsNode?) -> WhileNode
1132
+ def while_node(source: default_source, node_id: 0, location: default_location, flags: 0, while_keyword_loc: location, do_keyword_loc: nil, end_keyword_loc: nil, predicate: default_node(source, location), statements: nil)
1133
+ WhileNode.new(source, node_id, location, flags, while_keyword_loc, do_keyword_loc, end_keyword_loc, predicate, statements)
822
1134
  end
823
1135
 
824
1136
  # Create a new XStringNode node.
1137
+ #
1138
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?opening_loc: Location, ?content_loc: Location, ?closing_loc: Location, ?unescaped: String) -> XStringNode
825
1139
  def x_string_node(source: default_source, node_id: 0, location: default_location, flags: 0, opening_loc: location, content_loc: location, closing_loc: location, unescaped: "")
826
1140
  XStringNode.new(source, node_id, location, flags, opening_loc, content_loc, closing_loc, unescaped)
827
1141
  end
828
1142
 
829
1143
  # Create a new YieldNode node.
1144
+ #
1145
+ #: (?source: Source, ?node_id: Integer, ?location: Location, ?flags: Integer, ?keyword_loc: Location, ?lparen_loc: Location?, ?arguments: ArgumentsNode?, ?rparen_loc: Location?) -> YieldNode
830
1146
  def yield_node(source: default_source, node_id: 0, location: default_location, flags: 0, keyword_loc: location, lparen_loc: nil, arguments: nil, rparen_loc: nil)
831
1147
  YieldNode.new(source, node_id, location, flags, keyword_loc, lparen_loc, arguments, rparen_loc)
832
1148
  end
833
1149
 
834
1150
  # Retrieve the value of one of the ArgumentsNodeFlags flags.
1151
+ #
1152
+ #: (Symbol name) -> Integer
835
1153
  def arguments_node_flag(name)
836
1154
  case name
837
1155
  when :contains_forwarding then ArgumentsNodeFlags::CONTAINS_FORWARDING
@@ -844,6 +1162,8 @@ module Prism
844
1162
  end
845
1163
 
846
1164
  # Retrieve the value of one of the ArrayNodeFlags flags.
1165
+ #
1166
+ #: (Symbol name) -> Integer
847
1167
  def array_node_flag(name)
848
1168
  case name
849
1169
  when :contains_splat then ArrayNodeFlags::CONTAINS_SPLAT
@@ -852,6 +1172,8 @@ module Prism
852
1172
  end
853
1173
 
854
1174
  # Retrieve the value of one of the CallNodeFlags flags.
1175
+ #
1176
+ #: (Symbol name) -> Integer
855
1177
  def call_node_flag(name)
856
1178
  case name
857
1179
  when :safe_navigation then CallNodeFlags::SAFE_NAVIGATION
@@ -863,6 +1185,8 @@ module Prism
863
1185
  end
864
1186
 
865
1187
  # Retrieve the value of one of the EncodingFlags flags.
1188
+ #
1189
+ #: (Symbol name) -> Integer
866
1190
  def encoding_flag(name)
867
1191
  case name
868
1192
  when :forced_utf8_encoding then EncodingFlags::FORCED_UTF8_ENCODING
@@ -872,6 +1196,8 @@ module Prism
872
1196
  end
873
1197
 
874
1198
  # Retrieve the value of one of the IntegerBaseFlags flags.
1199
+ #
1200
+ #: (Symbol name) -> Integer
875
1201
  def integer_base_flag(name)
876
1202
  case name
877
1203
  when :binary then IntegerBaseFlags::BINARY
@@ -883,6 +1209,8 @@ module Prism
883
1209
  end
884
1210
 
885
1211
  # Retrieve the value of one of the InterpolatedStringNodeFlags flags.
1212
+ #
1213
+ #: (Symbol name) -> Integer
886
1214
  def interpolated_string_node_flag(name)
887
1215
  case name
888
1216
  when :frozen then InterpolatedStringNodeFlags::FROZEN
@@ -892,6 +1220,8 @@ module Prism
892
1220
  end
893
1221
 
894
1222
  # Retrieve the value of one of the KeywordHashNodeFlags flags.
1223
+ #
1224
+ #: (Symbol name) -> Integer
895
1225
  def keyword_hash_node_flag(name)
896
1226
  case name
897
1227
  when :symbol_keys then KeywordHashNodeFlags::SYMBOL_KEYS
@@ -900,6 +1230,8 @@ module Prism
900
1230
  end
901
1231
 
902
1232
  # Retrieve the value of one of the LoopFlags flags.
1233
+ #
1234
+ #: (Symbol name) -> Integer
903
1235
  def loop_flag(name)
904
1236
  case name
905
1237
  when :begin_modifier then LoopFlags::BEGIN_MODIFIER
@@ -908,6 +1240,8 @@ module Prism
908
1240
  end
909
1241
 
910
1242
  # Retrieve the value of one of the ParameterFlags flags.
1243
+ #
1244
+ #: (Symbol name) -> Integer
911
1245
  def parameter_flag(name)
912
1246
  case name
913
1247
  when :repeated_parameter then ParameterFlags::REPEATED_PARAMETER
@@ -916,6 +1250,8 @@ module Prism
916
1250
  end
917
1251
 
918
1252
  # Retrieve the value of one of the ParenthesesNodeFlags flags.
1253
+ #
1254
+ #: (Symbol name) -> Integer
919
1255
  def parentheses_node_flag(name)
920
1256
  case name
921
1257
  when :multiple_statements then ParenthesesNodeFlags::MULTIPLE_STATEMENTS
@@ -924,6 +1260,8 @@ module Prism
924
1260
  end
925
1261
 
926
1262
  # Retrieve the value of one of the RangeFlags flags.
1263
+ #
1264
+ #: (Symbol name) -> Integer
927
1265
  def range_flag(name)
928
1266
  case name
929
1267
  when :exclude_end then RangeFlags::EXCLUDE_END
@@ -932,6 +1270,8 @@ module Prism
932
1270
  end
933
1271
 
934
1272
  # Retrieve the value of one of the RegularExpressionFlags flags.
1273
+ #
1274
+ #: (Symbol name) -> Integer
935
1275
  def regular_expression_flag(name)
936
1276
  case name
937
1277
  when :ignore_case then RegularExpressionFlags::IGNORE_CASE
@@ -950,6 +1290,8 @@ module Prism
950
1290
  end
951
1291
 
952
1292
  # Retrieve the value of one of the ShareableConstantNodeFlags flags.
1293
+ #
1294
+ #: (Symbol name) -> Integer
953
1295
  def shareable_constant_node_flag(name)
954
1296
  case name
955
1297
  when :literal then ShareableConstantNodeFlags::LITERAL
@@ -960,6 +1302,8 @@ module Prism
960
1302
  end
961
1303
 
962
1304
  # Retrieve the value of one of the StringFlags flags.
1305
+ #
1306
+ #: (Symbol name) -> Integer
963
1307
  def string_flag(name)
964
1308
  case name
965
1309
  when :forced_utf8_encoding then StringFlags::FORCED_UTF8_ENCODING
@@ -971,6 +1315,8 @@ module Prism
971
1315
  end
972
1316
 
973
1317
  # Retrieve the value of one of the SymbolFlags flags.
1318
+ #
1319
+ #: (Symbol name) -> Integer
974
1320
  def symbol_flag(name)
975
1321
  case name
976
1322
  when :forced_utf8_encoding then SymbolFlags::FORCED_UTF8_ENCODING
@@ -984,20 +1330,40 @@ module Prism
984
1330
 
985
1331
  # The default source object that gets attached to nodes and locations if no
986
1332
  # source is specified.
1333
+ #
1334
+ #: () -> Source
987
1335
  def default_source
988
- Source.for("")
1336
+ Source.for("", 1, [0])
989
1337
  end
990
1338
 
991
1339
  # The default location object that gets attached to nodes if no location is
992
1340
  # specified, which uses the given source.
1341
+ #
1342
+ #: () -> Location
993
1343
  def default_location
994
1344
  Location.new(default_source, 0, 0)
995
1345
  end
996
1346
 
997
1347
  # The default node that gets attached to nodes if no node is specified for a
998
1348
  # required node field.
1349
+ #
1350
+ #: (Source source, Location location) -> node
999
1351
  def default_node(source, location)
1000
- MissingNode.new(source, -1, location, 0)
1352
+ ErrorRecoveryNode.new(source, -1, location, 0, nil)
1353
+ end
1354
+
1355
+ private
1356
+
1357
+ # Build the newline byte offset array for the given source string.
1358
+ #
1359
+ #: (String source) -> Array[Integer]
1360
+ def build_offsets(source)
1361
+ offsets = [0]
1362
+ start = 0
1363
+ while (index = source.byteindex("\n", start))
1364
+ offsets << (start = index + 1)
1365
+ end
1366
+ offsets
1001
1367
  end
1002
1368
  end
1003
1369
  end