prism 0.24.0 → 0.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/BSDmakefile +58 -0
- data/CHANGELOG.md +69 -1
- data/Makefile +22 -16
- data/README.md +45 -6
- data/config.yml +510 -4
- data/docs/build_system.md +31 -0
- data/docs/configuration.md +3 -0
- data/docs/cruby_compilation.md +1 -1
- data/docs/parser_translation.md +14 -9
- data/docs/releasing.md +7 -9
- data/docs/ripper_translation.md +50 -0
- data/docs/ruby_api.md +1 -0
- data/docs/serialization.md +26 -5
- data/ext/prism/api_node.c +911 -815
- data/ext/prism/api_pack.c +9 -0
- data/ext/prism/extconf.rb +34 -13
- data/ext/prism/extension.c +341 -68
- data/ext/prism/extension.h +5 -4
- data/include/prism/ast.h +213 -64
- data/include/prism/defines.h +106 -2
- data/include/prism/diagnostic.h +146 -72
- data/include/prism/encoding.h +22 -4
- data/include/prism/node.h +93 -0
- data/include/prism/options.h +82 -7
- data/include/prism/pack.h +11 -0
- data/include/prism/parser.h +203 -54
- data/include/prism/prettyprint.h +8 -0
- data/include/prism/static_literals.h +118 -0
- data/include/prism/util/pm_buffer.h +65 -2
- data/include/prism/util/pm_constant_pool.h +18 -1
- data/include/prism/util/pm_integer.h +119 -0
- data/include/prism/util/pm_list.h +1 -1
- data/include/prism/util/pm_newline_list.h +8 -0
- data/include/prism/util/pm_string.h +26 -2
- data/include/prism/version.h +2 -2
- data/include/prism.h +59 -1
- data/lib/prism/compiler.rb +8 -1
- data/lib/prism/debug.rb +46 -3
- data/lib/prism/desugar_compiler.rb +4 -2
- data/lib/prism/dispatcher.rb +29 -0
- data/lib/prism/dot_visitor.rb +87 -16
- data/lib/prism/dsl.rb +24 -12
- data/lib/prism/ffi.rb +77 -12
- data/lib/prism/lex_compat.rb +17 -15
- data/lib/prism/mutation_compiler.rb +11 -0
- data/lib/prism/node.rb +2112 -2499
- data/lib/prism/node_ext.rb +77 -29
- data/lib/prism/pack.rb +4 -0
- data/lib/prism/parse_result/comments.rb +34 -17
- data/lib/prism/parse_result/newlines.rb +3 -1
- data/lib/prism/parse_result.rb +83 -32
- data/lib/prism/pattern.rb +16 -4
- data/lib/prism/polyfill/string.rb +12 -0
- data/lib/prism/reflection.rb +421 -0
- data/lib/prism/serialize.rb +450 -102
- data/lib/prism/translation/parser/compiler.rb +189 -50
- data/lib/prism/translation/parser/lexer.rb +103 -22
- data/lib/prism/translation/parser/rubocop.rb +41 -13
- data/lib/prism/translation/parser.rb +119 -7
- data/lib/prism/translation/parser33.rb +1 -1
- data/lib/prism/translation/parser34.rb +1 -1
- data/lib/prism/translation/ripper/sexp.rb +125 -0
- data/lib/prism/translation/ripper/shim.rb +5 -0
- data/lib/prism/translation/ripper.rb +3212 -462
- data/lib/prism/translation/ruby_parser.rb +35 -18
- data/lib/prism/translation.rb +3 -1
- data/lib/prism/visitor.rb +10 -0
- data/lib/prism.rb +9 -18
- data/prism.gemspec +39 -6
- data/rbi/prism/compiler.rbi +14 -0
- data/rbi/prism/desugar_compiler.rbi +5 -0
- data/rbi/prism/mutation_compiler.rbi +5 -0
- data/rbi/prism/node.rbi +8674 -0
- data/rbi/prism/node_ext.rbi +102 -0
- data/rbi/prism/parse_result.rbi +307 -0
- data/rbi/prism/reflection.rbi +64 -0
- data/rbi/prism/translation/parser/compiler.rbi +13 -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/ripper/ripper_compiler.rbi +5 -0
- data/rbi/prism/translation/ripper.rbi +25 -0
- data/rbi/prism/translation/ruby_parser.rbi +11 -0
- data/rbi/prism/visitor.rbi +470 -0
- data/rbi/prism.rbi +38 -7748
- 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 +462 -0
- data/sig/prism/mutation_compiler.rbs +158 -0
- data/sig/prism/node.rbs +3538 -0
- data/sig/prism/node_ext.rbs +78 -0
- data/sig/prism/pack.rbs +43 -0
- data/sig/prism/parse_result.rbs +128 -0
- data/sig/prism/pattern.rbs +13 -0
- data/sig/prism/reflection.rbs +56 -0
- data/sig/prism/serialize.rbs +7 -0
- data/sig/prism/visitor.rbs +168 -0
- data/sig/prism.rbs +188 -4767
- data/src/diagnostic.c +597 -230
- data/src/encoding.c +211 -108
- data/src/node.c +7526 -447
- data/src/options.c +66 -31
- data/src/pack.c +33 -17
- data/src/prettyprint.c +1294 -1385
- data/src/prism.c +4015 -1149
- data/src/regexp.c +17 -2
- data/src/serialize.c +47 -28
- data/src/static_literals.c +552 -0
- data/src/token_type.c +4 -3
- data/src/util/pm_buffer.c +147 -20
- data/src/util/pm_char.c +4 -4
- data/src/util/pm_constant_pool.c +35 -11
- data/src/util/pm_integer.c +635 -0
- data/src/util/pm_list.c +1 -1
- data/src/util/pm_newline_list.c +14 -5
- data/src/util/pm_string.c +134 -5
- data/src/util/pm_string_list.c +2 -2
- metadata +41 -8
- data/docs/ripper.md +0 -36
- data/include/prism/util/pm_state_stack.h +0 -42
- data/rbi/prism_static.rbi +0 -207
- data/sig/prism_static.rbs +0 -201
- data/src/util/pm_state_stack.c +0 -25
data/config.yml
CHANGED
@@ -1,3 +1,286 @@
|
|
1
|
+
errors:
|
2
|
+
- ALIAS_ARGUMENT
|
3
|
+
- ALIAS_ARGUMENT_NUMBERED_REFERENCE
|
4
|
+
- AMPAMPEQ_MULTI_ASSIGN
|
5
|
+
- ARGUMENT_AFTER_BLOCK
|
6
|
+
- ARGUMENT_AFTER_FORWARDING_ELLIPSES
|
7
|
+
- ARGUMENT_BARE_HASH
|
8
|
+
- ARGUMENT_BLOCK_FORWARDING
|
9
|
+
- ARGUMENT_BLOCK_MULTI
|
10
|
+
- ARGUMENT_FORMAL_CLASS
|
11
|
+
- ARGUMENT_FORMAL_CONSTANT
|
12
|
+
- ARGUMENT_FORMAL_GLOBAL
|
13
|
+
- ARGUMENT_FORMAL_IVAR
|
14
|
+
- ARGUMENT_FORWARDING_UNBOUND
|
15
|
+
- ARGUMENT_IN
|
16
|
+
- ARGUMENT_NO_FORWARDING_AMP
|
17
|
+
- ARGUMENT_NO_FORWARDING_ELLIPSES
|
18
|
+
- ARGUMENT_NO_FORWARDING_STAR
|
19
|
+
- ARGUMENT_NO_FORWARDING_STAR_STAR
|
20
|
+
- ARGUMENT_SPLAT_AFTER_ASSOC_SPLAT
|
21
|
+
- ARGUMENT_SPLAT_AFTER_SPLAT
|
22
|
+
- ARGUMENT_TERM_PAREN
|
23
|
+
- ARGUMENT_UNEXPECTED_BLOCK
|
24
|
+
- ARRAY_ELEMENT
|
25
|
+
- ARRAY_EXPRESSION
|
26
|
+
- ARRAY_EXPRESSION_AFTER_STAR
|
27
|
+
- ARRAY_SEPARATOR
|
28
|
+
- ARRAY_TERM
|
29
|
+
- BEGIN_LONELY_ELSE
|
30
|
+
- BEGIN_TERM
|
31
|
+
- BEGIN_UPCASE_BRACE
|
32
|
+
- BEGIN_UPCASE_TERM
|
33
|
+
- BEGIN_UPCASE_TOPLEVEL
|
34
|
+
- BLOCK_PARAM_LOCAL_VARIABLE
|
35
|
+
- BLOCK_PARAM_PIPE_TERM
|
36
|
+
- BLOCK_TERM_BRACE
|
37
|
+
- BLOCK_TERM_END
|
38
|
+
- CANNOT_PARSE_EXPRESSION
|
39
|
+
- CANNOT_PARSE_STRING_PART
|
40
|
+
- CASE_EXPRESSION_AFTER_CASE
|
41
|
+
- CASE_EXPRESSION_AFTER_WHEN
|
42
|
+
- CASE_MATCH_MISSING_PREDICATE
|
43
|
+
- CASE_MISSING_CONDITIONS
|
44
|
+
- CASE_TERM
|
45
|
+
- CLASS_IN_METHOD
|
46
|
+
- CLASS_NAME
|
47
|
+
- CLASS_SUPERCLASS
|
48
|
+
- CLASS_TERM
|
49
|
+
- CLASS_UNEXPECTED_END
|
50
|
+
- CLASS_VARIABLE_BARE
|
51
|
+
- CONDITIONAL_ELSIF_PREDICATE
|
52
|
+
- CONDITIONAL_IF_PREDICATE
|
53
|
+
- CONDITIONAL_PREDICATE_TERM
|
54
|
+
- CONDITIONAL_TERM
|
55
|
+
- CONDITIONAL_TERM_ELSE
|
56
|
+
- CONDITIONAL_UNLESS_PREDICATE
|
57
|
+
- CONDITIONAL_UNTIL_PREDICATE
|
58
|
+
- CONDITIONAL_WHILE_PREDICATE
|
59
|
+
- CONSTANT_PATH_COLON_COLON_CONSTANT
|
60
|
+
- DEF_ENDLESS
|
61
|
+
- DEF_ENDLESS_SETTER
|
62
|
+
- DEF_NAME
|
63
|
+
- DEF_PARAMS_TERM
|
64
|
+
- DEF_PARAMS_TERM_PAREN
|
65
|
+
- DEF_RECEIVER
|
66
|
+
- DEF_RECEIVER_TERM
|
67
|
+
- DEF_TERM
|
68
|
+
- DEFINED_EXPRESSION
|
69
|
+
- EMBDOC_TERM
|
70
|
+
- EMBEXPR_END
|
71
|
+
- EMBVAR_INVALID
|
72
|
+
- END_UPCASE_BRACE
|
73
|
+
- END_UPCASE_TERM
|
74
|
+
- ESCAPE_INVALID_CONTROL
|
75
|
+
- ESCAPE_INVALID_CONTROL_REPEAT
|
76
|
+
- ESCAPE_INVALID_HEXADECIMAL
|
77
|
+
- ESCAPE_INVALID_META
|
78
|
+
- ESCAPE_INVALID_META_REPEAT
|
79
|
+
- ESCAPE_INVALID_UNICODE
|
80
|
+
- ESCAPE_INVALID_UNICODE_CM_FLAGS
|
81
|
+
- ESCAPE_INVALID_UNICODE_LITERAL
|
82
|
+
- ESCAPE_INVALID_UNICODE_LONG
|
83
|
+
- ESCAPE_INVALID_UNICODE_TERM
|
84
|
+
- EXPECT_ARGUMENT
|
85
|
+
- EXPECT_EOL_AFTER_STATEMENT
|
86
|
+
- EXPECT_EXPRESSION_AFTER_AMPAMPEQ
|
87
|
+
- EXPECT_EXPRESSION_AFTER_COMMA
|
88
|
+
- EXPECT_EXPRESSION_AFTER_EQUAL
|
89
|
+
- EXPECT_EXPRESSION_AFTER_LESS_LESS
|
90
|
+
- EXPECT_EXPRESSION_AFTER_LPAREN
|
91
|
+
- EXPECT_EXPRESSION_AFTER_OPERATOR
|
92
|
+
- EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ
|
93
|
+
- EXPECT_EXPRESSION_AFTER_QUESTION
|
94
|
+
- EXPECT_EXPRESSION_AFTER_SPLAT
|
95
|
+
- EXPECT_EXPRESSION_AFTER_SPLAT_HASH
|
96
|
+
- EXPECT_EXPRESSION_AFTER_STAR
|
97
|
+
- EXPECT_IDENT_REQ_PARAMETER
|
98
|
+
- EXPECT_LPAREN_REQ_PARAMETER
|
99
|
+
- EXPECT_MESSAGE
|
100
|
+
- EXPECT_RBRACKET
|
101
|
+
- EXPECT_RPAREN
|
102
|
+
- EXPECT_RPAREN_AFTER_MULTI
|
103
|
+
- EXPECT_RPAREN_REQ_PARAMETER
|
104
|
+
- EXPECT_STRING_CONTENT
|
105
|
+
- EXPECT_WHEN_DELIMITER
|
106
|
+
- EXPRESSION_BARE_HASH
|
107
|
+
- EXPRESSION_NOT_WRITABLE
|
108
|
+
- EXPRESSION_NOT_WRITABLE_ENCODING
|
109
|
+
- EXPRESSION_NOT_WRITABLE_FALSE
|
110
|
+
- EXPRESSION_NOT_WRITABLE_FILE
|
111
|
+
- EXPRESSION_NOT_WRITABLE_LINE
|
112
|
+
- EXPRESSION_NOT_WRITABLE_NIL
|
113
|
+
- EXPRESSION_NOT_WRITABLE_SELF
|
114
|
+
- EXPRESSION_NOT_WRITABLE_TRUE
|
115
|
+
- FLOAT_PARSE
|
116
|
+
- FOR_COLLECTION
|
117
|
+
- FOR_IN
|
118
|
+
- FOR_INDEX
|
119
|
+
- FOR_TERM
|
120
|
+
- GLOBAL_VARIABLE_BARE
|
121
|
+
- HASH_EXPRESSION_AFTER_LABEL
|
122
|
+
- HASH_KEY
|
123
|
+
- HASH_ROCKET
|
124
|
+
- HASH_TERM
|
125
|
+
- HASH_VALUE
|
126
|
+
- HEREDOC_TERM
|
127
|
+
- INCOMPLETE_QUESTION_MARK
|
128
|
+
- INCOMPLETE_VARIABLE_CLASS
|
129
|
+
- INCOMPLETE_VARIABLE_CLASS_3_3_0
|
130
|
+
- INCOMPLETE_VARIABLE_INSTANCE
|
131
|
+
- INCOMPLETE_VARIABLE_INSTANCE_3_3_0
|
132
|
+
- INSTANCE_VARIABLE_BARE
|
133
|
+
- INVALID_BLOCK_EXIT
|
134
|
+
- INVALID_CHARACTER
|
135
|
+
- INVALID_ENCODING_MAGIC_COMMENT
|
136
|
+
- INVALID_FLOAT_EXPONENT
|
137
|
+
- INVALID_MULTIBYTE_CHAR
|
138
|
+
- INVALID_MULTIBYTE_CHARACTER
|
139
|
+
- INVALID_MULTIBYTE_ESCAPE
|
140
|
+
- INVALID_NUMBER_BINARY
|
141
|
+
- INVALID_NUMBER_DECIMAL
|
142
|
+
- INVALID_NUMBER_HEXADECIMAL
|
143
|
+
- INVALID_NUMBER_OCTAL
|
144
|
+
- INVALID_NUMBER_UNDERSCORE
|
145
|
+
- INVALID_PERCENT
|
146
|
+
- INVALID_PRINTABLE_CHARACTER
|
147
|
+
- INVALID_RETRY_AFTER_ELSE
|
148
|
+
- INVALID_RETRY_AFTER_ENSURE
|
149
|
+
- INVALID_RETRY_WITHOUT_RESCUE
|
150
|
+
- INVALID_VARIABLE_GLOBAL
|
151
|
+
- INVALID_VARIABLE_GLOBAL_3_3_0
|
152
|
+
- INVALID_YIELD
|
153
|
+
- IT_NOT_ALLOWED_NUMBERED
|
154
|
+
- IT_NOT_ALLOWED_ORDINARY
|
155
|
+
- LAMBDA_OPEN
|
156
|
+
- LAMBDA_TERM_BRACE
|
157
|
+
- LAMBDA_TERM_END
|
158
|
+
- LIST_I_LOWER_ELEMENT
|
159
|
+
- LIST_I_LOWER_TERM
|
160
|
+
- LIST_I_UPPER_ELEMENT
|
161
|
+
- LIST_I_UPPER_TERM
|
162
|
+
- LIST_W_LOWER_ELEMENT
|
163
|
+
- LIST_W_LOWER_TERM
|
164
|
+
- LIST_W_UPPER_ELEMENT
|
165
|
+
- LIST_W_UPPER_TERM
|
166
|
+
- MALLOC_FAILED
|
167
|
+
- MIXED_ENCODING
|
168
|
+
- MODULE_IN_METHOD
|
169
|
+
- MODULE_NAME
|
170
|
+
- MODULE_TERM
|
171
|
+
- MULTI_ASSIGN_MULTI_SPLATS
|
172
|
+
- MULTI_ASSIGN_UNEXPECTED_REST
|
173
|
+
- NO_LOCAL_VARIABLE
|
174
|
+
- NOT_EXPRESSION
|
175
|
+
- NUMBER_LITERAL_UNDERSCORE
|
176
|
+
- NUMBERED_PARAMETER_IT
|
177
|
+
- NUMBERED_PARAMETER_ORDINARY
|
178
|
+
- NUMBERED_PARAMETER_OUTER_SCOPE
|
179
|
+
- OPERATOR_MULTI_ASSIGN
|
180
|
+
- OPERATOR_WRITE_ARGUMENTS
|
181
|
+
- OPERATOR_WRITE_BLOCK
|
182
|
+
- PARAMETER_ASSOC_SPLAT_MULTI
|
183
|
+
- PARAMETER_BLOCK_MULTI
|
184
|
+
- PARAMETER_CIRCULAR
|
185
|
+
- PARAMETER_METHOD_NAME
|
186
|
+
- PARAMETER_NAME_DUPLICATED
|
187
|
+
- PARAMETER_NO_DEFAULT
|
188
|
+
- PARAMETER_NO_DEFAULT_KW
|
189
|
+
- PARAMETER_NUMBERED_RESERVED
|
190
|
+
- PARAMETER_ORDER
|
191
|
+
- PARAMETER_SPLAT_MULTI
|
192
|
+
- PARAMETER_STAR
|
193
|
+
- PARAMETER_UNEXPECTED_FWD
|
194
|
+
- PARAMETER_WILD_LOOSE_COMMA
|
195
|
+
- PATTERN_CAPTURE_DUPLICATE
|
196
|
+
- PATTERN_EXPRESSION_AFTER_BRACKET
|
197
|
+
- PATTERN_EXPRESSION_AFTER_COMMA
|
198
|
+
- PATTERN_EXPRESSION_AFTER_HROCKET
|
199
|
+
- PATTERN_EXPRESSION_AFTER_IN
|
200
|
+
- PATTERN_EXPRESSION_AFTER_KEY
|
201
|
+
- PATTERN_EXPRESSION_AFTER_PAREN
|
202
|
+
- PATTERN_EXPRESSION_AFTER_PIN
|
203
|
+
- PATTERN_EXPRESSION_AFTER_PIPE
|
204
|
+
- PATTERN_EXPRESSION_AFTER_RANGE
|
205
|
+
- PATTERN_EXPRESSION_AFTER_REST
|
206
|
+
- PATTERN_HASH_KEY
|
207
|
+
- PATTERN_HASH_KEY_DUPLICATE
|
208
|
+
- PATTERN_HASH_KEY_LABEL
|
209
|
+
- PATTERN_IDENT_AFTER_HROCKET
|
210
|
+
- PATTERN_LABEL_AFTER_COMMA
|
211
|
+
- PATTERN_REST
|
212
|
+
- PATTERN_TERM_BRACE
|
213
|
+
- PATTERN_TERM_BRACKET
|
214
|
+
- PATTERN_TERM_PAREN
|
215
|
+
- PIPEPIPEEQ_MULTI_ASSIGN
|
216
|
+
- REGEXP_ENCODING_OPTION_MISMATCH
|
217
|
+
- REGEXP_INCOMPAT_CHAR_ENCODING
|
218
|
+
- REGEXP_INVALID_UNICODE_RANGE
|
219
|
+
- REGEXP_NON_ESCAPED_MBC
|
220
|
+
- REGEXP_TERM
|
221
|
+
- REGEXP_UNKNOWN_OPTIONS
|
222
|
+
- REGEXP_UTF8_CHAR_NON_UTF8_REGEXP
|
223
|
+
- RESCUE_EXPRESSION
|
224
|
+
- RESCUE_MODIFIER_VALUE
|
225
|
+
- RESCUE_TERM
|
226
|
+
- RESCUE_VARIABLE
|
227
|
+
- RETURN_INVALID
|
228
|
+
- SCRIPT_NOT_FOUND
|
229
|
+
- SINGLETON_FOR_LITERALS
|
230
|
+
- STATEMENT_ALIAS
|
231
|
+
- STATEMENT_POSTEXE_END
|
232
|
+
- STATEMENT_PREEXE_BEGIN
|
233
|
+
- STATEMENT_UNDEF
|
234
|
+
- STRING_CONCATENATION
|
235
|
+
- STRING_INTERPOLATED_TERM
|
236
|
+
- STRING_LITERAL_EOF
|
237
|
+
- STRING_LITERAL_TERM
|
238
|
+
- SYMBOL_INVALID
|
239
|
+
- SYMBOL_TERM_DYNAMIC
|
240
|
+
- SYMBOL_TERM_INTERPOLATED
|
241
|
+
- TERNARY_COLON
|
242
|
+
- TERNARY_EXPRESSION_FALSE
|
243
|
+
- TERNARY_EXPRESSION_TRUE
|
244
|
+
- UNARY_RECEIVER
|
245
|
+
- UNDEF_ARGUMENT
|
246
|
+
- UNEXPECTED_BLOCK_ARGUMENT
|
247
|
+
- UNEXPECTED_TOKEN_CLOSE_CONTEXT
|
248
|
+
- UNEXPECTED_TOKEN_IGNORE
|
249
|
+
- UNTIL_TERM
|
250
|
+
- VOID_EXPRESSION
|
251
|
+
- WHILE_TERM
|
252
|
+
- WRITE_TARGET_IN_METHOD
|
253
|
+
- WRITE_TARGET_READONLY
|
254
|
+
- WRITE_TARGET_UNEXPECTED
|
255
|
+
- XSTRING_TERM
|
256
|
+
warnings:
|
257
|
+
- AMBIGUOUS_FIRST_ARGUMENT_MINUS
|
258
|
+
- AMBIGUOUS_FIRST_ARGUMENT_PLUS
|
259
|
+
- AMBIGUOUS_PREFIX_AMPERSAND
|
260
|
+
- AMBIGUOUS_PREFIX_STAR
|
261
|
+
- AMBIGUOUS_PREFIX_STAR_STAR
|
262
|
+
- AMBIGUOUS_SLASH
|
263
|
+
- COMPARISON_AFTER_COMPARISON
|
264
|
+
- DOT_DOT_DOT_EOL
|
265
|
+
- EQUAL_IN_CONDITIONAL
|
266
|
+
- EQUAL_IN_CONDITIONAL_3_3_0
|
267
|
+
- END_IN_METHOD
|
268
|
+
- DUPLICATED_HASH_KEY
|
269
|
+
- DUPLICATED_WHEN_CLAUSE
|
270
|
+
- FLOAT_OUT_OF_RANGE
|
271
|
+
- IGNORED_FROZEN_STRING_LITERAL
|
272
|
+
- INTEGER_IN_FLIP_FLOP
|
273
|
+
- INVALID_CHARACTER
|
274
|
+
- INVALID_NUMBERED_REFERENCE
|
275
|
+
- INVALID_SHAREABLE_CONSTANT_VALUE
|
276
|
+
- KEYWORD_EOL
|
277
|
+
- LITERAL_IN_CONDITION_DEFAULT
|
278
|
+
- LITERAL_IN_CONDITION_VERBOSE
|
279
|
+
- SHEBANG_CARRIAGE_RETURN
|
280
|
+
- UNEXPECTED_CARRIAGE_RETURN
|
281
|
+
- UNREACHABLE_STATEMENT
|
282
|
+
- UNUSED_LOCAL_VARIABLE
|
283
|
+
- VOID_STATEMENT
|
1
284
|
tokens:
|
2
285
|
- name: EOF
|
3
286
|
value: 1
|
@@ -368,6 +651,13 @@ flags:
|
|
368
651
|
- name: HEXADECIMAL
|
369
652
|
comment: "0x prefix"
|
370
653
|
comment: Flags for integer nodes that correspond to the base of the integer.
|
654
|
+
- name: InterpolatedStringNodeFlags
|
655
|
+
values:
|
656
|
+
- name: FROZEN
|
657
|
+
comment: "frozen by virtue of a `frozen_string_literal: true` comment or `--enable-frozen-string-literal`; only for adjacent string literals like `'a' 'b'`"
|
658
|
+
- name: MUTABLE
|
659
|
+
comment: "mutable by virtue of a `frozen_string_literal: false` comment or `--disable-frozen-string-literal`; only for adjacent string literals like `'a' 'b'`"
|
660
|
+
comment: Flags for interpolated string nodes that indicated mutability if they are also marked as literals.
|
371
661
|
- name: KeywordHashNodeFlags
|
372
662
|
values:
|
373
663
|
- name: SYMBOL_KEYS
|
@@ -413,6 +703,15 @@ flags:
|
|
413
703
|
- name: FORCED_US_ASCII_ENCODING
|
414
704
|
comment: "internal bytes forced the encoding to US-ASCII"
|
415
705
|
comment: Flags for regular expression and match last line nodes.
|
706
|
+
- name: ShareableConstantNodeFlags
|
707
|
+
values:
|
708
|
+
- name: LITERAL
|
709
|
+
comment: "constant writes that should be modified with shareable constant value literal"
|
710
|
+
- name: EXPERIMENTAL_EVERYTHING
|
711
|
+
comment: "constant writes that should be modified with shareable constant value experimental everything"
|
712
|
+
- name: EXPERIMENTAL_COPY
|
713
|
+
comment: "constant writes that should be modified with shareable constant value experimental copy"
|
714
|
+
comment: Flags for shareable constant nodes.
|
416
715
|
- name: StringFlags
|
417
716
|
values:
|
418
717
|
- name: FORCED_UTF8_ENCODING
|
@@ -420,7 +719,9 @@ flags:
|
|
420
719
|
- name: FORCED_BINARY_ENCODING
|
421
720
|
comment: "internal bytes forced the encoding to binary"
|
422
721
|
- name: FROZEN
|
423
|
-
comment: "frozen by virtue of a `frozen_string_literal` comment"
|
722
|
+
comment: "frozen by virtue of a `frozen_string_literal: true` comment or `--enable-frozen-string-literal`"
|
723
|
+
- name: MUTABLE
|
724
|
+
comment: "mutable by virtue of a `frozen_string_literal: false` comment or `--disable-frozen-string-literal`"
|
424
725
|
comment: Flags for string nodes.
|
425
726
|
- name: SymbolFlags
|
426
727
|
values:
|
@@ -727,6 +1028,7 @@ nodes:
|
|
727
1028
|
kind: ParametersNode
|
728
1029
|
- name: locals
|
729
1030
|
type: node[]
|
1031
|
+
kind: BlockLocalVariableNode
|
730
1032
|
- name: opening_loc
|
731
1033
|
type: location?
|
732
1034
|
- name: closing_loc
|
@@ -1056,12 +1358,37 @@ nodes:
|
|
1056
1358
|
fields:
|
1057
1359
|
- name: name
|
1058
1360
|
type: constant
|
1361
|
+
comment: |
|
1362
|
+
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).
|
1363
|
+
|
1364
|
+
@@abc = 123 # name `@@abc`
|
1365
|
+
|
1366
|
+
@@_test = :test # name `@@_test`
|
1059
1367
|
- name: name_loc
|
1060
1368
|
type: location
|
1369
|
+
comment: |
|
1370
|
+
The location of the variable name.
|
1371
|
+
|
1372
|
+
@@foo = :bar
|
1373
|
+
^^^^^
|
1061
1374
|
- name: value
|
1062
1375
|
type: node
|
1376
|
+
comment: |
|
1377
|
+
The value to assign to the class variable. Can be any node that
|
1378
|
+
represents a non-void expression.
|
1379
|
+
|
1380
|
+
@@foo = :bar
|
1381
|
+
^^^^
|
1382
|
+
|
1383
|
+
@@_xyz = 123
|
1384
|
+
^^^
|
1063
1385
|
- name: operator_loc
|
1064
|
-
type: location
|
1386
|
+
type: location
|
1387
|
+
comment: |
|
1388
|
+
The location of the `=` operator.
|
1389
|
+
|
1390
|
+
@@foo = :bar
|
1391
|
+
^
|
1065
1392
|
comment: |
|
1066
1393
|
Represents writing to a class variable.
|
1067
1394
|
|
@@ -1134,6 +1461,9 @@ nodes:
|
|
1134
1461
|
type: node?
|
1135
1462
|
- name: child
|
1136
1463
|
type: node
|
1464
|
+
kind:
|
1465
|
+
- ConstantReadNode
|
1466
|
+
- MissingNode
|
1137
1467
|
- name: delimiter_loc
|
1138
1468
|
type: location
|
1139
1469
|
comment: |
|
@@ -1177,6 +1507,9 @@ nodes:
|
|
1177
1507
|
type: node?
|
1178
1508
|
- name: child
|
1179
1509
|
type: node
|
1510
|
+
kind:
|
1511
|
+
- ConstantReadNode
|
1512
|
+
- MissingNode
|
1180
1513
|
- name: delimiter_loc
|
1181
1514
|
type: location
|
1182
1515
|
comment: |
|
@@ -1396,6 +1729,10 @@ nodes:
|
|
1396
1729
|
baz if foo .. bar
|
1397
1730
|
^^^^^^^^^^
|
1398
1731
|
- name: FloatNode
|
1732
|
+
fields:
|
1733
|
+
- name: value
|
1734
|
+
type: double
|
1735
|
+
comment: The value of the floating point number as a Float.
|
1399
1736
|
comment: |
|
1400
1737
|
Represents a floating point number literal.
|
1401
1738
|
|
@@ -1545,6 +1882,9 @@ nodes:
|
|
1545
1882
|
^
|
1546
1883
|
- name: elements
|
1547
1884
|
type: node[]
|
1885
|
+
kind:
|
1886
|
+
- AssocNode
|
1887
|
+
- AssocSplatNode
|
1548
1888
|
comment: |
|
1549
1889
|
The elements of the hash. These can be either `AssocNode`s or `AssocSplatNode`s.
|
1550
1890
|
|
@@ -1571,8 +1911,12 @@ nodes:
|
|
1571
1911
|
type: node?
|
1572
1912
|
- name: elements
|
1573
1913
|
type: node[]
|
1914
|
+
kind: AssocNode
|
1574
1915
|
- name: rest
|
1575
1916
|
type: node?
|
1917
|
+
kind:
|
1918
|
+
- AssocSplatNode
|
1919
|
+
- NoKeywordsParameterNode
|
1576
1920
|
- name: opening_loc
|
1577
1921
|
type: location?
|
1578
1922
|
- name: closing_loc
|
@@ -1613,6 +1957,10 @@ nodes:
|
|
1613
1957
|
fields:
|
1614
1958
|
- name: numeric
|
1615
1959
|
type: node
|
1960
|
+
kind:
|
1961
|
+
- FloatNode
|
1962
|
+
- IntegerNode
|
1963
|
+
- RationalNode
|
1616
1964
|
comment: |
|
1617
1965
|
Represents an imaginary number literal.
|
1618
1966
|
|
@@ -1851,12 +2199,37 @@ nodes:
|
|
1851
2199
|
fields:
|
1852
2200
|
- name: name
|
1853
2201
|
type: constant
|
2202
|
+
comment: |
|
2203
|
+
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).
|
2204
|
+
|
2205
|
+
@x = :y # name `:@x`
|
2206
|
+
|
2207
|
+
@_foo = "bar" # name `@_foo`
|
1854
2208
|
- name: name_loc
|
1855
2209
|
type: location
|
2210
|
+
comment: |
|
2211
|
+
The location of the variable name.
|
2212
|
+
|
2213
|
+
@_x = 1
|
2214
|
+
^^^
|
1856
2215
|
- name: value
|
1857
2216
|
type: node
|
2217
|
+
comment: |
|
2218
|
+
The value to assign to the instance variable. Can be any node that
|
2219
|
+
represents a non-void expression.
|
2220
|
+
|
2221
|
+
@foo = :bar
|
2222
|
+
^^^^
|
2223
|
+
|
2224
|
+
@_x = 1234
|
2225
|
+
^^^^
|
1858
2226
|
- name: operator_loc
|
1859
2227
|
type: location
|
2228
|
+
comment: |
|
2229
|
+
The location of the `=` operator.
|
2230
|
+
|
2231
|
+
@x = y
|
2232
|
+
^
|
1860
2233
|
comment: |
|
1861
2234
|
Represents writing to an instance variable.
|
1862
2235
|
|
@@ -1867,6 +2240,9 @@ nodes:
|
|
1867
2240
|
- name: flags
|
1868
2241
|
type: flags
|
1869
2242
|
kind: IntegerBaseFlags
|
2243
|
+
- name: value
|
2244
|
+
type: integer
|
2245
|
+
comment: The value of the integer literal as a number.
|
1870
2246
|
comment: |
|
1871
2247
|
Represents an integer number literal.
|
1872
2248
|
|
@@ -1881,6 +2257,10 @@ nodes:
|
|
1881
2257
|
type: location
|
1882
2258
|
- name: parts
|
1883
2259
|
type: node[]
|
2260
|
+
kind:
|
2261
|
+
- StringNode
|
2262
|
+
- EmbeddedStatementsNode
|
2263
|
+
- EmbeddedVariableNode
|
1884
2264
|
- name: closing_loc
|
1885
2265
|
type: location
|
1886
2266
|
newline: parts
|
@@ -1898,6 +2278,10 @@ nodes:
|
|
1898
2278
|
type: location
|
1899
2279
|
- name: parts
|
1900
2280
|
type: node[]
|
2281
|
+
kind:
|
2282
|
+
- StringNode
|
2283
|
+
- EmbeddedStatementsNode
|
2284
|
+
- EmbeddedVariableNode
|
1901
2285
|
- name: closing_loc
|
1902
2286
|
type: location
|
1903
2287
|
newline: parts
|
@@ -1908,10 +2292,18 @@ nodes:
|
|
1908
2292
|
^^^^^^^^^^^^^^^^
|
1909
2293
|
- name: InterpolatedStringNode
|
1910
2294
|
fields:
|
2295
|
+
- name: flags
|
2296
|
+
type: flags
|
2297
|
+
kind: InterpolatedStringNodeFlags
|
1911
2298
|
- name: opening_loc
|
1912
2299
|
type: location?
|
1913
2300
|
- name: parts
|
1914
2301
|
type: node[]
|
2302
|
+
kind:
|
2303
|
+
- StringNode
|
2304
|
+
- EmbeddedStatementsNode
|
2305
|
+
- EmbeddedVariableNode
|
2306
|
+
- InterpolatedStringNode # `"a" "#{b}"`
|
1915
2307
|
- name: closing_loc
|
1916
2308
|
type: location?
|
1917
2309
|
newline: parts
|
@@ -1926,6 +2318,10 @@ nodes:
|
|
1926
2318
|
type: location?
|
1927
2319
|
- name: parts
|
1928
2320
|
type: node[]
|
2321
|
+
kind:
|
2322
|
+
- StringNode
|
2323
|
+
- EmbeddedStatementsNode
|
2324
|
+
- EmbeddedVariableNode
|
1929
2325
|
- name: closing_loc
|
1930
2326
|
type: location?
|
1931
2327
|
newline: parts
|
@@ -1940,6 +2336,10 @@ nodes:
|
|
1940
2336
|
type: location
|
1941
2337
|
- name: parts
|
1942
2338
|
type: node[]
|
2339
|
+
kind:
|
2340
|
+
- StringNode
|
2341
|
+
- EmbeddedStatementsNode
|
2342
|
+
- EmbeddedVariableNode
|
1943
2343
|
- name: closing_loc
|
1944
2344
|
type: location
|
1945
2345
|
newline: parts
|
@@ -1948,6 +2348,12 @@ nodes:
|
|
1948
2348
|
|
1949
2349
|
`foo #{bar} baz`
|
1950
2350
|
^^^^^^^^^^^^^^^^
|
2351
|
+
- name: ItParametersNode
|
2352
|
+
comment: |
|
2353
|
+
Represents an implicit set of parameters through the use of the `it` keyword within a block or lambda.
|
2354
|
+
|
2355
|
+
-> { it + it }
|
2356
|
+
^^^^^^^^^^^^^^
|
1951
2357
|
- name: KeywordHashNode
|
1952
2358
|
fields:
|
1953
2359
|
- name: flags
|
@@ -1955,6 +2361,9 @@ nodes:
|
|
1955
2361
|
kind: KeywordHashNodeFlags
|
1956
2362
|
- name: elements
|
1957
2363
|
type: node[]
|
2364
|
+
kind:
|
2365
|
+
- AssocNode
|
2366
|
+
- AssocSplatNode
|
1958
2367
|
comment: |
|
1959
2368
|
Represents a hash literal without opening and closing braces.
|
1960
2369
|
|
@@ -2162,6 +2571,7 @@ nodes:
|
|
2162
2571
|
kind: CallNode
|
2163
2572
|
- name: targets
|
2164
2573
|
type: node[]
|
2574
|
+
kind: LocalVariableTargetNode
|
2165
2575
|
comment: |
|
2166
2576
|
Represents writing local variables using a regular expression match with named capture groups.
|
2167
2577
|
|
@@ -2193,10 +2603,35 @@ nodes:
|
|
2193
2603
|
fields:
|
2194
2604
|
- name: lefts
|
2195
2605
|
type: node[]
|
2606
|
+
kind:
|
2607
|
+
- LocalVariableTargetNode
|
2608
|
+
- InstanceVariableTargetNode
|
2609
|
+
- ClassVariableTargetNode
|
2610
|
+
- GlobalVariableTargetNode
|
2611
|
+
- ConstantTargetNode
|
2612
|
+
- ConstantPathTargetNode
|
2613
|
+
- CallTargetNode
|
2614
|
+
- IndexTargetNode
|
2615
|
+
- MultiTargetNode
|
2616
|
+
- RequiredParameterNode
|
2617
|
+
- BackReferenceReadNode # On parsing error of `$',`
|
2618
|
+
- NumberedReferenceReadNode # On parsing error of `$1,`
|
2196
2619
|
- name: rest
|
2197
2620
|
type: node?
|
2198
2621
|
- name: rights
|
2199
2622
|
type: node[]
|
2623
|
+
kind:
|
2624
|
+
- LocalVariableTargetNode
|
2625
|
+
- InstanceVariableTargetNode
|
2626
|
+
- ClassVariableTargetNode
|
2627
|
+
- GlobalVariableTargetNode
|
2628
|
+
- ConstantTargetNode
|
2629
|
+
- ConstantPathTargetNode
|
2630
|
+
- CallTargetNode
|
2631
|
+
- IndexTargetNode
|
2632
|
+
- MultiTargetNode
|
2633
|
+
- RequiredParameterNode
|
2634
|
+
- BackReferenceReadNode # On parsing error of `*,$'`
|
2200
2635
|
- name: lparen_loc
|
2201
2636
|
type: location?
|
2202
2637
|
- name: rparen_loc
|
@@ -2210,10 +2645,30 @@ nodes:
|
|
2210
2645
|
fields:
|
2211
2646
|
- name: lefts
|
2212
2647
|
type: node[]
|
2648
|
+
kind:
|
2649
|
+
- LocalVariableTargetNode
|
2650
|
+
- InstanceVariableTargetNode
|
2651
|
+
- ClassVariableTargetNode
|
2652
|
+
- GlobalVariableTargetNode
|
2653
|
+
- ConstantTargetNode
|
2654
|
+
- ConstantPathTargetNode
|
2655
|
+
- CallTargetNode
|
2656
|
+
- IndexTargetNode
|
2657
|
+
- MultiTargetNode
|
2213
2658
|
- name: rest
|
2214
2659
|
type: node?
|
2215
2660
|
- name: rights
|
2216
2661
|
type: node[]
|
2662
|
+
kind:
|
2663
|
+
- LocalVariableTargetNode
|
2664
|
+
- InstanceVariableTargetNode
|
2665
|
+
- ClassVariableTargetNode
|
2666
|
+
- GlobalVariableTargetNode
|
2667
|
+
- ConstantTargetNode
|
2668
|
+
- ConstantPathTargetNode
|
2669
|
+
- CallTargetNode
|
2670
|
+
- IndexTargetNode
|
2671
|
+
- MultiTargetNode
|
2217
2672
|
- name: lparen_loc
|
2218
2673
|
type: location?
|
2219
2674
|
- name: rparen_loc
|
@@ -2271,13 +2726,13 @@ nodes:
|
|
2271
2726
|
- name: number
|
2272
2727
|
type: uint32
|
2273
2728
|
comment: |
|
2274
|
-
The (1-indexed, from the left) number of the capture group. Numbered references that
|
2729
|
+
The (1-indexed, from the left) number of the capture group. Numbered references that are too large result in this value being `0`.
|
2275
2730
|
|
2276
2731
|
$1 # number `1`
|
2277
2732
|
|
2278
2733
|
$5432 # number `5432`
|
2279
2734
|
|
2280
|
-
$4294967296 # number `
|
2735
|
+
$4294967296 # number `0`
|
2281
2736
|
comment: |
|
2282
2737
|
Represents reading a numbered reference to a capture in the previous match.
|
2283
2738
|
|
@@ -2357,16 +2812,36 @@ nodes:
|
|
2357
2812
|
fields:
|
2358
2813
|
- name: requireds
|
2359
2814
|
type: node[]
|
2815
|
+
kind:
|
2816
|
+
- RequiredParameterNode
|
2817
|
+
- MultiTargetNode
|
2360
2818
|
- name: optionals
|
2361
2819
|
type: node[]
|
2820
|
+
kind: OptionalParameterNode
|
2362
2821
|
- name: rest
|
2363
2822
|
type: node?
|
2823
|
+
kind:
|
2824
|
+
- RestParameterNode
|
2825
|
+
- ImplicitRestNode # Only in block parameters
|
2364
2826
|
- name: posts
|
2365
2827
|
type: node[]
|
2828
|
+
kind:
|
2829
|
+
- RequiredParameterNode
|
2830
|
+
- MultiTargetNode
|
2831
|
+
# On parsing error of `f(**kwargs, ...)` or `f(**nil, ...)`, the keyword_rest value is moved here:
|
2832
|
+
- KeywordRestParameterNode
|
2833
|
+
- NoKeywordsParameterNode
|
2366
2834
|
- name: keywords
|
2367
2835
|
type: node[]
|
2836
|
+
kind:
|
2837
|
+
- RequiredKeywordParameterNode
|
2838
|
+
- OptionalKeywordParameterNode
|
2368
2839
|
- name: keyword_rest
|
2369
2840
|
type: node?
|
2841
|
+
kind:
|
2842
|
+
- KeywordRestParameterNode
|
2843
|
+
- ForwardingParameterNode
|
2844
|
+
- NoKeywordsParameterNode
|
2370
2845
|
- name: block
|
2371
2846
|
type: node?
|
2372
2847
|
kind: BlockParameterNode
|
@@ -2636,6 +3111,29 @@ nodes:
|
|
2636
3111
|
|
2637
3112
|
self
|
2638
3113
|
^^^^
|
3114
|
+
- name: ShareableConstantNode
|
3115
|
+
fields:
|
3116
|
+
- name: flags
|
3117
|
+
type: flags
|
3118
|
+
kind: ShareableConstantNodeFlags
|
3119
|
+
- name: write
|
3120
|
+
type: node
|
3121
|
+
kind:
|
3122
|
+
- ConstantWriteNode
|
3123
|
+
- ConstantAndWriteNode
|
3124
|
+
- ConstantOrWriteNode
|
3125
|
+
- ConstantOperatorWriteNode
|
3126
|
+
- ConstantPathWriteNode
|
3127
|
+
- ConstantPathAndWriteNode
|
3128
|
+
- ConstantPathOrWriteNode
|
3129
|
+
- ConstantPathOperatorWriteNode
|
3130
|
+
comment: The constant write that should be modified with the shareability state.
|
3131
|
+
comment: |
|
3132
|
+
This node wraps a constant write to indicate that when the value is written, it should have its shareability state modified.
|
3133
|
+
|
3134
|
+
# shareable_constant_value: literal
|
3135
|
+
C = { a: 1 }
|
3136
|
+
^^^^^^^^^^^^
|
2639
3137
|
- name: SingletonClassNode
|
2640
3138
|
fields:
|
2641
3139
|
- name: locals
|
@@ -2663,6 +3161,9 @@ nodes:
|
|
2663
3161
|
^^^^^^^^^^^^
|
2664
3162
|
- name: SourceFileNode
|
2665
3163
|
fields:
|
3164
|
+
- name: flags
|
3165
|
+
type: flags
|
3166
|
+
kind: StringFlags
|
2666
3167
|
- name: filepath
|
2667
3168
|
type: string
|
2668
3169
|
comment: |
|
@@ -2772,6 +3273,9 @@ nodes:
|
|
2772
3273
|
fields:
|
2773
3274
|
- name: names
|
2774
3275
|
type: node[]
|
3276
|
+
kind:
|
3277
|
+
- SymbolNode
|
3278
|
+
- InterpolatedSymbolNode
|
2775
3279
|
- name: keyword_loc
|
2776
3280
|
type: location
|
2777
3281
|
comment: |
|
@@ -2833,6 +3337,8 @@ nodes:
|
|
2833
3337
|
type: location
|
2834
3338
|
- name: conditions
|
2835
3339
|
type: node[]
|
3340
|
+
- name: then_keyword_loc
|
3341
|
+
type: location?
|
2836
3342
|
- name: statements
|
2837
3343
|
type: node?
|
2838
3344
|
kind: StatementsNode
|