prism 0.24.0 → 0.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +4 -4
  2. data/BSDmakefile +58 -0
  3. data/CHANGELOG.md +50 -1
  4. data/Makefile +5 -2
  5. data/README.md +45 -6
  6. data/config.yml +499 -4
  7. data/docs/build_system.md +31 -0
  8. data/docs/configuration.md +2 -0
  9. data/docs/cruby_compilation.md +1 -1
  10. data/docs/parser_translation.md +14 -9
  11. data/docs/releasing.md +2 -2
  12. data/docs/ripper_translation.md +50 -0
  13. data/docs/ruby_api.md +1 -0
  14. data/docs/serialization.md +26 -5
  15. data/ext/prism/api_node.c +911 -815
  16. data/ext/prism/api_pack.c +9 -0
  17. data/ext/prism/extconf.rb +27 -11
  18. data/ext/prism/extension.c +313 -66
  19. data/ext/prism/extension.h +5 -4
  20. data/include/prism/ast.h +213 -64
  21. data/include/prism/defines.h +106 -2
  22. data/include/prism/diagnostic.h +134 -71
  23. data/include/prism/encoding.h +22 -4
  24. data/include/prism/node.h +93 -0
  25. data/include/prism/options.h +82 -7
  26. data/include/prism/pack.h +11 -0
  27. data/include/prism/parser.h +198 -53
  28. data/include/prism/prettyprint.h +8 -0
  29. data/include/prism/static_literals.h +118 -0
  30. data/include/prism/util/pm_buffer.h +65 -2
  31. data/include/prism/util/pm_constant_pool.h +18 -1
  32. data/include/prism/util/pm_integer.h +119 -0
  33. data/include/prism/util/pm_list.h +1 -1
  34. data/include/prism/util/pm_newline_list.h +8 -0
  35. data/include/prism/util/pm_string.h +26 -2
  36. data/include/prism/version.h +2 -2
  37. data/include/prism.h +59 -1
  38. data/lib/prism/compiler.rb +8 -1
  39. data/lib/prism/debug.rb +46 -3
  40. data/lib/prism/desugar_compiler.rb +1 -1
  41. data/lib/prism/dispatcher.rb +29 -0
  42. data/lib/prism/dot_visitor.rb +87 -16
  43. data/lib/prism/dsl.rb +24 -12
  44. data/lib/prism/ffi.rb +67 -12
  45. data/lib/prism/lex_compat.rb +17 -15
  46. data/lib/prism/mutation_compiler.rb +11 -0
  47. data/lib/prism/node.rb +2096 -2499
  48. data/lib/prism/node_ext.rb +77 -29
  49. data/lib/prism/pack.rb +4 -0
  50. data/lib/prism/parse_result/comments.rb +34 -17
  51. data/lib/prism/parse_result/newlines.rb +3 -1
  52. data/lib/prism/parse_result.rb +78 -32
  53. data/lib/prism/pattern.rb +16 -4
  54. data/lib/prism/polyfill/string.rb +12 -0
  55. data/lib/prism/serialize.rb +439 -102
  56. data/lib/prism/translation/parser/compiler.rb +152 -50
  57. data/lib/prism/translation/parser/lexer.rb +103 -22
  58. data/lib/prism/translation/parser/rubocop.rb +41 -13
  59. data/lib/prism/translation/parser.rb +119 -7
  60. data/lib/prism/translation/parser33.rb +1 -1
  61. data/lib/prism/translation/parser34.rb +1 -1
  62. data/lib/prism/translation/ripper/sexp.rb +125 -0
  63. data/lib/prism/translation/ripper/shim.rb +5 -0
  64. data/lib/prism/translation/ripper.rb +3212 -462
  65. data/lib/prism/translation/ruby_parser.rb +35 -18
  66. data/lib/prism/translation.rb +3 -1
  67. data/lib/prism/visitor.rb +10 -0
  68. data/lib/prism.rb +8 -2
  69. data/prism.gemspec +33 -4
  70. data/rbi/prism/compiler.rbi +14 -0
  71. data/rbi/prism/desugar_compiler.rbi +5 -0
  72. data/rbi/prism/mutation_compiler.rbi +5 -0
  73. data/rbi/prism/node.rbi +8221 -0
  74. data/rbi/prism/node_ext.rbi +102 -0
  75. data/rbi/prism/parse_result.rbi +304 -0
  76. data/rbi/prism/translation/parser/compiler.rbi +13 -0
  77. data/rbi/prism/translation/ripper/ripper_compiler.rbi +5 -0
  78. data/rbi/prism/translation/ripper.rbi +25 -0
  79. data/rbi/prism/translation/ruby_parser.rbi +11 -0
  80. data/rbi/prism/visitor.rbi +470 -0
  81. data/rbi/prism.rbi +39 -7749
  82. data/sig/prism/compiler.rbs +9 -0
  83. data/sig/prism/dispatcher.rbs +16 -0
  84. data/sig/prism/dot_visitor.rbs +6 -0
  85. data/sig/prism/dsl.rbs +462 -0
  86. data/sig/prism/mutation_compiler.rbs +158 -0
  87. data/sig/prism/node.rbs +3529 -0
  88. data/sig/prism/node_ext.rbs +78 -0
  89. data/sig/prism/pack.rbs +43 -0
  90. data/sig/prism/parse_result.rbs +127 -0
  91. data/sig/prism/pattern.rbs +13 -0
  92. data/sig/prism/serialize.rbs +7 -0
  93. data/sig/prism/visitor.rbs +168 -0
  94. data/sig/prism.rbs +188 -4767
  95. data/src/diagnostic.c +575 -230
  96. data/src/encoding.c +211 -108
  97. data/src/node.c +7526 -447
  98. data/src/options.c +36 -12
  99. data/src/pack.c +33 -17
  100. data/src/prettyprint.c +1294 -1385
  101. data/src/prism.c +3628 -1099
  102. data/src/regexp.c +17 -2
  103. data/src/serialize.c +47 -28
  104. data/src/static_literals.c +552 -0
  105. data/src/token_type.c +1 -0
  106. data/src/util/pm_buffer.c +147 -20
  107. data/src/util/pm_char.c +4 -4
  108. data/src/util/pm_constant_pool.c +35 -11
  109. data/src/util/pm_integer.c +629 -0
  110. data/src/util/pm_list.c +1 -1
  111. data/src/util/pm_newline_list.c +14 -5
  112. data/src/util/pm_string.c +134 -5
  113. data/src/util/pm_string_list.c +2 -2
  114. metadata +35 -6
  115. data/docs/ripper.md +0 -36
  116. data/rbi/prism_static.rbi +0 -207
  117. data/sig/prism_static.rbs +0 -201
