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/config.yml CHANGED
@@ -5,7 +5,6 @@ errors:
5
5
  - ARGUMENT_AFTER_BLOCK
6
6
  - ARGUMENT_AFTER_FORWARDING_ELLIPSES
7
7
  - ARGUMENT_BARE_HASH
8
- - ARGUMENT_BLOCK_FORWARDING
9
8
  - ARGUMENT_BLOCK_MULTI
10
9
  - ARGUMENT_CONFLICT_AMPERSAND
11
10
  - ARGUMENT_CONFLICT_STAR
@@ -17,6 +16,8 @@ errors:
17
16
  - ARGUMENT_FORWARDING_UNBOUND
18
17
  - ARGUMENT_NO_FORWARDING_AMPERSAND
19
18
  - ARGUMENT_NO_FORWARDING_ELLIPSES
19
+ - ARGUMENT_NO_FORWARDING_ELLIPSES_LAMBDA
20
+ - ARGUMENT_NO_FORWARDING_ELLIPSES_BLOCK
20
21
  - ARGUMENT_NO_FORWARDING_STAR
21
22
  - ARGUMENT_NO_FORWARDING_STAR_STAR
22
23
  - ARGUMENT_SPLAT_AFTER_ASSOC_SPLAT
@@ -62,6 +63,7 @@ errors:
62
63
  - DEF_ENDLESS
63
64
  - DEF_ENDLESS_PARAMETERS
64
65
  - DEF_ENDLESS_SETTER
66
+ - DEF_ENDLESS_DO_BLOCK
65
67
  - DEF_NAME
66
68
  - DEF_PARAMS_TERM
67
69
  - DEF_PARAMS_TERM_PAREN
@@ -95,7 +97,6 @@ errors:
95
97
  - EXPECT_EXPRESSION_AFTER_LPAREN
96
98
  - EXPECT_EXPRESSION_AFTER_OPERATOR
97
99
  - EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ
98
- - EXPECT_EXPRESSION_AFTER_QUESTION
99
100
  - EXPECT_EXPRESSION_AFTER_SPLAT
100
101
  - EXPECT_EXPRESSION_AFTER_SPLAT_HASH
101
102
  - EXPECT_EXPRESSION_AFTER_STAR
@@ -245,7 +246,9 @@ errors:
245
246
  - PATTERN_TERM_PAREN
246
247
  - PIPEPIPEEQ_MULTI_ASSIGN
247
248
  - REGEXP_ENCODING_OPTION_MISMATCH
249
+ - REGEXP_ESCAPED_NON_ASCII_IN_UTF8
248
250
  - REGEXP_INCOMPAT_CHAR_ENCODING
251
+ - REGEXP_INVALID_CHAR_PROPERTY
249
252
  - REGEXP_INVALID_UNICODE_RANGE
250
253
  - REGEXP_NON_ESCAPED_MBC
251
254
  - REGEXP_PARSE_ERROR
@@ -356,6 +359,8 @@ tokens:
356
359
  comment: "when"
357
360
  - name: NEWLINE
358
361
  comment: "a newline character outside of other tokens"
362
+ - name: NEWLINE_TERMINATOR
363
+ comment: "a newline that terminates a construct where a newline is otherwise insignificant"
359
364
  - name: PARENTHESIS_RIGHT
360
365
  comment: ")"
361
366
  - name: PIPE
@@ -374,7 +379,7 @@ tokens:
374
379
  - name: AMPERSAND_EQUAL
375
380
  comment: "&="
376
381
  - name: BACKTICK
377
- comment: "`"
382
+ comment: "` as a method name"
378
383
  - name: BACK_REFERENCE
379
384
  comment: "a back reference"
380
385
  - name: BANG
@@ -385,6 +390,10 @@ tokens:
385
390
  comment: "!~"
386
391
  - name: BRACE_LEFT
387
392
  comment: "{"
393
+ - name: BRACE_LEFT_ARGUMENT
394
+ comment: "{ for a block following a parenthesized argument"
395
+ - name: BRACE_LEFT_HASH
396
+ comment: "{ for a hash literal"
388
397
  - name: BRACKET_LEFT
389
398
  comment: "["
390
399
  - name: BRACKET_LEFT_ARRAY
@@ -491,6 +500,10 @@ tokens:
491
500
  comment: "def"
492
501
  - name: KEYWORD_DEFINED
493
502
  comment: "defined?"
503
+ - name: KEYWORD_DO_BLOCK
504
+ comment: "do keyword for a block attached to a command"
505
+ - name: KEYWORD_DO_LAMBDA
506
+ comment: "do keyword that opens the body of a lambda literal"
494
507
  - name: KEYWORD_DO_LOOP
495
508
  comment: "do keyword for a predicate in a while, until, or for loop"
496
509
  - name: KEYWORD_END_UPCASE
@@ -577,6 +590,8 @@ tokens:
577
590
  comment: "a numbered reference to a capture group in the previous regular expression match"
578
591
  - name: PARENTHESIS_LEFT
579
592
  comment: "("
593
+ - name: PARENTHESIS_LEFT_GROUPING
594
+ comment: "( scanned at the beginning of an expression"
580
595
  - name: PARENTHESIS_LEFT_PARENTHESES
581
596
  comment: "( for a parentheses node"
582
597
  - name: PERCENT
@@ -651,12 +666,12 @@ tokens:
651
666
  comment: "unary **"
652
667
  - name: WORDS_SEP
653
668
  comment: "a separator between words in a list"
669
+ - name: WORDS_SEP_IMPLICIT
670
+ comment: "a separator between words in a list that has no source characters"
671
+ - name: XSTRING_BEGIN
672
+ comment: "the beginning of an execution string"
654
673
  - name: __END__
655
674
  comment: "marker for the point in the file at which the parser should stop"
656
- - name: MISSING
657
- comment: "a token that was expected but not found"
658
- - name: NOT_PROVIDED
659
- comment: "a token that was not present but it is okay"
660
675
  flags:
661
676
  - name: ArgumentsNodeFlags
662
677
  values:
@@ -811,8 +826,6 @@ nodes:
811
826
  - GlobalVariableReadNode
812
827
  - BackReferenceReadNode
813
828
  - NumberedReferenceReadNode
