prism 1.8.1 → 2.0.0.rc1

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 (241) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +90 -2
  3. data/Makefile +41 -12
  4. data/README.md +35 -97
  5. data/config.yml +174 -163
  6. data/docs/build_system.md +2 -2
  7. data/docs/configuration.md +5 -4
  8. data/docs/encoding.md +2 -2
  9. data/docs/fuzzing.md +4 -11
  10. data/docs/javascript.md +19 -4
  11. data/docs/mapping.md +1 -1
  12. data/docs/releasing.md +77 -5
  13. data/docs/relocation.md +2 -4
  14. data/docs/ripper_translation.md +8 -17
  15. data/docs/serialization.md +21 -24
  16. data/docs/testing.md +46 -29
  17. data/ext/prism/api_node.c +1461 -1401
  18. data/ext/prism/extconf.rb +3 -4
  19. data/ext/prism/extension.c +778 -422
  20. data/ext/prism/extension.h +3 -3
  21. data/include/prism/arena.h +37 -0
  22. data/include/prism/ast.h +2729 -612
  23. data/include/prism/buffer.h +52 -0
  24. data/include/prism/comments.h +55 -0
  25. data/include/prism/compiler/accel.h +24 -0
  26. data/include/prism/compiler/align.h +36 -0
  27. data/include/prism/compiler/assume.h +25 -0
  28. data/include/prism/compiler/exported.h +24 -0
  29. data/include/prism/compiler/fallthrough.h +22 -0
  30. data/include/prism/compiler/filesystem.h +32 -0
  31. data/include/prism/compiler/flex_array.h +19 -0
  32. data/include/prism/compiler/force_inline.h +21 -0
  33. data/include/prism/compiler/format.h +25 -0
  34. data/include/prism/compiler/inline.h +17 -0
  35. data/include/prism/compiler/nodiscard.h +22 -0
  36. data/include/prism/compiler/nonnull.h +18 -0
  37. data/include/prism/compiler/unused.h +18 -0
  38. data/include/prism/constant_pool.h +81 -0
  39. data/include/prism/diagnostic.h +38 -405
  40. data/include/prism/errors_format.h +53 -0
  41. data/include/prism/excludes.h +29 -0
  42. data/include/prism/integer.h +41 -0
  43. data/include/prism/internal/allocator.h +68 -0
  44. data/include/prism/internal/allocator_debug.h +88 -0
  45. data/include/prism/internal/arena.h +108 -0
  46. data/include/prism/internal/bit.h +42 -0
  47. data/include/prism/internal/buffer.h +91 -0
  48. data/include/prism/internal/char.h +145 -0
  49. data/include/prism/internal/comments.h +53 -0
  50. data/include/prism/internal/constant_pool.h +152 -0
  51. data/include/prism/internal/diagnostic.h +389 -0
  52. data/include/prism/{encoding.h → internal/encoding.h} +27 -68
  53. data/include/prism/internal/integer.h +68 -0
  54. data/include/prism/internal/isinf.h +16 -0
  55. data/include/prism/internal/line_offset_list.h +34 -0
  56. data/include/prism/{util/pm_list.h → internal/list.h} +11 -52
  57. data/include/prism/internal/magic_comments.h +23 -0
  58. data/include/prism/internal/memchr.h +15 -0
  59. data/include/prism/internal/node.h +38 -0
  60. data/include/prism/internal/options.h +232 -0
  61. data/include/prism/internal/parser.h +984 -0
  62. data/include/prism/internal/regexp.h +26 -0
  63. data/include/prism/internal/serialize.h +39 -0
  64. data/include/prism/internal/source.h +72 -0
  65. data/include/prism/{static_literals.h → internal/static_literals.h} +26 -47
  66. data/include/prism/internal/stringy.h +35 -0
  67. data/include/prism/{util/pm_strncasecmp.h → internal/strncasecmp.h} +3 -17
  68. data/include/prism/{util/pm_strpbrk.h → internal/strpbrk.h} +7 -20
  69. data/include/prism/internal/tokens.h +11 -0
  70. data/include/prism/json.h +32 -0
  71. data/include/prism/line_offset_list.h +61 -0
  72. data/include/prism/magic_comments.h +35 -0
  73. data/include/prism/node.h +18 -53
  74. data/include/prism/options.h +146 -280
  75. data/include/prism/parser.h +336 -868
  76. data/include/prism/prettyprint.h +6 -9
  77. data/include/prism/serialize.h +115 -0
  78. data/include/prism/source.h +155 -0
  79. data/include/prism/stream.h +28 -0
  80. data/include/prism/string_query.h +63 -0
  81. data/include/prism/stringy.h +72 -0
  82. data/include/prism/version.h +13 -4
  83. data/include/prism.h +43 -320
  84. data/lib/prism/compiler.rb +319 -305
  85. data/lib/prism/desugar_compiler.rb +105 -34
  86. data/lib/prism/dispatcher.rb +646 -473
  87. data/lib/prism/dot_visitor.rb +592 -511
  88. data/lib/prism/dsl.rb +391 -25
  89. data/lib/prism/ffi.rb +252 -90
  90. data/lib/prism/inspect_visitor.rb +357 -325
  91. data/lib/prism/lex_compat.rb +311 -228
  92. data/lib/prism/mutation_compiler.rb +313 -305
  93. data/lib/prism/node.rb +20284 -7038
  94. data/lib/prism/node_ext.rb +180 -187
  95. data/lib/prism/node_find.rb +215 -0
  96. data/lib/prism/parse_result/errors.rb +7 -1
  97. data/lib/prism/parse_result/newlines.rb +276 -8
  98. data/lib/prism/parse_result.rb +462 -139
  99. data/lib/prism/pattern.rb +65 -20
  100. data/lib/prism/reflection.rb +23 -12
  101. data/lib/prism/relocation.rb +149 -87
  102. data/lib/prism/serialize.rb +3442 -536
  103. data/lib/prism/string_query.rb +16 -1
  104. data/lib/prism/translation/parser/builder.rb +10 -2
  105. data/lib/prism/translation/parser/compiler.rb +44 -52
  106. data/lib/prism/translation/parser/lexer.rb +41 -92
  107. data/lib/prism/translation/parser.rb +1 -1
  108. data/lib/prism/translation/parser_current.rb +1 -1
  109. data/lib/prism/translation/ripper/filter.rb +53 -0
  110. data/lib/prism/translation/ripper/lexer.rb +92 -5
  111. data/lib/prism/translation/ripper/sexp.rb +2 -10
  112. data/lib/prism/translation/ripper/shim.rb +2 -0
  113. data/lib/prism/translation/ripper.rb +1005 -224
  114. data/lib/prism/translation/ruby_parser.rb +73 -316
  115. data/lib/prism/translation.rb +2 -0
  116. data/lib/prism/visitor.rb +632 -5
  117. data/lib/prism.rb +79 -22
  118. data/prism.gemspec +123 -61
  119. data/rbi/generated/prism/compiler.rbi +489 -0
  120. data/rbi/generated/prism/desugar_compiler.rbi +306 -0
  121. data/rbi/generated/prism/dispatcher.rbi +1138 -0
  122. data/rbi/generated/prism/dot_visitor.rbi +618 -0
  123. data/rbi/generated/prism/dsl.rbi +751 -0
  124. data/rbi/generated/prism/inspect_visitor.rbi +503 -0
  125. data/rbi/generated/prism/lex_compat.rbi +162 -0
  126. data/rbi/generated/prism/mutation_compiler.rbi +464 -0
  127. data/rbi/generated/prism/node.rbi +13681 -0
  128. data/rbi/generated/prism/node_ext.rbi +259 -0
  129. data/rbi/generated/prism/node_find.rbi +79 -0
  130. data/rbi/generated/prism/parse_result/errors.rbi +21 -0
  131. data/rbi/generated/prism/parse_result/newlines.rbi +208 -0
  132. data/rbi/generated/prism/parse_result.rbi +764 -0
  133. data/rbi/generated/prism/pattern.rbi +134 -0
  134. data/rbi/generated/prism/reflection.rbi +89 -0
  135. data/rbi/generated/prism/relocation.rbi +329 -0
  136. data/rbi/generated/prism/serialize.rbi +181 -0
  137. data/rbi/generated/prism/string_query.rbi +36 -0
  138. data/rbi/generated/prism/translation.rbi +7 -0
  139. data/rbi/generated/prism/visitor.rbi +650 -0
  140. data/rbi/generated/prism.rbi +86 -0
  141. data/rbi/prism/translation/parser_versions.rbi +5 -0
  142. data/rbi/rubyvm/node_find.rbi +14 -0
  143. data/sig/generated/prism/compiler.rbs +492 -0
  144. data/sig/generated/prism/desugar_compiler.rbs +305 -0
  145. data/sig/generated/prism/dispatcher.rbs +1292 -0
  146. data/sig/generated/prism/dot_visitor.rbs +635 -0
  147. data/sig/generated/prism/dsl.rbs +928 -0
  148. data/sig/generated/prism/inspect_visitor.rbs +509 -0
  149. data/sig/generated/prism/lex_compat.rbs +166 -0
  150. data/sig/{prism → generated/prism}/mutation_compiler.rbs +309 -4
  151. data/sig/generated/prism/node.rbs +20160 -0
  152. data/sig/generated/prism/node_ext.rbs +290 -0
  153. data/sig/generated/prism/node_find.rbs +90 -0
  154. data/sig/generated/prism/parse_result/errors.rbs +22 -0
  155. data/sig/generated/prism/parse_result/newlines.rbs +223 -0
  156. data/sig/generated/prism/parse_result.rbs +859 -0
  157. data/sig/generated/prism/pattern.rbs +156 -0
  158. data/sig/generated/prism/reflection.rbs +101 -0
  159. data/sig/generated/prism/relocation.rbs +428 -0
  160. data/sig/generated/prism/serialize.rbs +195 -0
  161. data/sig/generated/prism/string_query.rbs +36 -0
  162. data/sig/generated/prism/translation.rbs +8 -0
  163. data/sig/generated/prism/visitor.rbs +1111 -0
  164. data/sig/generated/prism.rbs +84 -0
  165. data/sig/manifest.yaml +2 -0
  166. data/src/arena.c +117 -0
  167. data/src/{util/pm_buffer.c → buffer.c} +44 -21
  168. data/src/{util/pm_char.c → char.c} +28 -57
  169. data/src/comments.c +454 -0
  170. data/src/constant_pool.c +406 -0
  171. data/src/diagnostic.c +93 -65
  172. data/src/encoding.c +8 -3
  173. data/src/errors_format.c +519 -0
  174. data/src/{util/pm_integer.c → integer.c} +33 -22
  175. data/src/json.c +5733 -0
  176. data/src/line_offset_list.c +100 -0
  177. data/src/list.c +24 -0
  178. data/src/{util/pm_memchr.c → memchr.c} +8 -6
  179. data/src/node.c +3504 -7674
  180. data/src/options.c +162 -49
  181. data/src/parser.c +349 -0
  182. data/src/prettyprint.c +421 -354
  183. data/src/prism.c +8035 -7019
  184. data/src/regexp.c +961 -45
  185. data/src/serialize.c +459 -424
  186. data/src/source.c +518 -0
  187. data/src/static_literals.c +111 -43
  188. data/src/string_query.c +166 -0
  189. data/src/stringy.c +91 -0
  190. data/src/{util/pm_strncasecmp.c → strncasecmp.c} +5 -4
  191. data/src/strpbrk.c +447 -0
  192. data/src/{token_type.c → tokens.c} +39 -18
  193. metadata +123 -62
  194. data/ext/prism/api_pack.c +0 -276
  195. data/include/prism/defines.h +0 -260
  196. data/include/prism/pack.h +0 -163
  197. data/include/prism/regexp.h +0 -43
  198. data/include/prism/util/pm_buffer.h +0 -236
  199. data/include/prism/util/pm_char.h +0 -204
  200. data/include/prism/util/pm_constant_pool.h +0 -218
  201. data/include/prism/util/pm_integer.h +0 -130
  202. data/include/prism/util/pm_memchr.h +0 -29
  203. data/include/prism/util/pm_newline_list.h +0 -113
  204. data/include/prism/util/pm_string.h +0 -200
  205. data/lib/prism/lex_ripper.rb +0 -64
  206. data/lib/prism/pack.rb +0 -230
  207. data/lib/prism/parse_result/comments.rb +0 -188
  208. data/rbi/prism/compiler.rbi +0 -12
  209. data/rbi/prism/dsl.rbi +0 -524
  210. data/rbi/prism/inspect_visitor.rbi +0 -12
  211. data/rbi/prism/node.rbi +0 -8747
  212. data/rbi/prism/node_ext.rbi +0 -107
  213. data/rbi/prism/parse_result.rbi +0 -404
  214. data/rbi/prism/reflection.rbi +0 -58
  215. data/rbi/prism/string_query.rbi +0 -12
  216. data/rbi/prism/visitor.rbi +0 -473
  217. data/rbi/prism.rbi +0 -66
  218. data/sig/prism/compiler.rbs +0 -9
  219. data/sig/prism/dispatcher.rbs +0 -19
  220. data/sig/prism/dot_visitor.rbs +0 -6
  221. data/sig/prism/dsl.rbs +0 -351
  222. data/sig/prism/inspect_visitor.rbs +0 -22
  223. data/sig/prism/lex_compat.rbs +0 -10
  224. data/sig/prism/node.rbs +0 -4039
  225. data/sig/prism/node_ext.rbs +0 -149
  226. data/sig/prism/pack.rbs +0 -43
  227. data/sig/prism/parse_result/comments.rbs +0 -38
  228. data/sig/prism/parse_result.rbs +0 -196
  229. data/sig/prism/pattern.rbs +0 -13
  230. data/sig/prism/reflection.rbs +0 -50
  231. data/sig/prism/relocation.rbs +0 -185
  232. data/sig/prism/serialize.rbs +0 -8
  233. data/sig/prism/string_query.rbs +0 -11
  234. data/sig/prism/visitor.rbs +0 -169
  235. data/sig/prism.rbs +0 -258
  236. data/src/pack.c +0 -509
  237. data/src/util/pm_constant_pool.c +0 -342
  238. data/src/util/pm_list.c +0 -49
  239. data/src/util/pm_newline_list.c +0 -125
  240. data/src/util/pm_string.c +0 -381
  241. 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