data/config.yml CHANGED
@@ -1,3 +1,275 @@
1
+ errors:
2
+ - ALIAS_ARGUMENT
3
+ - ALIAS_ARGUMENT_NUMBERED_REFERENCE
4
+ - AMPAMPEQ_MULTI_ASSIGN
5
+ - ARGUMENT_AFTER_BLOCK
6
+ - ARGUMENT_AFTER_FORWARDING_ELLIPSES
7
+ - ARGUMENT_BARE_HASH
8
+ - ARGUMENT_BLOCK_FORWARDING
9
+ - ARGUMENT_BLOCK_MULTI
10
+ - ARGUMENT_FORMAL_CLASS
11
+ - ARGUMENT_FORMAL_CONSTANT
12
+ - ARGUMENT_FORMAL_GLOBAL
13
+ - ARGUMENT_FORMAL_IVAR
14
+ - ARGUMENT_FORWARDING_UNBOUND
15
+ - ARGUMENT_IN
16
+ - ARGUMENT_NO_FORWARDING_AMP
17
+ - ARGUMENT_NO_FORWARDING_ELLIPSES
18
+ - ARGUMENT_NO_FORWARDING_STAR
19
+ - ARGUMENT_NO_FORWARDING_STAR_STAR
20
+ - ARGUMENT_SPLAT_AFTER_ASSOC_SPLAT
21
+ - ARGUMENT_SPLAT_AFTER_SPLAT
22
+ - ARGUMENT_TERM_PAREN
23
+ - ARGUMENT_UNEXPECTED_BLOCK
24
+ - ARRAY_ELEMENT
25
+ - ARRAY_EXPRESSION
26
+ - ARRAY_EXPRESSION_AFTER_STAR
27
+ - ARRAY_SEPARATOR
28
+ - ARRAY_TERM
29
+ - BEGIN_LONELY_ELSE
30
+ - BEGIN_TERM
31
+ - BEGIN_UPCASE_BRACE
32
+ - BEGIN_UPCASE_TERM
33
+ - BEGIN_UPCASE_TOPLEVEL
34
+ - BLOCK_PARAM_LOCAL_VARIABLE
35
+ - BLOCK_PARAM_PIPE_TERM
36
+ - BLOCK_TERM_BRACE
37
+ - BLOCK_TERM_END
38
+ - CANNOT_PARSE_EXPRESSION
39
+ - CANNOT_PARSE_STRING_PART
40
+ - CASE_EXPRESSION_AFTER_CASE
41
+ - CASE_EXPRESSION_AFTER_WHEN
42
+ - CASE_MATCH_MISSING_PREDICATE
43
+ - CASE_MISSING_CONDITIONS
44
+ - CASE_TERM
45
+ - CLASS_IN_METHOD
46
+ - CLASS_NAME
47
+ - CLASS_SUPERCLASS
48
+ - CLASS_TERM
49
+ - CLASS_UNEXPECTED_END
50
+ - CLASS_VARIABLE_BARE
51
+ - CONDITIONAL_ELSIF_PREDICATE
52
+ - CONDITIONAL_IF_PREDICATE
53
+ - CONDITIONAL_PREDICATE_TERM
54
+ - CONDITIONAL_TERM
55
+ - CONDITIONAL_TERM_ELSE
56
+ - CONDITIONAL_UNLESS_PREDICATE
57
+ - CONDITIONAL_UNTIL_PREDICATE
58
+ - CONDITIONAL_WHILE_PREDICATE
59
+ - CONSTANT_PATH_COLON_COLON_CONSTANT
60
+ - DEF_ENDLESS
61
+ - DEF_ENDLESS_SETTER
62
+ - DEF_NAME
63
+ - DEF_NAME_AFTER_RECEIVER
64
+ - DEF_PARAMS_TERM
65
+ - DEF_PARAMS_TERM_PAREN
66
+ - DEF_RECEIVER
67
+ - DEF_RECEIVER_TERM
68
+ - DEF_TERM
69
+ - DEFINED_EXPRESSION
70
+ - EMBDOC_TERM
71
+ - EMBEXPR_END
72
+ - EMBVAR_INVALID
73
+ - END_UPCASE_BRACE
74
+ - END_UPCASE_TERM
75
+ - ESCAPE_INVALID_CONTROL
76
+ - ESCAPE_INVALID_CONTROL_REPEAT
77
+ - ESCAPE_INVALID_HEXADECIMAL
78
+ - ESCAPE_INVALID_META
79
+ - ESCAPE_INVALID_META_REPEAT
80
+ - ESCAPE_INVALID_UNICODE
81
+ - ESCAPE_INVALID_UNICODE_CM_FLAGS
82
+ - ESCAPE_INVALID_UNICODE_LITERAL
83
+ - ESCAPE_INVALID_UNICODE_LONG
84
+ - ESCAPE_INVALID_UNICODE_TERM
85
+ - EXPECT_ARGUMENT
86
+ - EXPECT_EOL_AFTER_STATEMENT
87
+ - EXPECT_EXPRESSION_AFTER_AMPAMPEQ
88
+ - EXPECT_EXPRESSION_AFTER_COMMA
89
+ - EXPECT_EXPRESSION_AFTER_EQUAL
90
+ - EXPECT_EXPRESSION_AFTER_LESS_LESS
91
+ - EXPECT_EXPRESSION_AFTER_LPAREN
92
+ - EXPECT_EXPRESSION_AFTER_OPERATOR
93
+ - EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ
94
+ - EXPECT_EXPRESSION_AFTER_QUESTION
95
+ - EXPECT_EXPRESSION_AFTER_SPLAT
96
+ - EXPECT_EXPRESSION_AFTER_SPLAT_HASH
97
+ - EXPECT_EXPRESSION_AFTER_STAR
98
+ - EXPECT_IDENT_REQ_PARAMETER
99
+ - EXPECT_LPAREN_REQ_PARAMETER
100
+ - EXPECT_RBRACKET
101
+ - EXPECT_RPAREN
102
+ - EXPECT_RPAREN_AFTER_MULTI
103
+ - EXPECT_RPAREN_REQ_PARAMETER
104
+ - EXPECT_STRING_CONTENT
105
+ - EXPECT_WHEN_DELIMITER
106
+ - EXPRESSION_BARE_HASH
107
+ - FLOAT_PARSE
108
+ - FOR_COLLECTION
109
+ - FOR_IN
110
+ - FOR_INDEX
111
+ - FOR_TERM
112
+ - GLOBAL_VARIABLE_BARE
113
+ - HASH_EXPRESSION_AFTER_LABEL
114
+ - HASH_KEY
115
+ - HASH_ROCKET
116
+ - HASH_TERM
117
+ - HASH_VALUE
118
+ - HEREDOC_TERM
119
+ - INCOMPLETE_QUESTION_MARK
120
+ - INCOMPLETE_VARIABLE_CLASS
121
+ - INCOMPLETE_VARIABLE_CLASS_3_3_0
122
+ - INCOMPLETE_VARIABLE_INSTANCE
123
+ - INCOMPLETE_VARIABLE_INSTANCE_3_3_0
124
+ - INSTANCE_VARIABLE_BARE
125
+ - INVALID_BLOCK_EXIT
126
+ - INVALID_CHARACTER
127
+ - INVALID_ENCODING_MAGIC_COMMENT
128
+ - INVALID_FLOAT_EXPONENT
129
+ - INVALID_MULTIBYTE_CHAR
130
+ - INVALID_MULTIBYTE_CHARACTER
131
+ - INVALID_MULTIBYTE_ESCAPE
132
+ - INVALID_NUMBER_BINARY
133
+ - INVALID_NUMBER_DECIMAL
134
+ - INVALID_NUMBER_HEXADECIMAL
135
+ - INVALID_NUMBER_OCTAL
136
+ - INVALID_NUMBER_UNDERSCORE
137
+ - INVALID_PERCENT
138
+ - INVALID_PRINTABLE_CHARACTER
139
+ - INVALID_RETRY_AFTER_ELSE
140
+ - INVALID_RETRY_AFTER_ENSURE
141
+ - INVALID_RETRY_WITHOUT_RESCUE
142
+ - INVALID_VARIABLE_GLOBAL
143
+ - INVALID_VARIABLE_GLOBAL_3_3_0
144
+ - INVALID_YIELD
145
+ - IT_NOT_ALLOWED_NUMBERED
146
+ - IT_NOT_ALLOWED_ORDINARY
147
+ - LAMBDA_OPEN
148
+ - LAMBDA_TERM_BRACE
149
+ - LAMBDA_TERM_END
150
+ - LIST_I_LOWER_ELEMENT
151
+ - LIST_I_LOWER_TERM
152
+ - LIST_I_UPPER_ELEMENT
153
+ - LIST_I_UPPER_TERM
154
+ - LIST_W_LOWER_ELEMENT
155
+ - LIST_W_LOWER_TERM
156
+ - LIST_W_UPPER_ELEMENT
157
+ - LIST_W_UPPER_TERM
158
+ - MALLOC_FAILED
159
+ - MIXED_ENCODING
160
+ - MODULE_IN_METHOD
161
+ - MODULE_NAME
162
+ - MODULE_TERM
163
+ - MULTI_ASSIGN_MULTI_SPLATS
164
+ - MULTI_ASSIGN_UNEXPECTED_REST
165
+ - NO_LOCAL_VARIABLE
166
+ - NOT_EXPRESSION
167
+ - NUMBER_LITERAL_UNDERSCORE
168
+ - NUMBERED_PARAMETER_IT
169
+ - NUMBERED_PARAMETER_ORDINARY
170
+ - NUMBERED_PARAMETER_OUTER_SCOPE
171
+ - OPERATOR_MULTI_ASSIGN
172
+ - OPERATOR_WRITE_ARGUMENTS
173
+ - OPERATOR_WRITE_BLOCK
174
+ - PARAMETER_ASSOC_SPLAT_MULTI
175
+ - PARAMETER_BLOCK_MULTI
176
+ - PARAMETER_CIRCULAR
177
+ - PARAMETER_METHOD_NAME
178
+ - PARAMETER_NAME_DUPLICATED
179
+ - PARAMETER_NO_DEFAULT
180
+ - PARAMETER_NO_DEFAULT_KW
181
+ - PARAMETER_NUMBERED_RESERVED
182
+ - PARAMETER_ORDER
183
+ - PARAMETER_SPLAT_MULTI
184
+ - PARAMETER_STAR
185
+ - PARAMETER_UNEXPECTED_FWD
186
+ - PARAMETER_WILD_LOOSE_COMMA
187
+ - PATTERN_CAPTURE_DUPLICATE
188
+ - PATTERN_EXPRESSION_AFTER_BRACKET
189
+ - PATTERN_EXPRESSION_AFTER_COMMA
190
+ - PATTERN_EXPRESSION_AFTER_HROCKET
191
+ - PATTERN_EXPRESSION_AFTER_IN
192
+ - PATTERN_EXPRESSION_AFTER_KEY
193
+ - PATTERN_EXPRESSION_AFTER_PAREN
194
+ - PATTERN_EXPRESSION_AFTER_PIN
195
+ - PATTERN_EXPRESSION_AFTER_PIPE
196
+ - PATTERN_EXPRESSION_AFTER_RANGE
197
+ - PATTERN_EXPRESSION_AFTER_REST
198
+ - PATTERN_HASH_KEY
199
+ - PATTERN_HASH_KEY_DUPLICATE
200
+ - PATTERN_HASH_KEY_LABEL
201
+ - PATTERN_IDENT_AFTER_HROCKET
202
+ - PATTERN_LABEL_AFTER_COMMA
203
+ - PATTERN_REST
204
+ - PATTERN_TERM_BRACE
205
+ - PATTERN_TERM_BRACKET
206
+ - PATTERN_TERM_PAREN
207
+ - PIPEPIPEEQ_MULTI_ASSIGN
208
+ - REGEXP_ENCODING_OPTION_MISMATCH
209
+ - REGEXP_INCOMPAT_CHAR_ENCODING
210
+ - REGEXP_INVALID_UNICODE_RANGE
211
+ - REGEXP_NON_ESCAPED_MBC
212
+ - REGEXP_TERM
213
+ - REGEXP_UNKNOWN_OPTIONS
214
+ - REGEXP_UTF8_CHAR_NON_UTF8_REGEXP
215
+ - RESCUE_EXPRESSION
216
+ - RESCUE_MODIFIER_VALUE
217
+ - RESCUE_TERM
218
+ - RESCUE_VARIABLE
219
+ - RETURN_INVALID
220
+ - SCRIPT_NOT_FOUND
221
+ - SINGLETON_FOR_LITERALS
222
+ - STATEMENT_ALIAS
223
+ - STATEMENT_POSTEXE_END
224
+ - STATEMENT_PREEXE_BEGIN
225
+ - STATEMENT_UNDEF
226
+ - STRING_CONCATENATION
227
+ - STRING_INTERPOLATED_TERM
228
+ - STRING_LITERAL_EOF
229
+ - STRING_LITERAL_TERM
230
+ - SYMBOL_INVALID
231
+ - SYMBOL_TERM_DYNAMIC
232
+ - SYMBOL_TERM_INTERPOLATED
233
+ - TERNARY_COLON
234
+ - TERNARY_EXPRESSION_FALSE
235
+ - TERNARY_EXPRESSION_TRUE
236
+ - UNARY_RECEIVER
237
+ - UNDEF_ARGUMENT
238
+ - UNEXPECTED_TOKEN_CLOSE_CONTEXT
239
+ - UNEXPECTED_TOKEN_IGNORE
240
+ - UNTIL_TERM
241
+ - VOID_EXPRESSION
242
+ - WHILE_TERM
243
+ - WRITE_TARGET_IN_METHOD
244
+ - WRITE_TARGET_READONLY
245
+ - WRITE_TARGET_UNEXPECTED
246
+ - XSTRING_TERM
247
+ warnings:
248
+ - AMBIGUOUS_FIRST_ARGUMENT_MINUS
249
+ - AMBIGUOUS_FIRST_ARGUMENT_PLUS
250
+ - AMBIGUOUS_PREFIX_AMPERSAND
251
+ - AMBIGUOUS_PREFIX_STAR
252
+ - AMBIGUOUS_PREFIX_STAR_STAR
253
+ - AMBIGUOUS_SLASH
254
+ - COMPARISON_AFTER_COMPARISON
255
+ - DOT_DOT_DOT_EOL
256
+ - EQUAL_IN_CONDITIONAL
257
+ - EQUAL_IN_CONDITIONAL_3_3_0
258
+ - END_IN_METHOD
259
+ - DUPLICATED_HASH_KEY
260
+ - DUPLICATED_WHEN_CLAUSE
261
+ - FLOAT_OUT_OF_RANGE
262
+ - IGNORED_FROZEN_STRING_LITERAL
263
+ - INTEGER_IN_FLIP_FLOP
264
+ - INVALID_CHARACTER
265
+ - INVALID_NUMBERED_REFERENCE
266
+ - INVALID_SHAREABLE_CONSTANT_VALUE
267
+ - KEYWORD_EOL
268
+ - LITERAL_IN_CONDITION_DEFAULT
269
+ - LITERAL_IN_CONDITION_VERBOSE
270
+ - SHEBANG_CARRIAGE_RETURN
271
+ - UNEXPECTED_CARRIAGE_RETURN
272
+ - UNUSED_LOCAL_VARIABLE
1
273
  tokens:
2
274
  - name: EOF
3
275
  value: 1
@@ -368,6 +640,13 @@ flags:
368
640
  - name: HEXADECIMAL
369
641
  comment: "0x prefix"
370
642
  comment: Flags for integer nodes that correspond to the base of the integer.
643
+ - name: InterpolatedStringNodeFlags
644
+ values:
645
+ - name: FROZEN
646
+ comment: "frozen by virtue of a `frozen_string_literal: true` comment or `--enable-frozen-string-literal`; only for adjacent string literals like `'a' 'b'`"
647
+ - name: MUTABLE
648
+ comment: "mutable by virtue of a `frozen_string_literal: false` comment or `--disable-frozen-string-literal`; only for adjacent string literals like `'a' 'b'`"
649
+ comment: Flags for interpolated string nodes that indicated mutability if they are also marked as literals.
371
650
  - name: KeywordHashNodeFlags
372
651
  values:
373
652
  - name: SYMBOL_KEYS
@@ -413,6 +692,15 @@ flags:
413
692
  - name: FORCED_US_ASCII_ENCODING
414
693
  comment: "internal bytes forced the encoding to US-ASCII"
415
694
  comment: Flags for regular expression and match last line nodes.
695
+ - name: ShareableConstantNodeFlags
696
+ values:
697
+ - name: LITERAL
698
+ comment: "constant writes that should be modified with shareable constant value literal"
699
+ - name: EXPERIMENTAL_EVERYTHING
700
+ comment: "constant writes that should be modified with shareable constant value experimental everything"
701
+ - name: EXPERIMENTAL_COPY
702
+ comment: "constant writes that should be modified with shareable constant value experimental copy"
703
+ comment: Flags for shareable constant nodes.
416
704
  - name: StringFlags