814
- - on error: SymbolNode # alias $a b
815
- - on error: MissingNode # alias $a 42
816
829
  comment: |
817
830
  Represents the old name of the global variable that can be used before aliasing.
818
831
 
@@ -821,7 +834,7 @@ nodes:
821
834
  - name: keyword_loc
822
835
  type: location
823
836
  comment: |
824
- The location of the `alias` keyword.
837
+ The Location of the `alias` keyword.
825
838
 
826
839
  alias $foo $bar
827
840
  ^^^^^
@@ -853,8 +866,6 @@ nodes:
853
866
  kind:
854
867
  - SymbolNode
855
868
  - InterpolatedSymbolNode
856
- - on error: GlobalVariableReadNode # alias a $b
857
- - on error: MissingNode # alias a 42
858
869
  comment: |
859
870
  Represents the old name of the method that will be aliased.
860
871
 
@@ -869,7 +880,7 @@ nodes:
869
880
  - name: keyword_loc
870
881
  type: location
871
882
  comment: |
872
- Represents the location of the `alias` keyword.
883
+ Represents the Location of the `alias` keyword.
873
884
 
874
885
  alias foo bar
875
886
  ^^^^^
@@ -899,7 +910,7 @@ nodes:
899
910
  - name: operator_loc
900
911
  type: location
901
912
  comment: |
902
- Represents the alternation operator location.
913
+ Represents the alternation operator Location.
903
914
 
904
915
  foo => bar | baz
905
916
  ^
@@ -935,7 +946,7 @@ nodes:
935
946
  - name: operator_loc
936
947
  type: location
937
948
  comment: |
938
- The location of the `and` keyword or the `&&` operator.
949
+ The Location of the `and` keyword or the `&&` operator.
939
950
 
940
951
  left and right
941
952
  ^^^
@@ -970,7 +981,7 @@ nodes:
970
981
  - name: opening_loc
971
982
  type: location?
972
983
  comment: |
973
- Represents the optional source location for the opening token.
984
+ Represents the optional source Location for the opening token.
974
985
 
975
986
  [1,2,3] # "["
976
987
  %w[foo bar baz] # "%w["
@@ -979,7 +990,7 @@ nodes:
979
990
  - name: closing_loc
980
991
  type: location?
981
992
  comment: |
982
- Represents the optional source location for the closing token.
993
+ Represents the optional source Location for the closing token.
983
994
 
984
995
  [1,2,3] # "]"
985
996
  %w[foo bar baz] # "]"
@@ -1018,7 +1029,9 @@ nodes:
1018
1029
  ^ ^
1019
1030
  - name: rest
1020
1031
  type: node?
1021
- kind: pattern expression
1032
+ kind:
1033
+ - ImplicitRestNode
1034
+ - SplatNode
1022
1035
  comment: |
1023
1036
  Represents the rest element of the array pattern.
1024
1037
 
@@ -1035,14 +1048,14 @@ nodes:
1035
1048
  - name: opening_loc
1036
1049
  type: location?
1037
1050
  comment: |
1038
- Represents the opening location of the array pattern.
1051
+ Represents the opening Location of the array pattern.
1039
1052
 
1040
1053
  foo in [1, 2]
1041
1054
  ^
1042
1055
  - name: closing_loc
1043
1056
  type: location?
1044
1057
  comment: |
1045
- Represents the closing location of the array pattern.
1058
+ Represents the closing Location of the array pattern.
1046
1059
 
1047
1060
  foo in [1, 2]
1048
1061
  ^
@@ -1050,19 +1063,19 @@ nodes:
1050
1063
  Represents an array pattern in pattern matching.
1051
1064
 
1052
1065
  foo in 1, 2
1053
- ^^^^^^^^^^^
1066
+ ^^^^
1054
1067
 
1055
1068
  foo in [1, 2]
1056
- ^^^^^^^^^^^^^
1069
+ ^^^^^^
1057
1070
 
1058
1071
  foo in *bar
1059
- ^^^^^^^^^^^
1072
+ ^^^^
1060
1073
 
1061
1074
  foo in Bar[]
1062
- ^^^^^^^^^^^^
1075
+ ^^^^^
1063
1076
 
1064
1077
  foo in Bar[1, 2, 3]
1065
- ^^^^^^^^^^^^^^^^^^^
1078
+ ^^^^^^^^^^^^
1066
1079
  - name: AssocNode
1067
1080
  fields:
1068
1081
  - name: key
@@ -1093,7 +1106,7 @@ nodes:
1093
1106
  - name: operator_loc
1094
1107
  type: location?
1095
1108
  comment: |
1096
- The location of the `=>` operator, if present.
1109
+ The Location of the `=>` operator, if present.
1097
1110
 
1098
1111
  { foo => bar }
1099
1112
  ^^
@@ -1115,7 +1128,7 @@ nodes:
1115
1128
  - name: operator_loc
1116
1129
  type: location
1117
1130
  comment: |
1118
- The location of the `**` operator.
1131
+ The Location of the `**` operator.
1119
1132
 
1120
1133
  { **x }
1121
1134
  ^^
@@ -1144,7 +1157,7 @@ nodes:
1144
1157
  - name: begin_keyword_loc
1145
1158
  type: location?
1146
1159
  comment: |
1147
- Represents the location of the `begin` keyword.
1160
+ Represents the Location of the `begin` keyword.
1148
1161
 
1149
1162
  begin x end
1150
1163
  ^^^^^
@@ -1171,7 +1184,7 @@ nodes:
1171
1184
  Represents the else clause within the begin block.
1172
1185
 
1173
1186
  begin x; rescue y; else z; end
1174
- ^^^^^^
1187
+ ^^^^^^^^^^^
1175
1188
  - name: ensure_clause
1176
1189
  type: node?
1177
1190
  kind: EnsureNode
@@ -1183,7 +1196,7 @@ nodes:
1183
1196
  - name: end_keyword_loc
1184
1197
  type: location?
1185
1198
  comment: |
1186
- Represents the location of the `end` keyword.
1199
+ Represents the Location of the `end` keyword.
1187
1200
 
1188
1201
  begin x end
1189
1202
  ^^^
@@ -1204,11 +1217,11 @@ nodes:
1204
1217
  The expression that is being passed as a block argument. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
1205
1218
 
