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/pattern.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  # :markup: markdown
3
+ #--
4
+ # rbs_inline: enabled
3
5
 
4
6
  module Prism
5
7
  # A pattern is an object that wraps a Ruby pattern matching expression. The
@@ -41,7 +43,9 @@ module Prism
41
43
  class CompilationError < StandardError
42
44
  # Create a new CompilationError with the given representation of the node
43
45
  # that caused the error.
44
- def initialize(repr)
46
+ #
47
+ #: (String repr) -> void
48
+ def initialize(repr) # :nodoc:
45
49
  super(<<~ERROR)
46
50
  prism was unable to compile the pattern you provided into a usable
47
51
  expression. It failed on to understand the node represented by:
@@ -57,10 +61,13 @@ module Prism
57
61
  end
58
62
 
59
63
  # The query that this pattern was initialized with.
60
- attr_reader :query
64
+ attr_reader :query #: String
65
+ # @rbs @compiled: Proc?
61
66
 
62
67
  # Create a new pattern with the given query. The query should be a string
63
68
  # containing a Ruby pattern matching expression.
69
+ #
70
+ #: (String query) -> void
64
71
  def initialize(query)
65
72
  @query = query
66
73
  @compiled = nil
@@ -68,6 +75,8 @@ module Prism
68
75
 
69
76
  # Compile the query into a callable object that can be used to match against
70
77
  # nodes.
78
+ #
79
+ #: () -> Proc
71
80
  def compile
72
81
  result = Prism.parse("case nil\nin #{query}\nend")
73
82
 
@@ -84,7 +93,10 @@ module Prism
84
93
  # pattern. If a block is given, it will be called with each node that
85
94
  # matches the pattern. If no block is given, an enumerator will be returned
86
95
  # that will yield each node that matches the pattern.
87
- def scan(root)
96
+ #
97
+ #: (node root) -> Enumerator[node, void]
98
+ #: (node root) { (node) -> void } -> void
99
+ def scan(root, &blk)
88
100
  return to_enum(:scan, root) unless block_given?
89
101
 
90
102
  @compiled ||= compile
@@ -100,23 +112,33 @@ module Prism
100
112
 
101
113
  # Shortcut for combining two procs into one that returns true if both return
102
114
  # true.
103
- def combine_and(left, right)
115
+ #
116
+ #: (Proc left, Proc right) -> Proc
117
+ def combine_and(left, right) # :nodoc:
104
118
  ->(other) { left.call(other) && right.call(other) }
105
119
  end
106
120
 
107
121
  # Shortcut for combining two procs into one that returns true if either
108
122
  # returns true.
109
- def combine_or(left, right)
123
+ #
124
+ #: (Proc left, Proc right) -> Proc
125
+ def combine_or(left, right) # :nodoc:
110
126
  ->(other) { left.call(other) || right.call(other) }
111
127
  end
112
128
 
113
- # Raise an error because the given node is not supported.
114
- def compile_error(node)
129
+ # Raise an error because the given node is not supported. Note purposefully
130
+ # not typing this method since it is a no return method that Steep does not
131
+ # understand.
132
+ #
133
+ #: (node node) -> bot
134
+ def compile_error(node) # :nodoc:
115
135
  raise CompilationError, node.inspect
116
136
  end
117
137
 
118
138
  # in [foo, bar, baz]
119
- def compile_array_pattern_node(node)
139
+ #
140
+ #: (ArrayPatternNode node) -> Proc
141
+ def compile_array_pattern_node(node) # :nodoc:
120
142
  compile_error(node) if !node.rest.nil? || node.posts.any?
121
143
 
122
144
  constant = node.constant
@@ -141,15 +163,19 @@ module Prism
141
163
  end
142
164
 
143
165
  # in foo | bar
144
- def compile_alternation_pattern_node(node)
166
+ #
167
+ #: (AlternationPatternNode node) -> Proc
168
+ def compile_alternation_pattern_node(node) # :nodoc:
145
169
  combine_or(compile_node(node.left), compile_node(node.right))
146
170
  end
147
171
 
148
172
  # in Prism::ConstantReadNode
149
- def compile_constant_path_node(node)
173
+ #
174
+ #: (ConstantPathNode node) -> Proc
175
+ def compile_constant_path_node(node) # :nodoc:
150
176
  parent = node.parent