417
705
  values:
418
706
  - name: FORCED_UTF8_ENCODING
@@ -420,7 +708,9 @@ flags:
420
708
  - name: FORCED_BINARY_ENCODING
421
709
  comment: "internal bytes forced the encoding to binary"
422
710
  - name: FROZEN
423
- comment: "frozen by virtue of a `frozen_string_literal` comment"
711
+ comment: "frozen by virtue of a `frozen_string_literal: true` comment or `--enable-frozen-string-literal`"
712
+ - name: MUTABLE
713
+ comment: "mutable by virtue of a `frozen_string_literal: false` comment or `--disable-frozen-string-literal`"
424
714
  comment: Flags for string nodes.
425
715
  - name: SymbolFlags
426
716
  values:
@@ -727,6 +1017,7 @@ nodes:
727
1017
  kind: ParametersNode
728
1018
  - name: locals
729
1019
  type: node[]
1020
+ kind: BlockLocalVariableNode
730
1021
  - name: opening_loc
731
1022
  type: location?
732
1023
  - name: closing_loc
@@ -1056,12 +1347,37 @@ nodes:
1056
1347
  fields:
1057
1348
  - name: name
1058
1349
  type: constant
1350
+ comment: |
1351
+ The name of the class variable, which is a `@@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
1352
+
1353
+ @@abc = 123 # name `@@abc`
1354
+
1355
+ @@_test = :test # name `@@_test`
1059
1356
  - name: name_loc
1060
1357
  type: location
1358
+ comment: |
1359
+ The location of the variable name.
1360
+
1361
+ @@foo = :bar
1362
+ ^^^^^
1061
1363
  - name: value
1062
1364
  type: node
1365
+ comment: |
1366
+ The value to assign to the class variable. Can be any node that
1367
+ represents a non-void expression.
1368
+
1369
+ @@foo = :bar
1370
+ ^^^^
1371
+
1372
+ @@_xyz = 123
1373
+ ^^^
1063
1374
  - name: operator_loc
1064
- type: location?
1375
+ type: location
1376
+ comment: |
1377
+ The location of the `=` operator.
1378
+
1379
+ @@foo = :bar
1380
+ ^
1065
1381
  comment: |
1066
1382
  Represents writing to a class variable.
1067
1383
 
@@ -1134,6 +1450,9 @@ nodes:
1134
1450
  type: node?
1135
1451
  - name: child
1136
1452
  type: node
1453
+ kind:
1454
+ - ConstantReadNode
1455
+ - MissingNode
1137
1456
  - name: delimiter_loc
1138
1457
  type: location
1139
1458
  comment: |
@@ -1177,6 +1496,9 @@ nodes:
1177
1496
  type: node?
1178
1497
  - name: child
1179
1498
  type: node
1499
+ kind:
1500
+ - ConstantReadNode
1501
+ - MissingNode
1180
1502
  - name: delimiter_loc
1181
1503
  type: location
1182
1504
  comment: |
@@ -1396,6 +1718,10 @@ nodes:
1396
1718
  baz if foo .. bar
1397
1719
  ^^^^^^^^^^
1398
1720
  - name: FloatNode
1721
+ fields:
1722
+ - name: value
1723
+ type: double
1724
+ comment: The value of the floating point number as a Float.
1399
1725
  comment: |
1400
1726
  Represents a floating point number literal.
1401
1727
 
@@ -1545,6 +1871,9 @@ nodes:
1545
1871
  ^
1546
1872
  - name: elements
1547
1873
  type: node[]
1874
+ kind:
1875
+ - AssocNode
1876
+ - AssocSplatNode
1548
1877
  comment: |
1549
1878
  The elements of the hash. These can be either `AssocNode`s or `AssocSplatNode`s.
1550
1879
 
@@ -1571,8 +1900,12 @@ nodes:
1571
1900
  type: node?
1572
1901
  - name: elements
1573
1902
  type: node[]
1903
+ kind: AssocNode
1574
1904
  - name: rest
1575
1905
  type: node?
1906
+ kind:
1907
+ - AssocSplatNode
1908
+ - NoKeywordsParameterNode
1576
1909
  - name: opening_loc
1577
1910
  type: location?
1578
1911
  - name: closing_loc
@@ -1613,6 +1946,10 @@ nodes:
1613
1946
  fields:
1614
1947
  - name: numeric
1615
1948
  type: node
1949
+ kind:
1950
+ - FloatNode
1951
+ - IntegerNode
1952
+ - RationalNode
1616
1953
  comment: |
1617
1954
  Represents an imaginary number literal.
1618
1955
 
@@ -1851,12 +2188,37 @@ nodes:
1851
2188
  fields:
1852
2189
  - name: name
1853
2190
  type: constant
2191
+ comment: |
2192
+ The name of the instance variable, which is a `@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
2193
+
2194
+ @x = :y # name `:@x`
2195
+
2196
+ @_foo = "bar" # name `@_foo`
1854
2197
  - name: name_loc