@@ -64,6 +63,7 @@ errors:
64
63
  - DEF_ENDLESS
65
64
  - DEF_ENDLESS_PARAMETERS
66
65
  - DEF_ENDLESS_SETTER
66
+ - DEF_ENDLESS_DO_BLOCK
67
67
  - DEF_NAME
68
68
  - DEF_PARAMS_TERM
69
69
  - DEF_PARAMS_TERM_PAREN
@@ -97,7 +97,6 @@ errors:
97
97
  - EXPECT_EXPRESSION_AFTER_LPAREN
98
98
  - EXPECT_EXPRESSION_AFTER_OPERATOR
99
99
  - EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ
100
- - EXPECT_EXPRESSION_AFTER_QUESTION
101
100
  - EXPECT_EXPRESSION_AFTER_SPLAT
102
101
  - EXPECT_EXPRESSION_AFTER_SPLAT_HASH
103
102
  - EXPECT_EXPRESSION_AFTER_STAR
@@ -247,7 +246,9 @@ errors:
247
246
  - PATTERN_TERM_PAREN
248
247
  - PIPEPIPEEQ_MULTI_ASSIGN
249
248
  - REGEXP_ENCODING_OPTION_MISMATCH
249
+ - REGEXP_ESCAPED_NON_ASCII_IN_UTF8
250
250
  - REGEXP_INCOMPAT_CHAR_ENCODING