1206
1219
  foo(&args)
1207
- ^^^^^
1220
+ ^^^^
1208
1221
  - name: operator_loc
1209
1222
  type: location
1210
1223
  comment: |
1211
- Represents the location of the `&` operator.
1224
+ Represents the Location of the `&` operator.
1212
1225
 
1213
1226
  foo(&args)
1214
1227
  ^
@@ -1216,7 +1229,7 @@ nodes:
1216
1229
  Represents a block argument using `&`.
1217
1230
 
1218
1231
  bar(&args)
1219
- ^^^^^^^^^^
1232
+ ^^^^^
1220
1233
  - name: BlockLocalVariableNode
1221
1234
  flags: ParameterFlags
1222
1235
  fields:
@@ -1269,14 +1282,14 @@ nodes:
1269
1282
  - name: opening_loc
1270
1283
  type: location
1271
1284
  comment: |
1272
- Represents the location of the opening `{` or `do`.
1285
+ Represents the Location of the opening `{` or `do`.
1273
1286
 
1274
1287
  [1, 2, 3].each { |i| puts x }
1275
1288
  ^
1276
1289
  - name: closing_loc
1277
1290
  type: location
1278
1291
  comment: |
1279
- Represents the location of the closing `}` or `end`.
1292
+ Represents the Location of the closing `}` or `end`.
1280
1293
 
1281
1294
  [1, 2, 3].each { |i| puts x }
1282
1295
  ^
@@ -1299,14 +1312,14 @@ nodes:
1299
1312
  - name: name_loc
1300
1313
  type: location?
1301
1314
  comment: |
1302
- Represents the location of the block parameter name.
1315
+ Represents the Location of the block parameter name.
1303
1316
 
1304
1317
  def a(&b)
1305
1318
  ^
1306
1319
  - name: operator_loc
1307
1320
  type: location
1308
1321
  comment: |
1309
- Represents the location of the `&` operator.
1322
+ Represents the Location of the `&` operator.
1310
1323
 
1311
1324
  def a(&b)
1312
1325
  ^
@@ -1346,7 +1359,7 @@ nodes:
1346
1359
  - name: opening_loc
1347
1360
  type: location?
1348
1361
  comment: |
1349
- Represents the opening location of the block parameters.
1362
+ Represents the opening Location of the block parameters.
1350
1363
 
1351
1364
  -> (a, b = 1; local) { }
1352
1365
  ^
@@ -1357,7 +1370,7 @@ nodes:
1357
1370
  - name: closing_loc
1358
1371
  type: location?
1359
1372
  comment: |
1360
- Represents the closing location of the block parameters.
1373
+ Represents the closing Location of the block parameters.
1361
1374
 
1362
1375
  -> (a, b = 1; local) { }
1363
1376
  ^
@@ -1387,7 +1400,7 @@ nodes:
1387
1400
  - name: keyword_loc
1388
1401
  type: location
1389
1402
  comment: |
1390
- The location of the `break` keyword.
1403
+ The Location of the `break` keyword.
1391
1404
 
1392
1405
  break foo
1393
1406
  ^^^^^
@@ -1410,14 +1423,14 @@ nodes:
1410
1423
  - name: call_operator_loc
1411
1424
  type: location?
1412
1425
  comment: |
1413
- Represents the location of the call operator.
1426
+ Represents the Location of the call operator.
1414
1427
 
1415
1428
  foo.bar &&= value
1416
1429
  ^
1417
1430
  - name: message_loc
1418
1431
  type: location?
1419
1432
  comment: |
1420
- Represents the location of the message.
1433
+ Represents the Location of the message.
1421
1434
 
1422
1435
  foo.bar &&= value
1423
1436
  ^^^
@@ -1438,7 +1451,7 @@ nodes:
1438
1451
  - name: operator_loc
1439
1452
  type: location
1440
1453
  comment: |
1441
- Represents the location of the operator.
1454
+ Represents the Location of the operator.
1442
1455
 
1443
1456
  foo.bar &&= value
1444
1457
  ^^^
@@ -1475,7 +1488,7 @@ nodes:
1475
1488
  - name: call_operator_loc
1476
1489
  type: location?
1477
1490
  comment: |
1478
- Represents the location of the call operator.
1491
+ Represents the Location of the call operator.
1479
1492
 
1480
1493
  foo.bar
1481
1494
  ^
@@ -1492,14 +1505,15 @@ nodes:
1492
1505
  - name: message_loc
1493
1506
  type: location?
1494
1507
  comment: |
1495
- Represents the location of the message.
1508
+ Represents the Location of the message.
1496
1509
 
1497
1510
  foo.bar
1498
1511
  ^^^
1499
1512
  - name: opening_loc
1500
1513
  type: location?
1501
1514
  comment: |
1502
- Represents the location of the left parenthesis.
1515
+ Represents the Location of the left parenthesis.
1516
+
1503
1517
  foo(bar)
1504
1518
  ^
1505
1519
  - name: arguments
@@ -1513,14 +1527,14 @@ nodes:
1513
1527
  - name: closing_loc
1514
1528
  type: location?
1515
1529
  comment: |
1516
- Represents the location of the right parenthesis.
1530
+ Represents the Location of the right parenthesis.
1517
1531
 
1518
1532
  foo(bar)
1519
1533
  ^
1520
1534
  - name: equal_loc
1521
1535
  type: location?
1522
1536
  comment: |
1523
- Represents the location of the equal sign, in the case that this is an attribute write.
1537
+ Represents the Location of the equal sign, in the case that this is an attribute write.
1524
1538
 
1525
1539
  foo.bar = value
1526
1540
  ^
@@ -1571,14 +1585,14 @@ nodes:
1571
1585
  - name: call_operator_loc
1572
1586
  type: location?
1573
1587
  comment: |
1574
- Represents the location of the call operator.
1588
+ Represents the Location of the call operator.
1575
1589
 
1576
1590
  foo.bar += value
1577
1591
  ^
1578
1592
  - name: message_loc
1579
1593
  type: location?
1580
1594
  comment: |
1581
- Represents the location of the message.
1595
+ Represents the Location of the message.
1582
1596
 
1583
1597
  foo.bar += value
1584
1598
  ^^^