1855
2198
  type: location
2199
+ comment: |
2200
+ The location of the variable name.
2201
+
2202
+ @_x = 1
2203
+ ^^^
1856
2204
  - name: value
1857
2205
  type: node
2206
+ comment: |
2207
+ The value to assign to the instance variable. Can be any node that
2208
+ represents a non-void expression.
2209
+
2210
+ @foo = :bar
2211
+ ^^^^
2212
+
2213
+ @_x = 1234
2214
+ ^^^^
1858
2215
  - name: operator_loc
1859
2216
  type: location
2217
+ comment: |
2218
+ The location of the `=` operator.
2219
+
2220
+ @x = y
2221
+ ^
1860
2222
  comment: |
1861
2223
  Represents writing to an instance variable.
1862
2224
 
@@ -1867,6 +2229,9 @@ nodes:
1867
2229
  - name: flags
1868
2230
  type: flags
1869
2231
  kind: IntegerBaseFlags
2232
+ - name: value
2233
+ type: integer
2234
+ comment: The value of the integer literal as a number.
1870
2235
  comment: |
1871
2236
  Represents an integer number literal.
1872
2237
 
@@ -1881,6 +2246,10 @@ nodes:
1881
2246
  type: location
1882
2247
  - name: parts
1883
2248
  type: node[]