251
+ - REGEXP_INVALID_CHAR_PROPERTY
251
252
  - REGEXP_INVALID_UNICODE_RANGE
252
253
  - REGEXP_NON_ESCAPED_MBC
253
254
  - REGEXP_PARSE_ERROR
@@ -358,6 +359,8 @@ tokens:
358
359
  comment: "when"
359
360
  - name: NEWLINE
360
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"
361
364
  - name: PARENTHESIS_RIGHT
362
365
  comment: ")"
363
366
  - name: PIPE
@@ -376,7 +379,7 @@ tokens:
376
379
  - name: AMPERSAND_EQUAL
377
380
  comment: "&="
378
381
  - name: BACKTICK
379
- comment: "`"
382
+ comment: "` as a method name"
380
383
  - name: BACK_REFERENCE
381
384
  comment: "a back reference"
382
385
  - name: BANG
@@ -387,6 +390,10 @@ tokens:
387
390
  comment: "!~"
388
391
  - name: BRACE_LEFT
389
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"
390
397
  - name: BRACKET_LEFT
391
398
  comment: "["
392
399
  - name: BRACKET_LEFT_ARRAY
@@ -493,6 +500,10 @@ tokens:
493
500
  comment: "def"
494
501
  - name: KEYWORD_DEFINED
495
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"
496
507
  - name: KEYWORD_DO_LOOP
497
508
  comment: "do keyword for a predicate in a while, until, or for loop"
498
509
  - name: KEYWORD_END_UPCASE
@@ -579,6 +590,8 @@ tokens:
579
590
  comment: "a numbered reference to a capture group in the previous regular expression match"
580
591
  - name: PARENTHESIS_LEFT
581
592
  comment: "("
593
+ - name: PARENTHESIS_LEFT_GROUPING
594
+ comment: "( scanned at the beginning of an expression"
582
595
  - name: PARENTHESIS_LEFT_PARENTHESES
583
596
  comment: "( for a parentheses node"
584
597
  - name: PERCENT
@@ -653,12 +666,12 @@ tokens:
653
666
  comment: "unary **"
654
667
  - name: WORDS_SEP
655
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"
656
673
  - name: __END__
657
674
  comment: "marker for the point in the file at which the parser should stop"
658
- - name: MISSING
659
- comment: "a token that was expected but not found"
660
- - name: NOT_PROVIDED
661
- comment: "a token that was not present but it is okay"
662
675
  flags:
663
676
  - name: ArgumentsNodeFlags
664
677
  values:
@@ -813,8 +826,6 @@ nodes:
813
826
  - GlobalVariableReadNode
814
827
  - BackReferenceReadNode
815
828
  - NumberedReferenceReadNode
816
- - on error: SymbolNode # alias $a b
817
- - on error: MissingNode # alias $a 42
818
829
  comment: |
819
830
  Represents the old name of the global variable that can be used before aliasing.
820
831
 
@@ -823,7 +834,7 @@ nodes:
823
834
  - name: keyword_loc
824
835
  type: location
825
836
  comment: |
826
- The location of the `alias` keyword.
837
+ The Location of the `alias` keyword.
827
838
 
828
839
  alias $foo $bar
829
840
  ^^^^^
@@ -855,8 +866,6 @@ nodes:
855
866
  kind:
856
867
  - SymbolNode
857
868
  - InterpolatedSymbolNode
858
- - on error: GlobalVariableReadNode # alias a $b
859
- - on error: MissingNode # alias a 42
860
869
  comment: |
861
870
  Represents the old name of the method that will be aliased.
862
871
 
@@ -871,7 +880,7 @@ nodes:
871
880
  - name: keyword_loc
872
881
  type: location
873
882
  comment: |
874
- Represents the location of the `alias` keyword.
883
+ Represents the Location of the `alias` keyword.
875
884
 
876
885
  alias foo bar
877
886
  ^^^^^
@@ -901,7 +910,7 @@ nodes:
901
910
  - name: operator_loc
902
911
  type: location
903
912
  comment: |
904
- Represents the alternation operator location.
913
+ Represents the alternation operator Location.
905
914
 
906
915
  foo => bar | baz
907
916
  ^
@@ -937,7 +946,7 @@ nodes:
937
946
  - name: operator_loc
938
947
  type: location
939
948
  comment: |
940
- The location of the `and` keyword or the `&&` operator.
949
+ The Location of the `and` keyword or the `&&` operator.
941
950
 
942
951
  left and right
943
952
  ^^^
@@ -972,7 +981,7 @@ nodes:
972
981
  - name: opening_loc
973
982
  type: location?
974
983
  comment: |
975
- Represents the optional source location for the opening token.
984
+ Represents the optional source Location for the opening token.
976
985
 
977
986
  [1,2,3] # "["
978
987
  %w[foo bar baz] # "%w["
@@ -981,7 +990,7 @@ nodes:
981
990
  - name: closing_loc
982
991
  type: location?
983
992
  comment: |
984
- Represents the optional source location for the closing token.
993
+ Represents the optional source Location for the closing token.
985
994
 
986
995
  [1,2,3] # "]"
987
996
  %w[foo bar baz] # "]"
@@ -1020,7 +1029,9 @@ nodes:
1020
1029
  ^ ^
1021
1030
  - name: rest
1022
1031
  type: node?
1023
- kind: pattern expression
1032
+ kind:
1033
+ - ImplicitRestNode
1034
+ - SplatNode
1024
1035
  comment: |
1025
1036
  Represents the rest element of the array pattern.
1026
1037
 
@@ -1037,14 +1048,14 @@ nodes:
1037
1048
  - name: opening_loc
1038
1049
  type: location?
1039
1050
  comment: |
1040
- Represents the opening location of the array pattern.
1051
+ Represents the opening Location of the array pattern.
1041
1052
 
1042
1053
  foo in [1, 2]
1043
1054
  ^
1044
1055
  - name: closing_loc
1045
1056
  type: location?
1046
1057
  comment: |
1047
- Represents the closing location of the array pattern.
1058
+ Represents the closing Location of the array pattern.
1048
1059
 
1049
1060
  foo in [1, 2]
1050
1061
  ^
@@ -1052,19 +1063,19 @@ nodes:
1052
1063
  Represents an array pattern in pattern matching.
1053
1064
 
1054
1065
  foo in 1, 2
1055
- ^^^^^^^^^^^
1066
+ ^^^^
1056
1067
 
1057
1068
  foo in [1, 2]
1058
- ^^^^^^^^^^^^^
1069
+ ^^^^^^
1059
1070
 
1060
1071
  foo in *bar
1061
- ^^^^^^^^^^^
1072
+ ^^^^
1062
1073
 
1063
1074
  foo in Bar[]
1064
- ^^^^^^^^^^^^
1075
+ ^^^^^
1065
1076
 
1066
1077
  foo in Bar[1, 2, 3]