@@ -1606,7 +1620,7 @@ nodes:
1606
1620
  - name: binary_operator_loc
1607
1621
  type: location
1608
1622
  comment: |
1609
- Represents the location of the binary operator.
1623
+ Represents the Location of the binary operator.
1610
1624
 
1611
1625
  foo.bar += value
1612
1626
  ^^
@@ -1637,14 +1651,14 @@ nodes:
1637
1651
  - name: call_operator_loc
1638
1652
  type: location?
1639
1653
  comment: |
1640
- Represents the location of the call operator.
1654
+ Represents the Location of the call operator.
1641
1655
 
1642
1656
  foo.bar ||= value
1643
1657
  ^
1644
1658
  - name: message_loc
1645
1659
  type: location?
1646
1660
  comment: |
1647
- Represents the location of the message.
1661
+ Represents the Location of the message.
1648
1662
 
1649
1663
  foo.bar ||= value
1650
1664
  ^^^
@@ -1665,7 +1679,7 @@ nodes:
1665
1679
  - name: operator_loc
1666
1680
  type: location
1667
1681
  comment: |
1668
- Represents the location of the operator.
1682
+ Represents the Location of the operator.
1669
1683
 
1670
1684
  foo.bar ||= value
1671
1685
  ^^^
@@ -1696,7 +1710,7 @@ nodes:
1696
1710
  - name: call_operator_loc
1697
1711
  type: location
1698
1712
  comment: |
1699
- Represents the location of the call operator.
1713
+ Represents the Location of the call operator.
1700
1714
 
1701
1715
  foo.bar = 1
1702
1716
  ^
@@ -1710,7 +1724,7 @@ nodes:
1710
1724
  - name: message_loc
1711
1725
  type: location
1712
1726
  comment: |
1713
- Represents the location of the message.
1727
+ Represents the Location of the message.
1714
1728
 
1715
1729
  foo.bar = 1
1716
1730
  ^^^
@@ -1748,7 +1762,7 @@ nodes:
1748
1762
  - name: operator_loc
1749
1763
  type: location
1750
1764
  comment: |
1751
- Represents the location of the `=>` operator.
1765
+ Represents the Location of the `=>` operator.
1752
1766
 
1753
1767
  foo => bar
1754
1768
  ^^
@@ -1756,7 +1770,7 @@ nodes:
1756
1770
  Represents assigning to a local variable in pattern matching.
1757
1771
 
1758
1772
  foo => [bar => baz]
1759
- ^^^^^^^^^^^^
1773
+ ^^^^^^^^^^
1760
1774
  - name: CaseMatchNode
1761
1775
  fields:
1762
1776
  - name: predicate
@@ -1766,7 +1780,7 @@ nodes:
1766
1780
  Represents the predicate of the case match. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
1767
1781
 
1768
1782
  case true; in false; end
1769
- ^^^^
1783
+ ^^^^
1770
1784
  - name: conditions
1771
1785
  type: node[]
1772
1786
  kind: InNode
@@ -1782,18 +1796,18 @@ nodes:
1782
1796
  Represents the else clause of the case match.
1783
1797
 
1784
1798
  case true; in false; else; end
1785
- ^^^^
1799
+ ^^^^^^^^^
1786
1800
  - name: case_keyword_loc
1787
1801
  type: location
1788
1802
  comment: |
1789
- Represents the location of the `case` keyword.
1803
+ Represents the Location of the `case` keyword.
1790
1804
 
1791
1805
  case true; in false; end
1792
1806
  ^^^^
1793
1807
  - name: end_keyword_loc
1794
1808
  type: location
1795
1809
  comment: |
1796
- Represents the location of the `end` keyword.
1810
+ Represents the Location of the `end` keyword.
1797
1811
 
1798
1812
  case true; in false; end
1799
1813
  ^^^
@@ -1829,18 +1843,18 @@ nodes:
1829
1843
  Represents the else clause of the case statement.
1830
1844
 
1831
1845
  case true; when false; else; end
1832
- ^^^^
1846
+ ^^^^^^^^^
1833
1847
  - name: case_keyword_loc
1834
1848
  type: location
1835
1849
  comment: |
1836
- Represents the location of the `case` keyword.
1850
+ Represents the Location of the `case` keyword.
1837
1851
 
1838
1852
  case true; when false; end
1839
1853
  ^^^^
1840
1854
  - name: end_keyword_loc
1841
1855
  type: location
1842
1856
  comment: |
1843
- Represents the location of the `end` keyword.
1857
+ Represents the Location of the `end` keyword.
1844
1858
 
1845
1859
  case true; when false; end
1846
1860
  ^^^
@@ -1858,7 +1872,7 @@ nodes:
1858
1872
  - name: class_keyword_loc
1859
1873
  type: location
1860
1874
  comment: |
1861
- Represents the location of the `class` keyword.
1875
+ Represents the Location of the `class` keyword.
1862
1876
 
1863
1877
  class Foo end
1864
1878
  ^^^^^
@@ -1867,11 +1881,10 @@ nodes:
1867
1881
  kind:
1868
1882
  - ConstantReadNode
1869
1883
  - ConstantPathNode
1870
- - on error: CallNode # class 0.X end
1871
1884
  - name: inheritance_operator_loc
1872
1885
  type: location?
1873
1886
  comment: |
1874
- Represents the location of the `<` operator.
1887
+ Represents the Location of the `<` operator.
1875
1888
 
1876
1889
  class Foo < Bar
1877
1890
  ^
@@ -1891,13 +1904,12 @@ nodes:
1891
1904
  comment: |
1892
1905
  Represents the body of the class.
1893
1906
 
1894
- class Foo
1895
- foo
1896
- ^^^
1907
+ class Foo; bar; end
1908
+ ^^^
1897
1909
  - name: end_keyword_loc
1898
1910
  type: location
1899
1911
  comment: |
1900
- Represents the location of the `end` keyword.
1912
+ Represents the Location of the `end` keyword.
1901
1913
 
1902
1914
  class Foo end
1903
1915
  ^^^
@@ -1924,14 +1936,14 @@ nodes:
1924
1936
  - name: name_loc
1925
1937
  type: location
1926
1938
  comment: |
1927
- Represents the location of the variable name.
1939
+ Represents the Location of the variable name.
1928
1940
 