2249
+ kind:
2250
+ - StringNode
2251
+ - EmbeddedStatementsNode
2252
+ - EmbeddedVariableNode
1884
2253
  - name: closing_loc
1885
2254
  type: location
1886
2255
  newline: parts
@@ -1898,6 +2267,10 @@ nodes:
1898
2267
  type: location
1899
2268
  - name: parts
1900
2269
  type: node[]
2270
+ kind:
2271
+ - StringNode
2272
+ - EmbeddedStatementsNode
2273
+ - EmbeddedVariableNode
1901
2274
  - name: closing_loc
1902
2275
  type: location
1903
2276
  newline: parts
@@ -1908,10 +2281,18 @@ nodes:
1908
2281
  ^^^^^^^^^^^^^^^^
1909
2282
  - name: InterpolatedStringNode
1910
2283
  fields:
2284
+ - name: flags
2285
+ type: flags
2286
+ kind: InterpolatedStringNodeFlags
1911
2287
  - name: opening_loc
1912
2288
  type: location?
1913
2289
  - name: parts
1914
2290
  type: node[]
2291
+ kind:
2292
+ - StringNode
2293
+ - EmbeddedStatementsNode
2294
+ - EmbeddedVariableNode
2295
+ - InterpolatedStringNode # `"a" "#{b}"`
1915
2296
  - name: closing_loc