1067
- ^^^^^^^^^^^^^^^^^^^
1078
+ ^^^^^^^^^^^^
1068
1079
  - name: AssocNode
1069
1080
  fields:
1070
1081
  - name: key
@@ -1095,7 +1106,7 @@ nodes:
1095
1106
  - name: operator_loc
1096
1107
  type: location?
1097
1108
  comment: |
1098
- The location of the `=>` operator, if present.
1109
+ The Location of the `=>` operator, if present.
1099
1110
 
1100
1111
  { foo => bar }
1101
1112
  ^^
@@ -1117,7 +1128,7 @@ nodes:
1117
1128
  - name: operator_loc
1118
1129
  type: location
1119
1130
  comment: |
1120
- The location of the `**` operator.
1131
+ The Location of the `**` operator.
1121
1132
 
1122
1133
  { **x }
1123
1134
  ^^
@@ -1146,7 +1157,7 @@ nodes:
1146
1157
  - name: begin_keyword_loc
1147
1158
  type: location?
1148
1159
  comment: |
1149
- Represents the location of the `begin` keyword.
1160
+ Represents the Location of the `begin` keyword.
1150
1161
 
1151
1162
  begin x end
1152
1163
  ^^^^^
@@ -1173,7 +1184,7 @@ nodes:
1173
1184
  Represents the else clause within the begin block.
1174
1185
 
1175
1186
  begin x; rescue y; else z; end
1176
- ^^^^^^
1187
+ ^^^^^^^^^^^
1177
1188
  - name: ensure_clause
1178
1189
  type: node?
1179
1190
  kind: EnsureNode
@@ -1185,7 +1196,7 @@ nodes:
1185
1196
  - name: end_keyword_loc
1186
1197
  type: location?
1187
1198
  comment: |
1188
- Represents the location of the `end` keyword.
1199
+ Represents the Location of the `end` keyword.
1189
1200
 
1190
1201
  begin x end
1191
1202
  ^^^
@@ -1206,11 +1217,11 @@ nodes:
1206
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).
1207
1218
 
1208
1219
  foo(&args)
1209
- ^^^^^
1220
+ ^^^^
1210
1221
  - name: operator_loc
1211
1222
  type: location
1212
1223
  comment: |
1213
- Represents the location of the `&` operator.
1224
+ Represents the Location of the `&` operator.
1214
1225
 
1215
1226
  foo(&args)
1216
1227
  ^
@@ -1218,7 +1229,7 @@ nodes:
1218
1229
  Represents a block argument using `&`.
1219
1230
 
1220
1231
  bar(&args)
1221
- ^^^^^^^^^^
1232
+ ^^^^^
1222
1233
  - name: BlockLocalVariableNode
1223
1234
  flags: ParameterFlags
1224
1235
  fields:
@@ -1271,17 +1282,17 @@ nodes:
1271
1282
  - name: opening_loc
1272
1283
  type: location
1273
1284
  comment: |
1274
- Represents the location of the opening `|`.
1285
+ Represents the Location of the opening `{` or `do`.
1275
1286
 
1276
1287
  [1, 2, 3].each { |i| puts x }
1277
- ^
1288
+ ^
1278
1289
  - name: closing_loc
1279
1290
  type: location
1280
1291
  comment: |
1281
- Represents the location of the closing `|`.
1292
+ Represents the Location of the closing `}` or `end`.
1282
1293
 
1283
1294
  [1, 2, 3].each { |i| puts x }
1284
- ^
1295
+ ^
1285
1296
  comment: |
1286
1297
  Represents a block of ruby code.
1287
1298
 
@@ -1301,14 +1312,14 @@ nodes:
1301
1312
  - name: name_loc
1302
1313
  type: location?
1303
1314
  comment: |
1304
- Represents the location of the block parameter name.
1315
+ Represents the Location of the block parameter name.
1305
1316
 
1306
1317
  def a(&b)
1307
1318
  ^
1308
1319
  - name: operator_loc
1309
1320
  type: location
1310
1321
  comment: |
1311
- Represents the location of the `&` operator.
1322
+ Represents the Location of the `&` operator.
1312
1323
 
1313
1324
  def a(&b)
1314
1325
  ^
@@ -1348,7 +1359,7 @@ nodes:
1348
1359
  - name: opening_loc
1349
1360
  type: location?
1350
1361
  comment: |
1351
- Represents the opening location of the block parameters.
1362
+ Represents the opening Location of the block parameters.
1352
1363
 
1353
1364
  -> (a, b = 1; local) { }
1354
1365
  ^
@@ -1359,7 +1370,7 @@ nodes:
1359
1370
  - name: closing_loc
1360
1371
  type: location?
1361
1372
  comment: |
1362
- Represents the closing location of the block parameters.
1373
+ Represents the closing Location of the block parameters.
1363
1374
 
1364
1375
  -> (a, b = 1; local) { }
1365
1376
  ^
@@ -1389,7 +1400,7 @@ nodes:
1389
1400
  - name: keyword_loc
1390
1401
  type: location
1391
1402
  comment: |
1392
- The location of the `break` keyword.
1403
+ The Location of the `break` keyword.
1393
1404
 
1394
1405
  break foo
1395
1406
  ^^^^^
@@ -1412,14 +1423,14 @@ nodes:
1412
1423
  - name: call_operator_loc
1413
1424
  type: location?
1414
1425
  comment: |
1415
- Represents the location of the call operator.
1426
+ Represents the Location of the call operator.
1416
1427
 
1417
1428
  foo.bar &&= value
1418
1429
  ^
1419
1430
  - name: message_loc
1420
1431
  type: location?
1421
1432
  comment: |
1422
- Represents the location of the message.
1433
+ Represents the Location of the message.
1423
1434
 
1424
1435
  foo.bar &&= value
1425
1436
  ^^^
@@ -1440,7 +1451,7 @@ nodes:
1440
1451
  - name: operator_loc
1441
1452
  type: location
1442
1453
  comment: |
1443
- Represents the location of the operator.
1454
+ Represents the Location of the operator.
1444
1455
 
1445
1456
  foo.bar &&= value
1446
1457
  ^^^
@@ -1477,7 +1488,7 @@ nodes:
1477
1488
  - name: call_operator_loc
1478
1489
  type: location?
1479
1490
  comment: |
1480
- Represents the location of the call operator.
1491
+ Represents the Location of the call operator.
1481
1492
 
1482
1493
  foo.bar
1483
1494
  ^
@@ -1494,14 +1505,15 @@ nodes:
1494
1505
  - name: message_loc
1495
1506
  type: location?
1496
1507
  comment: |
1497
- Represents the location of the message.
1508
+ Represents the Location of the message.
1498
1509
 
1499
1510
  foo.bar
1500
1511
  ^^^
1501
1512
  - name: opening_loc
1502
1513
  type: location?
1503
1514
  comment: |
1504
- Represents the location of the left parenthesis.
1515
+ Represents the Location of the left parenthesis.
1516
+
1505
1517
  foo(bar)
1506
1518
  ^
1507
1519
  - name: arguments
@@ -1515,14 +1527,14 @@ nodes:
1515
1527
  - name: closing_loc
1516
1528
  type: location?
1517
1529
  comment: |
1518
- Represents the location of the right parenthesis.
1530
+ Represents the Location of the right parenthesis.
1519
1531
 
1520
1532
  foo(bar)
1521
1533
  ^
1522
1534
  - name: equal_loc
1523
1535
  type: location?
1524
1536
  comment: |
1525
- 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.
1526
1538
 
1527
1539
  foo.bar = value
1528
1540
  ^
