jruby-prism-parser 0.24.0-java → 1.4.0-java
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.
- checksums.yaml +4 -4
- data/BSDmakefile +58 -0
- data/CHANGELOG.md +269 -1
- data/CONTRIBUTING.md +0 -4
- data/Makefile +25 -18
- data/README.md +57 -6
- data/config.yml +1724 -140
- data/docs/build_system.md +39 -11
- data/docs/configuration.md +4 -0
- data/docs/cruby_compilation.md +1 -1
- data/docs/fuzzing.md +1 -1
- data/docs/parser_translation.md +14 -9
- data/docs/parsing_rules.md +4 -1
- data/docs/releasing.md +8 -10
- data/docs/relocation.md +34 -0
- data/docs/ripper_translation.md +72 -0
- data/docs/ruby_api.md +2 -1
- data/docs/serialization.md +29 -5
- data/ext/prism/api_node.c +3395 -1999
- data/ext/prism/api_pack.c +9 -0
- data/ext/prism/extconf.rb +55 -34
- data/ext/prism/extension.c +597 -346
- data/ext/prism/extension.h +6 -5
- data/include/prism/ast.h +2612 -455
- data/include/prism/defines.h +160 -2
- data/include/prism/diagnostic.h +188 -76
- data/include/prism/encoding.h +22 -4
- data/include/prism/node.h +89 -17
- data/include/prism/options.h +224 -12
- data/include/prism/pack.h +11 -0
- data/include/prism/parser.h +267 -66
- data/include/prism/prettyprint.h +8 -0
- data/include/prism/regexp.h +18 -8
- data/include/prism/static_literals.h +121 -0
- data/include/prism/util/pm_buffer.h +75 -2
- data/include/prism/util/pm_char.h +1 -2
- data/include/prism/util/pm_constant_pool.h +18 -9
- data/include/prism/util/pm_integer.h +126 -0
- data/include/prism/util/pm_list.h +1 -1
- data/include/prism/util/pm_newline_list.h +19 -0
- data/include/prism/util/pm_string.h +48 -8
- data/include/prism/version.h +3 -3
- data/include/prism.h +99 -5
- data/jruby-prism.jar +0 -0
- data/lib/prism/compiler.rb +11 -1
- data/lib/prism/desugar_compiler.rb +113 -74
- data/lib/prism/dispatcher.rb +45 -1
- data/lib/prism/dot_visitor.rb +201 -77
- data/lib/prism/dsl.rb +673 -461
- data/lib/prism/ffi.rb +233 -45
- data/lib/prism/inspect_visitor.rb +2389 -0
- data/lib/prism/lex_compat.rb +35 -16
- data/lib/prism/mutation_compiler.rb +24 -8
- data/lib/prism/node.rb +7731 -8460
- data/lib/prism/node_ext.rb +328 -32
- data/lib/prism/pack.rb +4 -0
- data/lib/prism/parse_result/comments.rb +34 -24
- data/lib/prism/parse_result/errors.rb +65 -0
- data/lib/prism/parse_result/newlines.rb +102 -12
- data/lib/prism/parse_result.rb +448 -44
- data/lib/prism/pattern.rb +28 -10
- data/lib/prism/polyfill/append_as_bytes.rb +15 -0
- data/lib/prism/polyfill/byteindex.rb +13 -0
- data/lib/prism/polyfill/unpack1.rb +14 -0
- data/lib/prism/reflection.rb +413 -0
- data/lib/prism/relocation.rb +504 -0
- data/lib/prism/serialize.rb +1940 -1198
- data/lib/prism/string_query.rb +30 -0
- data/lib/prism/translation/parser/builder.rb +61 -0
- data/lib/prism/translation/parser/compiler.rb +569 -195
- data/lib/prism/translation/parser/lexer.rb +516 -39
- data/lib/prism/translation/parser.rb +177 -12
- data/lib/prism/translation/parser33.rb +1 -1
- data/lib/prism/translation/parser34.rb +1 -1
- data/lib/prism/translation/parser35.rb +12 -0
- data/lib/prism/translation/ripper/sexp.rb +125 -0
- data/lib/prism/translation/ripper/shim.rb +5 -0
- data/lib/prism/translation/ripper.rb +3224 -462
- data/lib/prism/translation/ruby_parser.rb +194 -69
- data/lib/prism/translation.rb +4 -1
- data/lib/prism/version.rb +1 -1
- data/lib/prism/visitor.rb +13 -0
- data/lib/prism.rb +17 -27
- data/prism.gemspec +57 -17
- data/rbi/prism/compiler.rbi +12 -0
- data/rbi/prism/dsl.rbi +524 -0
- data/rbi/prism/inspect_visitor.rbi +12 -0
- data/rbi/prism/node.rbi +8722 -0
- data/rbi/prism/node_ext.rbi +107 -0
- data/rbi/prism/parse_result.rbi +404 -0
- data/rbi/prism/reflection.rbi +58 -0
- data/rbi/prism/string_query.rbi +12 -0
- data/rbi/prism/translation/parser.rbi +11 -0
- data/rbi/prism/translation/parser33.rbi +6 -0
- data/rbi/prism/translation/parser34.rbi +6 -0
- data/rbi/prism/translation/parser35.rbi +6 -0
- data/rbi/prism/translation/ripper.rbi +15 -0
- data/rbi/prism/visitor.rbi +473 -0
- data/rbi/prism.rbi +44 -7745
- data/sig/prism/compiler.rbs +9 -0
- data/sig/prism/dispatcher.rbs +16 -0
- data/sig/prism/dot_visitor.rbs +6 -0
- data/sig/prism/dsl.rbs +351 -0
- data/sig/prism/inspect_visitor.rbs +22 -0
- data/sig/prism/lex_compat.rbs +10 -0
- data/sig/prism/mutation_compiler.rbs +159 -0
- data/sig/prism/node.rbs +3614 -0
- data/sig/prism/node_ext.rbs +82 -0
- data/sig/prism/pack.rbs +43 -0
- data/sig/prism/parse_result.rbs +192 -0
- data/sig/prism/pattern.rbs +13 -0
- data/sig/prism/reflection.rbs +50 -0
- data/sig/prism/relocation.rbs +185 -0
- data/sig/prism/serialize.rbs +8 -0
- data/sig/prism/string_query.rbs +11 -0
- data/sig/prism/visitor.rbs +169 -0
- data/sig/prism.rbs +248 -4767
- data/src/diagnostic.c +672 -230
- data/src/encoding.c +211 -108
- data/src/node.c +7541 -1653
- data/src/options.c +135 -20
- data/src/pack.c +33 -17
- data/src/prettyprint.c +1543 -1485
- data/src/prism.c +7813 -3050
- data/src/regexp.c +225 -73
- data/src/serialize.c +101 -77
- data/src/static_literals.c +617 -0
- data/src/token_type.c +14 -13
- data/src/util/pm_buffer.c +187 -20
- data/src/util/pm_char.c +5 -5
- data/src/util/pm_constant_pool.c +39 -19
- data/src/util/pm_integer.c +670 -0
- data/src/util/pm_list.c +1 -1
- data/src/util/pm_newline_list.c +43 -5
- data/src/util/pm_string.c +213 -33
- data/src/util/pm_strncasecmp.c +13 -1
- data/src/util/pm_strpbrk.c +32 -6
- metadata +55 -19
- data/docs/ripper.md +0 -36
- data/include/prism/util/pm_state_stack.h +0 -42
- data/include/prism/util/pm_string_list.h +0 -44
- data/lib/prism/debug.rb +0 -206
- data/lib/prism/node_inspector.rb +0 -68
- data/lib/prism/translation/parser/rubocop.rb +0 -45
- data/rbi/prism_static.rbi +0 -207
- data/sig/prism_static.rbs +0 -201
- data/src/util/pm_state_stack.c +0 -25
- data/src/util/pm_string_list.c +0 -28
data/config.yml
CHANGED
@@ -1,3 +1,324 @@
|
|
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_CONFLICT_AMPERSAND
|
11
|
+
- ARGUMENT_CONFLICT_STAR
|
12
|
+
- ARGUMENT_CONFLICT_STAR_STAR
|
13
|
+
- ARGUMENT_FORMAL_CLASS
|
14
|
+
- ARGUMENT_FORMAL_CONSTANT
|
15
|
+
- ARGUMENT_FORMAL_GLOBAL
|
16
|
+
- ARGUMENT_FORMAL_IVAR
|
17
|
+
- ARGUMENT_FORWARDING_UNBOUND
|
18
|
+
- ARGUMENT_NO_FORWARDING_AMPERSAND
|
19
|
+
- ARGUMENT_NO_FORWARDING_ELLIPSES
|
20
|
+
- ARGUMENT_NO_FORWARDING_STAR
|
21
|
+
- ARGUMENT_NO_FORWARDING_STAR_STAR
|
22
|
+
- ARGUMENT_SPLAT_AFTER_ASSOC_SPLAT
|
23
|
+
- ARGUMENT_SPLAT_AFTER_SPLAT
|
24
|
+
- ARGUMENT_TERM_PAREN
|
25
|
+
- ARGUMENT_UNEXPECTED_BLOCK
|
26
|
+
- ARRAY_ELEMENT
|
27
|
+
- ARRAY_EXPRESSION
|
28
|
+
- ARRAY_EXPRESSION_AFTER_STAR
|
29
|
+
- ARRAY_SEPARATOR
|
30
|
+
- ARRAY_TERM
|
31
|
+
- BEGIN_LONELY_ELSE
|
32
|
+
- BEGIN_TERM
|
33
|
+
- BEGIN_UPCASE_BRACE
|
34
|
+
- BEGIN_UPCASE_TERM
|
35
|
+
- BEGIN_UPCASE_TOPLEVEL
|
36
|
+
- BLOCK_PARAM_LOCAL_VARIABLE
|
37
|
+
- BLOCK_PARAM_PIPE_TERM
|
38
|
+
- BLOCK_TERM_BRACE
|
39
|
+
- BLOCK_TERM_END
|
40
|
+
- CANNOT_PARSE_EXPRESSION
|
41
|
+
- CANNOT_PARSE_STRING_PART
|
42
|
+
- CASE_EXPRESSION_AFTER_CASE
|
43
|
+
- CASE_EXPRESSION_AFTER_WHEN
|
44
|
+
- CASE_MATCH_MISSING_PREDICATE
|
45
|
+
- CASE_MISSING_CONDITIONS
|
46
|
+
- CASE_TERM
|
47
|
+
- CLASS_IN_METHOD
|
48
|
+
- CLASS_NAME
|
49
|
+
- CLASS_SUPERCLASS
|
50
|
+
- CLASS_TERM
|
51
|
+
- CLASS_UNEXPECTED_END
|
52
|
+
- CLASS_VARIABLE_BARE
|
53
|
+
- CONDITIONAL_ELSIF_PREDICATE
|
54
|
+
- CONDITIONAL_IF_PREDICATE
|
55
|
+
- CONDITIONAL_PREDICATE_TERM
|
56
|
+
- CONDITIONAL_TERM
|
57
|
+
- CONDITIONAL_TERM_ELSE
|
58
|
+
- CONDITIONAL_UNLESS_PREDICATE
|
59
|
+
- CONDITIONAL_UNTIL_PREDICATE
|
60
|
+
- CONDITIONAL_WHILE_PREDICATE
|
61
|
+
- CONSTANT_PATH_COLON_COLON_CONSTANT
|
62
|
+
- DEF_ENDLESS
|
63
|
+
- DEF_ENDLESS_SETTER
|
64
|
+
- DEF_NAME
|
65
|
+
- DEF_PARAMS_TERM
|
66
|
+
- DEF_PARAMS_TERM_PAREN
|
67
|
+
- DEF_RECEIVER
|
68
|
+
- DEF_RECEIVER_TERM
|
69
|
+
- DEF_TERM
|
70
|
+
- DEFINED_EXPRESSION
|
71
|
+
- EMBDOC_TERM
|
72
|
+
- EMBEXPR_END
|
73
|
+
- EMBVAR_INVALID
|
74
|
+
- END_UPCASE_BRACE
|
75
|
+
- END_UPCASE_TERM
|
76
|
+
- ESCAPE_INVALID_CONTROL
|
77
|
+
- ESCAPE_INVALID_CONTROL_REPEAT
|
78
|
+
- ESCAPE_INVALID_HEXADECIMAL
|
79
|
+
- ESCAPE_INVALID_META
|
80
|
+
- ESCAPE_INVALID_META_REPEAT
|
81
|
+
- ESCAPE_INVALID_UNICODE
|
82
|
+
- ESCAPE_INVALID_UNICODE_CM_FLAGS
|
83
|
+
- ESCAPE_INVALID_UNICODE_LIST
|
84
|
+
- ESCAPE_INVALID_UNICODE_LITERAL
|
85
|
+
- ESCAPE_INVALID_UNICODE_LONG
|
86
|
+
- ESCAPE_INVALID_UNICODE_SHORT
|
87
|
+
- ESCAPE_INVALID_UNICODE_TERM
|
88
|
+
- EXPECT_ARGUMENT
|
89
|
+
- EXPECT_EOL_AFTER_STATEMENT
|
90
|
+
- EXPECT_EXPRESSION_AFTER_AMPAMPEQ
|
91
|
+
- EXPECT_EXPRESSION_AFTER_COMMA
|
92
|
+
- EXPECT_EXPRESSION_AFTER_EQUAL
|
93
|
+
- EXPECT_EXPRESSION_AFTER_LESS_LESS
|
94
|
+
- EXPECT_EXPRESSION_AFTER_LPAREN
|
95
|
+
- EXPECT_EXPRESSION_AFTER_OPERATOR
|
96
|
+
- EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ
|
97
|
+
- EXPECT_EXPRESSION_AFTER_QUESTION
|
98
|
+
- EXPECT_EXPRESSION_AFTER_SPLAT
|
99
|
+
- EXPECT_EXPRESSION_AFTER_SPLAT_HASH
|
100
|
+
- EXPECT_EXPRESSION_AFTER_STAR
|
101
|
+
- EXPECT_FOR_DELIMITER
|
102
|
+
- EXPECT_IDENT_REQ_PARAMETER
|
103
|
+
- EXPECT_IN_DELIMITER
|
104
|
+
- EXPECT_LPAREN_REQ_PARAMETER
|
105
|
+
- EXPECT_MESSAGE
|
106
|
+
- EXPECT_RBRACKET
|
107
|
+
- EXPECT_RPAREN
|
108
|
+
- EXPECT_RPAREN_AFTER_MULTI
|
109
|
+
- EXPECT_RPAREN_REQ_PARAMETER
|
110
|
+
- EXPECT_SINGLETON_CLASS_DELIMITER
|
111
|
+
- EXPECT_STRING_CONTENT
|
112
|
+
- EXPECT_WHEN_DELIMITER
|
113
|
+
- EXPRESSION_BARE_HASH
|
114
|
+
- EXPRESSION_NOT_WRITABLE
|
115
|
+
- EXPRESSION_NOT_WRITABLE_ENCODING
|
116
|
+
- EXPRESSION_NOT_WRITABLE_FALSE
|
117
|
+
- EXPRESSION_NOT_WRITABLE_FILE
|
118
|
+
- EXPRESSION_NOT_WRITABLE_LINE
|
119
|
+
- EXPRESSION_NOT_WRITABLE_NIL
|
120
|
+
- EXPRESSION_NOT_WRITABLE_NUMBERED
|
121
|
+
- EXPRESSION_NOT_WRITABLE_SELF
|
122
|
+
- EXPRESSION_NOT_WRITABLE_TRUE
|
123
|
+
- FLOAT_PARSE
|
124
|
+
- FOR_COLLECTION
|
125
|
+
- FOR_IN
|
126
|
+
- FOR_INDEX
|
127
|
+
- FOR_TERM
|
128
|
+
- GLOBAL_VARIABLE_BARE
|
129
|
+
- HASH_EXPRESSION_AFTER_LABEL
|
130
|
+
- HASH_KEY
|
131
|
+
- HASH_ROCKET
|
132
|
+
- HASH_TERM
|
133
|
+
- HASH_VALUE
|
134
|
+
- HEREDOC_IDENTIFIER
|
135
|
+
- HEREDOC_TERM
|
136
|
+
- INCOMPLETE_QUESTION_MARK
|
137
|
+
- INCOMPLETE_VARIABLE_CLASS
|
138
|
+
- INCOMPLETE_VARIABLE_CLASS_3_3
|
139
|
+
- INCOMPLETE_VARIABLE_INSTANCE
|
140
|
+
- INCOMPLETE_VARIABLE_INSTANCE_3_3
|
141
|
+
- INSTANCE_VARIABLE_BARE
|
142
|
+
- INVALID_BLOCK_EXIT
|
143
|
+
- INVALID_CHARACTER
|
144
|
+
- INVALID_COMMA
|
145
|
+
- INVALID_ENCODING_MAGIC_COMMENT
|
146
|
+
- INVALID_ESCAPE_CHARACTER
|
147
|
+
- INVALID_FLOAT_EXPONENT
|
148
|
+
- INVALID_LOCAL_VARIABLE_READ
|
149
|
+
- INVALID_LOCAL_VARIABLE_WRITE
|
150
|
+
- INVALID_MULTIBYTE_CHAR
|
151
|
+
- INVALID_MULTIBYTE_CHARACTER
|
152
|
+
- INVALID_MULTIBYTE_ESCAPE
|
153
|
+
- INVALID_NUMBER_BINARY
|
154
|
+
- INVALID_NUMBER_DECIMAL
|
155
|
+
- INVALID_NUMBER_FRACTION
|
156
|
+
- INVALID_NUMBER_HEXADECIMAL
|
157
|
+
- INVALID_NUMBER_OCTAL
|
158
|
+
- INVALID_NUMBER_UNDERSCORE_INNER
|
159
|
+
- INVALID_NUMBER_UNDERSCORE_TRAILING
|
160
|
+
- INVALID_PERCENT
|
161
|
+
- INVALID_PERCENT_EOF
|
162
|
+
- INVALID_PRINTABLE_CHARACTER
|
163
|
+
- INVALID_RETRY_AFTER_ELSE
|
164
|
+
- INVALID_RETRY_AFTER_ENSURE
|
165
|
+
- INVALID_RETRY_WITHOUT_RESCUE
|
166
|
+
- INVALID_SYMBOL
|
167
|
+
- INVALID_VARIABLE_GLOBAL
|
168
|
+
- INVALID_VARIABLE_GLOBAL_3_3
|
169
|
+
- INVALID_YIELD
|
170
|
+
- IT_NOT_ALLOWED_NUMBERED
|
171
|
+
- IT_NOT_ALLOWED_ORDINARY
|
172
|
+
- LAMBDA_OPEN
|
173
|
+
- LAMBDA_TERM_BRACE
|
174
|
+
- LAMBDA_TERM_END
|
175
|
+
- LIST_I_LOWER_ELEMENT
|
176
|
+
- LIST_I_LOWER_TERM
|
177
|
+
- LIST_I_UPPER_ELEMENT
|
178
|
+
- LIST_I_UPPER_TERM
|
179
|
+
- LIST_W_LOWER_ELEMENT
|
180
|
+
- LIST_W_LOWER_TERM
|
181
|
+
- LIST_W_UPPER_ELEMENT
|
182
|
+
- LIST_W_UPPER_TERM
|
183
|
+
- MALLOC_FAILED
|
184
|
+
- MIXED_ENCODING
|
185
|
+
- MODULE_IN_METHOD
|
186
|
+
- MODULE_NAME
|
187
|
+
- MODULE_TERM
|
188
|
+
- MULTI_ASSIGN_MULTI_SPLATS
|
189
|
+
- MULTI_ASSIGN_UNEXPECTED_REST
|
190
|
+
- NESTING_TOO_DEEP
|
191
|
+
- NO_LOCAL_VARIABLE
|
192
|
+
- NON_ASSOCIATIVE_OPERATOR
|
193
|
+
- NOT_EXPRESSION
|
194
|
+
- NUMBER_LITERAL_UNDERSCORE
|
195
|
+
- NUMBERED_PARAMETER_INNER_BLOCK
|
196
|
+
- NUMBERED_PARAMETER_IT
|
197
|
+
- NUMBERED_PARAMETER_ORDINARY
|
198
|
+
- NUMBERED_PARAMETER_OUTER_BLOCK
|
199
|
+
- OPERATOR_MULTI_ASSIGN
|
200
|
+
- OPERATOR_WRITE_ARGUMENTS
|
201
|
+
- OPERATOR_WRITE_BLOCK
|
202
|
+
- PARAMETER_ASSOC_SPLAT_MULTI
|
203
|
+
- PARAMETER_BLOCK_MULTI
|
204
|
+
- PARAMETER_CIRCULAR
|
205
|
+
- PARAMETER_FORWARDING_AFTER_REST
|
206
|
+
- PARAMETER_METHOD_NAME
|
207
|
+
- PARAMETER_NAME_DUPLICATED
|
208
|
+
- PARAMETER_NO_DEFAULT
|
209
|
+
- PARAMETER_NO_DEFAULT_KW
|
210
|
+
- PARAMETER_NUMBERED_RESERVED
|
211
|
+
- PARAMETER_ORDER
|
212
|
+
- PARAMETER_SPLAT_MULTI
|
213
|
+
- PARAMETER_STAR
|
214
|
+
- PARAMETER_UNEXPECTED_FWD
|
215
|
+
- PARAMETER_UNEXPECTED_NO_KW
|
216
|
+
- PARAMETER_WILD_LOOSE_COMMA
|
217
|
+
- PATTERN_ARRAY_MULTIPLE_RESTS
|
218
|
+
- PATTERN_CAPTURE_DUPLICATE
|
219
|
+
- PATTERN_EXPRESSION_AFTER_BRACKET
|
220
|
+
- PATTERN_EXPRESSION_AFTER_COMMA
|
221
|
+
- PATTERN_EXPRESSION_AFTER_HROCKET
|
222
|
+
- PATTERN_EXPRESSION_AFTER_IN
|
223
|
+
- PATTERN_EXPRESSION_AFTER_KEY
|
224
|
+
- PATTERN_EXPRESSION_AFTER_PAREN
|
225
|
+
- PATTERN_EXPRESSION_AFTER_PIN
|
226
|
+
- PATTERN_EXPRESSION_AFTER_PIPE
|
227
|
+
- PATTERN_EXPRESSION_AFTER_RANGE
|
228
|
+
- PATTERN_EXPRESSION_AFTER_REST
|
229
|
+
- PATTERN_FIND_MISSING_INNER
|
230
|
+
- PATTERN_HASH_IMPLICIT
|
231
|
+
- PATTERN_HASH_KEY
|
232
|
+
- PATTERN_HASH_KEY_DUPLICATE
|
233
|
+
- PATTERN_HASH_KEY_INTERPOLATED
|
234
|
+
- PATTERN_HASH_KEY_LABEL
|
235
|
+
- PATTERN_HASH_KEY_LOCALS
|
236
|
+
- PATTERN_IDENT_AFTER_HROCKET
|
237
|
+
- PATTERN_LABEL_AFTER_COMMA
|
238
|
+
- PATTERN_REST
|
239
|
+
- PATTERN_TERM_BRACE
|
240
|
+
- PATTERN_TERM_BRACKET
|
241
|
+
- PATTERN_TERM_PAREN
|
242
|
+
- PIPEPIPEEQ_MULTI_ASSIGN
|
243
|
+
- REGEXP_ENCODING_OPTION_MISMATCH
|
244
|
+
- REGEXP_INCOMPAT_CHAR_ENCODING
|
245
|
+
- REGEXP_INVALID_UNICODE_RANGE
|
246
|
+
- REGEXP_NON_ESCAPED_MBC
|
247
|
+
- REGEXP_PARSE_ERROR
|
248
|
+
- REGEXP_TERM
|
249
|
+
- REGEXP_UNKNOWN_OPTIONS
|
250
|
+
- REGEXP_UTF8_CHAR_NON_UTF8_REGEXP
|
251
|
+
- RESCUE_EXPRESSION
|
252
|
+
- RESCUE_MODIFIER_VALUE
|
253
|
+
- RESCUE_TERM
|
254
|
+
- RESCUE_VARIABLE
|
255
|
+
- RETURN_INVALID
|
256
|
+
- SCRIPT_NOT_FOUND
|
257
|
+
- SINGLETON_FOR_LITERALS
|
258
|
+
- STATEMENT_ALIAS
|
259
|
+
- STATEMENT_POSTEXE_END
|
260
|
+
- STATEMENT_PREEXE_BEGIN
|
261
|
+
- STATEMENT_UNDEF
|
262
|
+
- STRING_CONCATENATION
|
263
|
+
- STRING_INTERPOLATED_TERM
|
264
|
+
- STRING_LITERAL_EOF
|
265
|
+
- STRING_LITERAL_TERM
|
266
|
+
- SYMBOL_INVALID
|
267
|
+
- SYMBOL_TERM_DYNAMIC
|
268
|
+
- SYMBOL_TERM_INTERPOLATED
|
269
|
+
- TERNARY_COLON
|
270
|
+
- TERNARY_EXPRESSION_FALSE
|
271
|
+
- TERNARY_EXPRESSION_TRUE
|
272
|
+
- UNARY_DISALLOWED
|
273
|
+
- UNARY_RECEIVER
|
274
|
+
- UNDEF_ARGUMENT
|
275
|
+
- UNEXPECTED_BLOCK_ARGUMENT
|
276
|
+
- UNEXPECTED_INDEX_BLOCK
|
277
|
+
- UNEXPECTED_INDEX_KEYWORDS
|
278
|
+
- UNEXPECTED_LABEL
|
279
|
+
- UNEXPECTED_MULTI_WRITE
|
280
|
+
- UNEXPECTED_RANGE_OPERATOR
|
281
|
+
- UNEXPECTED_SAFE_NAVIGATION
|
282
|
+
- UNEXPECTED_TOKEN_CLOSE_CONTEXT
|
283
|
+
- UNEXPECTED_TOKEN_IGNORE
|
284
|
+
- UNTIL_TERM
|
285
|
+
- VOID_EXPRESSION
|
286
|
+
- WHILE_TERM
|
287
|
+
- WRITE_TARGET_IN_METHOD
|
288
|
+
- WRITE_TARGET_READONLY
|
289
|
+
- WRITE_TARGET_UNEXPECTED
|
290
|
+
- XSTRING_TERM
|
291
|
+
warnings:
|
292
|
+
- AMBIGUOUS_BINARY_OPERATOR
|
293
|
+
- AMBIGUOUS_FIRST_ARGUMENT_MINUS
|
294
|
+
- AMBIGUOUS_FIRST_ARGUMENT_PLUS
|
295
|
+
- AMBIGUOUS_PREFIX_AMPERSAND
|
296
|
+
- AMBIGUOUS_PREFIX_STAR
|
297
|
+
- AMBIGUOUS_PREFIX_STAR_STAR
|
298
|
+
- AMBIGUOUS_SLASH
|
299
|
+
- COMPARISON_AFTER_COMPARISON
|
300
|
+
- DOT_DOT_DOT_EOL
|
301
|
+
- EQUAL_IN_CONDITIONAL
|
302
|
+
- EQUAL_IN_CONDITIONAL_3_3
|
303
|
+
- END_IN_METHOD
|
304
|
+
- DUPLICATED_HASH_KEY
|
305
|
+
- DUPLICATED_WHEN_CLAUSE
|
306
|
+
- FLOAT_OUT_OF_RANGE
|
307
|
+
- IGNORED_FROZEN_STRING_LITERAL
|
308
|
+
- INDENTATION_MISMATCH
|
309
|
+
- INTEGER_IN_FLIP_FLOP
|
310
|
+
- INVALID_CHARACTER
|
311
|
+
- INVALID_MAGIC_COMMENT_VALUE
|
312
|
+
- INVALID_NUMBERED_REFERENCE
|
313
|
+
- KEYWORD_EOL
|
314
|
+
- LITERAL_IN_CONDITION_DEFAULT
|
315
|
+
- LITERAL_IN_CONDITION_VERBOSE
|
316
|
+
- SHAREABLE_CONSTANT_VALUE_LINE
|
317
|
+
- SHEBANG_CARRIAGE_RETURN
|
318
|
+
- UNEXPECTED_CARRIAGE_RETURN
|
319
|
+
- UNREACHABLE_STATEMENT
|
320
|
+
- UNUSED_LOCAL_VARIABLE
|
321
|
+
- VOID_STATEMENT
|
1
322
|
tokens:
|
2
323
|
- name: EOF
|
3
324
|
value: 1
|
@@ -331,8 +652,16 @@ tokens:
|
|
331
652
|
flags:
|
332
653
|
- name: ArgumentsNodeFlags
|
333
654
|
values:
|
655
|
+
- name: CONTAINS_FORWARDING
|
656
|
+
comment: "if the arguments contain forwarding"
|
657
|
+
- name: CONTAINS_KEYWORDS
|
658
|
+
comment: "if the arguments contain keywords"
|
334
659
|
- name: CONTAINS_KEYWORD_SPLAT
|
335
|
-
comment: "if arguments contain keyword splat"
|
660
|
+
comment: "if the arguments contain a keyword splat"
|
661
|
+
- name: CONTAINS_SPLAT
|
662
|
+
comment: "if the arguments contain a splat"
|
663
|
+
- name: CONTAINS_MULTIPLE_SPLATS
|
664
|
+
comment: "if the arguments contain multiple splats"
|
336
665
|
comment: Flags for arguments nodes.
|
337
666
|
- name: ArrayNodeFlags
|
338
667
|
values:
|
@@ -368,6 +697,13 @@ flags:
|
|
368
697
|
- name: HEXADECIMAL
|
369
698
|
comment: "0x prefix"
|
370
699
|
comment: Flags for integer nodes that correspond to the base of the integer.
|
700
|
+
- name: InterpolatedStringNodeFlags
|
701
|
+
values:
|
702
|
+
- name: FROZEN
|
703
|
+
comment: "frozen by virtue of a `frozen_string_literal: true` comment or `--enable-frozen-string-literal`; only for adjacent string literals like `'a' 'b'`"
|
704
|
+
- name: MUTABLE
|
705
|
+
comment: "mutable by virtue of a `frozen_string_literal: false` comment or `--disable-frozen-string-literal`; only for adjacent string literals like `'a' 'b'`"
|
706
|
+
comment: Flags for interpolated string nodes that indicated mutability if they are also marked as literals.
|
371
707
|
- name: KeywordHashNodeFlags
|
372
708
|
values:
|
373
709
|
- name: SYMBOL_KEYS
|
@@ -383,6 +719,11 @@ flags:
|
|
383
719
|
- name: REPEATED_PARAMETER
|
384
720
|
comment: "a parameter name that has been repeated in the method signature"
|
385
721
|
comment: Flags for parameter nodes.
|
722
|
+
- name: ParenthesesNodeFlags
|
723
|
+
values:
|
724
|
+
- name: MULTIPLE_STATEMENTS
|
725
|
+
comment: "parentheses that contain multiple potentially void statements"
|
726
|
+
comment: Flags for parentheses nodes.
|
386
727
|
- name: RangeFlags
|
387
728
|
values:
|
388
729
|
- name: EXCLUDE_END
|
@@ -413,6 +754,15 @@ flags:
|
|
413
754
|
- name: FORCED_US_ASCII_ENCODING
|
414
755
|
comment: "internal bytes forced the encoding to US-ASCII"
|
415
756
|
comment: Flags for regular expression and match last line nodes.
|
757
|
+
- name: ShareableConstantNodeFlags
|
758
|
+
values:
|
759
|
+
- name: LITERAL
|
760
|
+
comment: "constant writes that should be modified with shareable constant value literal"
|
761
|
+
- name: EXPERIMENTAL_EVERYTHING
|
762
|
+
comment: "constant writes that should be modified with shareable constant value experimental everything"
|
763
|
+
- name: EXPERIMENTAL_COPY
|
764
|
+
comment: "constant writes that should be modified with shareable constant value experimental copy"
|
765
|
+
comment: Flags for shareable constant nodes.
|
416
766
|
- name: StringFlags
|
417
767
|
values:
|
418
768
|
- name: FORCED_UTF8_ENCODING
|
@@ -420,7 +770,9 @@ flags:
|
|
420
770
|
- name: FORCED_BINARY_ENCODING
|
421
771
|
comment: "internal bytes forced the encoding to binary"
|
422
772
|
- name: FROZEN
|
423
|
-
comment: "frozen by virtue of a `frozen_string_literal` comment"
|
773
|
+
comment: "frozen by virtue of a `frozen_string_literal: true` comment or `--enable-frozen-string-literal`"
|
774
|
+
- name: MUTABLE
|
775
|
+
comment: "mutable by virtue of a `frozen_string_literal: false` comment or `--disable-frozen-string-literal`"
|
424
776
|
comment: Flags for string nodes.
|
425
777
|
- name: SymbolFlags
|
426
778
|
values:
|
@@ -436,10 +788,35 @@ nodes:
|
|
436
788
|
fields:
|
437
789
|
- name: new_name
|
438
790
|
type: node
|
791
|
+
kind:
|
792
|
+
- GlobalVariableReadNode
|
793
|
+
- BackReferenceReadNode
|
794
|
+
- NumberedReferenceReadNode
|
795
|
+
comment: |
|
796
|
+
Represents the new name of the global variable that can be used after aliasing.
|
797
|
+
|
798
|
+
alias $foo $bar
|
799
|
+
^^^^
|
439
800
|
- name: old_name
|
440
801
|
type: node
|
802
|
+
kind:
|
803
|
+
- GlobalVariableReadNode
|
804
|
+
- BackReferenceReadNode
|
805
|
+
- NumberedReferenceReadNode
|
806
|
+
- on error: SymbolNode # alias $a b
|
807
|
+
- on error: MissingNode # alias $a 42
|
808
|
+
comment: |
|
809
|
+
Represents the old name of the global variable that can be used before aliasing.
|
810
|
+
|
811
|
+
alias $foo $bar
|
812
|
+
^^^^
|
441
813
|
- name: keyword_loc
|
442
814
|
type: location
|
815
|
+
comment: |
|
816
|
+
The location of the `alias` keyword.
|
817
|
+
|
818
|
+
alias $foo $bar
|
819
|
+
^^^^^
|
443
820
|
comment: |
|
444
821
|
Represents the use of the `alias` keyword to alias a global variable.
|
445
822
|
|
@@ -449,10 +826,45 @@ nodes:
|
|
449
826
|
fields:
|
450
827
|
- name: new_name
|
451
828
|
type: node
|
829
|
+
kind:
|
830
|
+
- SymbolNode
|
831
|
+
- InterpolatedSymbolNode
|
832
|
+
comment: |
|
833
|
+
Represents the new name of the method that will be aliased.
|
834
|
+
|
835
|
+
alias foo bar
|
836
|
+
^^^
|
837
|
+
|
838
|
+
alias :foo :bar
|
839
|
+
^^^^
|
840
|
+
|
841
|
+
alias :"#{foo}" :"#{bar}"
|
842
|
+
^^^^^^^^^
|
452
843
|
- name: old_name
|
453
844
|
type: node
|
845
|
+
kind:
|
846
|
+
- SymbolNode
|
847
|
+
- InterpolatedSymbolNode
|
848
|
+
- on error: GlobalVariableReadNode # alias a $b
|
849
|
+
- on error: MissingNode # alias a 42
|
850
|
+
comment: |
|
851
|
+
Represents the old name of the method that will be aliased.
|
852
|
+
|
853
|
+
alias foo bar
|
854
|
+
^^^
|
855
|
+
|
856
|
+
alias :foo :bar
|
857
|
+
^^^^
|
858
|
+
|
859
|
+
alias :"#{foo}" :"#{bar}"
|
860
|
+
^^^^^^^^^
|
454
861
|
- name: keyword_loc
|
455
862
|
type: location
|
863
|
+
comment: |
|
864
|
+
Represents the location of the `alias` keyword.
|
865
|
+
|
866
|
+
alias foo bar
|
867
|
+
^^^^^
|
456
868
|
comment: |
|
457
869
|
Represents the use of the `alias` keyword to alias a method.
|
458
870
|
|
@@ -462,10 +874,27 @@ nodes:
|
|
462
874
|
fields:
|
463
875
|
- name: left
|
464
876
|
type: node
|
877
|
+
kind: pattern expression
|
878
|
+
comment: |
|
879
|
+
Represents the left side of the expression.
|
880
|
+
|
881
|
+
foo => bar | baz
|
882
|
+
^^^
|
465
883
|
- name: right
|
466
884
|
type: node
|
885
|
+
kind: pattern expression
|
886
|
+
comment: |
|
887
|
+
Represents the right side of the expression.
|
888
|
+
|
889
|
+
foo => bar | baz
|
890
|
+
^^^
|
467
891
|
- name: operator_loc
|
468
892
|
type: location
|
893
|
+
comment: |
|
894
|
+
Represents the alternation operator location.
|
895
|
+
|
896
|
+
foo => bar | baz
|
897
|
+
^
|
469
898
|
comment: |
|
470
899
|
Represents an alternation pattern in pattern matching.
|
471
900
|
|
@@ -475,6 +904,7 @@ nodes:
|
|
475
904
|
fields:
|
476
905
|
- name: left
|
477
906
|
type: node
|
907
|
+
kind: non-void expression
|
478
908
|
comment: |
|
479
909
|
Represents the left side of the expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
480
910
|
|
@@ -485,8 +915,9 @@ nodes:
|
|
485
915
|
^
|
486
916
|
- name: right
|
487
917
|
type: node
|
918
|
+
kind: Node
|
488
919
|
comment: |
|
489
|
-
Represents the right side of the expression.
|
920
|
+
Represents the right side of the expression.
|
490
921
|
|
491
922
|
left && right
|
492
923
|
^^^^^
|
@@ -506,28 +937,46 @@ nodes:
|
|
506
937
|
left and right
|
507
938
|
^^^^^^^^^^^^^^
|
508
939
|
- name: ArgumentsNode
|
940
|
+
flags: ArgumentsNodeFlags
|
509
941
|
fields:
|
510
|
-
- name: flags
|
511
|
-
type: flags
|
512
|
-
kind: ArgumentsNodeFlags
|
513
942
|
- name: arguments
|
514
943
|
type: node[]
|
944
|
+
kind: non-void expression
|
945
|
+
comment: |
|
946
|
+
The list of arguments, if present. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
947
|
+
|
948
|
+
foo(bar, baz)
|
949
|
+
^^^^^^^^
|
515
950
|
comment: |
|
516
951
|
Represents a set of arguments to a method or a keyword.
|
517
952
|
|
518
953
|
return foo, bar, baz
|
519
954
|
^^^^^^^^^^^^^
|
520
955
|
- name: ArrayNode
|
956
|
+
flags: ArrayNodeFlags
|
521
957
|
fields:
|
522
|
-
- name: flags
|
523
|
-
type: flags
|
524
|
-
kind: ArrayNodeFlags
|
525
958
|
- name: elements
|
526
959
|
type: node[]
|
960
|
+
kind: non-void expression
|
961
|
+
comment: Represent the list of zero or more [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression) within the array.
|
527
962
|
- name: opening_loc
|
528
963
|
type: location?
|
964
|
+
comment: |
|
965
|
+
Represents the optional source location for the opening token.
|
966
|
+
|
967
|
+
[1,2,3] # "["
|
968
|
+
%w[foo bar baz] # "%w["
|
969
|
+
%I(apple orange banana) # "%I("
|
970
|
+
foo = 1, 2, 3 # nil
|
529
971
|
- name: closing_loc
|
530
972
|
type: location?
|
973
|
+
comment: |
|
974
|
+
Represents the optional source location for the closing token.
|
975
|
+
|
976
|
+
[1,2,3] # "]"
|
977
|
+
%w[foo bar baz] # "]"
|
978
|
+
%I(apple orange banana) # ")"
|
979
|
+
foo = 1, 2, 3 # nil
|
531
980
|
comment: |
|
532
981
|
Represents an array literal. This can be a regular array using brackets or a special array using % like %w or %i.
|
533
982
|
|
@@ -537,16 +986,47 @@ nodes:
|
|
537
986
|
fields:
|
538
987
|
- name: constant
|
539
988
|
type: node?
|
989
|
+
kind:
|
990
|
+
- ConstantReadNode
|
991
|
+
- ConstantPathNode
|
540
992
|
- name: requireds
|
541
993
|
type: node[]
|
994
|
+
kind: pattern expression
|
995
|
+
comment: |
|
996
|
+
Represents the required elements of the array pattern.
|
997
|
+
|
998
|
+
foo in [1, 2]
|
999
|
+
^ ^
|
542
1000
|
- name: rest
|
543
1001
|
type: node?
|
1002
|
+
kind: pattern expression
|
1003
|
+
comment: |
|
1004
|
+
Represents the rest element of the array pattern.
|
1005
|
+
|
1006
|
+
foo in *bar
|
1007
|
+
^^^^
|
544
1008
|
- name: posts
|
545
1009
|
type: node[]
|
1010
|
+
kind: pattern expression
|
1011
|
+
comment: |
|
1012
|
+
Represents the elements after the rest element of the array pattern.
|
1013
|
+
|
1014
|
+
foo in *bar, baz
|
1015
|
+
^^^
|
546
1016
|
- name: opening_loc
|
547
1017
|
type: location?
|
1018
|
+
comment: |
|
1019
|
+
Represents the opening location of the array pattern.
|
1020
|
+
|
1021
|
+
foo in [1, 2]
|
1022
|
+
^
|
548
1023
|
- name: closing_loc
|
549
1024
|
type: location?
|
1025
|
+
comment: |
|
1026
|
+
Represents the closing location of the array pattern.
|
1027
|
+
|
1028
|
+
foo in [1, 2]
|
1029
|
+
^
|
550
1030
|
comment: |
|
551
1031
|
Represents an array pattern in pattern matching.
|
552
1032
|
|
@@ -556,8 +1036,8 @@ nodes:
|
|
556
1036
|
foo in [1, 2]
|
557
1037
|
^^^^^^^^^^^^^
|
558
1038
|
|
559
|
-
foo in *
|
560
|
-
|
1039
|
+
foo in *bar
|
1040
|
+
^^^^^^^^^^^
|
561
1041
|
|
562
1042
|
foo in Bar[]
|
563
1043
|
^^^^^^^^^^^^
|
@@ -568,6 +1048,7 @@ nodes:
|
|
568
1048
|
fields:
|
569
1049
|
- name: key
|
570
1050
|
type: node
|
1051
|
+
kind: non-void expression
|
571
1052
|
comment: |
|
572
1053
|
The key of the association. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
573
1054
|
|
@@ -581,6 +1062,7 @@ nodes:
|
|
581
1062
|
^^^^^^^^^^
|
582
1063
|
- name: value
|
583
1064
|
type: node
|
1065
|
+
kind: non-void expression
|
584
1066
|
comment: |
|
585
1067
|
The value of the association, if present. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
586
1068
|
|
@@ -605,6 +1087,7 @@ nodes:
|
|
605
1087
|
fields:
|
606
1088
|
- name: value
|
607
1089
|
type: node?
|
1090
|
+
kind: non-void expression
|
608
1091
|
comment: |
|
609
1092
|
The value to be splatted, if present. Will be missing when keyword rest argument forwarding is used.
|
610
1093
|
|
@@ -641,20 +1124,50 @@ nodes:
|
|
641
1124
|
fields:
|
642
1125
|
- name: begin_keyword_loc
|
643
1126
|
type: location?
|
1127
|
+
comment: |
|
1128
|
+
Represents the location of the `begin` keyword.
|
1129
|
+
|
1130
|
+
begin x end
|
1131
|
+
^^^^^
|
644
1132
|
- name: statements
|
645
1133
|
type: node?
|
646
1134
|
kind: StatementsNode
|
1135
|
+
comment: |
|
1136
|
+
Represents the statements within the begin block.
|
1137
|
+
|
1138
|
+
begin x end
|
1139
|
+
^
|
647
1140
|
- name: rescue_clause
|
648
1141
|
type: node?
|
649
1142
|
kind: RescueNode
|
1143
|
+
comment: |
|
1144
|
+
Represents the rescue clause within the begin block.
|
1145
|
+
|
1146
|
+
begin x; rescue y; end
|
1147
|
+
^^^^^^^^
|
650
1148
|
- name: else_clause
|
651
1149
|
type: node?
|
652
1150
|
kind: ElseNode
|
1151
|
+
comment: |
|
1152
|
+
Represents the else clause within the begin block.
|
1153
|
+
|
1154
|
+
begin x; rescue y; else z; end
|
1155
|
+
^^^^^^
|
653
1156
|
- name: ensure_clause
|
654
1157
|
type: node?
|
655
1158
|
kind: EnsureNode
|
1159
|
+
comment: |
|
1160
|
+
Represents the ensure clause within the begin block.
|
1161
|
+
|
1162
|
+
begin x; ensure y; end
|
1163
|
+
^^^^^^^^
|
656
1164
|
- name: end_keyword_loc
|
657
1165
|
type: location?
|
1166
|
+
comment: |
|
1167
|
+
Represents the location of the `end` keyword.
|
1168
|
+
|
1169
|
+
begin x end
|
1170
|
+
^^^
|
658
1171
|
newline: false
|
659
1172
|
comment: |
|
660
1173
|
Represents a begin statement.
|
@@ -667,20 +1180,34 @@ nodes:
|
|
667
1180
|
fields:
|
668
1181
|
- name: expression
|
669
1182
|
type: node?
|
1183
|
+
kind: non-void expression
|
1184
|
+
comment: |
|
1185
|
+
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).
|
1186
|
+
|
1187
|
+
foo(&args)
|
1188
|
+
^^^^^
|
670
1189
|
- name: operator_loc
|
671
1190
|
type: location
|
1191
|
+
comment: |
|
1192
|
+
Represents the location of the `&` operator.
|
1193
|
+
|
1194
|
+
foo(&args)
|
1195
|
+
^
|
672
1196
|
comment: |
|
673
|
-
Represents block
|
1197
|
+
Represents a block argument using `&`.
|
674
1198
|
|
675
1199
|
bar(&args)
|
676
1200
|
^^^^^^^^^^
|
677
1201
|
- name: BlockLocalVariableNode
|
1202
|
+
flags: ParameterFlags
|
678
1203
|
fields:
|
679
|
-
- name: flags
|
680
|
-
type: flags
|
681
|
-
kind: ParameterFlags
|
682
1204
|
- name: name
|
683
1205
|
type: constant
|
1206
|
+
comment: |
|
1207
|
+
The name of the block local variable.
|
1208
|
+
|
1209
|
+
a { |; b| } # name `:b`
|
1210
|
+
^
|
684
1211
|
comment: |
|
685
1212
|
Represents a block local variable.
|
686
1213
|
|
@@ -690,32 +1217,83 @@ nodes:
|
|
690
1217
|
fields:
|
691
1218
|
- name: locals
|
692
1219
|
type: constant[]
|
1220
|
+
comment: |
|
1221
|
+
The local variables declared in the block.
|
1222
|
+
|
1223
|
+
[1, 2, 3].each { |i| puts x } # locals: [:i]
|
1224
|
+
^
|
693
1225
|
- name: parameters
|
694
1226
|
type: node?
|
1227
|
+
kind:
|
1228
|
+
- BlockParametersNode
|
1229
|
+
- NumberedParametersNode
|
1230
|
+
- ItParametersNode
|
1231
|
+
comment: |
|
1232
|
+
The parameters of the block.
|
1233
|
+
|
1234
|
+
[1, 2, 3].each { |i| puts x }
|
1235
|
+
^^^
|
1236
|
+
[1, 2, 3].each { puts _1 }
|
1237
|
+
^^^^^^^^^^^
|
1238
|
+
[1, 2, 3].each { puts it }
|
1239
|
+
^^^^^^^^^^^
|
695
1240
|
- name: body
|
696
1241
|
type: node?
|
1242
|
+
kind:
|
1243
|
+
- StatementsNode
|
1244
|
+
- BeginNode
|
1245
|
+
comment: |
|
1246
|
+
The body of the block.
|
1247
|
+
|
1248
|
+
[1, 2, 3].each { |i| puts x }
|
1249
|
+
^^^^^^
|
697
1250
|
- name: opening_loc
|
698
1251
|
type: location
|
1252
|
+
comment: |
|
1253
|
+
Represents the location of the opening `|`.
|
1254
|
+
|
1255
|
+
[1, 2, 3].each { |i| puts x }
|
1256
|
+
^
|
699
1257
|
- name: closing_loc
|
700
1258
|
type: location
|
1259
|
+
comment: |
|
1260
|
+
Represents the location of the closing `|`.
|
1261
|
+
|
1262
|
+
[1, 2, 3].each { |i| puts x }
|
1263
|
+
^
|
701
1264
|
comment: |
|
702
1265
|
Represents a block of ruby code.
|
703
1266
|
|
704
1267
|
[1, 2, 3].each { |i| puts x }
|
705
1268
|
^^^^^^^^^^^^^^
|
706
1269
|
- name: BlockParameterNode
|
1270
|
+
flags: ParameterFlags
|
707
1271
|
fields:
|
708
|
-
- name: flags
|
709
|
-
type: flags
|
710
|
-
kind: ParameterFlags
|
711
1272
|
- name: name
|
712
1273
|
type: constant?
|
1274
|
+
comment: |
|
1275
|
+
The name of the block parameter.
|
1276
|
+
|
1277
|
+
def a(&b) # name `:b`
|
1278
|
+
^
|
1279
|
+
end
|
713
1280
|
- name: name_loc
|
714
1281
|
type: location?
|
1282
|
+
comment: |
|
1283
|
+
Represents the location of the block parameter name.
|
1284
|
+
|
1285
|
+
def a(&b)
|
1286
|
+
^
|
715
1287
|
- name: operator_loc
|
716
1288
|
type: location
|
1289
|
+
comment: |
|
1290
|
+
Represents the location of the `&` operator.
|
1291
|
+
|
1292
|
+
def a(&b)
|
1293
|
+
^
|
1294
|
+
end
|
717
1295
|
comment: |
|
718
|
-
Represents a block parameter
|
1296
|
+
Represents a block parameter of a method, block, or lambda definition.
|
719
1297
|
|
720
1298
|
def a(&b)
|
721
1299
|
^^
|
@@ -725,12 +1303,49 @@ nodes:
|
|
725
1303
|
- name: parameters
|
726
1304
|
type: node?
|
727
1305
|
kind: ParametersNode
|
1306
|
+
comment: |
|
1307
|
+
Represents the parameters of the block.
|
1308
|
+
|
1309
|
+
-> (a, b = 1; local) { }
|
1310
|
+
^^^^^^^^
|
1311
|
+
|
1312
|
+
foo do |a, b = 1; local|
|
1313
|
+
^^^^^^^^
|
1314
|
+
end
|
728
1315
|
- name: locals
|
729
1316
|
type: node[]
|
1317
|
+
kind: BlockLocalVariableNode
|
1318
|
+
comment: |
|
1319
|
+
Represents the local variables of the block.
|
1320
|
+
|
1321
|
+
-> (a, b = 1; local) { }
|
1322
|
+
^^^^^
|
1323
|
+
|
1324
|
+
foo do |a, b = 1; local|
|
1325
|
+
^^^^^
|
1326
|
+
end
|
730
1327
|
- name: opening_loc
|
731
1328
|
type: location?
|
1329
|
+
comment: |
|
1330
|
+
Represents the opening location of the block parameters.
|
1331
|
+
|
1332
|
+
-> (a, b = 1; local) { }
|
1333
|
+
^
|
1334
|
+
|
1335
|
+
foo do |a, b = 1; local|
|
1336
|
+
^
|
1337
|
+
end
|
732
1338
|
- name: closing_loc
|
733
1339
|
type: location?
|
1340
|
+
comment: |
|
1341
|
+
Represents the closing location of the block parameters.
|
1342
|
+
|
1343
|
+
-> (a, b = 1; local) { }
|
1344
|
+
^
|
1345
|
+
|
1346
|
+
foo do |a, b = 1; local|
|
1347
|
+
^
|
1348
|
+
end
|
734
1349
|
comment: |
|
735
1350
|
Represents a block's parameters declaration.
|
736
1351
|
|
@@ -745,44 +1360,88 @@ nodes:
|
|
745
1360
|
- name: arguments
|
746
1361
|
type: node?
|
747
1362
|
kind: ArgumentsNode
|
1363
|
+
comment: |
|
1364
|
+
The arguments to the break statement, if present. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1365
|
+
|
1366
|
+
break foo
|
1367
|
+
^^^
|
748
1368
|
- name: keyword_loc
|
749
1369
|
type: location
|
1370
|
+
comment: |
|
1371
|
+
The location of the `break` keyword.
|
1372
|
+
|
1373
|
+
break foo
|
1374
|
+
^^^^^
|
750
1375
|
comment: |
|
751
1376
|
Represents the use of the `break` keyword.
|
752
1377
|
|
753
1378
|
break foo
|
754
1379
|
^^^^^^^^^
|
755
1380
|
- name: CallAndWriteNode
|
1381
|
+
flags: CallNodeFlags
|
756
1382
|
fields:
|
757
|
-
- name: flags
|
758
|
-
type: flags
|
759
|
-
kind: CallNodeFlags
|
760
1383
|
- name: receiver
|
761
1384
|
type: node?
|
1385
|
+
kind: non-void expression
|
1386
|
+
comment: |
|
1387
|
+
The object that the method is being called on. This can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1388
|
+
|
1389
|
+
foo.bar &&= value
|
1390
|
+
^^^
|
762
1391
|
- name: call_operator_loc
|
763
1392
|
type: location?
|
1393
|
+
comment: |
|
1394
|
+
Represents the location of the call operator.
|
1395
|
+
|
1396
|
+
foo.bar &&= value
|
1397
|
+
^
|
764
1398
|
- name: message_loc
|
765
1399
|
type: location?
|
1400
|
+
comment: |
|
1401
|
+
Represents the location of the message.
|
1402
|
+
|
1403
|
+
foo.bar &&= value
|
1404
|
+
^^^
|
766
1405
|
- name: read_name
|
767
1406
|
type: constant
|
1407
|
+
comment: |
|
1408
|
+
Represents the name of the method being called.
|
1409
|
+
|
1410
|
+
foo.bar &&= value # read_name `:bar`
|
1411
|
+
^^^
|
768
1412
|
- name: write_name
|
769
1413
|
type: constant
|
1414
|
+
comment: |
|
1415
|
+
Represents the name of the method being written to.
|
1416
|
+
|
1417
|
+
foo.bar &&= value # write_name `:bar=`
|
1418
|
+
^^^
|
770
1419
|
- name: operator_loc
|
771
1420
|
type: location
|
1421
|
+
comment: |
|
1422
|
+
Represents the location of the operator.
|
1423
|
+
|
1424
|
+
foo.bar &&= value
|
1425
|
+
^^^
|
772
1426
|
- name: value
|
773
1427
|
type: node
|
1428
|
+
kind: non-void expression
|
1429
|
+
comment: |
|
1430
|
+
Represents the value being assigned.
|
1431
|
+
|
1432
|
+
foo.bar &&= value
|
1433
|
+
^^^^^
|
774
1434
|
comment: |
|
775
1435
|
Represents the use of the `&&=` operator on a call.
|
776
1436
|
|
777
1437
|
foo.bar &&= value
|
778
1438
|
^^^^^^^^^^^^^^^^^
|
779
1439
|
- name: CallNode
|
1440
|
+
flags: CallNodeFlags
|
780
1441
|
fields:
|
781
|
-
- name: flags
|
782
|
-
type: flags
|
783
|
-
kind: CallNodeFlags
|
784
1442
|
- name: receiver
|
785
1443
|
type: node?
|
1444
|
+
kind: non-void expression
|
786
1445
|
comment: |
|
787
1446
|
The object that the method is being called on. This can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
788
1447
|
|
@@ -796,19 +1455,59 @@ nodes:
|
|
796
1455
|
^^^
|
797
1456
|
- name: call_operator_loc
|
798
1457
|
type: location?
|
1458
|
+
comment: |
|
1459
|
+
Represents the location of the call operator.
|
1460
|
+
|
1461
|
+
foo.bar
|
1462
|
+
^
|
1463
|
+
|
1464
|
+
foo&.bar
|
1465
|
+
^^
|
799
1466
|
- name: name
|
800
1467
|
type: constant
|
1468
|
+
comment: |
|
1469
|
+
Represents the name of the method being called.
|
1470
|
+
|
1471
|
+
foo.bar # name `:foo`
|
1472
|
+
^^^
|
801
1473
|
- name: message_loc
|
802
1474
|
type: location?
|
1475
|
+
comment: |
|
1476
|
+
Represents the location of the message.
|
1477
|
+
|
1478
|
+
foo.bar
|
1479
|
+
^^^
|
803
1480
|
- name: opening_loc
|
804
1481
|
type: location?
|
1482
|
+
comment: |
|
1483
|
+
Represents the location of the left parenthesis.
|
1484
|
+
foo(bar)
|
1485
|
+
^
|
805
1486
|
- name: arguments
|
806
1487
|
type: node?
|
807
1488
|
kind: ArgumentsNode
|
1489
|
+
comment: |
|
1490
|
+
Represents the arguments to the method call. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1491
|
+
|
1492
|
+
foo(bar)
|
1493
|
+
^^^
|
808
1494
|
- name: closing_loc
|
809
1495
|
type: location?
|
1496
|
+
comment: |
|
1497
|
+
Represents the location of the right parenthesis.
|
1498
|
+
|
1499
|
+
foo(bar)
|
1500
|
+
^
|
810
1501
|
- name: block
|
811
1502
|
type: node?
|
1503
|
+
kind:
|
1504
|
+
- BlockNode
|
1505
|
+
- BlockArgumentNode
|
1506
|
+
comment: |
|
1507
|
+
Represents the block that is being passed to the method.
|
1508
|
+
|
1509
|
+
foo { |a| a }
|
1510
|
+
^^^^^^^^^
|
812
1511
|
comment: |
|
813
1512
|
Represents a method call, in all of the various forms that can take.
|
814
1513
|
|
@@ -830,68 +1529,162 @@ nodes:
|
|
830
1529
|
foo&.bar
|
831
1530
|
^^^^^^^^
|
832
1531
|
- name: CallOperatorWriteNode
|
1532
|
+
flags: CallNodeFlags
|
833
1533
|
fields:
|
834
|
-
- name: flags
|
835
|
-
type: flags
|
836
|
-
kind: CallNodeFlags
|
837
1534
|
- name: receiver
|
838
1535
|
type: node?
|
1536
|
+
kind: non-void expression
|
1537
|
+
comment: |
|
1538
|
+
The object that the method is being called on. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1539
|
+
|
1540
|
+
foo.bar += value
|
1541
|
+
^^^
|
839
1542
|
- name: call_operator_loc
|
840
1543
|
type: location?
|
1544
|
+
comment: |
|
1545
|
+
Represents the location of the call operator.
|
1546
|
+
|
1547
|
+
foo.bar += value
|
1548
|
+
^
|
841
1549
|
- name: message_loc
|
842
1550
|
type: location?
|
1551
|
+
comment: |
|
1552
|
+
Represents the location of the message.
|
1553
|
+
|
1554
|
+
foo.bar += value
|
1555
|
+
^^^
|
843
1556
|
- name: read_name
|
844
1557
|
type: constant
|
1558
|
+
comment: |
|
1559
|
+
Represents the name of the method being called.
|
1560
|
+
|
1561
|
+
foo.bar += value # read_name `:bar`
|
1562
|
+
^^^
|
845
1563
|
- name: write_name
|
846
1564
|
type: constant
|
847
|
-
|
1565
|
+
comment: |
|
1566
|
+
Represents the name of the method being written to.
|
1567
|
+
|
1568
|
+
foo.bar += value # write_name `:bar=`
|
1569
|
+
^^^
|
1570
|
+
- name: binary_operator
|
848
1571
|
type: constant
|
849
|
-
|
1572
|
+
comment: |
|
1573
|
+
Represents the binary operator being used.
|
1574
|
+
|
1575
|
+
foo.bar += value # binary_operator `:+`
|
1576
|
+
^
|
1577
|
+
- name: binary_operator_loc
|
850
1578
|
type: location
|
1579
|
+
comment: |
|
1580
|
+
Represents the location of the binary operator.
|
1581
|
+
|
1582
|
+
foo.bar += value
|
1583
|
+
^^
|
851
1584
|
- name: value
|
852
1585
|
type: node
|
1586
|
+
kind: non-void expression
|
1587
|
+
comment: |
|
1588
|
+
Represents the value being assigned.
|
1589
|
+
|
1590
|
+
foo.bar += value
|
1591
|
+
^^^^^
|
853
1592
|
comment: |
|
854
1593
|
Represents the use of an assignment operator on a call.
|
855
1594
|
|
856
1595
|
foo.bar += baz
|
857
1596
|
^^^^^^^^^^^^^^
|
858
1597
|
- name: CallOrWriteNode
|
1598
|
+
flags: CallNodeFlags
|
859
1599
|
fields:
|
860
|
-
- name: flags
|
861
|
-
type: flags
|
862
|
-
kind: CallNodeFlags
|
863
1600
|
- name: receiver
|
864
1601
|
type: node?
|
1602
|
+
kind: non-void expression
|
1603
|
+
comment: |
|
1604
|
+
The object that the method is being called on. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1605
|
+
|
1606
|
+
foo.bar ||= value
|
1607
|
+
^^^
|
865
1608
|
- name: call_operator_loc
|
866
1609
|
type: location?
|
1610
|
+
comment: |
|
1611
|
+
Represents the location of the call operator.
|
1612
|
+
|
1613
|
+
foo.bar ||= value
|
1614
|
+
^
|
867
1615
|
- name: message_loc
|
868
1616
|
type: location?
|
1617
|
+
comment: |
|
1618
|
+
Represents the location of the message.
|
1619
|
+
|
1620
|
+
foo.bar ||= value
|
1621
|
+
^^^
|
869
1622
|
- name: read_name
|
870
1623
|
type: constant
|
1624
|
+
comment: |
|
1625
|
+
Represents the name of the method being called.
|
1626
|
+
|
1627
|
+
foo.bar ||= value # read_name `:bar`
|
1628
|
+
^^^
|
871
1629
|
- name: write_name
|
872
1630
|
type: constant
|
1631
|
+
comment: |
|
1632
|
+
Represents the name of the method being written to.
|
1633
|
+
|
1634
|
+
foo.bar ||= value # write_name `:bar=`
|
1635
|
+
^^^
|
873
1636
|
- name: operator_loc
|
874
1637
|
type: location
|
1638
|
+
comment: |
|
1639
|
+
Represents the location of the operator.
|
1640
|
+
|
1641
|
+
foo.bar ||= value
|
1642
|
+
^^^
|
875
1643
|
- name: value
|
876
1644
|
type: node
|
1645
|
+
kind: non-void expression
|
1646
|
+
comment: |
|
1647
|
+
Represents the value being assigned.
|
1648
|
+
|
1649
|
+
foo.bar ||= value
|
1650
|
+
^^^^^
|
877
1651
|
comment: |
|
878
1652
|
Represents the use of the `||=` operator on a call.
|
879
1653
|
|
880
1654
|
foo.bar ||= value
|
881
1655
|
^^^^^^^^^^^^^^^^^
|
882
1656
|
- name: CallTargetNode
|
1657
|
+
flags: CallNodeFlags
|
883
1658
|
fields:
|
884
|
-
- name: flags
|
885
|
-
type: flags
|
886
|
-
kind: CallNodeFlags
|
887
1659
|
- name: receiver
|
888
1660
|
type: node
|
1661
|
+
kind: non-void expression
|
1662
|
+
comment: |
|
1663
|
+
The object that the method is being called on. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1664
|
+
|
1665
|
+
foo.bar = 1
|
1666
|
+
^^^
|
889
1667
|
- name: call_operator_loc
|
890
1668
|
type: location
|
1669
|
+
comment: |
|
1670
|
+
Represents the location of the call operator.
|
1671
|
+
|
1672
|
+
foo.bar = 1
|
1673
|
+
^
|
891
1674
|
- name: name
|
892
1675
|
type: constant
|
1676
|
+
comment: |
|
1677
|
+
Represents the name of the method being called.
|
1678
|
+
|
1679
|
+
foo.bar = 1 # name `:foo`
|
1680
|
+
^^^
|
893
1681
|
- name: message_loc
|
894
1682
|
type: location
|
1683
|
+
comment: |
|
1684
|
+
Represents the location of the message.
|
1685
|
+
|
1686
|
+
foo.bar = 1
|
1687
|
+
^^^
|
895
1688
|
comment: |
|
896
1689
|
Represents assigning to a method call.
|
897
1690
|
|
@@ -909,10 +1702,27 @@ nodes:
|
|
909
1702
|
fields:
|
910
1703
|
- name: value
|
911
1704
|
type: node
|
1705
|
+
kind: pattern expression
|
1706
|
+
comment: |
|
1707
|
+
Represents the value to capture.
|
1708
|
+
|
1709
|
+
foo => bar
|
1710
|
+
^^^
|
912
1711
|
- name: target
|
913
1712
|
type: node
|
1713
|
+
kind: LocalVariableTargetNode
|
1714
|
+
comment: |
|
1715
|
+
Represents the target of the capture.
|
1716
|
+
|
1717
|
+
foo => bar
|
1718
|
+
^^^
|
914
1719
|
- name: operator_loc
|
915
1720
|
type: location
|
1721
|
+
comment: |
|
1722
|
+
Represents the location of the `=>` operator.
|
1723
|
+
|
1724
|
+
foo => bar
|
1725
|
+
^^
|
916
1726
|
comment: |
|
917
1727
|
Represents assigning to a local variable in pattern matching.
|
918
1728
|
|
@@ -922,15 +1732,42 @@ nodes:
|
|
922
1732
|
fields:
|
923
1733
|
- name: predicate
|
924
1734
|
type: node?
|
1735
|
+
kind: non-void expression
|
1736
|
+
comment: |
|
1737
|
+
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).
|
1738
|
+
|
1739
|
+
case true; in false; end
|
1740
|
+
^^^^
|
925
1741
|
- name: conditions
|
926
1742
|
type: node[]
|
927
|
-
|
1743
|
+
kind: InNode
|
1744
|
+
comment: |
|
1745
|
+
Represents the conditions of the case match.
|
1746
|
+
|
1747
|
+
case true; in false; end
|
1748
|
+
^^^^^^^^
|
1749
|
+
- name: else_clause
|
928
1750
|
type: node?
|
929
1751
|
kind: ElseNode
|
1752
|
+
comment: |
|
1753
|
+
Represents the else clause of the case match.
|
1754
|
+
|
1755
|
+
case true; in false; else; end
|
1756
|
+
^^^^
|
930
1757
|
- name: case_keyword_loc
|
931
1758
|
type: location
|
1759
|
+
comment: |
|
1760
|
+
Represents the location of the `case` keyword.
|
1761
|
+
|
1762
|
+
case true; in false; end
|
1763
|
+
^^^^
|
932
1764
|
- name: end_keyword_loc
|
933
1765
|
type: location
|
1766
|
+
comment: |
|
1767
|
+
Represents the location of the `end` keyword.
|
1768
|
+
|
1769
|
+
case true; in false; end
|
1770
|
+
^^^
|
934
1771
|
comment: |
|
935
1772
|
Represents the use of a case statement for pattern matching.
|
936
1773
|
|
@@ -942,15 +1779,42 @@ nodes:
|
|
942
1779
|
fields:
|
943
1780
|
- name: predicate
|
944
1781
|
type: node?
|
1782
|
+
kind: non-void expression
|
1783
|
+
comment: |
|
1784
|
+
Represents the predicate of the case statement. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1785
|
+
|
1786
|
+
case true; when false; end
|
1787
|
+
^^^^
|
945
1788
|
- name: conditions
|
946
1789
|
type: node[]
|
947
|
-
|
1790
|
+
kind: WhenNode
|
1791
|
+
comment: |
|
1792
|
+
Represents the conditions of the case statement.
|
1793
|
+
|
1794
|
+
case true; when false; end
|
1795
|
+
^^^^^^^^^^
|
1796
|
+
- name: else_clause
|
948
1797
|
type: node?
|
949
1798
|
kind: ElseNode
|
1799
|
+
comment: |
|
1800
|
+
Represents the else clause of the case statement.
|
1801
|
+
|
1802
|
+
case true; when false; else; end
|
1803
|
+
^^^^
|
950
1804
|
- name: case_keyword_loc
|
951
1805
|
type: location
|
1806
|
+
comment: |
|
1807
|
+
Represents the location of the `case` keyword.
|
1808
|
+
|
1809
|
+
case true; when false; end
|
1810
|
+
^^^^
|
952
1811
|
- name: end_keyword_loc
|
953
1812
|
type: location
|
1813
|
+
comment: |
|
1814
|
+
Represents the location of the `end` keyword.
|
1815
|
+
|
1816
|
+
case true; when false; end
|
1817
|
+
^^^
|
954
1818
|
comment: |
|
955
1819
|
Represents the use of a case statement.
|
956
1820
|
|
@@ -966,12 +1830,20 @@ nodes:
|
|
966
1830
|
type: location
|
967
1831
|
- name: constant_path
|
968
1832
|
type: node
|
1833
|
+
kind:
|
1834
|
+
- ConstantReadNode
|
1835
|
+
- ConstantPathNode
|
1836
|
+
- on error: CallNode # class 0.X end
|
969
1837
|
- name: inheritance_operator_loc
|
970
1838
|
type: location?
|
971
1839
|
- name: superclass
|
972
1840
|
type: node?
|
1841
|
+
kind: non-void expression
|
973
1842
|
- name: body
|
974
1843
|
type: node?
|
1844
|
+
kind:
|
1845
|
+
- StatementsNode
|
1846
|
+
- BeginNode
|
975
1847
|
- name: end_keyword_loc
|
976
1848
|
type: location
|
977
1849
|
- name: name
|
@@ -985,12 +1857,33 @@ nodes:
|
|
985
1857
|
fields:
|
986
1858
|
- name: name
|
987
1859
|
type: constant
|
1860
|
+
comment: |
|
1861
|
+
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).
|
1862
|
+
|
1863
|
+
@@target &&= value # name `:@@target`
|
1864
|
+
^^^^^^^^
|
988
1865
|
- name: name_loc
|
989
1866
|
type: location
|
1867
|
+
comment: |
|
1868
|
+
Represents the location of the variable name.
|
1869
|
+
|
1870
|
+
@@target &&= value
|
1871
|
+
^^^^^^^^
|
990
1872
|
- name: operator_loc
|
991
1873
|
type: location
|
1874
|
+
comment: |
|
1875
|
+
Represents the location of the `&&=` operator.
|
1876
|
+
|
1877
|
+
@@target &&= value
|
1878
|
+
^^^
|
992
1879
|
- name: value
|
993
1880
|
type: node
|
1881
|
+
kind: non-void expression
|
1882
|
+
comment: |
|
1883
|
+
Represents the value being assigned. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1884
|
+
|
1885
|
+
@@target &&= value
|
1886
|
+
^^^^^
|
994
1887
|
comment: |
|
995
1888
|
Represents the use of the `&&=` operator for assignment to a class variable.
|
996
1889
|
|
@@ -1002,11 +1895,12 @@ nodes:
|
|
1002
1895
|
type: constant
|
1003
1896
|
- name: name_loc
|
1004
1897
|
type: location
|
1005
|
-
- name:
|
1898
|
+
- name: binary_operator_loc
|
1006
1899
|
type: location
|
1007
1900
|
- name: value
|
1008
1901
|
type: node
|
1009
|
-
|
1902
|
+
kind: non-void expression
|
1903
|
+
- name: binary_operator
|
1010
1904
|
type: constant
|
1011
1905
|
comment: |
|
1012
1906
|
Represents assigning to a class variable using an operator that isn't `=`.
|
@@ -1023,6 +1917,7 @@ nodes:
|
|
1023
1917
|
type: location
|
1024
1918
|
- name: value
|
1025
1919
|
type: node
|
1920
|
+
kind: non-void expression
|
1026
1921
|
comment: |
|
1027
1922
|
Represents the use of the `||=` operator for assignment to a class variable.
|
1028
1923
|
|
@@ -1056,12 +1951,37 @@ nodes:
|
|
1056
1951
|
fields:
|
1057
1952
|
- name: name
|
1058
1953
|
type: constant
|
1954
|
+
comment: |
|
1955
|
+
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).
|
1956
|
+
|
1957
|
+
@@abc = 123 # name `@@abc`
|
1958
|
+
|
1959
|
+
@@_test = :test # name `@@_test`
|
1059
1960
|
- name: name_loc
|
1060
1961
|
type: location
|
1962
|
+
comment: |
|
1963
|
+
The location of the variable name.
|
1964
|
+
|
1965
|
+
@@foo = :bar
|
1966
|
+
^^^^^
|
1061
1967
|
- name: value
|
1062
1968
|
type: node
|
1969
|
+
kind: non-void expression
|
1970
|
+
comment: |
|
1971
|
+
The value to write to the class variable. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1972
|
+
|
1973
|
+
@@foo = :bar
|
1974
|
+
^^^^
|
1975
|
+
|
1976
|
+
@@_xyz = 123
|
1977
|
+
^^^
|
1063
1978
|
- name: operator_loc
|
1064
|
-
type: location
|
1979
|
+
type: location
|
1980
|
+
comment: |
|
1981
|
+
The location of the `=` operator.
|
1982
|
+
|
1983
|
+
@@foo = :bar
|
1984
|
+
^
|
1065
1985
|
comment: |
|
1066
1986
|
Represents writing to a class variable.
|
1067
1987
|
|
@@ -1077,6 +1997,7 @@ nodes:
|
|
1077
1997
|
type: location
|
1078
1998
|
- name: value
|
1079
1999
|
type: node
|
2000
|
+
kind: non-void expression
|
1080
2001
|
comment: |
|
1081
2002
|
Represents the use of the `&&=` operator for assignment to a constant.
|
1082
2003
|
|
@@ -1088,11 +2009,12 @@ nodes:
|
|
1088
2009
|
type: constant
|
1089
2010
|
- name: name_loc
|
1090
2011
|
type: location
|
1091
|
-
- name:
|
2012
|
+
- name: binary_operator_loc
|
1092
2013
|
type: location
|
1093
2014
|
- name: value
|
1094
2015
|
type: node
|
1095
|
-
|
2016
|
+
kind: non-void expression
|
2017
|
+
- name: binary_operator
|
1096
2018
|
type: constant
|
1097
2019
|
comment: |
|
1098
2020
|
Represents assigning to a constant using an operator that isn't `=`.
|
@@ -1109,6 +2031,7 @@ nodes:
|
|
1109
2031
|
type: location
|
1110
2032
|
- name: value
|
1111
2033
|
type: node
|
2034
|
+
kind: non-void expression
|
1112
2035
|
comment: |
|
1113
2036
|
Represents the use of the `||=` operator for assignment to a constant.
|
1114
2037
|
|
@@ -1123,6 +2046,7 @@ nodes:
|
|
1123
2046
|
type: location
|
1124
2047
|
- name: value
|
1125
2048
|
type: node
|
2049
|
+
kind: non-void expression
|
1126
2050
|
comment: |
|
1127
2051
|
Represents the use of the `&&=` operator for assignment to a constant path.
|
1128
2052
|
|
@@ -1132,10 +2056,41 @@ nodes:
|
|
1132
2056
|
fields:
|
1133
2057
|
- name: parent
|
1134
2058
|
type: node?
|
1135
|
-
|
1136
|
-
|
2059
|
+
kind: non-void expression
|
2060
|
+
comment: |
|
2061
|
+
The left-hand node of the path, if present. It can be `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression). It will be `nil` when the constant lookup is at the root of the module tree.
|
2062
|
+
|
2063
|
+
Foo::Bar
|
2064
|
+
^^^
|
2065
|
+
|
2066
|
+
self::Test
|
2067
|
+
^^^^
|
2068
|
+
|
2069
|
+
a.b::C
|
2070
|
+
^^^
|
2071
|
+
- name: name
|
2072
|
+
type: constant?
|
2073
|
+
comment: The name of the constant being accessed. This could be `nil` in the event of a syntax error.
|
1137
2074
|
- name: delimiter_loc
|
1138
2075
|
type: location
|
2076
|
+
comment: |
|
2077
|
+
The location of the `::` delimiter.
|
2078
|
+
|
2079
|
+
::Foo
|
2080
|
+
^^
|
2081
|
+
|
2082
|
+
One::Two
|
2083
|
+
^^
|
2084
|
+
- name: name_loc
|
2085
|
+
type: location
|
2086
|
+
comment: |
|
2087
|
+
The location of the name of the constant.
|
2088
|
+
|
2089
|
+
::Foo
|
2090
|
+
^^^
|
2091
|
+
|
2092
|
+
One::Two
|
2093
|
+
^^^
|
1139
2094
|
comment: |
|
1140
2095
|
Represents accessing a constant through a path of `::` operators.
|
1141
2096
|
|
@@ -1146,11 +2101,12 @@ nodes:
|
|
1146
2101
|
- name: target
|
1147
2102
|
type: node
|
1148
2103
|
kind: ConstantPathNode
|
1149
|
-
- name:
|
2104
|
+
- name: binary_operator_loc
|
1150
2105
|
type: location
|
1151
2106
|
- name: value
|
1152
2107
|
type: node
|
1153
|
-
|
2108
|
+
kind: non-void expression
|
2109
|
+
- name: binary_operator
|
1154
2110
|
type: constant
|
1155
2111
|
comment: |
|
1156
2112
|
Represents assigning to a constant path using an operator that isn't `=`.
|
@@ -1166,6 +2122,7 @@ nodes:
|
|
1166
2122
|
type: location
|
1167
2123
|
- name: value
|
1168
2124
|
type: node
|
2125
|
+
kind: non-void expression
|
1169
2126
|
comment: |
|
1170
2127
|
Represents the use of the `||=` operator for assignment to a constant path.
|
1171
2128
|
|
@@ -1175,10 +2132,13 @@ nodes:
|
|
1175
2132
|
fields:
|
1176
2133
|
- name: parent
|
1177
2134
|
type: node?
|
1178
|
-
|
1179
|
-
|
2135
|
+
kind: non-void expression
|
2136
|
+
- name: name
|
2137
|
+
type: constant?
|
1180
2138
|
- name: delimiter_loc
|
1181
2139
|
type: location
|
2140
|
+
- name: name_loc
|
2141
|
+
type: location
|
1182
2142
|
comment: |
|
1183
2143
|
Represents writing to a constant path in a context that doesn't have an explicit value.
|
1184
2144
|
|
@@ -1189,10 +2149,29 @@ nodes:
|
|
1189
2149
|
- name: target
|
1190
2150
|
type: node
|
1191
2151
|
kind: ConstantPathNode
|
2152
|
+
comment: |
|
2153
|
+
A node representing the constant path being written to.
|
2154
|
+
|
2155
|
+
Foo::Bar = 1
|
2156
|
+
^^^^^^^^
|
2157
|
+
|
2158
|
+
::Foo = :abc
|
2159
|
+
^^^^^
|
1192
2160
|
- name: operator_loc
|
1193
2161
|
type: location
|
2162
|
+
comment: |
|
2163
|
+
The location of the `=` operator.
|
2164
|
+
|
2165
|
+
::ABC = 123
|
2166
|
+
^
|
1194
2167
|
- name: value
|
1195
2168
|
type: node
|
2169
|
+
kind: non-void expression
|
2170
|
+
comment: |
|
2171
|
+
The value to write to the constant path. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
2172
|
+
|
2173
|
+
FOO::BAR = :abc
|
2174
|
+
^^^^
|
1196
2175
|
comment: |
|
1197
2176
|
Represents writing to a constant path.
|
1198
2177
|
|
@@ -1232,12 +2211,37 @@ nodes:
|
|
1232
2211
|
fields:
|
1233
2212
|
- name: name
|
1234
2213
|
type: constant
|
2214
|
+
comment: |
|
2215
|
+
The name of the [constant](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#constants).
|
2216
|
+
|
2217
|
+
Foo = :bar # name `:Foo`
|
2218
|
+
|
2219
|
+
XYZ = 1 # name `:XYZ`
|
1235
2220
|
- name: name_loc
|
1236
2221
|
type: location
|
2222
|
+
comment: |
|
2223
|
+
The location of the constant name.
|
2224
|
+
|
2225
|
+
FOO = 1
|
2226
|
+
^^^
|
1237
2227
|
- name: value
|
1238
2228
|
type: node
|
2229
|
+
kind: non-void expression
|
2230
|
+
comment: |
|
2231
|
+
The value to write to the constant. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
2232
|
+
|
2233
|
+
FOO = :bar
|
2234
|
+
^^^^
|
2235
|
+
|
2236
|
+
MyClass = Class.new
|
2237
|
+
^^^^^^^^^
|
1239
2238
|
- name: operator_loc
|
1240
2239
|
type: location
|
2240
|
+
comment: |
|
2241
|
+
The location of the `=` operator.
|
2242
|
+
|
2243
|
+
FOO = :bar
|
2244
|
+
^
|
1241
2245
|
comment: |
|
1242
2246
|
Represents writing to a constant.
|
1243
2247
|
|
@@ -1251,11 +2255,15 @@ nodes:
|
|
1251
2255
|
type: location
|
1252
2256
|
- name: receiver
|
1253
2257
|
type: node?
|
2258
|
+
kind: non-void expression
|
1254
2259
|
- name: parameters
|
1255
2260
|
type: node?
|
1256
2261
|
kind: ParametersNode
|
1257
2262
|
- name: body
|
1258
2263
|
type: node?
|
2264
|
+
kind:
|
2265
|
+
- StatementsNode
|
2266
|
+
- BeginNode
|
1259
2267
|
- name: locals
|
1260
2268
|
type: constant[]
|
1261
2269
|
- name: def_keyword_loc
|
@@ -1282,6 +2290,7 @@ nodes:
|
|
1282
2290
|
type: location?
|
1283
2291
|
- name: value
|
1284
2292
|
type: node
|
2293
|
+
kind: Node # More than non-void expression as defined?(return) is allowed, yet defined?(BEGIN{}) is SyntaxError
|
1285
2294
|
- name: rparen_loc
|
1286
2295
|
type: location?
|
1287
2296
|
- name: keyword_loc
|
@@ -1325,6 +2334,12 @@ nodes:
|
|
1325
2334
|
type: location
|
1326
2335
|
- name: variable
|
1327
2336
|
type: node
|
2337
|
+
kind:
|
2338
|
+
- InstanceVariableReadNode
|
2339
|
+
- ClassVariableReadNode
|
2340
|
+
- GlobalVariableReadNode
|
2341
|
+
- BackReferenceReadNode
|
2342
|
+
- NumberedReferenceReadNode
|
1328
2343
|
comment: |
|
1329
2344
|
Represents an interpolated variable.
|
1330
2345
|
|
@@ -1358,12 +2373,20 @@ nodes:
|
|
1358
2373
|
fields:
|
1359
2374
|
- name: constant
|
1360
2375
|
type: node?
|
2376
|
+
kind:
|
2377
|
+
- ConstantReadNode
|
2378
|
+
- ConstantPathNode
|
1361
2379
|
- name: left
|
1362
2380
|
type: node
|
2381
|
+
kind: SplatNode
|
1363
2382
|
- name: requireds
|
1364
2383
|
type: node[]
|
2384
|
+
kind: pattern expression
|
1365
2385
|
- name: right
|
1366
2386
|
type: node
|
2387
|
+
kind:
|
2388
|
+
- SplatNode
|
2389
|
+
- on error: MissingNode
|
1367
2390
|
- name: opening_loc
|
1368
2391
|
type: location?
|
1369
2392
|
- name: closing_loc
|
@@ -1380,14 +2403,14 @@ nodes:
|
|
1380
2403
|
foo in Foo(*bar, baz, *qux)
|
1381
2404
|
^^^^^^^^^^^^^^^^^^^^
|
1382
2405
|
- name: FlipFlopNode
|
2406
|
+
flags: RangeFlags
|
1383
2407
|
fields:
|
1384
|
-
- name: flags
|
1385
|
-
type: flags
|
1386
|
-
kind: RangeFlags
|
1387
2408
|
- name: left
|
1388
2409
|
type: node?
|
2410
|
+
kind: non-void expression
|
1389
2411
|
- name: right
|
1390
2412
|
type: node?
|
2413
|
+
kind: non-void expression
|
1391
2414
|
- name: operator_loc
|
1392
2415
|
type: location
|
1393
2416
|
comment: |
|
@@ -1396,6 +2419,10 @@ nodes:
|
|
1396
2419
|
baz if foo .. bar
|
1397
2420
|
^^^^^^^^^^
|
1398
2421
|
- name: FloatNode
|
2422
|
+
fields:
|
2423
|
+
- name: value
|
2424
|
+
type: double
|
2425
|
+
comment: The value of the floating point number as a Float.
|
1399
2426
|
comment: |
|
1400
2427
|
Represents a floating point number literal.
|
1401
2428
|
|
@@ -1405,19 +2432,70 @@ nodes:
|
|
1405
2432
|
fields:
|
1406
2433
|
- name: index
|
1407
2434
|
type: node
|
2435
|
+
kind:
|
2436
|
+
- LocalVariableTargetNode
|
2437
|
+
- InstanceVariableTargetNode
|
2438
|
+
- ClassVariableTargetNode
|
2439
|
+
- GlobalVariableTargetNode
|
2440
|
+
- ConstantTargetNode
|
2441
|
+
- ConstantPathTargetNode
|
2442
|
+
- CallTargetNode
|
2443
|
+
- IndexTargetNode
|
2444
|
+
- MultiTargetNode
|
2445
|
+
- on error: BackReferenceReadNode # for $& in a end
|
2446
|
+
- on error: NumberedReferenceReadNode # for $1 in a end
|
2447
|
+
- on error: MissingNode # for in 1..10; end
|
2448
|
+
comment: |
|
2449
|
+
The index expression for `for` loops.
|
2450
|
+
|
2451
|
+
for i in a end
|
2452
|
+
^
|
1408
2453
|
- name: collection
|
1409
2454
|
type: node
|
2455
|
+
kind: non-void expression
|
2456
|
+
comment: |
|
2457
|
+
The collection to iterate over.
|
2458
|
+
|
2459
|
+
for i in a end
|
2460
|
+
^
|
1410
2461
|
- name: statements
|
1411
2462
|
type: node?
|
1412
2463
|
kind: StatementsNode
|
2464
|
+
comment: |
|
2465
|
+
Represents the body of statements to execute for each iteration of the loop.
|
2466
|
+
|
2467
|
+
for i in a
|
2468
|
+
foo(i)
|
2469
|
+
^^^^^^
|
2470
|
+
end
|
1413
2471
|
- name: for_keyword_loc
|
1414
2472
|
type: location
|
2473
|
+
comment: |
|
2474
|
+
The location of the `for` keyword.
|
2475
|
+
|
2476
|
+
for i in a end
|
2477
|
+
^^^
|
1415
2478
|
- name: in_keyword_loc
|
1416
2479
|
type: location
|
2480
|
+
comment: |
|
2481
|
+
The location of the `in` keyword.
|
2482
|
+
|
2483
|
+
for i in a end
|
2484
|
+
^^
|
1417
2485
|
- name: do_keyword_loc
|
1418
2486
|
type: location?
|
2487
|
+
comment: |
|
2488
|
+
The location of the `do` keyword, if present.
|
2489
|
+
|
2490
|
+
for i in a do end
|
2491
|
+
^^
|
1419
2492
|
- name: end_keyword_loc
|
1420
2493
|
type: location
|
2494
|
+
comment: |
|
2495
|
+
The location of the `end` keyword.
|
2496
|
+
|
2497
|
+
for i in a end
|
2498
|
+
^^^
|
1421
2499
|
comment: |
|
1422
2500
|
Represents the use of the `for` keyword.
|
1423
2501
|
|
@@ -1458,6 +2536,7 @@ nodes:
|
|
1458
2536
|
type: location
|
1459
2537
|
- name: value
|
1460
2538
|
type: node
|
2539
|
+
kind: non-void expression
|
1461
2540
|
comment: |
|
1462
2541
|
Represents the use of the `&&=` operator for assignment to a global variable.
|
1463
2542
|
|
@@ -1469,11 +2548,12 @@ nodes:
|
|
1469
2548
|
type: constant
|
1470
2549
|
- name: name_loc
|
1471
2550
|
type: location
|
1472
|
-
- name:
|
2551
|
+
- name: binary_operator_loc
|
1473
2552
|
type: location
|
1474
2553
|
- name: value
|
1475
2554
|
type: node
|
1476
|
-
|
2555
|
+
kind: non-void expression
|
2556
|
+
- name: binary_operator
|
1477
2557
|
type: constant
|
1478
2558
|
comment: |
|
1479
2559
|
Represents assigning to a global variable using an operator that isn't `=`.
|
@@ -1490,6 +2570,7 @@ nodes:
|
|
1490
2570
|
type: location
|
1491
2571
|
- name: value
|
1492
2572
|
type: node
|
2573
|
+
kind: non-void expression
|
1493
2574
|
comment: |
|
1494
2575
|
Represents the use of the `||=` operator for assignment to a global variable.
|
1495
2576
|
|
@@ -1523,12 +2604,37 @@ nodes:
|
|
1523
2604
|
fields:
|
1524
2605
|
- name: name
|
1525
2606
|
type: constant
|
2607
|
+
comment: |
|
2608
|
+
The name of the global variable, which is a `$` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifier). Alternatively, it can be one of the special global variables designated by a symbol.
|
2609
|
+
|
2610
|
+
$foo = :bar # name `:$foo`
|
2611
|
+
|
2612
|
+
$_Test = 123 # name `:$_Test`
|
1526
2613
|
- name: name_loc
|
1527
2614
|
type: location
|
2615
|
+
comment: |
|
2616
|
+
The location of the global variable's name.
|
2617
|
+
|
2618
|
+
$foo = :bar
|
2619
|
+
^^^^
|
1528
2620
|
- name: value
|
1529
2621
|
type: node
|
2622
|
+
kind: non-void expression
|
2623
|
+
comment: |
|
2624
|
+
The value to write to the global variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
2625
|
+
|
2626
|
+
$foo = :bar
|
2627
|
+
^^^^
|
2628
|
+
|
2629
|
+
$-xyz = 123
|
2630
|
+
^^^
|
1530
2631
|
- name: operator_loc
|
1531
2632
|
type: location
|
2633
|
+
comment: |
|
2634
|
+
The location of the `=` operator.
|
2635
|
+
|
2636
|
+
$foo = :bar
|
2637
|
+
^
|
1532
2638
|
comment: |
|
1533
2639
|
Represents writing to a global variable.
|
1534
2640
|
|
@@ -1545,6 +2651,9 @@ nodes:
|
|
1545
2651
|
^
|
1546
2652
|
- name: elements
|
1547
2653
|
type: node[]
|
2654
|
+
kind:
|
2655
|
+
- AssocNode
|
2656
|
+
- AssocSplatNode
|
1548
2657
|
comment: |
|
1549
2658
|
The elements of the hash. These can be either `AssocNode`s or `AssocSplatNode`s.
|
1550
2659
|
|
@@ -1569,10 +2678,17 @@ nodes:
|
|
1569
2678
|
fields:
|
1570
2679
|
- name: constant
|
1571
2680
|
type: node?
|
2681
|
+
kind:
|
2682
|
+
- ConstantReadNode
|
2683
|
+
- ConstantPathNode
|
1572
2684
|
- name: elements
|
1573
2685
|
type: node[]
|
2686
|
+
kind: AssocNode
|
1574
2687
|
- name: rest
|
1575
2688
|
type: node?
|
2689
|
+
kind:
|
2690
|
+
- AssocSplatNode
|
2691
|
+
- NoKeywordsParameterNode
|
1576
2692
|
- name: opening_loc
|
1577
2693
|
type: location?
|
1578
2694
|
- name: closing_loc
|
@@ -1589,30 +2705,99 @@ nodes:
|
|
1589
2705
|
fields:
|
1590
2706
|
- name: if_keyword_loc
|
1591
2707
|
type: location?
|
2708
|
+
comment: |
|
2709
|
+
The location of the `if` keyword if present.
|
2710
|
+
|
2711
|
+
bar if foo
|
2712
|
+
^^
|
2713
|
+
|
2714
|
+
The `if_keyword_loc` field will be `nil` when the `IfNode` represents a ternary expression.
|
1592
2715
|
- name: predicate
|
1593
2716
|
type: node
|
2717
|
+
kind: non-void expression
|
2718
|
+
comment: |
|
2719
|
+
The node for the condition the `IfNode` is testing.
|
2720
|
+
|
2721
|
+
if foo
|
2722
|
+
^^^
|
2723
|
+
bar
|
2724
|
+
end
|
2725
|
+
|
2726
|
+
bar if foo
|
2727
|
+
^^^
|
2728
|
+
|
2729
|
+
foo ? bar : baz
|
2730
|
+
^^^
|
1594
2731
|
- name: then_keyword_loc
|
1595
2732
|
type: location?
|
2733
|
+
comment: |
|
2734
|
+
The location of the `then` keyword (if present) or the `?` in a ternary expression, `nil` otherwise.
|
2735
|
+
|
2736
|
+
if foo then bar end
|
2737
|
+
^^^^
|
2738
|
+
|
2739
|
+
a ? b : c
|
2740
|
+
^
|
1596
2741
|
- name: statements
|
1597
2742
|
type: node?
|
1598
2743
|
kind: StatementsNode
|
1599
|
-
|
2744
|
+
comment: |
|
2745
|
+
Represents the body of statements that will be executed when the predicate is evaluated as truthy. Will be `nil` when no body is provided.
|
2746
|
+
|
2747
|
+
if foo
|
2748
|
+
bar
|
2749
|
+
^^^
|
2750
|
+
baz
|
2751
|
+
^^^
|
2752
|
+
end
|
2753
|
+
- name: subsequent
|
1600
2754
|
type: node?
|
2755
|
+
kind:
|
2756
|
+
- ElseNode
|
2757
|
+
- IfNode
|
2758
|
+
comment: |
|
2759
|
+
Represents an `ElseNode` or an `IfNode` when there is an `else` or an `elsif` in the `if` statement.
|
2760
|
+
|
2761
|
+
if foo
|
2762
|
+
bar
|
2763
|
+
elsif baz
|
2764
|
+
^^^^^^^^^
|
2765
|
+
qux
|
2766
|
+
^^^
|
2767
|
+
end
|
2768
|
+
^^^
|
2769
|
+
|
2770
|
+
if foo then bar else baz end
|
2771
|
+
^^^^^^^^^^^^
|
1601
2772
|
- name: end_keyword_loc
|
1602
2773
|
type: location?
|
2774
|
+
comment: |
|
2775
|
+
The location of the `end` keyword if present, `nil` otherwise.
|
2776
|
+
|
2777
|
+
if foo
|
2778
|
+
bar
|
2779
|
+
end
|
2780
|
+
^^^
|
1603
2781
|
newline: predicate
|
1604
2782
|
comment: |
|
1605
|
-
Represents the use of the `if` keyword, either in the block form or the modifier form.
|
2783
|
+
Represents the use of the `if` keyword, either in the block form or the modifier form, or a ternary expression.
|
1606
2784
|
|
1607
2785
|
bar if foo
|
1608
2786
|
^^^^^^^^^^
|
1609
2787
|
|
1610
2788
|
if foo then bar end
|
1611
2789
|
^^^^^^^^^^^^^^^^^^^
|
2790
|
+
|
2791
|
+
foo ? bar : baz
|
2792
|
+
^^^^^^^^^^^^^^^
|
1612
2793
|
- name: ImaginaryNode
|
1613
2794
|
fields:
|
1614
2795
|
- name: numeric
|
1615
2796
|
type: node
|
2797
|
+
kind:
|
2798
|
+
- FloatNode
|
2799
|
+
- IntegerNode
|
2800
|
+
- RationalNode
|
1616
2801
|
comment: |
|
1617
2802
|
Represents an imaginary number literal.
|
1618
2803
|
|
@@ -1622,6 +2807,11 @@ nodes:
|
|
1622
2807
|
fields:
|
1623
2808
|
- name: value
|
1624
2809
|
type: node
|
2810
|
+
kind:
|
2811
|
+
- LocalVariableReadNode
|
2812
|
+
- CallNode
|
2813
|
+
- ConstantReadNode
|
2814
|
+
- LocalVariableTargetNode
|
1625
2815
|
comment: |
|
1626
2816
|
Represents a node that is implicitly being added to the tree but doesn't correspond directly to a node in the source.
|
1627
2817
|
|
@@ -1652,6 +2842,7 @@ nodes:
|
|
1652
2842
|
fields:
|
1653
2843
|
- name: pattern
|
1654
2844
|
type: node
|
2845
|
+
kind: pattern expression
|
1655
2846
|
- name: statements
|
1656
2847
|
type: node?
|
1657
2848
|
kind: StatementsNode
|
@@ -1665,12 +2856,11 @@ nodes:
|
|
1665
2856
|
case a; in b then c end
|
1666
2857
|
^^^^^^^^^^^
|
1667
2858
|
- name: IndexAndWriteNode
|
2859
|
+
flags: CallNodeFlags
|
1668
2860
|
fields:
|
1669
|
-
- name: flags
|
1670
|
-
type: flags
|
1671
|
-
kind: CallNodeFlags
|
1672
2861
|
- name: receiver
|
1673
2862
|
type: node?
|
2863
|
+
kind: non-void expression
|
1674
2864
|
- name: call_operator_loc
|
1675
2865
|
type: location?
|
1676
2866
|
- name: opening_loc
|
@@ -1682,22 +2872,23 @@ nodes:
|
|
1682
2872
|
type: location
|
1683
2873
|
- name: block
|
1684
2874
|
type: node?
|
2875
|
+
kind: BlockArgumentNode # foo[&b] &&= value, only valid on Ruby < 3.4
|
1685
2876
|
- name: operator_loc
|
1686
2877
|
type: location
|
1687
2878
|
- name: value
|
1688
2879
|
type: node
|
2880
|
+
kind: non-void expression
|
1689
2881
|
comment: |
|
1690
2882
|
Represents the use of the `&&=` operator on a call to the `[]` method.
|
1691
2883
|
|
1692
2884
|
foo.bar[baz] &&= value
|
1693
2885
|
^^^^^^^^^^^^^^^^^^^^^^
|
1694
2886
|
- name: IndexOperatorWriteNode
|
2887
|
+
flags: CallNodeFlags
|
1695
2888
|
fields:
|
1696
|
-
- name: flags
|
1697
|
-
type: flags
|
1698
|
-
kind: CallNodeFlags
|
1699
2889
|
- name: receiver
|
1700
2890
|
type: node?
|
2891
|
+
kind: non-void expression
|
1701
2892
|
- name: call_operator_loc
|
1702
2893
|
type: location?
|
1703
2894
|
- name: opening_loc
|
@@ -1709,24 +2900,25 @@ nodes:
|
|
1709
2900
|
type: location
|
1710
2901
|
- name: block
|
1711
2902
|
type: node?
|
1712
|
-
|
2903
|
+
kind: BlockArgumentNode # foo[&b] += value, only valid on Ruby < 3.4
|
2904
|
+
- name: binary_operator
|
1713
2905
|
type: constant
|
1714
|
-
- name:
|
2906
|
+
- name: binary_operator_loc
|
1715
2907
|
type: location
|
1716
2908
|
- name: value
|
1717
2909
|
type: node
|
2910
|
+
kind: non-void expression
|
1718
2911
|
comment: |
|
1719
2912
|
Represents the use of an assignment operator on a call to `[]`.
|
1720
2913
|
|
1721
2914
|
foo.bar[baz] += value
|
1722
2915
|
^^^^^^^^^^^^^^^^^^^^^
|
1723
2916
|
- name: IndexOrWriteNode
|
2917
|
+
flags: CallNodeFlags
|
1724
2918
|
fields:
|
1725
|
-
- name: flags
|
1726
|
-
type: flags
|
1727
|
-
kind: CallNodeFlags
|
1728
2919
|
- name: receiver
|
1729
2920
|
type: node?
|
2921
|
+
kind: non-void expression
|
1730
2922
|
- name: call_operator_loc
|
1731
2923
|
type: location?
|
1732
2924
|
- name: opening_loc
|
@@ -1738,22 +2930,23 @@ nodes:
|
|
1738
2930
|
type: location
|
1739
2931
|
- name: block
|
1740
2932
|
type: node?
|
2933
|
+
kind: BlockArgumentNode # foo[&b] ||= value, only valid on Ruby < 3.4
|
1741
2934
|
- name: operator_loc
|
1742
2935
|
type: location
|
1743
2936
|
- name: value
|
1744
2937
|
type: node
|
2938
|
+
kind: non-void expression
|
1745
2939
|
comment: |
|
1746
2940
|
Represents the use of the `||=` operator on a call to `[]`.
|
1747
2941
|
|
1748
2942
|
foo.bar[baz] ||= value
|
1749
2943
|
^^^^^^^^^^^^^^^^^^^^^^
|
1750
2944
|
- name: IndexTargetNode
|
2945
|
+
flags: CallNodeFlags
|
1751
2946
|
fields:
|
1752
|
-
- name: flags
|
1753
|
-
type: flags
|
1754
|
-
kind: CallNodeFlags
|
1755
2947
|
- name: receiver
|
1756
2948
|
type: node
|
2949
|
+
kind: non-void expression
|
1757
2950
|
- name: opening_loc
|
1758
2951
|
type: location
|
1759
2952
|
- name: arguments
|
@@ -1763,6 +2956,7 @@ nodes:
|
|
1763
2956
|
type: location
|
1764
2957
|
- name: block
|
1765
2958
|
type: node?
|
2959
|
+
kind: BlockArgumentNode # foo[&b], = 1, only valid on Ruby < 3.4
|
1766
2960
|
comment: |
|
1767
2961
|
Represents assigning to an index.
|
1768
2962
|
|
@@ -1786,6 +2980,7 @@ nodes:
|
|
1786
2980
|
type: location
|
1787
2981
|
- name: value
|
1788
2982
|
type: node
|
2983
|
+
kind: non-void expression
|
1789
2984
|
comment: |
|
1790
2985
|
Represents the use of the `&&=` operator for assignment to an instance variable.
|
1791
2986
|
|
@@ -1797,11 +2992,12 @@ nodes:
|
|
1797
2992
|
type: constant
|
1798
2993
|
- name: name_loc
|
1799
2994
|
type: location
|
1800
|
-
- name:
|
2995
|
+
- name: binary_operator_loc
|
1801
2996
|
type: location
|
1802
2997
|
- name: value
|
1803
2998
|
type: node
|
1804
|
-
|
2999
|
+
kind: non-void expression
|
3000
|
+
- name: binary_operator
|
1805
3001
|
type: constant
|
1806
3002
|
comment: |
|
1807
3003
|
Represents assigning to an instance variable using an operator that isn't `=`.
|
@@ -1818,6 +3014,7 @@ nodes:
|
|
1818
3014
|
type: location
|
1819
3015
|
- name: value
|
1820
3016
|
type: node
|
3017
|
+
kind: non-void expression
|
1821
3018
|
comment: |
|
1822
3019
|
Represents the use of the `||=` operator for assignment to an instance variable.
|
1823
3020
|
|
@@ -1851,36 +3048,64 @@ nodes:
|
|
1851
3048
|
fields:
|
1852
3049
|
- name: name
|
1853
3050
|
type: constant
|
3051
|
+
comment: |
|
3052
|
+
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).
|
3053
|
+
|
3054
|
+
@x = :y # name `:@x`
|
3055
|
+
|
3056
|
+
@_foo = "bar" # name `@_foo`
|
1854
3057
|
- name: name_loc
|
1855
3058
|
type: location
|
3059
|
+
comment: |
|
3060
|
+
The location of the variable name.
|
3061
|
+
|
3062
|
+
@_x = 1
|
3063
|
+
^^^
|
1856
3064
|
- name: value
|
1857
3065
|
type: node
|
3066
|
+
kind: non-void expression
|
3067
|
+
comment: |
|
3068
|
+
The value to write to the instance variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
3069
|
+
|
3070
|
+
@foo = :bar
|
3071
|
+
^^^^
|
3072
|
+
|
3073
|
+
@_x = 1234
|
3074
|
+
^^^^
|
1858
3075
|
- name: operator_loc
|
1859
3076
|
type: location
|
3077
|
+
comment: |
|
3078
|
+
The location of the `=` operator.
|
3079
|
+
|
3080
|
+
@x = y
|
3081
|
+
^
|
1860
3082
|
comment: |
|
1861
3083
|
Represents writing to an instance variable.
|
1862
3084
|
|
1863
3085
|
@foo = 1
|
1864
3086
|
^^^^^^^^
|
1865
3087
|
- name: IntegerNode
|
3088
|
+
flags: IntegerBaseFlags
|
1866
3089
|
fields:
|
1867
|
-
- name:
|
1868
|
-
type:
|
1869
|
-
|
3090
|
+
- name: value
|
3091
|
+
type: integer
|
3092
|
+
comment: The value of the integer literal as a number.
|
1870
3093
|
comment: |
|
1871
3094
|
Represents an integer number literal.
|
1872
3095
|
|
1873
3096
|
1
|
1874
3097
|
^
|
1875
3098
|
- name: InterpolatedMatchLastLineNode
|
3099
|
+
flags: RegularExpressionFlags
|
1876
3100
|
fields:
|
1877
|
-
- name: flags
|
1878
|
-
type: flags
|
1879
|
-
kind: RegularExpressionFlags
|
1880
3101
|
- name: opening_loc
|
1881
3102
|
type: location
|
1882
3103
|
- name: parts
|
1883
3104
|
type: node[]
|
3105
|
+
kind:
|
3106
|
+
- StringNode
|
3107
|
+
- EmbeddedStatementsNode
|
3108
|
+
- EmbeddedVariableNode
|
1884
3109
|
- name: closing_loc
|
1885
3110
|
type: location
|
1886
3111
|
newline: parts
|
@@ -1890,14 +3115,16 @@ nodes:
|
|
1890
3115
|
if /foo #{bar} baz/ then end
|
1891
3116
|
^^^^^^^^^^^^^^^^
|
1892
3117
|
- name: InterpolatedRegularExpressionNode
|
3118
|
+
flags: RegularExpressionFlags
|
1893
3119
|
fields:
|
1894
|
-
- name: flags
|
1895
|
-
type: flags
|
1896
|
-
kind: RegularExpressionFlags
|
1897
3120
|
- name: opening_loc
|
1898
3121
|
type: location
|
1899
3122
|
- name: parts
|
1900
3123
|
type: node[]
|
3124
|
+
kind:
|
3125
|
+
- StringNode
|
3126
|
+
- EmbeddedStatementsNode
|
3127
|
+
- EmbeddedVariableNode
|
1901
3128
|
- name: closing_loc
|
1902
3129
|
type: location
|
1903
3130
|
newline: parts
|
@@ -1907,11 +3134,18 @@ nodes:
|
|
1907
3134
|
/foo #{bar} baz/
|
1908
3135
|
^^^^^^^^^^^^^^^^
|
1909
3136
|
- name: InterpolatedStringNode
|
3137
|
+
flags: InterpolatedStringNodeFlags
|
1910
3138
|
fields:
|
1911
3139
|
- name: opening_loc
|
1912
3140
|
type: location?
|
1913
3141
|
- name: parts
|
1914
3142
|
type: node[]
|
3143
|
+
kind:
|
3144
|
+
- StringNode
|
3145
|
+
- EmbeddedStatementsNode
|
3146
|
+
- EmbeddedVariableNode
|
3147
|
+
- InterpolatedStringNode # `"a" "#{b}"`
|
3148
|
+
- on error: XStringNode # `<<`FOO` "bar"
|
1915
3149
|
- name: closing_loc
|
1916
3150
|
type: location?
|
1917
3151
|
newline: parts
|
@@ -1926,6 +3160,10 @@ nodes:
|
|
1926
3160
|
type: location?
|
1927
3161
|
- name: parts
|
1928
3162
|
type: node[]
|
3163
|
+
kind:
|
3164
|
+
- StringNode
|
3165
|
+
- EmbeddedStatementsNode
|
3166
|
+
- EmbeddedVariableNode
|
1929
3167
|
- name: closing_loc
|
1930
3168
|
type: location?
|
1931
3169
|
newline: parts
|
@@ -1940,6 +3178,10 @@ nodes:
|
|
1940
3178
|
type: location
|
1941
3179
|
- name: parts
|
1942
3180
|
type: node[]
|
3181
|
+
kind:
|
3182
|
+
- StringNode
|
3183
|
+
- EmbeddedStatementsNode
|
3184
|
+
- EmbeddedVariableNode
|
1943
3185
|
- name: closing_loc
|
1944
3186
|
type: location
|
1945
3187
|
newline: parts
|
@@ -1948,23 +3190,34 @@ nodes:
|
|
1948
3190
|
|
1949
3191
|
`foo #{bar} baz`
|
1950
3192
|
^^^^^^^^^^^^^^^^
|
3193
|
+
- name: ItLocalVariableReadNode
|
3194
|
+
comment: |
|
3195
|
+
Represents reading from the implicit `it` local variable.
|
3196
|
+
|
3197
|
+
-> { it }
|
3198
|
+
^^
|
3199
|
+
- name: ItParametersNode
|
3200
|
+
comment: |
|
3201
|
+
Represents an implicit set of parameters through the use of the `it` keyword within a block or lambda.
|
3202
|
+
|
3203
|
+
-> { it + it }
|
3204
|
+
^^^^^^^^^^^^^^
|
1951
3205
|
- name: KeywordHashNode
|
3206
|
+
flags: KeywordHashNodeFlags
|
1952
3207
|
fields:
|
1953
|
-
- name: flags
|
1954
|
-
type: flags
|
1955
|
-
kind: KeywordHashNodeFlags
|
1956
3208
|
- name: elements
|
1957
3209
|
type: node[]
|
3210
|
+
kind:
|
3211
|
+
- AssocNode
|
3212
|
+
- AssocSplatNode
|
1958
3213
|
comment: |
|
1959
3214
|
Represents a hash literal without opening and closing braces.
|
1960
3215
|
|
1961
3216
|
foo(a: b)
|
1962
3217
|
^^^^
|
1963
3218
|
- name: KeywordRestParameterNode
|
3219
|
+
flags: ParameterFlags
|
1964
3220
|
fields:
|
1965
|
-
- name: flags
|
1966
|
-
type: flags
|
1967
|
-
kind: ParameterFlags
|
1968
3221
|
- name: name
|
1969
3222
|
type: constant?
|
1970
3223
|
- name: name_loc
|
@@ -1989,8 +3242,15 @@ nodes:
|
|
1989
3242
|
type: location
|
1990
3243
|
- name: parameters
|
1991
3244
|
type: node?
|
3245
|
+
kind:
|
3246
|
+
- BlockParametersNode
|
3247
|
+
- NumberedParametersNode
|
3248
|
+
- ItParametersNode
|
1992
3249
|
- name: body
|
1993
3250
|
type: node?
|
3251
|
+
kind:
|
3252
|
+
- StatementsNode
|
3253
|
+
- BeginNode
|
1994
3254
|
comment: |
|
1995
3255
|
Represents using a lambda literal (not the lambda method call).
|
1996
3256
|
|
@@ -2004,6 +3264,7 @@ nodes:
|
|
2004
3264
|
type: location
|
2005
3265
|
- name: value
|
2006
3266
|
type: node
|
3267
|
+
kind: non-void expression
|
2007
3268
|
- name: name
|
2008
3269
|
type: constant
|
2009
3270
|
- name: depth
|
@@ -2017,13 +3278,14 @@ nodes:
|
|
2017
3278
|
fields:
|
2018
3279
|
- name: name_loc
|
2019
3280
|
type: location
|
2020
|
-
- name:
|
3281
|
+
- name: binary_operator_loc
|
2021
3282
|
type: location
|
2022
3283
|
- name: value
|
2023
3284
|
type: node
|
3285
|
+
kind: non-void expression
|
2024
3286
|
- name: name
|
2025
3287
|
type: constant
|
2026
|
-
- name:
|
3288
|
+
- name: binary_operator
|
2027
3289
|
type: constant
|
2028
3290
|
- name: depth
|
2029
3291
|
type: uint32
|
@@ -2040,6 +3302,7 @@ nodes:
|
|
2040
3302
|
type: location
|
2041
3303
|
- name: value
|
2042
3304
|
type: node
|
3305
|
+
kind: non-void expression
|
2043
3306
|
- name: name
|
2044
3307
|
type: constant
|
2045
3308
|
- name: depth
|
@@ -2064,10 +3327,6 @@ nodes:
|
|
2064
3327
|
|
2065
3328
|
_1 # name `:_1`
|
2066
3329
|
|
2067
|
-
Finally, for the default `it` block parameter, the name is `0it`. This is to distinguish it from an `it` local variable that is explicitly declared.
|
2068
|
-
|
2069
|
-
it # name `:0it`
|
2070
|
-
|
2071
3330
|
- name: depth
|
2072
3331
|
type: uint32
|
2073
3332
|
comment: |
|
@@ -2098,24 +3357,59 @@ nodes:
|
|
2098
3357
|
fields:
|
2099
3358
|
- name: name
|
2100
3359
|
type: constant
|
3360
|
+
comment: |
|
3361
|
+
The name of the local variable, which is an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
|
3362
|
+
|
3363
|
+
foo = :bar # name `:foo`
|
3364
|
+
|
3365
|
+
abc = 123 # name `:abc`
|
2101
3366
|
- name: depth
|
2102
3367
|
type: uint32
|
3368
|
+
comment: |
|
3369
|
+
The number of semantic scopes we have to traverse to find the declaration of this variable.
|
3370
|
+
|
3371
|
+
foo = 1 # depth 0
|
3372
|
+
|
3373
|
+
tap { foo = 1 } # depth 1
|
3374
|
+
|
3375
|
+
The specific rules for calculating the depth may differ from individual Ruby implementations, as they are not specified by the language. For more information, see [the Prism documentation](https://github.com/ruby/prism/blob/main/docs/local_variable_depth.md).
|
2103
3376
|
- name: name_loc
|
2104
3377
|
type: location
|
3378
|
+
comment: |
|
3379
|
+
The location of the variable name.
|
3380
|
+
|
3381
|
+
foo = :bar
|
3382
|
+
^^^
|
2105
3383
|
- name: value
|
2106
3384
|
type: node
|
3385
|
+
kind: non-void expression
|
3386
|
+
comment: |
|
3387
|
+
The value to write to the local variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
3388
|
+
|
3389
|
+
foo = :bar
|
3390
|
+
^^^^
|
3391
|
+
|
3392
|
+
abc = 1234
|
3393
|
+
^^^^
|
3394
|
+
|
3395
|
+
Note that since the name of a local variable is known before the value is parsed, it is valid for a local variable to appear within the value of its own write.
|
3396
|
+
|
3397
|
+
foo = foo
|
2107
3398
|
- name: operator_loc
|
2108
3399
|
type: location
|
3400
|
+
comment: |
|
3401
|
+
The location of the `=` operator.
|
3402
|
+
|
3403
|
+
x = :y
|
3404
|
+
^
|
2109
3405
|
comment: |
|
2110
3406
|
Represents writing to a local variable.
|
2111
3407
|
|
2112
3408
|
foo = 1
|
2113
3409
|
^^^^^^^
|
2114
3410
|
- name: MatchLastLineNode
|
3411
|
+
flags: RegularExpressionFlags
|
2115
3412
|
fields:
|
2116
|
-
- name: flags
|
2117
|
-
type: flags
|
2118
|
-
kind: RegularExpressionFlags
|
2119
3413
|
- name: opening_loc
|
2120
3414
|
type: location
|
2121
3415
|
- name: content_loc
|
@@ -2133,8 +3427,10 @@ nodes:
|
|
2133
3427
|
fields:
|
2134
3428
|
- name: value
|
2135
3429
|
type: node
|
3430
|
+
kind: non-void expression
|
2136
3431
|
- name: pattern
|
2137
3432
|
type: node
|
3433
|
+
kind: pattern expression
|
2138
3434
|
- name: operator_loc
|
2139
3435
|
type: location
|
2140
3436
|
comment: |
|
@@ -2146,8 +3442,10 @@ nodes:
|
|
2146
3442
|
fields:
|
2147
3443
|
- name: value
|
2148
3444
|
type: node
|
3445
|
+
kind: non-void expression
|
2149
3446
|
- name: pattern
|
2150
3447
|
type: node
|
3448
|
+
kind: pattern expression
|
2151
3449
|
- name: operator_loc
|
2152
3450
|
type: location
|
2153
3451
|
comment: |
|
@@ -2162,6 +3460,7 @@ nodes:
|
|
2162
3460
|
kind: CallNode
|
2163
3461
|
- name: targets
|
2164
3462
|
type: node[]
|
3463
|
+
kind: LocalVariableTargetNode
|
2165
3464
|
comment: |
|
2166
3465
|
Represents writing local variables using a regular expression match with named capture groups.
|
2167
3466
|
|
@@ -2178,8 +3477,15 @@ nodes:
|
|
2178
3477
|
type: location
|
2179
3478
|
- name: constant_path
|
2180
3479
|
type: node
|
3480
|
+
kind:
|
3481
|
+
- ConstantReadNode
|
3482
|
+
- ConstantPathNode
|
3483
|
+
- on error: MissingNode # module Parent module end
|
2181
3484
|
- name: body
|
2182
3485
|
type: node?
|
3486
|
+
kind:
|
3487
|
+
- StatementsNode
|
3488
|
+
- BeginNode
|
2183
3489
|
- name: end_keyword_loc
|
2184
3490
|
type: location
|
2185
3491
|
- name: name
|
@@ -2193,35 +3499,187 @@ nodes:
|
|
2193
3499
|
fields:
|
2194
3500
|
- name: lefts
|
2195
3501
|
type: node[]
|
3502
|
+
kind:
|
3503
|
+
- LocalVariableTargetNode
|
3504
|
+
- InstanceVariableTargetNode
|
3505
|
+
- ClassVariableTargetNode
|
3506
|
+
- GlobalVariableTargetNode
|
3507
|
+
- ConstantTargetNode
|
3508
|
+
- ConstantPathTargetNode
|
3509
|
+
- CallTargetNode
|
3510
|
+
- IndexTargetNode
|
3511
|
+
- MultiTargetNode
|
3512
|
+
- RequiredParameterNode # def m((a,b)); end
|
3513
|
+
- on error: BackReferenceReadNode # a, (b, $&) = z
|
3514
|
+
- on error: NumberedReferenceReadNode # a, (b, $1) = z
|
3515
|
+
comment: |
|
3516
|
+
Represents the targets expressions before a splat node.
|
3517
|
+
|
3518
|
+
a, (b, c, *) = 1, 2, 3, 4, 5
|
3519
|
+
^^^^
|
3520
|
+
|
3521
|
+
The splat node can be absent, in that case all target expressions are in the left field.
|
3522
|
+
|
3523
|
+
a, (b, c) = 1, 2, 3, 4, 5
|
3524
|
+
^^^^
|
2196
3525
|
- name: rest
|
2197
3526
|
type: node?
|
3527
|
+
kind:
|
3528
|
+
- ImplicitRestNode
|
3529
|
+
- SplatNode
|
3530
|
+
comment: |
|
3531
|
+
Represents a splat node in the target expression.
|
3532
|
+
|
3533
|
+
a, (b, *c) = 1, 2, 3, 4
|
3534
|
+
^^
|
3535
|
+
|
3536
|
+
The variable can be empty, this results in a `SplatNode` with a `nil` expression field.
|
3537
|
+
|
3538
|
+
a, (b, *) = 1, 2, 3, 4
|
3539
|
+
^
|
3540
|
+
|
3541
|
+
If the `*` is omitted, this field will contain an `ImplicitRestNode`
|
3542
|
+
|
3543
|
+
a, (b,) = 1, 2, 3, 4
|
3544
|
+
^
|
2198
3545
|
- name: rights
|
2199
3546
|
type: node[]
|
3547
|
+
kind:
|
3548
|
+
- LocalVariableTargetNode
|
3549
|
+
- InstanceVariableTargetNode
|
3550
|
+
- ClassVariableTargetNode
|
3551
|
+
- GlobalVariableTargetNode
|
3552
|
+
- ConstantTargetNode
|
3553
|
+
- ConstantPathTargetNode
|
3554
|
+
- CallTargetNode
|
3555
|
+
- IndexTargetNode
|
3556
|
+
- MultiTargetNode
|
3557
|
+
- RequiredParameterNode # def m((*,b)); end
|
3558
|
+
- on error: BackReferenceReadNode # a, (*, $&) = z
|
3559
|
+
- on error: NumberedReferenceReadNode # a, (*, $1) = z
|
3560
|
+
comment: |
|
3561
|
+
Represents the targets expressions after a splat node.
|
3562
|
+
|
3563
|
+
a, (*, b, c) = 1, 2, 3, 4, 5
|
3564
|
+
^^^^
|
2200
3565
|
- name: lparen_loc
|
2201
3566
|
type: location?
|
3567
|
+
comment: |
|
3568
|
+
The location of the opening parenthesis.
|
3569
|
+
|
3570
|
+
a, (b, c) = 1, 2, 3
|
3571
|
+
^
|
2202
3572
|
- name: rparen_loc
|
2203
3573
|
type: location?
|
3574
|
+
comment: |
|
3575
|
+
The location of the closing parenthesis.
|
3576
|
+
|
3577
|
+
a, (b, c) = 1, 2, 3
|
3578
|
+
^
|
2204
3579
|
comment: |
|
2205
3580
|
Represents a multi-target expression.
|
2206
3581
|
|
2207
3582
|
a, (b, c) = 1, 2, 3
|
2208
3583
|
^^^^^^
|
3584
|
+
|
3585
|
+
This can be a part of `MultiWriteNode` as above, or the target of a `for` loop
|
3586
|
+
|
3587
|
+
for a, b in [[1, 2], [3, 4]]
|
3588
|
+
^^^^
|
2209
3589
|
- name: MultiWriteNode
|
2210
3590
|
fields:
|
2211
3591
|
- name: lefts
|
2212
3592
|
type: node[]
|
3593
|
+
kind:
|
3594
|
+
- LocalVariableTargetNode
|
3595
|
+
- InstanceVariableTargetNode
|
3596
|
+
- ClassVariableTargetNode
|
3597
|
+
- GlobalVariableTargetNode
|
3598
|
+
- ConstantTargetNode
|
3599
|
+
- ConstantPathTargetNode
|
3600
|
+
- CallTargetNode
|
3601
|
+
- IndexTargetNode
|
3602
|
+
- MultiTargetNode
|
3603
|
+
- on error: BackReferenceReadNode # $&, = z
|
3604
|
+
- on error: NumberedReferenceReadNode # $1, = z
|
3605
|
+
comment: |
|
3606
|
+
Represents the targets expressions before a splat node.
|
3607
|
+
|
3608
|
+
a, b, * = 1, 2, 3, 4, 5
|
3609
|
+
^^^^
|
3610
|
+
|
3611
|
+
The splat node can be absent, in that case all target expressions are in the left field.
|
3612
|
+
|
3613
|
+
a, b, c = 1, 2, 3, 4, 5
|
3614
|
+
^^^^^^^
|
2213
3615
|
- name: rest
|
2214
3616
|
type: node?
|
3617
|
+
kind:
|
3618
|
+
- ImplicitRestNode
|
3619
|
+
- SplatNode
|
3620
|
+
comment: |
|
3621
|
+
Represents a splat node in the target expression.
|
3622
|
+
|
3623
|
+
a, b, *c = 1, 2, 3, 4
|
3624
|
+
^^
|
3625
|
+
|
3626
|
+
The variable can be empty, this results in a `SplatNode` with a `nil` expression field.
|
3627
|
+
|
3628
|
+
a, b, * = 1, 2, 3, 4
|
3629
|
+
^
|
3630
|
+
|
3631
|
+
If the `*` is omitted, this field will contain an `ImplicitRestNode`
|
3632
|
+
|
3633
|
+
a, b, = 1, 2, 3, 4
|
3634
|
+
^
|
2215
3635
|
- name: rights
|
2216
3636
|
type: node[]
|
3637
|
+
kind:
|
3638
|
+
- LocalVariableTargetNode
|
3639
|
+
- InstanceVariableTargetNode
|
3640
|
+
- ClassVariableTargetNode
|
3641
|
+
- GlobalVariableTargetNode
|
3642
|
+
- ConstantTargetNode
|
3643
|
+
- ConstantPathTargetNode
|
3644
|
+
- CallTargetNode
|
3645
|
+
- IndexTargetNode
|
3646
|
+
- MultiTargetNode
|
3647
|
+
- on error: BackReferenceReadNode # *, $& = z
|
3648
|
+
- on error: NumberedReferenceReadNode # *, $1 = z
|
3649
|
+
comment: |
|
3650
|
+
Represents the targets expressions after a splat node.
|
3651
|
+
|
3652
|
+
a, *, b, c = 1, 2, 3, 4, 5
|
3653
|
+
^^^^
|
2217
3654
|
- name: lparen_loc
|
2218
3655
|
type: location?
|
3656
|
+
comment: |
|
3657
|
+
The location of the opening parenthesis.
|
3658
|
+
|
3659
|
+
(a, b, c) = 1, 2, 3
|
3660
|
+
^
|
2219
3661
|
- name: rparen_loc
|
2220
3662
|
type: location?
|
3663
|
+
comment: |
|
3664
|
+
The location of the closing parenthesis.
|
3665
|
+
|
3666
|
+
(a, b, c) = 1, 2, 3
|
3667
|
+
^
|
2221
3668
|
- name: operator_loc
|
2222
3669
|
type: location
|
3670
|
+
comment: |
|
3671
|
+
The location of the operator.
|
3672
|
+
|
3673
|
+
a, b, c = 1, 2, 3
|
3674
|
+
^
|
2223
3675
|
- name: value
|
2224
3676
|
type: node
|
3677
|
+
kind: non-void expression
|
3678
|
+
comment: |
|
3679
|
+
The value to write to the targets. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
3680
|
+
|
3681
|
+
a, b, c = 1, 2, 3
|
3682
|
+
^^^^^^^
|
2225
3683
|
comment: |
|
2226
3684
|
Represents a write to a multi-target expression.
|
2227
3685
|
|
@@ -2271,29 +3729,28 @@ nodes:
|
|
2271
3729
|
- name: number
|
2272
3730
|
type: uint32
|
2273
3731
|
comment: |
|
2274
|
-
The (1-indexed, from the left) number of the capture group. Numbered references that
|
3732
|
+
The (1-indexed, from the left) number of the capture group. Numbered references that are too large result in this value being `0`.
|
2275
3733
|
|
2276
3734
|
$1 # number `1`
|
2277
3735
|
|
2278
3736
|
$5432 # number `5432`
|
2279
3737
|
|
2280
|
-
$4294967296 # number `
|
3738
|
+
$4294967296 # number `0`
|
2281
3739
|
comment: |
|
2282
3740
|
Represents reading a numbered reference to a capture in the previous match.
|
2283
3741
|
|
2284
3742
|
$1
|
2285
3743
|
^^
|
2286
3744
|
- name: OptionalKeywordParameterNode
|
3745
|
+
flags: ParameterFlags
|
2287
3746
|
fields:
|
2288
|
-
- name: flags
|
2289
|
-
type: flags
|
2290
|
-
kind: ParameterFlags
|
2291
3747
|
- name: name
|
2292
3748
|
type: constant
|
2293
3749
|
- name: name_loc
|
2294
3750
|
type: location
|
2295
3751
|
- name: value
|
2296
3752
|
type: node
|
3753
|
+
kind: non-void expression
|
2297
3754
|
comment: |
|
2298
3755
|
Represents an optional keyword parameter to a method, block, or lambda definition.
|
2299
3756
|
|
@@ -2301,10 +3758,8 @@ nodes:
|
|
2301
3758
|
^^^^
|
2302
3759
|
end
|
2303
3760
|
- name: OptionalParameterNode
|
3761
|
+
flags: ParameterFlags
|
2304
3762
|
fields:
|
2305
|
-
- name: flags
|
2306
|
-
type: flags
|
2307
|
-
kind: ParameterFlags
|
2308
3763
|
- name: name
|
2309
3764
|
type: constant
|
2310
3765
|
- name: name_loc
|
@@ -2313,6 +3768,7 @@ nodes:
|
|
2313
3768
|
type: location
|
2314
3769
|
- name: value
|
2315
3770
|
type: node
|
3771
|
+
kind: non-void expression
|
2316
3772
|
comment: |
|
2317
3773
|
Represents an optional parameter to a method, block, or lambda definition.
|
2318
3774
|
|
@@ -2323,6 +3779,7 @@ nodes:
|
|
2323
3779
|
fields:
|
2324
3780
|
- name: left
|
2325
3781
|
type: node
|
3782
|
+
kind: non-void expression
|
2326
3783
|
comment: |
|
2327
3784
|
Represents the left side of the expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
2328
3785
|
|
@@ -2333,8 +3790,9 @@ nodes:
|
|
2333
3790
|
^
|
2334
3791
|
- name: right
|
2335
3792
|
type: node
|
3793
|
+
kind: Node
|
2336
3794
|
comment: |
|
2337
|
-
Represents the right side of the expression.
|
3795
|
+
Represents the right side of the expression.
|
2338
3796
|
|
2339
3797
|
left || right
|
2340
3798
|
^^^^^
|
@@ -2357,16 +3815,38 @@ nodes:
|
|
2357
3815
|
fields:
|
2358
3816
|
- name: requireds
|
2359
3817
|
type: node[]
|
3818
|
+
kind:
|
3819
|
+
- RequiredParameterNode
|
3820
|
+
- MultiTargetNode
|
2360
3821
|
- name: optionals
|
2361
3822
|
type: node[]
|
3823
|
+
kind: OptionalParameterNode
|
2362
3824
|
- name: rest
|
2363
3825
|
type: node?
|
3826
|
+
kind:
|
3827
|
+
- RestParameterNode
|
3828
|
+
- ImplicitRestNode # Only in block parameters
|
2364
3829
|
- name: posts
|
2365
3830
|
type: node[]
|
3831
|
+
kind:
|
3832
|
+
- RequiredParameterNode
|
3833
|
+
- MultiTargetNode
|
3834
|
+
# On parsing error of `f(**kwargs, ...)` or `f(**nil, ...)`, the keyword_rest value is moved here:
|
3835
|
+
- on error: KeywordRestParameterNode
|
3836
|
+
- on error: NoKeywordsParameterNode
|
3837
|
+
# On parsing error of `f(..., ...)`, the first forwarding parameter is moved here:
|
3838
|
+
- on error: ForwardingParameterNode
|
2366
3839
|
- name: keywords
|
2367
3840
|
type: node[]
|
3841
|
+
kind:
|
3842
|
+
- RequiredKeywordParameterNode
|
3843
|
+
- OptionalKeywordParameterNode
|
2368
3844
|
- name: keyword_rest
|
2369
3845
|
type: node?
|
3846
|
+
kind:
|
3847
|
+
- KeywordRestParameterNode
|
3848
|
+
- ForwardingParameterNode
|
3849
|
+
- NoKeywordsParameterNode
|
2370
3850
|
- name: block
|
2371
3851
|
type: node?
|
2372
3852
|
kind: BlockParameterNode
|
@@ -2377,9 +3857,11 @@ nodes:
|
|
2377
3857
|
^^^^^^^
|
2378
3858
|
end
|
2379
3859
|
- name: ParenthesesNode
|
3860
|
+
flags: ParenthesesNodeFlags
|
2380
3861
|
fields:
|
2381
3862
|
- name: body
|
2382
3863
|
type: node?
|
3864
|
+
kind: non-void expression # Usually a StatementsNode but not always e.g. `1 in (..10)`
|
2383
3865
|
- name: opening_loc
|
2384
3866
|
type: location
|
2385
3867
|
- name: closing_loc
|
@@ -2394,6 +3876,7 @@ nodes:
|
|
2394
3876
|
fields:
|
2395
3877
|
- name: expression
|
2396
3878
|
type: node
|
3879
|
+
kind: non-void expression
|
2397
3880
|
- name: operator_loc
|
2398
3881
|
type: location
|
2399
3882
|
- name: lparen_loc
|
@@ -2409,6 +3892,15 @@ nodes:
|
|
2409
3892
|
fields:
|
2410
3893
|
- name: variable
|
2411
3894
|
type: node
|
3895
|
+
kind:
|
3896
|
+
- LocalVariableReadNode
|
3897
|
+
- InstanceVariableReadNode
|
3898
|
+
- ClassVariableReadNode
|
3899
|
+
- GlobalVariableReadNode # foo in ^$a
|
3900
|
+
- BackReferenceReadNode # foo in ^$&
|
3901
|
+
- NumberedReferenceReadNode # foo in ^$1
|
3902
|
+
- ItLocalVariableReadNode # proc { 1 in ^it }
|
3903
|
+
- on error: MissingNode # foo in ^Bar
|
2412
3904
|
- name: operator_loc
|
2413
3905
|
type: location
|
2414
3906
|
comment: |
|
@@ -2457,12 +3949,11 @@ nodes:
|
|
2457
3949
|
kind: StatementsNode
|
2458
3950
|
comment: The top level node of any parse tree.
|
2459
3951
|
- name: RangeNode
|
3952
|
+
flags: RangeFlags
|
2460
3953
|
fields:
|
2461
|
-
- name: flags
|
2462
|
-
type: flags
|
2463
|
-
kind: RangeFlags
|
2464
3954
|
- name: left
|
2465
3955
|
type: node?
|
3956
|
+
kind: non-void expression
|
2466
3957
|
comment: |
|
2467
3958
|
The left-hand side of the range, if present. It can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
2468
3959
|
|
@@ -2473,6 +3964,7 @@ nodes:
|
|
2473
3964
|
^^^^^
|
2474
3965
|
- name: right
|
2475
3966
|
type: node?
|
3967
|
+
kind: non-void expression
|
2476
3968
|
comment: |
|
2477
3969
|
The right-hand side of the range, if present. It can be either `nil` or any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
2478
3970
|
|
@@ -2495,9 +3987,20 @@ nodes:
|
|
2495
3987
|
c if a =~ /left/ ... b =~ /right/
|
2496
3988
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2497
3989
|
- name: RationalNode
|
3990
|
+
flags: IntegerBaseFlags
|
2498
3991
|
fields:
|
2499
|
-
- name:
|
2500
|
-
type:
|
3992
|
+
- name: numerator
|
3993
|
+
type: integer
|
3994
|
+
comment: |
|
3995
|
+
The numerator of the rational number.
|
3996
|
+
|
3997
|
+
1.5r # numerator 3
|
3998
|
+
- name: denominator
|
3999
|
+
type: integer
|
4000
|
+
comment: |
|
4001
|
+
The denominator of the rational number.
|
4002
|
+
|
4003
|
+
1.5r # denominator 2
|
2501
4004
|
comment: |
|
2502
4005
|
Represents a rational number literal.
|
2503
4006
|
|
@@ -2510,10 +4013,8 @@ nodes:
|
|
2510
4013
|
redo
|
2511
4014
|
^^^^
|
2512
4015
|
- name: RegularExpressionNode
|
4016
|
+
flags: RegularExpressionFlags
|
2513
4017
|
fields:
|
2514
|
-
- name: flags
|
2515
|
-
type: flags
|
2516
|
-
kind: RegularExpressionFlags
|
2517
4018
|
- name: opening_loc
|
2518
4019
|
type: location
|
2519
4020
|
- name: content_loc
|
@@ -2528,10 +4029,8 @@ nodes:
|
|
2528
4029
|
/foo/i
|
2529
4030
|
^^^^^^
|
2530
4031
|
- name: RequiredKeywordParameterNode
|
4032
|
+
flags: ParameterFlags
|
2531
4033
|
fields:
|
2532
|
-
- name: flags
|
2533
|
-
type: flags
|
2534
|
-
kind: ParameterFlags
|
2535
4034
|
- name: name
|
2536
4035
|
type: constant
|
2537
4036
|
- name: name_loc
|
@@ -2543,10 +4042,8 @@ nodes:
|
|
2543
4042
|
^^
|
2544
4043
|
end
|
2545
4044
|
- name: RequiredParameterNode
|
4045
|
+
flags: ParameterFlags
|
2546
4046
|
fields:
|
2547
|
-
- name: flags
|
2548
|
-
type: flags
|
2549
|
-
kind: ParameterFlags
|
2550
4047
|
- name: name
|
2551
4048
|
type: constant
|
2552
4049
|
comment: |
|
@@ -2559,10 +4056,12 @@ nodes:
|
|
2559
4056
|
fields:
|
2560
4057
|
- name: expression
|
2561
4058
|
type: node
|
4059
|
+
kind: Node
|
2562
4060
|
- name: keyword_loc
|
2563
4061
|
type: location
|
2564
4062
|
- name: rescue_expression
|
2565
4063
|
type: node
|
4064
|
+
kind: Node
|
2566
4065
|
newline: expression
|
2567
4066
|
comment: |
|
2568
4067
|
Represents an expression modified with a rescue.
|
@@ -2575,14 +4074,29 @@ nodes:
|
|
2575
4074
|
type: location
|
2576
4075
|
- name: exceptions
|
2577
4076
|
type: node[]
|
4077
|
+
kind: non-void expression
|
2578
4078
|
- name: operator_loc
|
2579
4079
|
type: location?
|
2580
4080
|
- name: reference
|
2581
4081
|
type: node?
|
4082
|
+
kind:
|
4083
|
+
- LocalVariableTargetNode
|
4084
|
+
- InstanceVariableTargetNode
|
4085
|
+
- ClassVariableTargetNode
|
4086
|
+
- GlobalVariableTargetNode
|
4087
|
+
- ConstantTargetNode
|
4088
|
+
- ConstantPathTargetNode
|
4089
|
+
- CallTargetNode
|
4090
|
+
- IndexTargetNode
|
4091
|
+
- on error: BackReferenceReadNode # => begin; rescue => $&; end
|
4092
|
+
- on error: NumberedReferenceReadNode # => begin; rescue => $1; end
|
4093
|
+
- on error: MissingNode # begin; rescue =>; end
|
4094
|
+
- name: then_keyword_loc
|
4095
|
+
type: location?
|
2582
4096
|
- name: statements
|
2583
4097
|
type: node?
|
2584
4098
|
kind: StatementsNode
|
2585
|
-
- name:
|
4099
|
+
- name: subsequent
|
2586
4100
|
type: node?
|
2587
4101
|
kind: RescueNode
|
2588
4102
|
comment: |
|
@@ -2594,12 +4108,10 @@ nodes:
|
|
2594
4108
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2595
4109
|
end
|
2596
4110
|
|
2597
|
-
`Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `
|
4111
|
+
`Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `reference` field.
|
2598
4112
|
- name: RestParameterNode
|
4113
|
+
flags: ParameterFlags
|
2599
4114
|
fields:
|
2600
|
-
- name: flags
|
2601
|
-
type: flags
|
2602
|
-
kind: ParameterFlags
|
2603
4115
|
- name: name
|
2604
4116
|
type: constant?
|
2605
4117
|
- name: name_loc
|
@@ -2636,6 +4148,27 @@ nodes:
|
|
2636
4148
|
|
2637
4149
|
self
|
2638
4150
|
^^^^
|
4151
|
+
- name: ShareableConstantNode
|
4152
|
+
flags: ShareableConstantNodeFlags
|
4153
|
+
fields:
|
4154
|
+
- name: write
|
4155
|
+
type: node
|
4156
|
+
kind:
|
4157
|
+
- ConstantWriteNode
|
4158
|
+
- ConstantAndWriteNode
|
4159
|
+
- ConstantOrWriteNode
|
4160
|
+
- ConstantOperatorWriteNode
|
4161
|
+
- ConstantPathWriteNode
|
4162
|
+
- ConstantPathAndWriteNode
|
4163
|
+
- ConstantPathOrWriteNode
|
4164
|
+
- ConstantPathOperatorWriteNode
|
4165
|
+
comment: The constant write that should be modified with the shareability state.
|
4166
|
+
comment: |
|
4167
|
+
This node wraps a constant write to indicate that when the value is written, it should have its shareability state modified.
|
4168
|
+
|
4169
|
+
# shareable_constant_value: literal
|
4170
|
+
C = { a: 1 }
|
4171
|
+
^^^^^^^^^^^^
|
2639
4172
|
- name: SingletonClassNode
|
2640
4173
|
fields:
|
2641
4174
|
- name: locals
|
@@ -2646,8 +4179,12 @@ nodes:
|
|
2646
4179
|
type: location
|
2647
4180
|
- name: expression
|
2648
4181
|
type: node
|
4182
|
+
kind: non-void expression
|
2649
4183
|
- name: body
|
2650
4184
|
type: node?
|
4185
|
+
kind:
|
4186
|
+
- StatementsNode
|
4187
|
+
- BeginNode
|
2651
4188
|
- name: end_keyword_loc
|
2652
4189
|
type: location
|
2653
4190
|
comment: |
|
@@ -2662,9 +4199,11 @@ nodes:
|
|
2662
4199
|
__ENCODING__
|
2663
4200
|
^^^^^^^^^^^^
|
2664
4201
|
- name: SourceFileNode
|
4202
|
+
flags: StringFlags
|
2665
4203
|
fields:
|
2666
4204
|
- name: filepath
|
2667
4205
|
type: string
|
4206
|
+
comment: Represents the file path being parsed. This corresponds directly to the `filepath` option given to the various `Prism::parse*` APIs.
|
2668
4207
|
comment: |
|
2669
4208
|
Represents the use of the `__FILE__` keyword.
|
2670
4209
|
|
@@ -2682,6 +4221,7 @@ nodes:
|
|
2682
4221
|
type: location
|
2683
4222
|
- name: expression
|
2684
4223
|
type: node?
|
4224
|
+
kind: non-void expression
|
2685
4225
|
comment: |
|
2686
4226
|
Represents the use of the splat operator.
|
2687
4227
|
|
@@ -2691,16 +4231,15 @@ nodes:
|
|
2691
4231
|
fields:
|
2692
4232
|
- name: body
|
2693
4233
|
type: node[]
|
4234
|
+
kind: Node
|
2694
4235
|
comment: |
|
2695
4236
|
Represents a set of statements contained within some scope.
|
2696
4237
|
|
2697
4238
|
foo; bar; baz
|
2698
4239
|
^^^^^^^^^^^^^
|
2699
4240
|
- name: StringNode
|
4241
|
+
flags: StringFlags
|
2700
4242
|
fields:
|
2701
|
-
- name: flags
|
2702
|
-
type: flags
|
2703
|
-
kind: StringFlags
|
2704
4243
|
- name: opening_loc
|
2705
4244
|
type: location?
|
2706
4245
|
- name: content_loc
|
@@ -2733,6 +4272,9 @@ nodes:
|
|
2733
4272
|
type: location?
|
2734
4273
|
- name: block
|
2735
4274
|
type: node?
|
4275
|
+
kind:
|
4276
|
+
- BlockNode
|
4277
|
+
- BlockArgumentNode
|
2736
4278
|
comment: |
|
2737
4279
|
Represents the use of the `super` keyword with parentheses or arguments.
|
2738
4280
|
|
@@ -2742,10 +4284,8 @@ nodes:
|
|
2742
4284
|
super foo, bar
|
2743
4285
|
^^^^^^^^^^^^^^
|
2744
4286
|
- name: SymbolNode
|
4287
|
+
flags: SymbolFlags
|
2745
4288
|
fields:
|
2746
|
-
- name: flags
|
2747
|
-
type: flags
|
2748
|
-
kind: SymbolFlags
|
2749
4289
|
- name: opening_loc
|
2750
4290
|
type: location?
|
2751
4291
|
- name: value_loc
|
@@ -2772,6 +4312,9 @@ nodes:
|
|
2772
4312
|
fields:
|
2773
4313
|
- name: names
|
2774
4314
|
type: node[]
|
4315
|
+
kind:
|
4316
|
+
- SymbolNode
|
4317
|
+
- InterpolatedSymbolNode
|
2775
4318
|
- name: keyword_loc
|
2776
4319
|
type: location
|
2777
4320
|
comment: |
|
@@ -2783,18 +4326,56 @@ nodes:
|
|
2783
4326
|
fields:
|
2784
4327
|
- name: keyword_loc
|
2785
4328
|
type: location
|
4329
|
+
comment: |
|
4330
|
+
The location of the `unless` keyword.
|
4331
|
+
|
4332
|
+
unless cond then bar end
|
4333
|
+
^^^^^^
|
4334
|
+
|
4335
|
+
bar unless cond
|
4336
|
+
^^^^^^
|
2786
4337
|
- name: predicate
|
2787
4338
|
type: node
|
4339
|
+
kind: non-void expression
|
4340
|
+
comment: |
|
4341
|
+
The condition to be evaluated for the unless expression. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
4342
|
+
|
4343
|
+
unless cond then bar end
|
4344
|
+
^^^^
|
4345
|
+
|
4346
|
+
bar unless cond
|
4347
|
+
^^^^
|
2788
4348
|
- name: then_keyword_loc
|
2789
4349
|
type: location?
|
4350
|
+
comment: |
|
4351
|
+
The location of the `then` keyword, if present.
|
4352
|
+
|
4353
|
+
unless cond then bar end
|
4354
|
+
^^^^
|
2790
4355
|
- name: statements
|
2791
4356
|
type: node?
|
2792
4357
|
kind: StatementsNode
|
2793
|
-
|
4358
|
+
comment: |
|
4359
|
+
The body of statements that will executed if the unless condition is
|
4360
|
+
falsey. Will be `nil` if no body is provided.
|
4361
|
+
|
4362
|
+
unless cond then bar end
|
4363
|
+
^^^
|
4364
|
+
- name: else_clause
|
2794
4365
|
type: node?
|
2795
4366
|
kind: ElseNode
|
4367
|
+
comment: |
|
4368
|
+
The else clause of the unless expression, if present.
|
4369
|
+
|
4370
|
+
unless cond then bar else baz end
|
4371
|
+
^^^^^^^^
|
2796
4372
|
- name: end_keyword_loc
|
2797
4373
|
type: location?
|
4374
|
+
comment: |
|
4375
|
+
The location of the `end` keyword, if present.
|
4376
|
+
|
4377
|
+
unless cond then bar end
|
4378
|
+
^^^
|
2798
4379
|
newline: predicate
|
2799
4380
|
comment: |
|
2800
4381
|
Represents the use of the `unless` keyword, either in the block form or the modifier form.
|
@@ -2805,16 +4386,17 @@ nodes:
|
|
2805
4386
|
unless foo then bar end
|
2806
4387
|
^^^^^^^^^^^^^^^^^^^^^^^
|
2807
4388
|
- name: UntilNode
|
4389
|
+
flags: LoopFlags
|
2808
4390
|
fields:
|
2809
|
-
- name: flags
|
2810
|
-
type: flags
|
2811
|
-
kind: LoopFlags
|
2812
4391
|
- name: keyword_loc
|
2813
4392
|
type: location
|
4393
|
+
- name: do_keyword_loc
|
4394
|
+
type: location?
|
2814
4395
|
- name: closing_loc
|
2815
4396
|
type: location?
|
2816
4397
|
- name: predicate
|
2817
4398
|
type: node
|
4399
|
+
kind: non-void expression
|
2818
4400
|
- name: statements
|
2819
4401
|
type: node?
|
2820
4402
|
kind: StatementsNode
|
@@ -2833,6 +4415,9 @@ nodes:
|
|
2833
4415
|
type: location
|
2834
4416
|
- name: conditions
|
2835
4417
|
type: node[]
|
4418
|
+
kind: non-void expression
|
4419
|
+
- name: then_keyword_loc
|
4420
|
+
type: location?
|
2836
4421
|
- name: statements
|
2837
4422
|
type: node?
|
2838
4423
|
kind: StatementsNode
|
@@ -2844,16 +4429,17 @@ nodes:
|
|
2844
4429
|
^^^^^^^^^
|
2845
4430
|
end
|
2846
4431
|
- name: WhileNode
|
4432
|
+
flags: LoopFlags
|
2847
4433
|
fields:
|
2848
|
-
- name: flags
|
2849
|
-
type: flags
|
2850
|
-
kind: LoopFlags
|
2851
4434
|
- name: keyword_loc
|
2852
4435
|
type: location
|
4436
|
+
- name: do_keyword_loc
|
4437
|
+
type: location?
|
2853
4438
|
- name: closing_loc
|
2854
4439
|
type: location?
|
2855
4440
|
- name: predicate
|
2856
4441
|
type: node
|
4442
|
+
kind: non-void expression
|
2857
4443
|
- name: statements
|
2858
4444
|
type: node?
|
2859
4445
|
kind: StatementsNode
|
@@ -2867,10 +4453,8 @@ nodes:
|
|
2867
4453
|
while foo do bar end
|
2868
4454
|
^^^^^^^^^^^^^^^^^^^^
|
2869
4455
|
- name: XStringNode
|
4456
|
+
flags: EncodingFlags
|
2870
4457
|
fields:
|
2871
|
-
- name: flags
|
2872
|
-
type: flags
|
2873
|
-
kind: EncodingFlags
|
2874
4458
|
- name: opening_loc
|
2875
4459
|
type: location
|
2876
4460
|
- name: content_loc
|