1929
1941
  @@target &&= value
1930
1942
  ^^^^^^^^
1931
1943
  - name: operator_loc
1932
1944
  type: location
1933
1945
  comment: |
1934
- Represents the location of the `&&=` operator.
1946
+ Represents the Location of the `&&=` operator.
1935
1947
 
1936
1948
  @@target &&= value
1937
1949
  ^^^
@@ -2019,7 +2031,7 @@ nodes:
2019
2031
  - name: name_loc
2020
2032
  type: location
2021
2033
  comment: |
2022
- The location of the variable name.
2034
+ The Location of the variable name.
2023
2035
 
2024
2036
  @@foo = :bar
2025
2037
  ^^^^^
@@ -2037,7 +2049,7 @@ nodes:
2037
2049
  - name: operator_loc
2038
2050
  type: location
2039
2051
  comment: |
2040
- The location of the `=` operator.
2052
+ The Location of the `=` operator.
2041
2053
 
2042
2054
  @@foo = :bar
2043
2055
  ^
@@ -2133,7 +2145,7 @@ nodes:
2133
2145
  - name: delimiter_loc
2134
2146
  type: location
2135
2147
  comment: |
2136
- The location of the `::` delimiter.
2148
+ The Location of the `::` delimiter.
2137
2149
 
2138
2150
  ::Foo
2139
2151
  ^^
@@ -2143,7 +2155,7 @@ nodes:
2143
2155
  - name: name_loc
2144
2156
  type: location
2145
2157
  comment: |
2146
- The location of the name of the constant.
2158
+ The Location of the name of the constant.
2147
2159
 
2148
2160
  ::Foo
2149
2161
  ^^^
@@ -2219,7 +2231,7 @@ nodes:
2219
2231
  - name: operator_loc
2220
2232
  type: location
2221
2233
  comment: |
2222
- The location of the `=` operator.
2234
+ The Location of the `=` operator.
2223
2235
 
2224
2236
  ::ABC = 123
2225
2237
  ^
@@ -2279,7 +2291,7 @@ nodes:
2279
2291
  - name: name_loc
2280
2292
  type: location
2281
2293
  comment: |
2282
- The location of the constant name.
2294
+ The Location of the constant name.
2283
2295
 
2284
2296
  FOO = 1
2285
2297
  ^^^
@@ -2297,7 +2309,7 @@ nodes:
2297
2309
  - name: operator_loc
2298
2310
  type: location
2299
2311
  comment: |
2300
- The location of the `=` operator.
2312
+ The Location of the `=` operator.
2301
2313
 
2302
2314
  FOO = :bar
2303
2315
  ^
@@ -2422,6 +2434,15 @@ nodes:
2422
2434
  ^^^^^^
2423
2435
  bar
2424
2436
  end
2437
+ - name: ErrorRecoveryNode
2438
+ fields:
2439
+ - name: unexpected
2440
+ type: node?
2441
+ kind: Node
2442
+ comment: |
2443
+ The unexpected node that was found in the tree, if there was one.
2444
+ comment: |
2445
+ Represents a node that is either missing or unexpected and results in a syntax error.
2425
2446
  - name: FalseNode
2426
2447
  comment: |
2427
2448
  Represents the use of the literal `false` keyword.
@@ -2464,9 +2485,7 @@ nodes:
2464
2485
  ^^^^^^
2465
2486
  - name: right
2466
2487
  type: node
2467
- kind:
2468
- - SplatNode
2469
- - on error: MissingNode
2488
+ kind: SplatNode
2470
2489
  comment: |
2471
2490
  Represents the second wildcard node in the pattern.
2472
2491
 
@@ -2478,7 +2497,7 @@ nodes:
2478
2497
  - name: opening_loc
2479
2498
  type: location?
2480
2499
  comment: |
2481
- The location of the opening brace.
2500
+ The Location of the opening brace.
2482
2501
 
2483
2502
  foo in [*bar, baz, *qux]
2484
2503
  ^
@@ -2488,7 +2507,7 @@ nodes:
2488
2507
  - name: closing_loc
2489
2508
  type: location?
2490
2509
  comment: |
2491
- The location of the closing brace.
2510
+ The Location of the closing brace.
2492
2511
 
2493
2512
  foo in [*bar, baz, *qux]
2494
2513
  ^
@@ -2549,9 +2568,6 @@ nodes:
2549
2568
  - CallTargetNode
2550
2569
  - IndexTargetNode
2551
2570
  - MultiTargetNode
2552
- - on error: BackReferenceReadNode # for $& in a end
2553
- - on error: NumberedReferenceReadNode # for $1 in a end
2554
- - on error: MissingNode # for in 1..10; end
2555
2571
  comment: |
2556
2572
  The index expression for `for` loops.
2557
2573
 
@@ -2578,28 +2594,28 @@ nodes:
2578
2594
  - name: for_keyword_loc
2579
2595
  type: location
2580
2596
  comment: |
2581
- The location of the `for` keyword.
2597
+ The Location of the `for` keyword.
2582
2598
 
2583
2599
  for i in a end
2584
2600
  ^^^
2585
2601
  - name: in_keyword_loc
2586
2602
  type: location
2587
2603
  comment: |
2588
- The location of the `in` keyword.
2604
+ The Location of the `in` keyword.
2589
2605
 
2590
2606
  for i in a end
2591
2607
  ^^
2592
2608
  - name: do_keyword_loc
2593
2609
  type: location?
2594
2610
  comment: |
2595
- The location of the `do` keyword, if present.
2611
+ The Location of the `do` keyword, if present.
2596
2612
 
2597
2613
  for i in a do end
2598
2614
  ^^
2599
2615
  - name: end_keyword_loc
2600
2616
  type: location
2601
2617
  comment: |
2602
- The location of the `end` keyword.
2618
+ The Location of the `end` keyword.
2603
2619
 
2604
2620
  for i in a end
2605
2621
  ^^^
@@ -2625,6 +2641,14 @@ nodes:
2625
2641
  end
2626
2642
  - name: ForwardingSuperNode
2627
2643
  fields:
2644
+ - name: keyword_loc
2645
+ type: location
2646
+ comment: |
2647
+ super
2648
+ ^^^^^
2649
+
2650
+ super { 123 }
2651
+ ^^^^^
2628
2652
  - name: block