151
177
 
152
- if parent.is_a?(ConstantReadNode) && parent.slice == "Prism"
178
+ if (parent.is_a?(ConstantReadNode) || parent.is_a?(ConstantPathNode)) && parent.slice == Prism.name
153
179
  name = node.name
154
180
  raise CompilationError, node.inspect if name.nil?
155
181
 
@@ -161,12 +187,16 @@ module Prism
161
187
 
162
188
  # in ConstantReadNode
163
189
  # in String
164
- def compile_constant_read_node(node)
190
+ #
191
+ #: (ConstantReadNode node) -> Proc
192
+ def compile_constant_read_node(node) # :nodoc:
165
193
  compile_constant_name(node, node.name)
166
194
  end
167
195
 
168
196
  # Compile a name associated with a constant.
169
- def compile_constant_name(node, name)
197
+ #
198
+ #: ((ConstantPathNode | ConstantReadNode) node, Symbol name) -> Proc
199
+ def compile_constant_name(node, name) # :nodoc:
170
200
  if Prism.const_defined?(name, false)
171
201
  clazz = Prism.const_get(name)
172
202
 
@@ -182,9 +212,14 @@ module Prism
182
212
 
183
213
  # in InstanceVariableReadNode[name: Symbol]
184
214
  # in { name: Symbol }
185
- def compile_hash_pattern_node(node)
215
+ #
216
+ #: (HashPatternNode node) -> Proc
217
+ def compile_hash_pattern_node(node) # :nodoc:
186
218
  compile_error(node) if node.rest
187
- compiled_constant = compile_node(node.constant) if node.constant
219
+
220
+ if (constant = node.constant)
221
+ compiled_constant = compile_node(constant)
222
+ end
188
223
 
189
224
  preprocessed =
190
225
  node.elements.to_h do |element|
@@ -212,12 +247,16 @@ module Prism
212
247
  end
213
248
 
214
249
  # in nil
215
- def compile_nil_node(node)
250
+ #
251
+ #: (NilNode node) -> Proc
252
+ def compile_nil_node(node) # :nodoc:
216
253
  ->(attribute) { attribute.nil? }
217
254
  end
218
255
 
219
256
  # in /foo/
220
- def compile_regular_expression_node(node)
257
+ #
258
+ #: (RegularExpressionNode node) -> Proc
259
+ def compile_regular_expression_node(node) # :nodoc:
221
260
  regexp = Regexp.new(node.unescaped, node.closing[1..])
222
261
 
223
262
  ->(attribute) { regexp === attribute }
@@ -225,7 +264,9 @@ module Prism
225
264
 
226
265
  # in ""
227
266
  # in "foo"
228
- def compile_string_node(node)
267
+ #
268
+ #: (StringNode node) -> Proc
269
+ def compile_string_node(node) # :nodoc:
229
270
  string = node.unescaped
230
271
 
231
272
  ->(attribute) { string === attribute }
@@ -233,7 +274,9 @@ module Prism
233
274
 
234
275
  # in :+
235
276
  # in :foo
236
- def compile_symbol_node(node)
277
+ #
278
+ #: (SymbolNode node) -> Proc
279
+ def compile_symbol_node(node) # :nodoc:
237
280
  symbol = node.unescaped.to_sym
238
281
 
239
282
  ->(attribute) { symbol === attribute }
@@ -241,7 +284,9 @@ module Prism
241
284
 
242
285
  # Compile any kind of node. Dispatch out to the individual compilation
243
286
  # methods based on the type of node.
244
- def compile_node(node)
287
+ #
288
+ #: (node node) -> Proc
289
+ def compile_node(node) # :nodoc:
245
290
  case node
246
291
  when AlternationPatternNode
247
292
  compile_alternation_pattern_node(node)
@@ -9,6 +9,9 @@ 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 Reflection module provides the ability to reflect on the structure of
14
17
  # the syntax tree itself, as opposed to looking at a single syntax tree. This
@@ -18,9 +21,11 @@ module Prism
18
21
  # for all other field types.
19
22
  class Field
20
23
  # The name of the field.
21
- attr_reader :name
24
+ attr_reader :name #: Symbol
22
25
 
23
26
  # Initializes the field with the given name.