@@ -1573,14 +1585,14 @@ nodes:
1573
1585
  - name: call_operator_loc
1574
1586
  type: location?
1575
1587
  comment: |
1576
- Represents the location of the call operator.
1588
+ Represents the Location of the call operator.
1577
1589
 
1578
1590
  foo.bar += value
1579
1591
  ^
1580
1592
  - name: message_loc
1581
1593
  type: location?
1582
1594
  comment: |
1583
- Represents the location of the message.
1595
+ Represents the Location of the message.
1584
1596
 
1585
1597
  foo.bar += value
1586
1598
  ^^^
@@ -1608,7 +1620,7 @@ nodes:
1608
1620
  - name: binary_operator_loc
1609
1621
  type: location
1610
1622
  comment: |
1611
- Represents the location of the binary operator.
1623
+ Represents the Location of the binary operator.
1612
1624
 
1613
1625
  foo.bar += value
1614
1626
  ^^
@@ -1639,14 +1651,14 @@ nodes:
1639
1651
  - name: call_operator_loc
1640
1652
  type: location?
1641
1653
  comment: |
1642
- Represents the location of the call operator.
1654
+ Represents the Location of the call operator.
1643
1655
 
1644
1656
  foo.bar ||= value
1645
1657
  ^
1646
1658
  - name: message_loc
1647
1659
  type: location?
1648
1660
  comment: |
1649
- Represents the location of the message.
1661
+ Represents the Location of the message.
1650
1662
 
1651
1663
  foo.bar ||= value
1652
1664
  ^^^
@@ -1667,7 +1679,7 @@ nodes:
1667
1679
  - name: operator_loc
1668
1680
  type: location
1669
1681
  comment: |
1670
- Represents the location of the operator.
1682
+ Represents the Location of the operator.
1671
1683
 
1672
1684
  foo.bar ||= value
1673
1685
  ^^^
@@ -1698,7 +1710,7 @@ nodes:
1698
1710
  - name: call_operator_loc
1699
1711
  type: location
1700
1712
  comment: |
1701
- Represents the location of the call operator.
1713
+ Represents the Location of the call operator.
1702
1714
 
1703
1715
  foo.bar = 1
1704
1716
  ^
@@ -1712,7 +1724,7 @@ nodes:
1712
1724
  - name: message_loc
1713
1725
  type: location
1714
1726
  comment: |
1715
- Represents the location of the message.
1727
+ Represents the Location of the message.
1716
1728
 
1717
1729
  foo.bar = 1
1718
1730
  ^^^
@@ -1750,7 +1762,7 @@ nodes:
1750
1762
  - name: operator_loc
1751
1763
  type: location
1752
1764
  comment: |
1753
- Represents the location of the `=>` operator.
1765
+ Represents the Location of the `=>` operator.
1754
1766
 
1755
1767
  foo => bar
1756
1768
  ^^
@@ -1758,7 +1770,7 @@ nodes:
1758
1770
  Represents assigning to a local variable in pattern matching.
1759
1771
 
1760
1772
  foo => [bar => baz]
1761
- ^^^^^^^^^^^^
1773
+ ^^^^^^^^^^
1762
1774
  - name: CaseMatchNode
1763
1775
  fields:
1764
1776
  - name: predicate
@@ -1768,7 +1780,7 @@ nodes:
1768
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).
1769
1781
 
1770
1782
  case true; in false; end
1771
- ^^^^
1783
+ ^^^^
1772
1784
  - name: conditions
1773
1785
  type: node[]
1774
1786
  kind: InNode
@@ -1784,18 +1796,18 @@ nodes:
1784
1796
  Represents the else clause of the case match.
1785
1797
 
1786
1798
  case true; in false; else; end
1787
- ^^^^
1799
+ ^^^^^^^^^
1788
1800
  - name: case_keyword_loc
1789
1801
  type: location
1790
1802
  comment: |
1791
- Represents the location of the `case` keyword.
1803
+ Represents the Location of the `case` keyword.
1792
1804
 
1793
1805
  case true; in false; end
1794
1806
  ^^^^
1795
1807
  - name: end_keyword_loc
1796
1808
  type: location
1797
1809
  comment: |
1798
- Represents the location of the `end` keyword.
1810
+ Represents the Location of the `end` keyword.
1799
1811
 
1800
1812
  case true; in false; end
1801
1813
  ^^^
@@ -1831,18 +1843,18 @@ nodes:
1831
1843
  Represents the else clause of the case statement.
1832
1844
 
1833
1845
  case true; when false; else; end
1834
- ^^^^
1846
+ ^^^^^^^^^
1835
1847
  - name: case_keyword_loc
1836
1848
  type: location
1837
1849
  comment: |
1838
- Represents the location of the `case` keyword.
1850
+ Represents the Location of the `case` keyword.
1839
1851
 
1840
1852
  case true; when false; end
1841
1853
  ^^^^
1842
1854
  - name: end_keyword_loc
1843
1855
  type: location
1844
1856
  comment: |
1845
- Represents the location of the `end` keyword.
1857
+ Represents the Location of the `end` keyword.
1846
1858
 
1847
1859
  case true; when false; end
1848
1860
  ^^^
@@ -1860,7 +1872,7 @@ nodes:
1860
1872
  - name: class_keyword_loc
1861
1873
  type: location
1862
1874
  comment: |
1863
- Represents the location of the `class` keyword.
1875
+ Represents the Location of the `class` keyword.
1864
1876
 
1865
1877
  class Foo end
1866
1878
  ^^^^^
@@ -1869,11 +1881,10 @@ nodes:
1869
1881
  kind:
1870
1882
  - ConstantReadNode
1871
1883
  - ConstantPathNode
1872
- - on error: CallNode # class 0.X end
1873
1884
  - name: inheritance_operator_loc
1874
1885
  type: location?
1875
1886
  comment: |
1876
- Represents the location of the `<` operator.
1887
+ Represents the Location of the `<` operator.
1877
1888
 
1878
1889
  class Foo < Bar
1879
1890
  ^
@@ -1893,13 +1904,12 @@ nodes:
1893
1904
  comment: |
1894
1905
  Represents the body of the class.
1895
1906
 
1896
- class Foo
1897
- foo
1898
- ^^^
1907
+ class Foo; bar; end
1908
+ ^^^
1899
1909
  - name: end_keyword_loc
1900
1910
  type: location
1901
1911
  comment: |
1902
- Represents the location of the `end` keyword.
1912
+ Represents the Location of the `end` keyword.
1903
1913
 
1904
1914
  class Foo end
1905
1915
  ^^^
@@ -1926,14 +1936,14 @@ nodes:
1926
1936
  - name: name_loc
1927
1937
  type: location
1928
1938
  comment: |
1929
- Represents the location of the variable name.
1939
+ Represents the Location of the variable name.
1930
1940
 
1931
1941
  @@target &&= value
1932
1942
  ^^^^^^^^
1933
1943
  - name: operator_loc
1934
1944
  type: location
1935
1945
  comment: |
1936
- Represents the location of the `&&=` operator.
1946
+ Represents the Location of the `&&=` operator.
1937
1947
 
1938
1948
  @@target &&= value
1939
1949
  ^^^
@@ -2021,7 +2031,7 @@ nodes:
2021
2031
  - name: name_loc
2022
2032
  type: location
2023
2033
  comment: |
2024
- The location of the variable name.
2034
+ The Location of the variable name.
2025
2035
 
2026
2036
  @@foo = :bar
2027
2037
  ^^^^^
@@ -2039,7 +2049,7 @@ nodes:
2039
2049
  - name: operator_loc
2040
2050
  type: location