2629
2653
  type: node?
2630
2654
  kind: BlockNode
@@ -2727,7 +2751,7 @@ nodes:
2727
2751
  - name: name_loc
2728
2752
  type: location
2729
2753
  comment: |
2730
- The location of the global variable's name.
2754
+ The Location of the global variable's name.
2731
2755
 
2732
2756
  $foo = :bar
2733
2757
  ^^^^
@@ -2745,7 +2769,7 @@ nodes:
2745
2769
  - name: operator_loc
2746
2770
  type: location
2747
2771
  comment: |
2748
- The location of the `=` operator.
2772
+ The Location of the `=` operator.
2749
2773
 
2750
2774
  $foo = :bar
2751
2775
  ^
@@ -2759,7 +2783,7 @@ nodes:
2759
2783
  - name: opening_loc
2760
2784
  type: location
2761
2785
  comment: |
2762
- The location of the opening brace.
2786
+ The Location of the opening brace.
2763
2787
 
2764
2788
  { a => b }
2765
2789
  ^
@@ -2779,7 +2803,7 @@ nodes:
2779
2803
  - name: closing_loc
2780
2804
  type: location
2781
2805
  comment: |
2782
- The location of the closing brace.
2806
+ The Location of the closing brace.
2783
2807
 
2784
2808
  { a => b }
2785
2809
  ^
@@ -2830,7 +2854,7 @@ nodes:
2830
2854
  - name: opening_loc
2831
2855
  type: location?
2832
2856
  comment: |
2833
- The location of the opening brace.
2857
+ The Location of the opening brace.
2834
2858
 
2835
2859
  foo => { a: 1 }
2836
2860
  ^
@@ -2840,7 +2864,7 @@ nodes:
2840
2864
  - name: closing_loc
2841
2865
  type: location?
2842
2866
  comment: |
2843
- The location of the closing brace.
2867
+ The Location of the closing brace.
2844
2868
 
2845
2869
  foo => { a: 1 }
2846
2870
  ^
@@ -2866,7 +2890,7 @@ nodes:
2866
2890
  - name: if_keyword_loc
2867
2891
  type: location?
2868
2892
  comment: |
2869
- The location of the `if` keyword if present.
2893
+ The Location of the `if` keyword if present.
2870
2894
 
2871
2895
  bar if foo
2872
2896
  ^^
@@ -2891,7 +2915,7 @@ nodes:
2891
2915
  - name: then_keyword_loc
2892
2916
  type: location?
2893
2917
  comment: |
2894
- The location of the `then` keyword (if present) or the `?` in a ternary expression, `nil` otherwise.
2918
+ The Location of the `then` keyword (if present) or the `?` in a ternary expression, `nil` otherwise.
2895
2919
 
2896
2920
  if foo then bar end
2897
2921
  ^^^^
@@ -2932,7 +2956,7 @@ nodes:
2932
2956
  - name: end_keyword_loc
2933
2957
  type: location?
2934
2958
  comment: |
2935
- The location of the `end` keyword if present, `nil` otherwise.
2959
+ The Location of the `end` keyword if present, `nil` otherwise.
2936
2960
 
2937
2961
  if foo
2938
2962
  bar
@@ -3006,9 +3030,9 @@ nodes:
3006
3030
  - name: statements
3007
3031
  type: node?
3008
3032
  kind: StatementsNode
3009
- - name: in_loc
3033
+ - name: in_keyword_loc
3010
3034
  type: location
3011
- - name: then_loc
3035
+ - name: then_keyword_loc
3012
3036
  type: location?
3013
3037
  comment: |
3014
3038
  Represents the use of the `in` keyword in a case statement.
@@ -3217,7 +3241,7 @@ nodes:
3217
3241
  - name: name_loc
3218
3242
  type: location
3219
3243
  comment: |
3220
- The location of the variable name.
3244
+ The Location of the variable name.
3221
3245
 
3222
3246
  @_x = 1
3223
3247
  ^^^
@@ -3235,7 +3259,7 @@ nodes:
3235
3259
  - name: operator_loc
3236
3260
  type: location
3237
3261
  comment: |
3238
- The location of the `=` operator.
3262
+ The Location of the `=` operator.
3239
3263
 
3240
3264
  @x = y
3241
3265
  ^
@@ -3305,10 +3329,6 @@ nodes:
3305
3329
  - EmbeddedStatementsNode
3306
3330
  - EmbeddedVariableNode
3307
3331
  - InterpolatedStringNode # `"a" "#{b}"`
3308
- - on error: XStringNode # `<<`FOO` "bar"
3309
- - on error: InterpolatedXStringNode
3310
- - on error: SymbolNode
3311
- - on error: InterpolatedSymbolNode
3312
3332
  - name: closing_loc
3313
3333
  type: location?
3314
3334
  newline: parts
@@ -3542,7 +3562,7 @@ nodes:
3542
3562
  - name: name_loc
3543
3563
  type: location
3544
3564
  comment: |
3545
- The location of the variable name.
3565
+ The Location of the variable name.
3546
3566
 
3547
3567
  foo = :bar
3548
3568
  ^^^
@@ -3564,7 +3584,7 @@ nodes:
3564
3584
  - name: operator_loc
3565
3585
  type: location
3566
3586
  comment: |
3567
- The location of the `=` operator.
3587
+ The Location of the `=` operator.
3568
3588
 
3569
3589
  x = :y
3570
3590
  ^
@@ -3597,7 +3617,7 @@ nodes:
3597
3617
  - name: pattern
3598
3618
  type: node
3599
3619
  kind: pattern expression
3600
- - name: operator_loc
3620
+ - name: keyword_loc
3601
3621
  type: location
3602
3622
  comment: |
3603
3623
  Represents the use of the modifier `in` operator.
@@ -3664,7 +3684,7 @@ nodes:
3664
3684
  - name: operator_loc
3665
3685
  type: location
3666
3686
  comment: |
3667
- The location of the operator.
3687
+ The Location of the operator.
3668
3688
 
3669
3689
  foo => bar
3670
3690
  ^^
@@ -3686,9 +3706,6 @@ nodes:
3686
3706
 
3687
3707
  /(?<foo>bar)/ =~ baz