27
+ #
28
+ #: (Symbol name) -> void
24
29
  def initialize(name)
25
30
  @name = name
26
31
  end
@@ -94,9 +99,11 @@ module Prism
94
99
  # the bitset should be accessed through their query methods.
95
100
  class FlagsField < Field
96
101
  # The names of the flags in the bitset.
97
- attr_reader :flags
102
+ attr_reader :flags #: Array[Symbol]
98
103
 
99
104
  # Initializes the flags field with the given name and flags.
105
+ #
106
+ #: (Symbol name, Array[Symbol] flags) -> void
100
107
  def initialize(name, flags)
101
108
  super(name)
102
109
  @flags = flags
@@ -104,6 +111,8 @@ module Prism
104
111
  end
105
112
 
106
113
  # Returns the fields for the given node.
114
+ #
115
+ #: (singleton(Node) node) -> Array[Field]
107
116
  def self.fields_for(node)
108
117
  case node.type
109
118
  when :alias_global_variable_node
@@ -206,6 +215,8 @@ module Prism
206
215
  [LocationField.new(:operator_loc), NodeField.new(:variable)]
207
216
  when :ensure_node
208
217
  [LocationField.new(:ensure_keyword_loc), OptionalNodeField.new(:statements), LocationField.new(:end_keyword_loc)]
218
+ when :error_recovery_node
219
+ [OptionalNodeField.new(:unexpected)]
209
220
  when :false_node
210
221
  []
211
222
  when :find_pattern_node
@@ -221,7 +232,7 @@ module Prism
221
232
  when :forwarding_parameter_node
222
233
  []
223
234
  when :forwarding_super_node
224
- [OptionalNodeField.new(:block)]
235
+ [LocationField.new(:keyword_loc), OptionalNodeField.new(:block)]
225
236
  when :global_variable_and_write_node
226
237
  [ConstantField.new(:name), LocationField.new(:name_loc), LocationField.new(:operator_loc), NodeField.new(:value)]
227
238
  when :global_variable_operator_write_node
@@ -247,7 +258,7 @@ module Prism
247
258
  when :implicit_rest_node
248
259
  []
249
260
  when :in_node
250
- [NodeField.new(:pattern), OptionalNodeField.new(:statements), LocationField.new(:in_loc), OptionalLocationField.new(:then_loc)]
261
+ [NodeField.new(:pattern), OptionalNodeField.new(:statements), LocationField.new(:in_keyword_loc), OptionalLocationField.new(:then_keyword_loc)]
251
262
  when :index_and_write_node
252
263
  [FlagsField.new(:flags, [:safe_navigation?, :variable_call?, :attribute_write?, :ignore_visibility?]), OptionalNodeField.new(:receiver), OptionalLocationField.new(:call_operator_loc), LocationField.new(:opening_loc), OptionalNodeField.new(:arguments), LocationField.new(:closing_loc), OptionalNodeField.new(:block), LocationField.new(:operator_loc), NodeField.new(:value)]
253
264
  when :index_operator_write_node
@@ -305,13 +316,11 @@ module Prism
305
316
  when :match_last_line_node
306
317
  [FlagsField.new(:flags, [:ignore_case?, :extended?, :multi_line?, :once?, :euc_jp?, :ascii_8bit?, :windows_31j?, :utf_8?, :forced_utf8_encoding?, :forced_binary_encoding?, :forced_us_ascii_encoding?]), LocationField.new(:opening_loc), LocationField.new(:content_loc), LocationField.new(:closing_loc), StringField.new(:unescaped)]
307
318
  when :match_predicate_node
308
- [NodeField.new(:value), NodeField.new(:pattern), LocationField.new(:operator_loc)]
319
+ [NodeField.new(:value), NodeField.new(:pattern), LocationField.new(:keyword_loc)]
309
320
  when :match_required_node
310
321
  [NodeField.new(:value), NodeField.new(:pattern), LocationField.new(:operator_loc)]
311
322
  when :match_write_node
312
323
  [NodeField.new(:call), NodeListField.new(:targets)]
313
- when :missing_node
314
- []
315
324
  when :module_node
316
325
  [ConstantListField.new(:locals), LocationField.new(:module_keyword_loc), NodeField.new(:constant_path), OptionalNodeField.new(:body), LocationField.new(:end_keyword_loc), ConstantField.new(:name)]