2041
2051
  comment: |
2042
- The location of the `=` operator.
2052
+ The Location of the `=` operator.
2043
2053
 
2044
2054
  @@foo = :bar
2045
2055
  ^
@@ -2135,7 +2145,7 @@ nodes:
2135
2145
  - name: delimiter_loc
2136
2146
  type: location
2137
2147
  comment: |
2138
- The location of the `::` delimiter.
2148
+ The Location of the `::` delimiter.
2139
2149
 
2140
2150
  ::Foo
2141
2151
  ^^
@@ -2145,7 +2155,7 @@ nodes:
2145
2155
  - name: name_loc
2146
2156
  type: location
2147
2157
  comment: |
2148
- The location of the name of the constant.
2158
+ The Location of the name of the constant.
2149
2159
 
2150
2160
  ::Foo
2151
2161
  ^^^
@@ -2221,7 +2231,7 @@ nodes:
2221
2231
  - name: operator_loc
2222
2232
  type: location
2223
2233
  comment: |
2224
- The location of the `=` operator.
2234
+ The Location of the `=` operator.
2225
2235
 
2226
2236
  ::ABC = 123
2227
2237
  ^
@@ -2281,7 +2291,7 @@ nodes:
2281
2291
  - name: name_loc
2282
2292
  type: location
2283
2293
  comment: |
2284
- The location of the constant name.
2294
+ The Location of the constant name.
2285
2295
 
2286
2296
  FOO = 1
2287
2297
  ^^^
@@ -2299,7 +2309,7 @@ nodes:
2299
2309
  - name: operator_loc
2300
2310
  type: location
2301
2311
  comment: |
2302
- The location of the `=` operator.
2312
+ The Location of the `=` operator.
2303
2313
 
2304
2314
  FOO = :bar
2305
2315
  ^
@@ -2424,6 +2434,15 @@ nodes:
2424
2434
  ^^^^^^
2425
2435
  bar
2426
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.
2427
2446
  - name: FalseNode
2428
2447
  comment: |
2429
2448
  Represents the use of the literal `false` keyword.
@@ -2466,9 +2485,7 @@ nodes:
2466
2485
  ^^^^^^
2467
2486
  - name: right
2468
2487
  type: node
2469
- kind:
2470
- - SplatNode
2471
- - on error: MissingNode
2488
+ kind: SplatNode
2472
2489
  comment: |
2473
2490
  Represents the second wildcard node in the pattern.
2474
2491
 
@@ -2480,7 +2497,7 @@ nodes:
2480
2497
  - name: opening_loc
2481
2498
  type: location?
2482
2499
  comment: |
2483
- The location of the opening brace.
2500
+ The Location of the opening brace.
2484
2501
 
2485
2502
  foo in [*bar, baz, *qux]
2486
2503
  ^
@@ -2490,7 +2507,7 @@ nodes:
2490
2507
  - name: closing_loc
2491
2508
  type: location?
2492
2509
  comment: |
2493
- The location of the closing brace.
2510
+ The Location of the closing brace.
2494
2511
 
2495
2512
  foo in [*bar, baz, *qux]
2496
2513
  ^
@@ -2551,9 +2568,6 @@ nodes:
2551
2568
  - CallTargetNode
2552
2569
  - IndexTargetNode
2553
2570
  - MultiTargetNode
2554
- - on error: BackReferenceReadNode # for $& in a end
2555
- - on error: NumberedReferenceReadNode # for $1 in a end
2556
- - on error: MissingNode # for in 1..10; end
2557
2571
  comment: |
2558
2572
  The index expression for `for` loops.
2559
2573
 
@@ -2580,28 +2594,28 @@ nodes:
2580
2594
  - name: for_keyword_loc
2581
2595
  type: location
2582
2596
  comment: |
2583
- The location of the `for` keyword.
2597
+ The Location of the `for` keyword.
2584
2598
 
2585
2599
  for i in a end
2586
2600
  ^^^
2587
2601
  - name: in_keyword_loc
2588
2602
  type: location
2589
2603
  comment: |
2590
- The location of the `in` keyword.
2604
+ The Location of the `in` keyword.
2591
2605
 
2592
2606
  for i in a end
2593
2607
  ^^
2594
2608
  - name: do_keyword_loc
2595
2609
  type: location?
2596
2610
  comment: |
2597
- The location of the `do` keyword, if present.
2611
+ The Location of the `do` keyword, if present.
2598
2612
 
2599
2613
  for i in a do end
2600
2614
  ^^
2601
2615
  - name: end_keyword_loc
2602
2616
  type: location
2603
2617
  comment: |
2604
- The location of the `end` keyword.
2618
+ The Location of the `end` keyword.
2605
2619
 
2606
2620
  for i in a end
2607
2621
  ^^^
@@ -2627,6 +2641,14 @@ nodes:
2627
2641
  end
2628
2642
  - name: ForwardingSuperNode
2629
2643
  fields:
2644
+ - name: keyword_loc
2645
+ type: location
2646
+ comment: |
2647
+ super
2648
+ ^^^^^
2649
+
2650
+ super { 123 }
2651
+ ^^^^^
2630
2652
  - name: block
2631
2653
  type: node?
2632
2654
  kind: BlockNode
@@ -2729,7 +2751,7 @@ nodes:
2729
2751
  - name: name_loc
2730
2752
  type: location
2731
2753
  comment: |
2732
- The location of the global variable's name.
2754
+ The Location of the global variable's name.
2733
2755
 
2734
2756
  $foo = :bar
2735
2757
  ^^^^
@@ -2747,7 +2769,7 @@ nodes:
2747
2769
  - name: operator_loc
2748
2770
  type: location
2749
2771
  comment: |
2750
- The location of the `=` operator.
2772
+ The Location of the `=` operator.
2751
2773
 
2752
2774
  $foo = :bar
2753
2775
  ^
@@ -2761,7 +2783,7 @@ nodes:
2761
2783
  - name: opening_loc
2762
2784
  type: location
2763
2785
  comment: |
2764
- The location of the opening brace.
2786
+ The Location of the opening brace.
2765
2787
 
2766
2788
  { a => b }
2767
2789
  ^
@@ -2781,7 +2803,7 @@ nodes:
2781
2803
  - name: closing_loc
2782
2804
  type: location
2783
2805
  comment: |
2784
- The location of the closing brace.
2806
+ The Location of the closing brace.
2785
2807
 
2786
2808
  { a => b }
2787
2809
  ^
@@ -2832,7 +2854,7 @@ nodes:
2832
2854
  - name: opening_loc
2833
2855
  type: location?
2834
2856
  comment: |
2835
- The location of the opening brace.
2857
+ The Location of the opening brace.
2836
2858
 
2837
2859
  foo => { a: 1 }
2838
2860
  ^
@@ -2842,7 +2864,7 @@ nodes:
2842
2864
  - name: closing_loc
2843
2865
  type: location?
2844
2866
  comment: |
2845
- The location of the closing brace.
2867
+ The Location of the closing brace.
2846
2868
 
2847
2869
  foo => { a: 1 }
2848
2870
  ^
@@ -2868,7 +2890,7 @@ nodes:
2868
2890
  - name: if_keyword_loc
2869
2891
  type: location?
2870
2892
  comment: |
2871
- The location of the `if` keyword if present.
2893
+ The Location of the `if` keyword if present.
2872
2894
 
2873
2895
  bar if foo
2874
2896
  ^^
@@ -2893,7 +2915,7 @@ nodes:
2893
2915
  - name: then_keyword_loc
2894
2916
  type: location?
2895
2917
  comment: |
2896
- 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.
2897
2919
 