3688
3708
  ^^^^^^^^^^^^^^^^^^^^
3689
- - name: MissingNode
3690
- comment: |
3691
- Represents a node that is missing from the source and results in a syntax error.
3692
3709
  - name: ModuleNode
3693
3710
  fields:
3694
3711
  - name: locals
@@ -3700,7 +3717,6 @@ nodes:
3700
3717
  kind:
3701
3718
  - ConstantReadNode
3702
3719
  - ConstantPathNode
3703
- - on error: MissingNode # module Parent module end
3704
3720
  - name: body
3705
3721
  type: node?
3706
3722
  kind:
@@ -3730,8 +3746,6 @@ nodes:
3730
3746
  - IndexTargetNode
3731
3747
  - MultiTargetNode
3732
3748
  - RequiredParameterNode # def m((a,b)); end
3733
- - on error: BackReferenceReadNode # a, (b, $&) = z
3734
- - on error: NumberedReferenceReadNode # a, (b, $1) = z
3735
3749
  comment: |
3736
3750
  Represents the targets expressions before a splat node.
3737
3751
 
@@ -3775,8 +3789,6 @@ nodes:
3775
3789
  - IndexTargetNode
3776
3790
  - MultiTargetNode
3777
3791
  - RequiredParameterNode # def m((*,b)); end
3778
- - on error: BackReferenceReadNode # a, (*, $&) = z
3779
- - on error: NumberedReferenceReadNode # a, (*, $1) = z
3780
3792
  comment: |
3781
3793
  Represents the targets expressions after a splat node.
3782
3794
 
@@ -3785,14 +3797,14 @@ nodes:
3785
3797
  - name: lparen_loc
3786
3798
  type: location?
3787
3799
  comment: |
3788
- The location of the opening parenthesis.
3800
+ The Location of the opening parenthesis.
3789
3801
 
3790
3802
  a, (b, c) = 1, 2, 3
3791
3803
  ^
3792
3804
  - name: rparen_loc
3793
3805
  type: location?
3794
3806
  comment: |
3795
- The location of the closing parenthesis.
3807
+ The Location of the closing parenthesis.
3796
3808
 
3797
3809
  a, (b, c) = 1, 2, 3
3798
3810
  ^
@@ -3820,8 +3832,6 @@ nodes:
3820
3832
  - CallTargetNode
3821
3833
  - IndexTargetNode
3822
3834
  - MultiTargetNode
3823
- - on error: BackReferenceReadNode # $&, = z
3824
- - on error: NumberedReferenceReadNode # $1, = z
3825
3835
  comment: |
3826
3836
  Represents the targets expressions before a splat node.
3827
3837
 
@@ -3864,8 +3874,6 @@ nodes:
3864
3874
  - CallTargetNode
3865
3875
  - IndexTargetNode
3866
3876
  - MultiTargetNode
3867
- - on error: BackReferenceReadNode # *, $& = z
3868
- - on error: NumberedReferenceReadNode # *, $1 = z
3869
3877
  comment: |
3870
3878
  Represents the targets expressions after a splat node.
3871
3879
 
@@ -3874,21 +3882,21 @@ nodes:
3874
3882
  - name: lparen_loc
3875
3883
  type: location?
3876
3884
  comment: |
3877
- The location of the opening parenthesis.
3885
+ The Location of the opening parenthesis.
3878
3886
 
3879
3887
  (a, b, c) = 1, 2, 3
3880
3888
  ^
3881
3889
  - name: rparen_loc
3882
3890
  type: location?
3883
3891
  comment: |
3884
- The location of the closing parenthesis.
3892
+ The Location of the closing parenthesis.
3885
3893
 
3886
3894
  (a, b, c) = 1, 2, 3
3887
3895
  ^
3888
3896
  - name: operator_loc
3889
3897
  type: location
3890
3898
  comment: |
3891
- The location of the operator.
3899
+ The Location of the operator.
3892
3900
 
3893
3901
  a, b, c = 1, 2, 3
3894
3902
  ^
@@ -3923,6 +3931,18 @@ nodes:
3923
3931
 
3924
3932
  nil
3925
3933
  ^^^
3934
+ - name: NoBlockParameterNode
3935
+ fields:
3936
+ - name: operator_loc
3937
+ type: location
3938
+ - name: keyword_loc
3939
+ type: location
3940
+ comment: |
3941
+ Represents the use of `&nil` inside method arguments.
3942
+
3943
+ def a(&nil)
3944
+ ^^^^
3945
+ end
3926
3946
  - name: NoKeywordsParameterNode
3927
3947
  fields:
3928
3948
  - name: operator_loc
@@ -4022,7 +4042,7 @@ nodes:
4022
4042
  - name: operator_loc
4023
4043
  type: location
4024
4044
  comment: |
4025
- The location of the `or` keyword or the `||` operator.
4045
+ The Location of the `or` keyword or the `||` operator.
4026
4046
 
4027
4047
  left or right
4028
4048
  ^^
@@ -4051,11 +4071,6 @@ nodes:
4051
4071
  kind:
4052
4072
  - RequiredParameterNode
4053
4073
  - MultiTargetNode
4054
- # On parsing error of `f(**kwargs, ...)` or `f(**nil, ...)`, the keyword_rest value is moved here:
4055
- - on error: KeywordRestParameterNode
4056
- - on error: NoKeywordsParameterNode
4057
- # On parsing error of `f(..., ...)`, the first forwarding parameter is moved here:
4058
- - on error: ForwardingParameterNode
4059
4074
  - name: keywords
4060
4075
  type: node[]
4061
4076
  kind:
@@ -4069,7 +4084,9 @@ nodes:
4069
4084
  - NoKeywordsParameterNode
4070
4085
  - name: block
4071
4086
  type: node?
4072
- kind: BlockParameterNode
4087
+ kind:
4088
+ - BlockParameterNode
4089
+ - NoBlockParameterNode
4073
4090
  comment: |
4074
4091
  Represents the list of parameters on a method, block, or lambda definition.
4075
4092
 
@@ -4105,21 +4122,21 @@ nodes:
4105
4122
  - name: operator_loc
4106
4123
  type: location
4107
4124
  comment: |
4108
- The location of the `^` operator
4125
+ The Location of the `^` operator
4109
4126
 