1916
2297
  type: location?
1917
2298
  newline: parts
@@ -1926,6 +2307,10 @@ nodes:
1926
2307
  type: location?
1927
2308
  - name: parts
1928
2309
  type: node[]
2310
+ kind:
2311
+ - StringNode
2312
+ - EmbeddedStatementsNode
2313
+ - EmbeddedVariableNode
1929
2314
  - name: closing_loc
1930
2315
  type: location?
1931
2316
  newline: parts
@@ -1940,6 +2325,10 @@ nodes:
1940
2325
  type: location
1941
2326
  - name: parts
1942
2327
  type: node[]
2328
+ kind:
2329
+ - StringNode
2330
+ - EmbeddedStatementsNode
2331
+ - EmbeddedVariableNode
1943
2332
  - name: closing_loc
1944
2333
  type: location
1945
2334
  newline: parts
@@ -1948,6 +2337,12 @@ nodes:
1948
2337
 
1949
2338
  `foo #{bar} baz`
1950
2339
  ^^^^^^^^^^^^^^^^
2340
+ - name: ItParametersNode
2341
+ comment: |
2342
+ Represents an implicit set of parameters through the use of the `it` keyword within a block or lambda.
2343
+
2344
+ -> { it + it }
2345
+ ^^^^^^^^^^^^^^
1951
2346
  - name: KeywordHashNode
1952
2347
  fields:
1953
2348
  - name: flags
@@ -1955,6 +2350,9 @@ nodes:
1955
2350
  kind: KeywordHashNodeFlags
1956
2351
  - name: elements
1957
2352
  type: node[]
2353
+ kind:
2354
+ - AssocNode
2355
+ - AssocSplatNode
1958
2356
  comment: |
1959
2357
  Represents a hash literal without opening and closing braces.
1960
2358
 
@@ -2162,6 +2560,7 @@ nodes:
2162
2560
  kind: CallNode
2163
2561
  - name: targets
2164
2562
  type: node[]
2563
+ kind: LocalVariableTargetNode
2165
2564
  comment: |
2166
2565
  Represents writing local variables using a regular expression match with named capture groups.
2167
2566
 
@@ -2193,10 +2592,35 @@ nodes:
2193
2592
  fields:
2194
2593
  - name: lefts
2195
2594
  type: node[]
2595
+ kind:
2596
+ - LocalVariableTargetNode
2597
+ - InstanceVariableTargetNode
2598
+ - ClassVariableTargetNode
2599
+ - GlobalVariableTargetNode
2600
+ - ConstantTargetNode
2601
+ - ConstantPathTargetNode
2602
+ - CallTargetNode
2603
+ - IndexTargetNode
2604
+ - MultiTargetNode
2605
+ - RequiredParameterNode
2606
+ - BackReferenceReadNode # On parsing error of `$',`
2607
+ - NumberedReferenceReadNode # On parsing error of `$1,`
2196
2608
  - name: rest
2197
2609
  type: node?
2198
2610
  - name: rights
2199
2611
  type: node[]
2612
+ kind:
2613
+ - LocalVariableTargetNode
2614
+ - InstanceVariableTargetNode
2615
+ - ClassVariableTargetNode
2616
+ - GlobalVariableTargetNode
2617
+ - ConstantTargetNode
2618
+ - ConstantPathTargetNode
2619
+ - CallTargetNode
2620
+ - IndexTargetNode
2621
+ - MultiTargetNode
2622
+ - RequiredParameterNode
2623
+ - BackReferenceReadNode # On parsing error of `*,$'`
2200
2624
  - name: lparen_loc
2201
2625
  type: location?
2202
2626
  - name: rparen_loc
@@ -2210,10 +2634,30 @@ nodes:
2210
2634
  fields:
2211
2635
  - name: lefts
2212
2636
  type: node[]
2637
+ kind:
2638
+ - LocalVariableTargetNode
2639
+ - InstanceVariableTargetNode
2640
+ - ClassVariableTargetNode
2641
+ - GlobalVariableTargetNode
2642
+ - ConstantTargetNode
2643
+ - ConstantPathTargetNode
2644
+ - CallTargetNode
2645
+ - IndexTargetNode
2646
+ - MultiTargetNode
2213
2647
  - name: rest