2898
2920
  if foo then bar end
2899
2921
  ^^^^
@@ -2934,7 +2956,7 @@ nodes:
2934
2956
  - name: end_keyword_loc
2935
2957
  type: location?
2936
2958
  comment: |
2937
- The location of the `end` keyword if present, `nil` otherwise.
2959
+ The Location of the `end` keyword if present, `nil` otherwise.
2938
2960
 
2939
2961
  if foo
2940
2962
  bar
@@ -3008,9 +3030,9 @@ nodes:
3008
3030
  - name: statements
3009
3031
  type: node?
3010
3032
  kind: StatementsNode
3011
- - name: in_loc
3033
+ - name: in_keyword_loc
3012
3034
  type: location
3013
- - name: then_loc
3035
+ - name: then_keyword_loc
3014
3036
  type: location?
3015
3037
  comment: |
3016
3038
  Represents the use of the `in` keyword in a case statement.
@@ -3219,7 +3241,7 @@ nodes:
3219
3241
  - name: name_loc
3220
3242
  type: location
3221
3243
  comment: |
3222
- The location of the variable name.
3244
+ The Location of the variable name.
3223
3245
 
3224
3246
  @_x = 1
3225
3247
  ^^^
@@ -3237,7 +3259,7 @@ nodes:
3237
3259
  - name: operator_loc
3238
3260
  type: location
3239
3261
  comment: |
3240
- The location of the `=` operator.
3262
+ The Location of the `=` operator.
3241
3263
 
3242
3264
  @x = y
3243
3265
  ^
@@ -3307,10 +3329,6 @@ nodes:
3307
3329
  - EmbeddedStatementsNode
3308
3330
  - EmbeddedVariableNode
3309
3331
  - InterpolatedStringNode # `"a" "#{b}"`
3310
- - on error: XStringNode # `<<`FOO` "bar"
3311
- - on error: InterpolatedXStringNode
3312
- - on error: SymbolNode
3313
- - on error: InterpolatedSymbolNode
3314
3332
  - name: closing_loc
3315
3333
  type: location?
3316
3334
  newline: parts
@@ -3544,7 +3562,7 @@ nodes:
3544
3562
  - name: name_loc
3545
3563
  type: location
3546
3564
  comment: |
3547
- The location of the variable name.
3565
+ The Location of the variable name.
3548
3566
 
3549
3567
  foo = :bar
3550
3568
  ^^^
@@ -3566,7 +3584,7 @@ nodes:
3566
3584
  - name: operator_loc
3567
3585
  type: location
3568
3586
  comment: |
3569
- The location of the `=` operator.
3587
+ The Location of the `=` operator.
3570
3588
 
3571
3589
  x = :y
3572
3590
  ^
@@ -3599,7 +3617,7 @@ nodes:
3599
3617
  - name: pattern
3600
3618
  type: node
3601
3619
  kind: pattern expression
3602
- - name: operator_loc
3620
+ - name: keyword_loc
3603
3621
  type: location
3604
3622
  comment: |
3605
3623
  Represents the use of the modifier `in` operator.
@@ -3666,7 +3684,7 @@ nodes:
3666
3684
  - name: operator_loc
3667
3685
  type: location
3668
3686
  comment: |
3669
- The location of the operator.
3687
+ The Location of the operator.
3670
3688
 
3671
3689
  foo => bar
3672
3690
  ^^
@@ -3688,9 +3706,6 @@ nodes:
3688
3706
 
3689
3707
  /(?<foo>bar)/ =~ baz
3690
3708
  ^^^^^^^^^^^^^^^^^^^^
3691
- - name: MissingNode
3692
- comment: |
3693
- Represents a node that is missing from the source and results in a syntax error.
3694
3709
  - name: ModuleNode
3695
3710
  fields:
3696
3711
  - name: locals
@@ -3702,7 +3717,6 @@ nodes:
3702
3717
  kind:
3703
3718
  - ConstantReadNode
3704
3719
  - ConstantPathNode
3705
- - on error: MissingNode # module Parent module end
3706
3720
  - name: body
3707
3721
  type: node?
3708
3722
  kind:
@@ -3732,8 +3746,6 @@ nodes:
3732
3746
  - IndexTargetNode
3733
3747
  - MultiTargetNode
3734
3748
  - RequiredParameterNode # def m((a,b)); end
3735
- - on error: BackReferenceReadNode # a, (b, $&) = z
3736
- - on error: NumberedReferenceReadNode # a, (b, $1) = z
3737
3749
  comment: |
3738
3750
  Represents the targets expressions before a splat node.
3739
3751
 
@@ -3777,8 +3789,6 @@ nodes:
3777
3789
  - IndexTargetNode
3778
3790
  - MultiTargetNode
3779
3791
  - RequiredParameterNode # def m((*,b)); end
3780
- - on error: BackReferenceReadNode # a, (*, $&) = z
3781
- - on error: NumberedReferenceReadNode # a, (*, $1) = z
3782
3792
  comment: |
3783
3793
  Represents the targets expressions after a splat node.
3784
3794
 
@@ -3787,14 +3797,14 @@ nodes:
3787
3797
  - name: lparen_loc
3788
3798
  type: location?
3789
3799
  comment: |
3790
- The location of the opening parenthesis.
3800
+ The Location of the opening parenthesis.
3791
3801
 
3792
3802
  a, (b, c) = 1, 2, 3
3793
3803
  ^
3794
3804
  - name: rparen_loc
3795
3805
  type: location?
3796
3806
  comment: |
3797
- The location of the closing parenthesis.
3807
+ The Location of the closing parenthesis.
3798
3808
 
3799
3809
  a, (b, c) = 1, 2, 3
3800
3810
  ^
@@ -3822,8 +3832,6 @@ nodes:
3822
3832
  - CallTargetNode
3823
3833
  - IndexTargetNode
3824
3834
  - MultiTargetNode
3825
- - on error: BackReferenceReadNode # $&, = z
3826
- - on error: NumberedReferenceReadNode # $1, = z
3827
3835
  comment: |
3828
3836
  Represents the targets expressions before a splat node.
3829
3837
 
@@ -3866,8 +3874,6 @@ nodes:
3866
3874
  - CallTargetNode
3867
3875
  - IndexTargetNode
3868
3876
  - MultiTargetNode
3869
- - on error: BackReferenceReadNode # *, $& = z
3870
- - on error: NumberedReferenceReadNode # *, $1 = z
3871
3877
  comment: |
3872
3878
  Represents the targets expressions after a splat node.
3873
3879
 
@@ -3876,21 +3882,21 @@ nodes:
3876
3882
  - name: lparen_loc
3877
3883
  type: location?
3878
3884
  comment: |
3879
- The location of the opening parenthesis.
3885
+ The Location of the opening parenthesis.
3880
3886
 
3881
3887
  (a, b, c) = 1, 2, 3
3882
3888
  ^
3883
3889
  - name: rparen_loc
3884
3890
  type: location?
3885
3891
  comment: |
3886
- The location of the closing parenthesis.
3892
+ The Location of the closing parenthesis.
3887
3893
 
3888
3894
  (a, b, c) = 1, 2, 3
3889
3895
  ^
3890
3896
  - name: operator_loc
3891
3897
  type: location
3892
3898
  comment: |
3893
- The location of the operator.
3899
+ The Location of the operator.
3894
3900
 
3895
3901
  a, b, c = 1, 2, 3
3896
3902
  ^
@@ -3925,6 +3931,18 @@ nodes:
3925
3931
 
3926
3932
  nil
3927
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
3928
3946
  - name: NoKeywordsParameterNode