317
326
  when :multi_target_node
@@ -322,6 +331,8 @@ module Prism
322
331
  [OptionalNodeField.new(:arguments), LocationField.new(:keyword_loc)]
323
332
  when :nil_node
324
333
  []
334
+ when :no_block_parameter_node
335
+ [LocationField.new(:operator_loc), LocationField.new(:keyword_loc)]
325
336
  when :no_keywords_parameter_node
326
337
  [LocationField.new(:operator_loc), LocationField.new(:keyword_loc)]
327
338
  when :numbered_parameters_node
@@ -391,19 +402,19 @@ module Prism
391
402
  when :super_node
392
403
  [LocationField.new(:keyword_loc), OptionalLocationField.new(:lparen_loc), OptionalNodeField.new(:arguments), OptionalLocationField.new(:rparen_loc), OptionalNodeField.new(:block)]
393
404
  when :symbol_node
394
- [FlagsField.new(:flags, [:forced_utf8_encoding?, :forced_binary_encoding?, :forced_us_ascii_encoding?]), OptionalLocationField.new(:opening_loc), OptionalLocationField.new(:value_loc), OptionalLocationField.new(:closing_loc), StringField.new(:unescaped)]
405
+ [FlagsField.new(:flags, [:forced_utf8_encoding?, :forced_binary_encoding?, :forced_us_ascii_encoding?]), OptionalLocationField.new(:opening_loc), LocationField.new(:content_loc), OptionalLocationField.new(:closing_loc), StringField.new(:unescaped)]
395
406
  when :true_node
396
407
  []
397
408
  when :undef_node
398
409
  [NodeListField.new(:names), LocationField.new(:keyword_loc)]
399
410
  when :unless_node
400
- [LocationField.new(:keyword_loc), NodeField.new(:predicate), OptionalLocationField.new(:then_keyword_loc), OptionalNodeField.new(:statements), OptionalNodeField.new(:else_clause), OptionalLocationField.new(:end_keyword_loc)]
411
+ [LocationField.new(:unless_keyword_loc), NodeField.new(:predicate), OptionalLocationField.new(:then_keyword_loc), OptionalNodeField.new(:statements), OptionalNodeField.new(:else_clause), OptionalLocationField.new(:end_keyword_loc)]
401
412
  when :until_node
402
- [FlagsField.new(:flags, [:begin_modifier?]), LocationField.new(:keyword_loc), OptionalLocationField.new(:do_keyword_loc), OptionalLocationField.new(:closing_loc), NodeField.new(:predicate), OptionalNodeField.new(:statements)]
413
+ [FlagsField.new(:flags, [:begin_modifier?]), LocationField.new(:until_keyword_loc), OptionalLocationField.new(:do_keyword_loc), OptionalLocationField.new(:end_keyword_loc), NodeField.new(:predicate), OptionalNodeField.new(:statements)]
403
414
  when :when_node
404
- [LocationField.new(:keyword_loc), NodeListField.new(:conditions), OptionalLocationField.new(:then_keyword_loc), OptionalNodeField.new(:statements)]
415
+ [LocationField.new(:when_keyword_loc), NodeListField.new(:conditions), OptionalLocationField.new(:then_keyword_loc), OptionalNodeField.new(:statements)]
405
416
  when :while_node
406
- [FlagsField.new(:flags, [:begin_modifier?]), LocationField.new(:keyword_loc), OptionalLocationField.new(:do_keyword_loc), OptionalLocationField.new(:closing_loc), NodeField.new(:predicate), OptionalNodeField.new(:statements)]
417
+ [FlagsField.new(:flags, [:begin_modifier?]), LocationField.new(:while_keyword_loc), OptionalLocationField.new(:do_keyword_loc), OptionalLocationField.new(:end_keyword_loc), NodeField.new(:predicate), OptionalNodeField.new(:statements)]
407
418
  when :x_string_node
408
419
  [FlagsField.new(:flags, [:forced_utf8_encoding?, :forced_binary_encoding?]), LocationField.new(:opening_loc), LocationField.new(:content_loc), LocationField.new(:closing_loc), StringField.new(:unescaped)]
409
420
  when :yield_node