4110
4127
  foo in ^(bar)
4111
4128
  ^
4112
4129
  - name: lparen_loc
4113
4130
  type: location
4114
4131
  comment: |
4115
- The location of the opening parenthesis.
4132
+ The Location of the opening parenthesis.
4116
4133
 
4117
4134
  foo in ^(bar)
4118
4135
  ^
4119
4136
  - name: rparen_loc
4120
4137
  type: location
4121
4138
  comment: |
4122
- The location of the closing parenthesis.
4139
+ The Location of the closing parenthesis.
4123
4140
 
4124
4141
  foo in ^(bar)
4125
4142
  ^
@@ -4140,7 +4157,6 @@ nodes:
4140
4157
  - BackReferenceReadNode # foo in ^$&
4141
4158
  - NumberedReferenceReadNode # foo in ^$1
4142
4159
  - ItLocalVariableReadNode # proc { 1 in ^it }
4143
- - on error: MissingNode # foo in ^Bar
4144
4160
  comment: |
4145
4161
  The variable used in the pinned expression
4146
4162
 
@@ -4149,7 +4165,7 @@ nodes:
4149
4165
  - name: operator_loc
4150
4166
  type: location
4151
4167
  comment: |
4152
- The location of the `^` operator
4168
+ The Location of the `^` operator
4153
4169
 
4154
4170
  foo in ^bar
4155
4171
  ^
@@ -4223,11 +4239,11 @@ nodes:
4223
4239
 
4224
4240
  1...foo
4225
4241
  ^^^
4226
- If neither right-hand or left-hand side was included, this will be a MissingNode.
4242
+ If neither right-hand or left-hand side was included, this will be an ErrorRecoveryNode.
4227
4243
  - name: operator_loc
4228
4244
  type: location
4229
4245
  comment: |
4230
- The location of the `..` or `...` operator.
4246
+ The Location of the `..` or `...` operator.
4231
4247
  comment: |
4232
4248
  Represents the use of the `..` or `...` operators.
4233
4249
 
@@ -4338,9 +4354,6 @@ nodes:
4338
4354
  - ConstantPathTargetNode
4339
4355
  - CallTargetNode
4340
4356
  - IndexTargetNode
4341
- - on error: BackReferenceReadNode # => begin; rescue => $&; end
4342
- - on error: NumberedReferenceReadNode # => begin; rescue => $1; end
4343
- - on error: MissingNode # begin; rescue =>; end
4344
4357
  - name: then_keyword_loc
4345
4358
  type: location?
4346
4359
  - name: statements
@@ -4453,7 +4466,7 @@ nodes:
4453
4466
  fields:
4454
4467
  - name: filepath
4455
4468
  type: string
4456
- comment: Represents the file path being parsed. This corresponds directly to the `filepath` option given to the various `Prism::parse*` APIs.
4469
+ comment: Represents the file path being parsed. This corresponds directly to the `filepath` option given to the various `Prism.parse*` APIs.
4457
4470
  comment: |
4458
4471
  Represents the use of the `__FILE__` keyword.
4459
4472
 
@@ -4541,8 +4554,8 @@ nodes:
4541
4554
  fields:
4542
4555
  - name: opening_loc
4543
4556
  type: location?
4544
- - name: value_loc
4545
- type: location?
4557
+ - name: content_loc
4558
+ type: location
4546
4559
  - name: closing_loc
4547
4560
  type: location?
4548
4561
  - name: unescaped
@@ -4577,10 +4590,10 @@ nodes:
4577
4590
  ^^^^^^^^^^^^^^^^^^^^^^
4578
4591
  - name: UnlessNode
4579
4592
  fields:
4580
- - name: keyword_loc
4593
+ - name: unless_keyword_loc
4581
4594
  type: location
4582
4595
  comment: |
4583
- The location of the `unless` keyword.
4596
+ The Location of the `unless` keyword.
4584
4597
 
4585
4598
  unless cond then bar end
4586
4599
  ^^^^^^
@@ -4601,7 +4614,7 @@ nodes:
4601
4614
  - name: then_keyword_loc
4602
4615
  type: location?
4603
4616
  comment: |
4604
- The location of the `then` keyword, if present.
4617
+ The Location of the `then` keyword, if present.
4605
4618
 
4606
4619
  unless cond then bar end
4607
4620
  ^^^^
@@ -4621,11 +4634,11 @@ nodes:
4621
4634
  The else clause of the unless expression, if present.
4622
4635
 
4623
4636
  unless cond then bar else baz end
4624
- ^^^^^^^^
4637
+ ^^^^^^^^^^^^
4625
4638
  - name: end_keyword_loc
4626
4639
  type: location?
4627
4640
  comment: |
4628
- The location of the `end` keyword, if present.
4641
+ The Location of the `end` keyword, if present.
4629
4642
 
4630
4643
  unless cond then bar end
4631
4644
  ^^^
@@ -4641,11 +4654,11 @@ nodes:
4641
4654
  - name: UntilNode
4642
4655
  flags: LoopFlags
4643
4656
  fields:
4644
- - name: keyword_loc
4657
+ - name: until_keyword_loc
4645
4658
  type: location
4646
4659
  - name: do_keyword_loc
4647
4660
  type: location?
4648
- - name: closing_loc
4661
+ - name: end_keyword_loc
4649
4662
  type: location?
4650
4663
  - name: predicate
4651
4664
  type: node
@@ -4664,7 +4677,7 @@ nodes:
4664
4677
  ^^^^^^^^^^^^^^^^^^^^
4665
4678
  - name: WhenNode
4666
4679
  fields:
4667
- - name: keyword_loc
4680
+ - name: when_keyword_loc
4668
4681
  type: location
4669
4682
  - name: conditions
4670
4683
  type: node[]
@@ -4684,11 +4697,11 @@ nodes:
4684
4697
  - name: WhileNode
4685
4698
  flags: LoopFlags
4686
4699
  fields:
4687
- - name: keyword_loc
4700
+ - name: while_keyword_loc
4688
4701
  type: location
4689
4702
  - name: do_keyword_loc
4690
4703
  type: location?
4691
- - name: closing_loc
4704
+ - name: end_keyword_loc
4692
4705
  type: location?
4693
4706
  - name: predicate
4694
4707
  type: node