3929
3947
  fields:
3930
3948
  - name: operator_loc
@@ -4024,7 +4042,7 @@ nodes:
4024
4042
  - name: operator_loc
4025
4043
  type: location
4026
4044
  comment: |
4027
- The location of the `or` keyword or the `||` operator.
4045
+ The Location of the `or` keyword or the `||` operator.
4028
4046
 
4029
4047
  left or right
4030
4048
  ^^
@@ -4053,11 +4071,6 @@ nodes:
4053
4071
  kind:
4054
4072
  - RequiredParameterNode
4055
4073
  - MultiTargetNode
4056
- # On parsing error of `f(**kwargs, ...)` or `f(**nil, ...)`, the keyword_rest value is moved here:
4057
- - on error: KeywordRestParameterNode
4058
- - on error: NoKeywordsParameterNode
4059
- # On parsing error of `f(..., ...)`, the first forwarding parameter is moved here:
4060
- - on error: ForwardingParameterNode
4061
4074
  - name: keywords
4062
4075
  type: node[]
4063
4076
  kind:
@@ -4071,7 +4084,9 @@ nodes:
4071
4084
  - NoKeywordsParameterNode
4072
4085
  - name: block
4073
4086
  type: node?
4074
- kind: BlockParameterNode
4087
+ kind:
4088
+ - BlockParameterNode
4089
+ - NoBlockParameterNode
4075
4090
  comment: |
4076
4091
  Represents the list of parameters on a method, block, or lambda definition.
4077
4092
 
@@ -4107,21 +4122,21 @@ nodes:
4107
4122
  - name: operator_loc
4108
4123
  type: location
4109
4124
  comment: |
4110
- The location of the `^` operator
4125
+ The Location of the `^` operator
4111
4126
 
4112
4127
  foo in ^(bar)
4113
4128
  ^
4114
4129
  - name: lparen_loc
4115
4130
  type: location
4116
4131
  comment: |
4117
- The location of the opening parenthesis.
4132
+ The Location of the opening parenthesis.
4118
4133
 
4119
4134
  foo in ^(bar)
4120
4135
  ^
4121
4136
  - name: rparen_loc
4122
4137
  type: location
4123
4138
  comment: |
4124
- The location of the closing parenthesis.
4139
+ The Location of the closing parenthesis.
4125
4140
 
4126
4141
  foo in ^(bar)
4127
4142
  ^
@@ -4142,7 +4157,6 @@ nodes:
4142
4157
  - BackReferenceReadNode # foo in ^$&
4143
4158
  - NumberedReferenceReadNode # foo in ^$1
4144
4159
  - ItLocalVariableReadNode # proc { 1 in ^it }
4145
- - on error: MissingNode # foo in ^Bar
4146
4160
  comment: |
4147
4161
  The variable used in the pinned expression
4148
4162
 
@@ -4151,7 +4165,7 @@ nodes:
4151
4165
  - name: operator_loc
4152
4166
  type: location
4153
4167
  comment: |
4154
- The location of the `^` operator
4168
+ The Location of the `^` operator
4155
4169
 
4156
4170
  foo in ^bar
4157
4171
  ^
@@ -4225,11 +4239,11 @@ nodes:
4225
4239
 
4226
4240
  1...foo
4227
4241
  ^^^
4228
- 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.
4229
4243
  - name: operator_loc
4230
4244
  type: location
4231
4245
  comment: |
4232
- The location of the `..` or `...` operator.
4246
+ The Location of the `..` or `...` operator.
4233
4247
  comment: |
4234
4248
  Represents the use of the `..` or `...` operators.
4235
4249
 
@@ -4340,9 +4354,6 @@ nodes:
4340
4354
  - ConstantPathTargetNode
4341
4355
  - CallTargetNode
4342
4356
  - IndexTargetNode
4343
- - on error: BackReferenceReadNode # => begin; rescue => $&; end
4344
- - on error: NumberedReferenceReadNode # => begin; rescue => $1; end
4345
- - on error: MissingNode # begin; rescue =>; end
4346
4357
  - name: then_keyword_loc
4347
4358
  type: location?
4348
4359
  - name: statements
@@ -4455,7 +4466,7 @@ nodes:
4455
4466
  fields:
4456
4467
  - name: filepath
4457
4468
  type: string
4458
- 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.
4459
4470
  comment: |
4460
4471
  Represents the use of the `__FILE__` keyword.
4461
4472
 
@@ -4543,8 +4554,8 @@ nodes:
4543
4554
  fields:
4544
4555
  - name: opening_loc
4545
4556
  type: location?
4546
- - name: value_loc
4547
- type: location?
4557
+ - name: content_loc
4558
+ type: location
4548
4559
  - name: closing_loc
4549
4560
  type: location?
4550
4561
  - name: unescaped
@@ -4579,10 +4590,10 @@ nodes:
4579
4590
  ^^^^^^^^^^^^^^^^^^^^^^
4580
4591
  - name: UnlessNode
4581
4592
  fields:
4582
- - name: keyword_loc
4593
+ - name: unless_keyword_loc
4583
4594
  type: location
4584
4595
  comment: |
4585
- The location of the `unless` keyword.
4596
+ The Location of the `unless` keyword.
4586
4597
 
4587
4598
  unless cond then bar end
4588
4599
  ^^^^^^
@@ -4603,7 +4614,7 @@ nodes:
4603
4614
  - name: then_keyword_loc
4604
4615
  type: location?
4605
4616
  comment: |
4606
- The location of the `then` keyword, if present.
4617
+ The Location of the `then` keyword, if present.
4607
4618
 
4608
4619
  unless cond then bar end
4609
4620
  ^^^^
@@ -4623,11 +4634,11 @@ nodes:
4623
4634
  The else clause of the unless expression, if present.
4624
4635
 
4625
4636
  unless cond then bar else baz end
4626
- ^^^^^^^^
4637
+ ^^^^^^^^^^^^
4627
4638
  - name: end_keyword_loc
4628
4639
  type: location?
4629
4640
  comment: |
4630
- The location of the `end` keyword, if present.
4641
+ The Location of the `end` keyword, if present.
4631
4642
 
4632
4643
  unless cond then bar end
4633
4644
  ^^^
@@ -4643,11 +4654,11 @@ nodes:
4643
4654
  - name: UntilNode
4644
4655
  flags: LoopFlags
4645
4656
  fields:
4646
- - name: keyword_loc
4657
+ - name: until_keyword_loc
4647
4658
  type: location
4648
4659
  - name: do_keyword_loc
4649
4660
  type: location?
4650
- - name: closing_loc
4661
+ - name: end_keyword_loc
4651
4662
  type: location?
4652
4663
  - name: predicate
4653
4664
  type: node
@@ -4666,7 +4677,7 @@ nodes:
4666
4677
  ^^^^^^^^^^^^^^^^^^^^
4667
4678
  - name: WhenNode
4668
4679
  fields:
4669
- - name: keyword_loc
4680
+ - name: when_keyword_loc
4670
4681
  type: location
4671
4682
  - name: conditions
4672
4683
  type: node[]
@@ -4686,11 +4697,11 @@ nodes:
4686
4697
  - name: WhileNode
4687
4698
  flags: LoopFlags
4688
4699
  fields:
4689
- - name: keyword_loc
4700
+ - name: while_keyword_loc
4690
4701
  type: location
4691
4702
  - name: do_keyword_loc
4692
4703
  type: location?
4693
- - name: closing_loc
4704
+ - name: end_keyword_loc
4694
4705
  type: location?
4695
4706
  - name: predicate
4696
4707
  type: node