2214
2648
  type: node?
2215
2649
  - name: rights
2216
2650
  type: node[]
2651
+ kind:
2652
+ - LocalVariableTargetNode
2653
+ - InstanceVariableTargetNode
2654
+ - ClassVariableTargetNode
2655
+ - GlobalVariableTargetNode
2656
+ - ConstantTargetNode
2657
+ - ConstantPathTargetNode
2658
+ - CallTargetNode
2659
+ - IndexTargetNode
2660
+ - MultiTargetNode
2217
2661
  - name: lparen_loc
2218
2662
  type: location?
2219
2663
  - name: rparen_loc
@@ -2271,13 +2715,13 @@ nodes:
2271
2715
  - name: number
2272
2716
  type: uint32
2273
2717
  comment: |
2274
- The (1-indexed, from the left) number of the capture group. Numbered references that would overflow a `uint32` result in a `number` of exactly `2**32 - 1`.
2718
+ The (1-indexed, from the left) number of the capture group. Numbered references that are too large result in this value being `0`.
2275
2719
 
2276
2720
  $1 # number `1`
2277
2721
 
2278
2722
  $5432 # number `5432`
2279
2723
 
2280
- $4294967296 # number `4294967295`
2724
+ $4294967296 # number `0`
2281
2725
  comment: |
2282
2726
  Represents reading a numbered reference to a capture in the previous match.
2283
2727
 
@@ -2357,16 +2801,36 @@ nodes:
2357
2801
  fields:
2358
2802
  - name: requireds
2359
2803
  type: node[]
2804
+ kind:
2805
+ - RequiredParameterNode
2806
+ - MultiTargetNode
2360
2807
  - name: optionals
2361
2808
  type: node[]
2809
+ kind: OptionalParameterNode
2362
2810
  - name: rest
2363
2811
  type: node?
2812
+ kind:
2813
+ - RestParameterNode
2814
+ - ImplicitRestNode # Only in block parameters
2364
2815
  - name: posts
2365
2816
  type: node[]
2817
+ kind:
2818
+ - RequiredParameterNode
2819
+ - MultiTargetNode
2820
+ # On parsing error of `f(**kwargs, ...)` or `f(**nil, ...)`, the keyword_rest value is moved here:
2821
+ - KeywordRestParameterNode
2822
+ - NoKeywordsParameterNode
2366
2823
  - name: keywords
2367
2824
  type: node[]
2825
+ kind:
2826
+ - RequiredKeywordParameterNode
2827
+ - OptionalKeywordParameterNode
2368
2828
  - name: keyword_rest
2369
2829
  type: node?
2830
+ kind:
2831
+ - KeywordRestParameterNode
2832
+ - ForwardingParameterNode
2833
+ - NoKeywordsParameterNode
2370
2834
  - name: block
2371
2835
  type: node?
2372
2836
  kind: BlockParameterNode
@@ -2636,6 +3100,29 @@ nodes:
2636
3100
 
2637
3101
  self
2638
3102
  ^^^^
3103
+ - name: ShareableConstantNode
3104
+ fields:
3105
+ - name: flags
3106
+ type: flags
3107
+ kind: ShareableConstantNodeFlags
3108
+ - name: write
3109
+ type: node
3110
+ kind:
3111
+ - ConstantWriteNode
3112
+ - ConstantAndWriteNode
3113
+ - ConstantOrWriteNode
3114
+ - ConstantOperatorWriteNode
3115
+ - ConstantPathWriteNode
3116
+ - ConstantPathAndWriteNode
3117
+ - ConstantPathOrWriteNode
3118
+ - ConstantPathOperatorWriteNode
3119
+ comment: The constant write that should be modified with the shareability state.
3120
+ comment: |
3121
+ This node wraps a constant write to indicate that when the value is written, it should have its shareability state modified.
3122
+
3123
+ # shareable_constant_value: literal
3124
+ C = { a: 1 }
3125
+ ^^^^^^^^^^^^
2639
3126
  - name: SingletonClassNode
2640
3127
  fields:
2641
3128
  - name: locals
@@ -2663,6 +3150,9 @@ nodes:
2663
3150
  ^^^^^^^^^^^^
2664
3151
  - name: SourceFileNode
2665
3152
  fields:
3153
+ - name: flags
3154
+ type: flags
3155
+ kind: StringFlags
2666
3156
  - name: filepath
2667
3157
  type: string
2668
3158
  comment: |
@@ -2772,6 +3262,9 @@ nodes:
2772
3262
  fields:
2773
3263
  - name: names
2774
3264
  type: node[]
3265
+ kind:
3266
+ - SymbolNode
3267
+ - InterpolatedSymbolNode
2775
3268
  - name: keyword_loc
2776
3269
  type: location
2777
3270
  comment: |
@@ -2833,6 +3326,8 @@ nodes:
2833
3326
  type: location
2834
3327
  - name: conditions
2835
3328
  type: node[]
3329
+ - name: then_keyword_loc
3330
+ type: location?
2836
3331
  - name: statements
2837
3332
  type: node?
2838
3333
  kind: StatementsNode