prism 0.29.0 → 1.1.0
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/CHANGELOG.md +77 -1
- data/CONTRIBUTING.md +0 -4
- data/README.md +4 -0
- data/config.yml +498 -145
- data/docs/fuzzing.md +1 -1
- data/docs/parsing_rules.md +4 -1
- data/docs/ripper_translation.md +22 -0
- data/docs/serialization.md +3 -0
- data/ext/prism/api_node.c +2858 -2082
- data/ext/prism/extconf.rb +1 -1
- data/ext/prism/extension.c +203 -421
- data/ext/prism/extension.h +2 -2
- data/include/prism/ast.h +1732 -453
- data/include/prism/defines.h +36 -0
- data/include/prism/diagnostic.h +23 -6
- data/include/prism/node.h +0 -21
- data/include/prism/options.h +94 -3
- data/include/prism/parser.h +57 -28
- data/include/prism/regexp.h +18 -8
- data/include/prism/static_literals.h +3 -2
- data/include/prism/util/pm_char.h +1 -2
- data/include/prism/util/pm_constant_pool.h +0 -8
- data/include/prism/util/pm_integer.h +22 -15
- data/include/prism/util/pm_newline_list.h +11 -0
- data/include/prism/util/pm_string.h +28 -12
- data/include/prism/version.h +3 -3
- data/include/prism.h +0 -11
- data/lib/prism/compiler.rb +3 -0
- data/lib/prism/desugar_compiler.rb +111 -74
- data/lib/prism/dispatcher.rb +16 -1
- data/lib/prism/dot_visitor.rb +45 -34
- data/lib/prism/dsl.rb +660 -468
- data/lib/prism/ffi.rb +64 -6
- data/lib/prism/inspect_visitor.rb +294 -64
- data/lib/prism/lex_compat.rb +1 -1
- data/lib/prism/mutation_compiler.rb +11 -6
- data/lib/prism/node.rb +2469 -4973
- data/lib/prism/node_ext.rb +91 -14
- data/lib/prism/parse_result/comments.rb +0 -7
- data/lib/prism/parse_result/errors.rb +65 -0
- data/lib/prism/parse_result/newlines.rb +101 -11
- data/lib/prism/parse_result.rb +43 -3
- data/lib/prism/reflection.rb +10 -8
- data/lib/prism/serialize.rb +484 -609
- data/lib/prism/translation/parser/compiler.rb +152 -132
- data/lib/prism/translation/parser/lexer.rb +26 -4
- data/lib/prism/translation/parser.rb +9 -4
- data/lib/prism/translation/ripper.rb +22 -20
- data/lib/prism/translation/ruby_parser.rb +73 -13
- data/lib/prism/visitor.rb +3 -0
- data/lib/prism.rb +0 -4
- data/prism.gemspec +3 -5
- data/rbi/prism/dsl.rbi +521 -0
- data/rbi/prism/node.rbi +744 -4837
- data/rbi/prism/visitor.rbi +3 -0
- data/rbi/prism.rbi +36 -30
- data/sig/prism/dsl.rbs +190 -303
- data/sig/prism/mutation_compiler.rbs +1 -0
- data/sig/prism/node.rbs +759 -628
- data/sig/prism/parse_result.rbs +2 -0
- data/sig/prism/visitor.rbs +1 -0
- data/sig/prism.rbs +103 -64
- data/src/diagnostic.c +62 -28
- data/src/node.c +499 -1754
- data/src/options.c +76 -27
- data/src/prettyprint.c +156 -112
- data/src/prism.c +2773 -2081
- data/src/regexp.c +202 -69
- data/src/serialize.c +170 -50
- data/src/static_literals.c +63 -84
- data/src/token_type.c +4 -4
- data/src/util/pm_constant_pool.c +0 -8
- data/src/util/pm_integer.c +53 -25
- data/src/util/pm_newline_list.c +29 -0
- data/src/util/pm_string.c +130 -80
- data/src/util/pm_strpbrk.c +32 -6
- metadata +4 -6
- data/include/prism/util/pm_string_list.h +0 -44
- data/lib/prism/debug.rb +0 -249
- data/lib/prism/translation/parser/rubocop.rb +0 -73
- data/src/util/pm_string_list.c +0 -28
data/config.yml
CHANGED
@@ -15,7 +15,6 @@ errors:
|
|
15
15
|
- ARGUMENT_FORMAL_GLOBAL
|
16
16
|
- ARGUMENT_FORMAL_IVAR
|
17
17
|
- ARGUMENT_FORWARDING_UNBOUND
|
18
|
-
- ARGUMENT_IN
|
19
18
|
- ARGUMENT_NO_FORWARDING_AMPERSAND
|
20
19
|
- ARGUMENT_NO_FORWARDING_ELLIPSES
|
21
20
|
- ARGUMENT_NO_FORWARDING_STAR
|
@@ -81,8 +80,10 @@ errors:
|
|
81
80
|
- ESCAPE_INVALID_META_REPEAT
|
82
81
|
- ESCAPE_INVALID_UNICODE
|
83
82
|
- ESCAPE_INVALID_UNICODE_CM_FLAGS
|
83
|
+
- ESCAPE_INVALID_UNICODE_LIST
|
84
84
|
- ESCAPE_INVALID_UNICODE_LITERAL
|
85
85
|
- ESCAPE_INVALID_UNICODE_LONG
|
86
|
+
- ESCAPE_INVALID_UNICODE_SHORT
|
86
87
|
- ESCAPE_INVALID_UNICODE_TERM
|
87
88
|
- EXPECT_ARGUMENT
|
88
89
|
- EXPECT_EOL_AFTER_STATEMENT
|
@@ -97,6 +98,7 @@ errors:
|
|
97
98
|
- EXPECT_EXPRESSION_AFTER_SPLAT
|
98
99
|
- EXPECT_EXPRESSION_AFTER_SPLAT_HASH
|
99
100
|
- EXPECT_EXPRESSION_AFTER_STAR
|
101
|
+
- EXPECT_FOR_DELIMITER
|
100
102
|
- EXPECT_IDENT_REQ_PARAMETER
|
101
103
|
- EXPECT_IN_DELIMITER
|
102
104
|
- EXPECT_LPAREN_REQ_PARAMETER
|
@@ -105,6 +107,7 @@ errors:
|
|
105
107
|
- EXPECT_RPAREN
|
106
108
|
- EXPECT_RPAREN_AFTER_MULTI
|
107
109
|
- EXPECT_RPAREN_REQ_PARAMETER
|
110
|
+
- EXPECT_SINGLETON_CLASS_DELIMITER
|
108
111
|
- EXPECT_STRING_CONTENT
|
109
112
|
- EXPECT_WHEN_DELIMITER
|
110
113
|
- EXPRESSION_BARE_HASH
|
@@ -114,6 +117,7 @@ errors:
|
|
114
117
|
- EXPRESSION_NOT_WRITABLE_FILE
|
115
118
|
- EXPRESSION_NOT_WRITABLE_LINE
|
116
119
|
- EXPRESSION_NOT_WRITABLE_NIL
|
120
|
+
- EXPRESSION_NOT_WRITABLE_NUMBERED
|
117
121
|
- EXPRESSION_NOT_WRITABLE_SELF
|
118
122
|
- EXPRESSION_NOT_WRITABLE_TRUE
|
119
123
|
- FLOAT_PARSE
|
@@ -153,6 +157,7 @@ errors:
|
|
153
157
|
- INVALID_NUMBER_UNDERSCORE_INNER
|
154
158
|
- INVALID_NUMBER_UNDERSCORE_TRAILING
|
155
159
|
- INVALID_PERCENT
|
160
|
+
- INVALID_PERCENT_EOF
|
156
161
|
- INVALID_PRINTABLE_CHARACTER
|
157
162
|
- INVALID_RETRY_AFTER_ELSE
|
158
163
|
- INVALID_RETRY_AFTER_ENSURE
|
@@ -181,12 +186,15 @@ errors:
|
|
181
186
|
- MODULE_TERM
|
182
187
|
- MULTI_ASSIGN_MULTI_SPLATS
|
183
188
|
- MULTI_ASSIGN_UNEXPECTED_REST
|
189
|
+
- NESTING_TOO_DEEP
|
184
190
|
- NO_LOCAL_VARIABLE
|
191
|
+
- NON_ASSOCIATIVE_OPERATOR
|
185
192
|
- NOT_EXPRESSION
|
186
193
|
- NUMBER_LITERAL_UNDERSCORE
|
194
|
+
- NUMBERED_PARAMETER_INNER_BLOCK
|
187
195
|
- NUMBERED_PARAMETER_IT
|
188
196
|
- NUMBERED_PARAMETER_ORDINARY
|
189
|
-
-
|
197
|
+
- NUMBERED_PARAMETER_OUTER_BLOCK
|
190
198
|
- OPERATOR_MULTI_ASSIGN
|
191
199
|
- OPERATOR_WRITE_ARGUMENTS
|
192
200
|
- OPERATOR_WRITE_BLOCK
|
@@ -203,8 +211,9 @@ errors:
|
|
203
211
|
- PARAMETER_SPLAT_MULTI
|
204
212
|
- PARAMETER_STAR
|
205
213
|
- PARAMETER_UNEXPECTED_FWD
|
206
|
-
- PARAMETER_WILD_LOOSE_COMMA
|
207
214
|
- PARAMETER_UNEXPECTED_NO_KW
|
215
|
+
- PARAMETER_WILD_LOOSE_COMMA
|
216
|
+
- PATTERN_ARRAY_MULTIPLE_RESTS
|
208
217
|
- PATTERN_CAPTURE_DUPLICATE
|
209
218
|
- PATTERN_EXPRESSION_AFTER_BRACKET
|
210
219
|
- PATTERN_EXPRESSION_AFTER_COMMA
|
@@ -216,6 +225,7 @@ errors:
|
|
216
225
|
- PATTERN_EXPRESSION_AFTER_PIPE
|
217
226
|
- PATTERN_EXPRESSION_AFTER_RANGE
|
218
227
|
- PATTERN_EXPRESSION_AFTER_REST
|
228
|
+
- PATTERN_FIND_MISSING_INNER
|
219
229
|
- PATTERN_HASH_IMPLICIT
|
220
230
|
- PATTERN_HASH_KEY
|
221
231
|
- PATTERN_HASH_KEY_DUPLICATE
|
@@ -233,6 +243,7 @@ errors:
|
|
233
243
|
- REGEXP_INCOMPAT_CHAR_ENCODING
|
234
244
|
- REGEXP_INVALID_UNICODE_RANGE
|
235
245
|
- REGEXP_NON_ESCAPED_MBC
|
246
|
+
- REGEXP_PARSE_ERROR
|
236
247
|
- REGEXP_TERM
|
237
248
|
- REGEXP_UNKNOWN_OPTIONS
|
238
249
|
- REGEXP_UTF8_CHAR_NON_UTF8_REGEXP
|
@@ -257,11 +268,15 @@ errors:
|
|
257
268
|
- TERNARY_COLON
|
258
269
|
- TERNARY_EXPRESSION_FALSE
|
259
270
|
- TERNARY_EXPRESSION_TRUE
|
271
|
+
- UNARY_DISALLOWED
|
260
272
|
- UNARY_RECEIVER
|
261
273
|
- UNDEF_ARGUMENT
|
262
274
|
- UNEXPECTED_BLOCK_ARGUMENT
|
263
275
|
- UNEXPECTED_INDEX_BLOCK
|
264
276
|
- UNEXPECTED_INDEX_KEYWORDS
|
277
|
+
- UNEXPECTED_LABEL
|
278
|
+
- UNEXPECTED_MULTI_WRITE
|
279
|
+
- UNEXPECTED_RANGE_OPERATOR
|
265
280
|
- UNEXPECTED_SAFE_NAVIGATION
|
266
281
|
- UNEXPECTED_TOKEN_CLOSE_CONTEXT
|
267
282
|
- UNEXPECTED_TOKEN_IGNORE
|
@@ -273,6 +288,7 @@ errors:
|
|
273
288
|
- WRITE_TARGET_UNEXPECTED
|
274
289
|
- XSTRING_TERM
|
275
290
|
warnings:
|
291
|
+
- AMBIGUOUS_BINARY_OPERATOR
|
276
292
|
- AMBIGUOUS_FIRST_ARGUMENT_MINUS
|
277
293
|
- AMBIGUOUS_FIRST_ARGUMENT_PLUS
|
278
294
|
- AMBIGUOUS_PREFIX_AMPERSAND
|
@@ -288,10 +304,11 @@ warnings:
|
|
288
304
|
- DUPLICATED_WHEN_CLAUSE
|
289
305
|
- FLOAT_OUT_OF_RANGE
|
290
306
|
- IGNORED_FROZEN_STRING_LITERAL
|
307
|
+
- INDENTATION_MISMATCH
|
291
308
|
- INTEGER_IN_FLIP_FLOP
|
292
309
|
- INVALID_CHARACTER
|
310
|
+
- INVALID_MAGIC_COMMENT_VALUE
|
293
311
|
- INVALID_NUMBERED_REFERENCE
|
294
|
-
- INVALID_SHAREABLE_CONSTANT_VALUE
|
295
312
|
- KEYWORD_EOL
|
296
313
|
- LITERAL_IN_CONDITION_DEFAULT
|
297
314
|
- LITERAL_IN_CONDITION_VERBOSE
|
@@ -634,10 +651,16 @@ tokens:
|
|
634
651
|
flags:
|
635
652
|
- name: ArgumentsNodeFlags
|
636
653
|
values:
|
654
|
+
- name: CONTAINS_FORWARDING
|
655
|
+
comment: "if the arguments contain forwarding"
|
637
656
|
- name: CONTAINS_KEYWORDS
|
638
|
-
comment: "if arguments contain keywords"
|
657
|
+
comment: "if the arguments contain keywords"
|
639
658
|
- name: CONTAINS_KEYWORD_SPLAT
|
640
|
-
comment: "if arguments contain keyword splat"
|
659
|
+
comment: "if the arguments contain a keyword splat"
|
660
|
+
- name: CONTAINS_SPLAT
|
661
|
+
comment: "if the arguments contain a splat"
|
662
|
+
- name: CONTAINS_MULTIPLE_SPLATS
|
663
|
+
comment: "if the arguments contain multiple splats"
|
641
664
|
comment: Flags for arguments nodes.
|
642
665
|
- name: ArrayNodeFlags
|
643
666
|
values:
|
@@ -725,11 +748,6 @@ flags:
|
|
725
748
|
- name: FORCED_US_ASCII_ENCODING
|
726
749
|
comment: "internal bytes forced the encoding to US-ASCII"
|
727
750
|
comment: Flags for regular expression and match last line nodes.
|
728
|
-
- name: ReturnNodeFlags
|
729
|
-
values:
|
730
|
-
- name: REDUNDANT
|
731
|
-
comment: "a return statement that is redundant because it is the last statement in a method"
|
732
|
-
comment: Flags for return nodes.
|
733
751
|
- name: ShareableConstantNodeFlags
|
734
752
|
values:
|
735
753
|
- name: LITERAL
|
@@ -764,15 +782,25 @@ nodes:
|
|
764
782
|
fields:
|
765
783
|
- name: new_name
|
766
784
|
type: node
|
785
|
+
kind:
|
786
|
+
- GlobalVariableReadNode
|
787
|
+
- BackReferenceReadNode
|
788
|
+
- NumberedReferenceReadNode
|
767
789
|
comment: |
|
768
|
-
Represents the new name of the global variable that can be used after aliasing.
|
790
|
+
Represents the new name of the global variable that can be used after aliasing.
|
769
791
|
|
770
792
|
alias $foo $bar
|
771
793
|
^^^^
|
772
794
|
- name: old_name
|
773
795
|
type: node
|
796
|
+
kind:
|
797
|
+
- GlobalVariableReadNode
|
798
|
+
- BackReferenceReadNode
|
799
|
+
- NumberedReferenceReadNode
|
800
|
+
- on error: SymbolNode # alias $a b
|
801
|
+
- on error: MissingNode # alias $a 42
|
774
802
|
comment: |
|
775
|
-
Represents the old name of the global variable that
|
803
|
+
Represents the old name of the global variable that can be used before aliasing.
|
776
804
|
|
777
805
|
alias $foo $bar
|
778
806
|
^^^^
|
@@ -792,8 +820,38 @@ nodes:
|
|
792
820
|
fields:
|
793
821
|
- name: new_name
|
794
822
|
type: node
|
823
|
+
kind:
|
824
|
+
- SymbolNode
|
825
|
+
- InterpolatedSymbolNode
|
826
|
+
comment: |
|
827
|
+
Represents the new name of the method that will be aliased.
|
828
|
+
|
829
|
+
alias foo bar
|
830
|
+
^^^
|
831
|
+
|
832
|
+
alias :foo :bar
|
833
|
+
^^^^
|
834
|
+
|
835
|
+
alias :"#{foo}" :"#{bar}"
|
836
|
+
^^^^^^^^^
|
795
837
|
- name: old_name
|
796
838
|
type: node
|
839
|
+
kind:
|
840
|
+
- SymbolNode
|
841
|
+
- InterpolatedSymbolNode
|
842
|
+
- on error: GlobalVariableReadNode # alias a $b
|
843
|
+
- on error: MissingNode # alias a 42
|
844
|
+
comment: |
|
845
|
+
Represents the old name of the method that will be aliased.
|
846
|
+
|
847
|
+
alias foo bar
|
848
|
+
^^^
|
849
|
+
|
850
|
+
alias :foo :bar
|
851
|
+
^^^^
|
852
|
+
|
853
|
+
alias :"#{foo}" :"#{bar}"
|
854
|
+
^^^^^^^^^
|
797
855
|
- name: keyword_loc
|
798
856
|
type: location
|
799
857
|
comment: |
|
@@ -805,10 +863,27 @@ nodes:
|
|
805
863
|
fields:
|
806
864
|
- name: left
|
807
865
|
type: node
|
866
|
+
kind: pattern expression
|
867
|
+
comment: |
|
868
|
+
Represents the left side of the expression.
|
869
|
+
|
870
|
+
foo => bar | baz
|
871
|
+
^^^
|
808
872
|
- name: right
|
809
873
|
type: node
|
874
|
+
kind: pattern expression
|
875
|
+
comment: |
|
876
|
+
Represents the right side of the expression.
|
877
|
+
|
878
|
+
foo => bar | baz
|
879
|
+
^^^
|
810
880
|
- name: operator_loc
|
811
881
|
type: location
|
882
|
+
comment: |
|
883
|
+
Represents the alternation operator location.
|
884
|
+
|
885
|
+
foo => bar | baz
|
886
|
+
^
|
812
887
|
comment: |
|
813
888
|
Represents an alternation pattern in pattern matching.
|
814
889
|
|
@@ -818,6 +893,7 @@ nodes:
|
|
818
893
|
fields:
|
819
894
|
- name: left
|
820
895
|
type: node
|
896
|
+
kind: non-void expression
|
821
897
|
comment: |
|
822
898
|
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).
|
823
899
|
|
@@ -828,8 +904,9 @@ nodes:
|
|
828
904
|
^
|
829
905
|
- name: right
|
830
906
|
type: node
|
907
|
+
kind: Node
|
831
908
|
comment: |
|
832
|
-
Represents the right side of the expression.
|
909
|
+
Represents the right side of the expression.
|
833
910
|
|
834
911
|
left && right
|
835
912
|
^^^^^
|
@@ -849,24 +926,22 @@ nodes:
|
|
849
926
|
left and right
|
850
927
|
^^^^^^^^^^^^^^
|
851
928
|
- name: ArgumentsNode
|
929
|
+
flags: ArgumentsNodeFlags
|
852
930
|
fields:
|
853
|
-
- name: flags
|
854
|
-
type: flags
|
855
|
-
kind: ArgumentsNodeFlags
|
856
931
|
- name: arguments
|
857
932
|
type: node[]
|
933
|
+
kind: non-void expression
|
858
934
|
comment: |
|
859
935
|
Represents a set of arguments to a method or a keyword.
|
860
936
|
|
861
937
|
return foo, bar, baz
|
862
938
|
^^^^^^^^^^^^^
|
863
939
|
- name: ArrayNode
|
940
|
+
flags: ArrayNodeFlags
|
864
941
|
fields:
|
865
|
-
- name: flags
|
866
|
-
type: flags
|
867
|
-
kind: ArrayNodeFlags
|
868
942
|
- name: elements
|
869
943
|
type: node[]
|
944
|
+
kind: non-void expression
|
870
945
|
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.
|
871
946
|
- name: opening_loc
|
872
947
|
type: location?
|
@@ -895,12 +970,18 @@ nodes:
|
|
895
970
|
fields:
|
896
971
|
- name: constant
|
897
972
|
type: node?
|
973
|
+
kind:
|
974
|
+
- ConstantReadNode
|
975
|
+
- ConstantPathNode
|
898
976
|
- name: requireds
|
899
977
|
type: node[]
|
978
|
+
kind: pattern expression
|
900
979
|
- name: rest
|
901
980
|
type: node?
|
981
|
+
kind: pattern expression
|
902
982
|
- name: posts
|
903
983
|
type: node[]
|
984
|
+
kind: pattern expression
|
904
985
|
- name: opening_loc
|
905
986
|
type: location?
|
906
987
|
- name: closing_loc
|
@@ -926,6 +1007,7 @@ nodes:
|
|
926
1007
|
fields:
|
927
1008
|
- name: key
|
928
1009
|
type: node
|
1010
|
+
kind: non-void expression
|
929
1011
|
comment: |
|
930
1012
|
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).
|
931
1013
|
|
@@ -939,6 +1021,7 @@ nodes:
|
|
939
1021
|
^^^^^^^^^^
|
940
1022
|
- name: value
|
941
1023
|
type: node
|
1024
|
+
kind: non-void expression
|
942
1025
|
comment: |
|
943
1026
|
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).
|
944
1027
|
|
@@ -963,6 +1046,7 @@ nodes:
|
|
963
1046
|
fields:
|
964
1047
|
- name: value
|
965
1048
|
type: node?
|
1049
|
+
kind: non-void expression
|
966
1050
|
comment: |
|
967
1051
|
The value to be splatted, if present. Will be missing when keyword rest argument forwarding is used.
|
968
1052
|
|
@@ -1025,18 +1109,17 @@ nodes:
|
|
1025
1109
|
fields:
|
1026
1110
|
- name: expression
|
1027
1111
|
type: node?
|
1112
|
+
kind: non-void expression
|
1028
1113
|
- name: operator_loc
|
1029
1114
|
type: location
|
1030
1115
|
comment: |
|
1031
|
-
Represents block
|
1116
|
+
Represents a block argument using `&`.
|
1032
1117
|
|
1033
1118
|
bar(&args)
|
1034
1119
|
^^^^^^^^^^
|
1035
1120
|
- name: BlockLocalVariableNode
|
1121
|
+
flags: ParameterFlags
|
1036
1122
|
fields:
|
1037
|
-
- name: flags
|
1038
|
-
type: flags
|
1039
|
-
kind: ParameterFlags
|
1040
1123
|
- name: name
|
1041
1124
|
type: constant
|
1042
1125
|
comment: |
|
@@ -1050,8 +1133,15 @@ nodes:
|
|
1050
1133
|
type: constant[]
|
1051
1134
|
- name: parameters
|
1052
1135
|
type: node?
|
1136
|
+
kind:
|
1137
|
+
- BlockParametersNode
|
1138
|
+
- NumberedParametersNode
|
1139
|
+
- ItParametersNode
|
1053
1140
|
- name: body
|
1054
1141
|
type: node?
|
1142
|
+
kind:
|
1143
|
+
- StatementsNode
|
1144
|
+
- BeginNode
|
1055
1145
|
- name: opening_loc
|
1056
1146
|
type: location
|
1057
1147
|
- name: closing_loc
|
@@ -1062,10 +1152,8 @@ nodes:
|
|
1062
1152
|
[1, 2, 3].each { |i| puts x }
|
1063
1153
|
^^^^^^^^^^^^^^
|
1064
1154
|
- name: BlockParameterNode
|
1155
|
+
flags: ParameterFlags
|
1065
1156
|
fields:
|
1066
|
-
- name: flags
|
1067
|
-
type: flags
|
1068
|
-
kind: ParameterFlags
|
1069
1157
|
- name: name
|
1070
1158
|
type: constant?
|
1071
1159
|
- name: name_loc
|
@@ -1073,7 +1161,7 @@ nodes:
|
|
1073
1161
|
- name: operator_loc
|
1074
1162
|
type: location
|
1075
1163
|
comment: |
|
1076
|
-
Represents a block parameter
|
1164
|
+
Represents a block parameter of a method, block, or lambda definition.
|
1077
1165
|
|
1078
1166
|
def a(&b)
|
1079
1167
|
^^
|
@@ -1122,12 +1210,11 @@ nodes:
|
|
1122
1210
|
break foo
|
1123
1211
|
^^^^^^^^^
|
1124
1212
|
- name: CallAndWriteNode
|
1213
|
+
flags: CallNodeFlags
|
1125
1214
|
fields:
|
1126
|
-
- name: flags
|
1127
|
-
type: flags
|
1128
|
-
kind: CallNodeFlags
|
1129
1215
|
- name: receiver
|
1130
1216
|
type: node?
|
1217
|
+
kind: non-void expression
|
1131
1218
|
- name: call_operator_loc
|
1132
1219
|
type: location?
|
1133
1220
|
- name: message_loc
|
@@ -1140,18 +1227,18 @@ nodes:
|
|
1140
1227
|
type: location
|
1141
1228
|
- name: value
|
1142
1229
|
type: node
|
1230
|
+
kind: non-void expression
|
1143
1231
|
comment: |
|
1144
1232
|
Represents the use of the `&&=` operator on a call.
|
1145
1233
|
|
1146
1234
|
foo.bar &&= value
|
1147
1235
|
^^^^^^^^^^^^^^^^^
|
1148
1236
|
- name: CallNode
|
1237
|
+
flags: CallNodeFlags
|
1149
1238
|
fields:
|
1150
|
-
- name: flags
|
1151
|
-
type: flags
|
1152
|
-
kind: CallNodeFlags
|
1153
1239
|
- name: receiver
|
1154
1240
|
type: node?
|
1241
|
+
kind: non-void expression
|
1155
1242
|
comment: |
|
1156
1243
|
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).
|
1157
1244
|
|
@@ -1178,6 +1265,9 @@ nodes:
|
|
1178
1265
|
type: location?
|
1179
1266
|
- name: block
|
1180
1267
|
type: node?
|
1268
|
+
kind:
|
1269
|
+
- BlockNode
|
1270
|
+
- BlockArgumentNode
|
1181
1271
|
comment: |
|
1182
1272
|
Represents a method call, in all of the various forms that can take.
|
1183
1273
|
|
@@ -1199,12 +1289,11 @@ nodes:
|
|
1199
1289
|
foo&.bar
|
1200
1290
|
^^^^^^^^
|
1201
1291
|
- name: CallOperatorWriteNode
|
1292
|
+
flags: CallNodeFlags
|
1202
1293
|
fields:
|
1203
|
-
- name: flags
|
1204
|
-
type: flags
|
1205
|
-
kind: CallNodeFlags
|
1206
1294
|
- name: receiver
|
1207
1295
|
type: node?
|
1296
|
+
kind: non-void expression
|
1208
1297
|
- name: call_operator_loc
|
1209
1298
|
type: location?
|
1210
1299
|
- name: message_loc
|
@@ -1219,18 +1308,18 @@ nodes:
|
|
1219
1308
|
type: location
|
1220
1309
|
- name: value
|
1221
1310
|
type: node
|
1311
|
+
kind: non-void expression
|
1222
1312
|
comment: |
|
1223
1313
|
Represents the use of an assignment operator on a call.
|
1224
1314
|
|
1225
1315
|
foo.bar += baz
|
1226
1316
|
^^^^^^^^^^^^^^
|
1227
1317
|
- name: CallOrWriteNode
|
1318
|
+
flags: CallNodeFlags
|
1228
1319
|
fields:
|
1229
|
-
- name: flags
|
1230
|
-
type: flags
|
1231
|
-
kind: CallNodeFlags
|
1232
1320
|
- name: receiver
|
1233
1321
|
type: node?
|
1322
|
+
kind: non-void expression
|
1234
1323
|
- name: call_operator_loc
|
1235
1324
|
type: location?
|
1236
1325
|
- name: message_loc
|
@@ -1243,18 +1332,18 @@ nodes:
|
|
1243
1332
|
type: location
|
1244
1333
|
- name: value
|
1245
1334
|
type: node
|
1335
|
+
kind: non-void expression
|
1246
1336
|
comment: |
|
1247
1337
|
Represents the use of the `||=` operator on a call.
|
1248
1338
|
|
1249
1339
|
foo.bar ||= value
|
1250
1340
|
^^^^^^^^^^^^^^^^^
|
1251
1341
|
- name: CallTargetNode
|
1342
|
+
flags: CallNodeFlags
|
1252
1343
|
fields:
|
1253
|
-
- name: flags
|
1254
|
-
type: flags
|
1255
|
-
kind: CallNodeFlags
|
1256
1344
|
- name: receiver
|
1257
1345
|
type: node
|
1346
|
+
kind: non-void expression
|
1258
1347
|
- name: call_operator_loc
|
1259
1348
|
type: location
|
1260
1349
|
- name: name
|
@@ -1278,8 +1367,10 @@ nodes:
|
|
1278
1367
|
fields:
|
1279
1368
|
- name: value
|
1280
1369
|
type: node
|
1370
|
+
kind: pattern expression
|
1281
1371
|
- name: target
|
1282
1372
|
type: node
|
1373
|
+
kind: LocalVariableTargetNode
|
1283
1374
|
- name: operator_loc
|
1284
1375
|
type: location
|
1285
1376
|
comment: |
|
@@ -1291,9 +1382,11 @@ nodes:
|
|
1291
1382
|
fields:
|
1292
1383
|
- name: predicate
|
1293
1384
|
type: node?
|
1385
|
+
kind: non-void expression
|
1294
1386
|
- name: conditions
|
1295
1387
|
type: node[]
|
1296
|
-
|
1388
|
+
kind: InNode
|
1389
|
+
- name: else_clause
|
1297
1390
|
type: node?
|
1298
1391
|
kind: ElseNode
|
1299
1392
|
- name: case_keyword_loc
|
@@ -1311,9 +1404,11 @@ nodes:
|
|
1311
1404
|
fields:
|
1312
1405
|
- name: predicate
|
1313
1406
|
type: node?
|
1407
|
+
kind: non-void expression
|
1314
1408
|
- name: conditions
|
1315
1409
|
type: node[]
|
1316
|
-
|
1410
|
+
kind: WhenNode
|
1411
|
+
- name: else_clause
|
1317
1412
|
type: node?
|
1318
1413
|
kind: ElseNode
|
1319
1414
|
- name: case_keyword_loc
|
@@ -1335,12 +1430,20 @@ nodes:
|
|
1335
1430
|
type: location
|
1336
1431
|
- name: constant_path
|
1337
1432
|
type: node
|
1433
|
+
kind:
|
1434
|
+
- ConstantReadNode
|
1435
|
+
- ConstantPathNode
|
1436
|
+
- on error: CallNode # class 0.X end
|
1338
1437
|
- name: inheritance_operator_loc
|
1339
1438
|
type: location?
|
1340
1439
|
- name: superclass
|
1341
1440
|
type: node?
|
1441
|
+
kind: non-void expression
|
1342
1442
|
- name: body
|
1343
1443
|
type: node?
|
1444
|
+
kind:
|
1445
|
+
- StatementsNode
|
1446
|
+
- BeginNode
|
1344
1447
|
- name: end_keyword_loc
|
1345
1448
|
type: location
|
1346
1449
|
- name: name
|
@@ -1360,6 +1463,7 @@ nodes:
|
|
1360
1463
|
type: location
|
1361
1464
|
- name: value
|
1362
1465
|
type: node
|
1466
|
+
kind: non-void expression
|
1363
1467
|
comment: |
|
1364
1468
|
Represents the use of the `&&=` operator for assignment to a class variable.
|
1365
1469
|
|
@@ -1375,6 +1479,7 @@ nodes:
|
|
1375
1479
|
type: location
|
1376
1480
|
- name: value
|
1377
1481
|
type: node
|
1482
|
+
kind: non-void expression
|
1378
1483
|
- name: binary_operator
|
1379
1484
|
type: constant
|
1380
1485
|
comment: |
|
@@ -1392,6 +1497,7 @@ nodes:
|
|
1392
1497
|
type: location
|
1393
1498
|
- name: value
|
1394
1499
|
type: node
|
1500
|
+
kind: non-void expression
|
1395
1501
|
comment: |
|
1396
1502
|
Represents the use of the `||=` operator for assignment to a class variable.
|
1397
1503
|
|
@@ -1440,6 +1546,7 @@ nodes:
|
|
1440
1546
|
^^^^^
|
1441
1547
|
- name: value
|
1442
1548
|
type: node
|
1549
|
+
kind: non-void expression
|
1443
1550
|
comment: |
|
1444
1551
|
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).
|
1445
1552
|
|
@@ -1470,6 +1577,7 @@ nodes:
|
|
1470
1577
|
type: location
|
1471
1578
|
- name: value
|
1472
1579
|
type: node
|
1580
|
+
kind: non-void expression
|
1473
1581
|
comment: |
|
1474
1582
|
Represents the use of the `&&=` operator for assignment to a constant.
|
1475
1583
|
|
@@ -1485,6 +1593,7 @@ nodes:
|
|
1485
1593
|
type: location
|
1486
1594
|
- name: value
|
1487
1595
|
type: node
|
1596
|
+
kind: non-void expression
|
1488
1597
|
- name: binary_operator
|
1489
1598
|
type: constant
|
1490
1599
|
comment: |
|
@@ -1502,6 +1611,7 @@ nodes:
|
|
1502
1611
|
type: location
|
1503
1612
|
- name: value
|
1504
1613
|
type: node
|
1614
|
+
kind: non-void expression
|
1505
1615
|
comment: |
|
1506
1616
|
Represents the use of the `||=` operator for assignment to a constant.
|
1507
1617
|
|
@@ -1516,6 +1626,7 @@ nodes:
|
|
1516
1626
|
type: location
|
1517
1627
|
- name: value
|
1518
1628
|
type: node
|
1629
|
+
kind: non-void expression
|
1519
1630
|
comment: |
|
1520
1631
|
Represents the use of the `&&=` operator for assignment to a constant path.
|
1521
1632
|
|
@@ -1525,6 +1636,7 @@ nodes:
|
|
1525
1636
|
fields:
|
1526
1637
|
- name: parent
|
1527
1638
|
type: node?
|
1639
|
+
kind: non-void expression
|
1528
1640
|
comment: |
|
1529
1641
|
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.
|
1530
1642
|
|
@@ -1573,6 +1685,7 @@ nodes:
|
|
1573
1685
|
type: location
|
1574
1686
|
- name: value
|
1575
1687
|
type: node
|
1688
|
+
kind: non-void expression
|
1576
1689
|
- name: binary_operator
|
1577
1690
|
type: constant
|
1578
1691
|
comment: |
|
@@ -1589,6 +1702,7 @@ nodes:
|
|
1589
1702
|
type: location
|
1590
1703
|
- name: value
|
1591
1704
|
type: node
|
1705
|
+
kind: non-void expression
|
1592
1706
|
comment: |
|
1593
1707
|
Represents the use of the `||=` operator for assignment to a constant path.
|
1594
1708
|
|
@@ -1598,6 +1712,7 @@ nodes:
|
|
1598
1712
|
fields:
|
1599
1713
|
- name: parent
|
1600
1714
|
type: node?
|
1715
|
+
kind: non-void expression
|
1601
1716
|
- name: name
|
1602
1717
|
type: constant?
|
1603
1718
|
- name: delimiter_loc
|
@@ -1631,6 +1746,7 @@ nodes:
|
|
1631
1746
|
^
|
1632
1747
|
- name: value
|
1633
1748
|
type: node
|
1749
|
+
kind: non-void expression
|
1634
1750
|
comment: |
|
1635
1751
|
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).
|
1636
1752
|
|
@@ -1690,6 +1806,7 @@ nodes:
|
|
1690
1806
|
^^^
|
1691
1807
|
- name: value
|
1692
1808
|
type: node
|
1809
|
+
kind: non-void expression
|
1693
1810
|
comment: |
|
1694
1811
|
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).
|
1695
1812
|
|
@@ -1718,11 +1835,15 @@ nodes:
|
|
1718
1835
|
type: location
|
1719
1836
|
- name: receiver
|
1720
1837
|
type: node?
|
1838
|
+
kind: non-void expression
|
1721
1839
|
- name: parameters
|
1722
1840
|
type: node?
|
1723
1841
|
kind: ParametersNode
|
1724
1842
|
- name: body
|
1725
1843
|
type: node?
|
1844
|
+
kind:
|
1845
|
+
- StatementsNode
|
1846
|
+
- BeginNode
|
1726
1847
|
- name: locals
|
1727
1848
|
type: constant[]
|
1728
1849
|
- name: def_keyword_loc
|
@@ -1749,6 +1870,7 @@ nodes:
|
|
1749
1870
|
type: location?
|
1750
1871
|
- name: value
|
1751
1872
|
type: node
|
1873
|
+
kind: Node # More than non-void expression as defined?(return) is allowed, yet defined?(BEGIN{}) is SyntaxError
|
1752
1874
|
- name: rparen_loc
|
1753
1875
|
type: location?
|
1754
1876
|
- name: keyword_loc
|
@@ -1792,6 +1914,12 @@ nodes:
|
|
1792
1914
|
type: location
|
1793
1915
|
- name: variable
|
1794
1916
|
type: node
|
1917
|
+
kind:
|
1918
|
+
- InstanceVariableReadNode
|
1919
|
+
- ClassVariableReadNode
|
1920
|
+
- GlobalVariableReadNode
|
1921
|
+
- BackReferenceReadNode
|
1922
|
+
- NumberedReferenceReadNode
|
1795
1923
|
comment: |
|
1796
1924
|
Represents an interpolated variable.
|
1797
1925
|
|
@@ -1825,12 +1953,20 @@ nodes:
|
|
1825
1953
|
fields:
|
1826
1954
|
- name: constant
|
1827
1955
|
type: node?
|
1956
|
+
kind:
|
1957
|
+
- ConstantReadNode
|
1958
|
+
- ConstantPathNode
|
1828
1959
|
- name: left
|
1829
1960
|
type: node
|
1961
|
+
kind: SplatNode
|
1830
1962
|
- name: requireds
|
1831
1963
|
type: node[]
|
1964
|
+
kind: pattern expression
|
1832
1965
|
- name: right
|
1833
1966
|
type: node
|
1967
|
+
kind:
|
1968
|
+
- SplatNode
|
1969
|
+
- on error: MissingNode
|
1834
1970
|
- name: opening_loc
|
1835
1971
|
type: location?
|
1836
1972
|
- name: closing_loc
|
@@ -1847,14 +1983,14 @@ nodes:
|
|
1847
1983
|
foo in Foo(*bar, baz, *qux)
|
1848
1984
|
^^^^^^^^^^^^^^^^^^^^
|
1849
1985
|
- name: FlipFlopNode
|
1986
|
+
flags: RangeFlags
|
1850
1987
|
fields:
|
1851
|
-
- name: flags
|
1852
|
-
type: flags
|
1853
|
-
kind: RangeFlags
|
1854
1988
|
- name: left
|
1855
1989
|
type: node?
|
1990
|
+
kind: non-void expression
|
1856
1991
|
- name: right
|
1857
1992
|
type: node?
|
1993
|
+
kind: non-void expression
|
1858
1994
|
- name: operator_loc
|
1859
1995
|
type: location
|
1860
1996
|
comment: |
|
@@ -1876,19 +2012,70 @@ nodes:
|
|
1876
2012
|
fields:
|
1877
2013
|
- name: index
|
1878
2014
|
type: node
|
2015
|
+
kind:
|
2016
|
+
- LocalVariableTargetNode
|
2017
|
+
- InstanceVariableTargetNode
|
2018
|
+
- ClassVariableTargetNode
|
2019
|
+
- GlobalVariableTargetNode
|
2020
|
+
- ConstantTargetNode
|
2021
|
+
- ConstantPathTargetNode
|
2022
|
+
- CallTargetNode
|
2023
|
+
- IndexTargetNode
|
2024
|
+
- MultiTargetNode
|
2025
|
+
- on error: BackReferenceReadNode # for $& in a end
|
2026
|
+
- on error: NumberedReferenceReadNode # for $1 in a end
|
2027
|
+
- on error: MissingNode # for in 1..10; end
|
2028
|
+
comment: |
|
2029
|
+
The index expression for `for` loops.
|
2030
|
+
|
2031
|
+
for i in a end
|
2032
|
+
^
|
1879
2033
|
- name: collection
|
1880
2034
|
type: node
|
2035
|
+
kind: non-void expression
|
2036
|
+
comment: |
|
2037
|
+
The collection to iterate over.
|
2038
|
+
|
2039
|
+
for i in a end
|
2040
|
+
^
|
1881
2041
|
- name: statements
|
1882
2042
|
type: node?
|
1883
2043
|
kind: StatementsNode
|
2044
|
+
comment: |
|
2045
|
+
Represents the body of statements to execute for each iteration of the loop.
|
2046
|
+
|
2047
|
+
for i in a
|
2048
|
+
foo(i)
|
2049
|
+
^^^^^^
|
2050
|
+
end
|
1884
2051
|
- name: for_keyword_loc
|
1885
2052
|
type: location
|
2053
|
+
comment: |
|
2054
|
+
The location of the `for` keyword.
|
2055
|
+
|
2056
|
+
for i in a end
|
2057
|
+
^^^
|
1886
2058
|
- name: in_keyword_loc
|
1887
2059
|
type: location
|
2060
|
+
comment: |
|
2061
|
+
The location of the `in` keyword.
|
2062
|
+
|
2063
|
+
for i in a end
|
2064
|
+
^^
|
1888
2065
|
- name: do_keyword_loc
|
1889
2066
|
type: location?
|
2067
|
+
comment: |
|
2068
|
+
The location of the `do` keyword, if present.
|
2069
|
+
|
2070
|
+
for i in a do end
|
2071
|
+
^^
|
1890
2072
|
- name: end_keyword_loc
|
1891
2073
|
type: location
|
2074
|
+
comment: |
|
2075
|
+
The location of the `end` keyword.
|
2076
|
+
|
2077
|
+
for i in a end
|
2078
|
+
^^^
|
1892
2079
|
comment: |
|
1893
2080
|
Represents the use of the `for` keyword.
|
1894
2081
|
|
@@ -1929,6 +2116,7 @@ nodes:
|
|
1929
2116
|
type: location
|
1930
2117
|
- name: value
|
1931
2118
|
type: node
|
2119
|
+
kind: non-void expression
|
1932
2120
|
comment: |
|
1933
2121
|
Represents the use of the `&&=` operator for assignment to a global variable.
|
1934
2122
|
|
@@ -1944,6 +2132,7 @@ nodes:
|
|
1944
2132
|
type: location
|
1945
2133
|
- name: value
|
1946
2134
|
type: node
|
2135
|
+
kind: non-void expression
|
1947
2136
|
- name: binary_operator
|
1948
2137
|
type: constant
|
1949
2138
|
comment: |
|
@@ -1961,6 +2150,7 @@ nodes:
|
|
1961
2150
|
type: location
|
1962
2151
|
- name: value
|
1963
2152
|
type: node
|
2153
|
+
kind: non-void expression
|
1964
2154
|
comment: |
|
1965
2155
|
Represents the use of the `||=` operator for assignment to a global variable.
|
1966
2156
|
|
@@ -2009,6 +2199,7 @@ nodes:
|
|
2009
2199
|
^^^^
|
2010
2200
|
- name: value
|
2011
2201
|
type: node
|
2202
|
+
kind: non-void expression
|
2012
2203
|
comment: |
|
2013
2204
|
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).
|
2014
2205
|
|
@@ -2067,6 +2258,9 @@ nodes:
|
|
2067
2258
|
fields:
|
2068
2259
|
- name: constant
|
2069
2260
|
type: node?
|
2261
|
+
kind:
|
2262
|
+
- ConstantReadNode
|
2263
|
+
- ConstantPathNode
|
2070
2264
|
- name: elements
|
2071
2265
|
type: node[]
|
2072
2266
|
kind: AssocNode
|
@@ -2100,6 +2294,7 @@ nodes:
|
|
2100
2294
|
The `if_keyword_loc` field will be `nil` when the `IfNode` represents a ternary expression.
|
2101
2295
|
- name: predicate
|
2102
2296
|
type: node
|
2297
|
+
kind: non-void expression
|
2103
2298
|
comment: |
|
2104
2299
|
The node for the condition the `IfNode` is testing.
|
2105
2300
|
|
@@ -2135,8 +2330,11 @@ nodes:
|
|
2135
2330
|
baz
|
2136
2331
|
^^^
|
2137
2332
|
end
|
2138
|
-
- name:
|
2333
|
+
- name: subsequent
|
2139
2334
|
type: node?
|
2335
|
+
kind:
|
2336
|
+
- ElseNode
|
2337
|
+
- IfNode
|
2140
2338
|
comment: |
|
2141
2339
|
Represents an `ElseNode` or an `IfNode` when there is an `else` or an `elsif` in the `if` statement.
|
2142
2340
|
|
@@ -2189,6 +2387,11 @@ nodes:
|
|
2189
2387
|
fields:
|
2190
2388
|
- name: value
|
2191
2389
|
type: node
|
2390
|
+
kind:
|
2391
|
+
- LocalVariableReadNode
|
2392
|
+
- CallNode
|
2393
|
+
- ConstantReadNode
|
2394
|
+
- LocalVariableTargetNode
|
2192
2395
|
comment: |
|
2193
2396
|
Represents a node that is implicitly being added to the tree but doesn't correspond directly to a node in the source.
|
2194
2397
|
|
@@ -2219,6 +2422,7 @@ nodes:
|
|
2219
2422
|
fields:
|
2220
2423
|
- name: pattern
|
2221
2424
|
type: node
|
2425
|
+
kind: pattern expression
|
2222
2426
|
- name: statements
|
2223
2427
|
type: node?
|
2224
2428
|
kind: StatementsNode
|
@@ -2232,12 +2436,11 @@ nodes:
|
|
2232
2436
|
case a; in b then c end
|
2233
2437
|
^^^^^^^^^^^
|
2234
2438
|
- name: IndexAndWriteNode
|
2439
|
+
flags: CallNodeFlags
|
2235
2440
|
fields:
|
2236
|
-
- name: flags
|
2237
|
-
type: flags
|
2238
|
-
kind: CallNodeFlags
|
2239
2441
|
- name: receiver
|
2240
2442
|
type: node?
|
2443
|
+
kind: non-void expression
|
2241
2444
|
- name: call_operator_loc
|
2242
2445
|
type: location?
|
2243
2446
|
- name: opening_loc
|
@@ -2249,22 +2452,23 @@ nodes:
|
|
2249
2452
|
type: location
|
2250
2453
|
- name: block
|
2251
2454
|
type: node?
|
2455
|
+
kind: BlockArgumentNode # foo[&b] &&= value, only valid on Ruby < 3.4
|
2252
2456
|
- name: operator_loc
|
2253
2457
|
type: location
|
2254
2458
|
- name: value
|
2255
2459
|
type: node
|
2460
|
+
kind: non-void expression
|
2256
2461
|
comment: |
|
2257
2462
|
Represents the use of the `&&=` operator on a call to the `[]` method.
|
2258
2463
|
|
2259
2464
|
foo.bar[baz] &&= value
|
2260
2465
|
^^^^^^^^^^^^^^^^^^^^^^
|
2261
2466
|
- name: IndexOperatorWriteNode
|
2467
|
+
flags: CallNodeFlags
|
2262
2468
|
fields:
|
2263
|
-
- name: flags
|
2264
|
-
type: flags
|
2265
|
-
kind: CallNodeFlags
|
2266
2469
|
- name: receiver
|
2267
2470
|
type: node?
|
2471
|
+
kind: non-void expression
|
2268
2472
|
- name: call_operator_loc
|
2269
2473
|
type: location?
|
2270
2474
|
- name: opening_loc
|
@@ -2276,24 +2480,25 @@ nodes:
|
|
2276
2480
|
type: location
|
2277
2481
|
- name: block
|
2278
2482
|
type: node?
|
2483
|
+
kind: BlockArgumentNode # foo[&b] += value, only valid on Ruby < 3.4
|
2279
2484
|
- name: binary_operator
|
2280
2485
|
type: constant
|
2281
2486
|
- name: binary_operator_loc
|
2282
2487
|
type: location
|
2283
2488
|
- name: value
|
2284
2489
|
type: node
|
2490
|
+
kind: non-void expression
|
2285
2491
|
comment: |
|
2286
2492
|
Represents the use of an assignment operator on a call to `[]`.
|
2287
2493
|
|
2288
2494
|
foo.bar[baz] += value
|
2289
2495
|
^^^^^^^^^^^^^^^^^^^^^
|
2290
2496
|
- name: IndexOrWriteNode
|
2497
|
+
flags: CallNodeFlags
|
2291
2498
|
fields:
|
2292
|
-
- name: flags
|
2293
|
-
type: flags
|
2294
|
-
kind: CallNodeFlags
|
2295
2499
|
- name: receiver
|
2296
2500
|
type: node?
|
2501
|
+
kind: non-void expression
|
2297
2502
|
- name: call_operator_loc
|
2298
2503
|
type: location?
|
2299
2504
|
- name: opening_loc
|
@@ -2305,22 +2510,23 @@ nodes:
|
|
2305
2510
|
type: location
|
2306
2511
|
- name: block
|
2307
2512
|
type: node?
|
2513
|
+
kind: BlockArgumentNode # foo[&b] ||= value, only valid on Ruby < 3.4
|
2308
2514
|
- name: operator_loc
|
2309
2515
|
type: location
|
2310
2516
|
- name: value
|
2311
2517
|
type: node
|
2518
|
+
kind: non-void expression
|
2312
2519
|
comment: |
|
2313
2520
|
Represents the use of the `||=` operator on a call to `[]`.
|
2314
2521
|
|
2315
2522
|
foo.bar[baz] ||= value
|
2316
2523
|
^^^^^^^^^^^^^^^^^^^^^^
|
2317
2524
|
- name: IndexTargetNode
|
2525
|
+
flags: CallNodeFlags
|
2318
2526
|
fields:
|
2319
|
-
- name: flags
|
2320
|
-
type: flags
|
2321
|
-
kind: CallNodeFlags
|
2322
2527
|
- name: receiver
|
2323
2528
|
type: node
|
2529
|
+
kind: non-void expression
|
2324
2530
|
- name: opening_loc
|
2325
2531
|
type: location
|
2326
2532
|
- name: arguments
|
@@ -2330,6 +2536,7 @@ nodes:
|
|
2330
2536
|
type: location
|
2331
2537
|
- name: block
|
2332
2538
|
type: node?
|
2539
|
+
kind: BlockArgumentNode # foo[&b], = 1, only valid on Ruby < 3.4
|
2333
2540
|
comment: |
|
2334
2541
|
Represents assigning to an index.
|
2335
2542
|
|
@@ -2353,6 +2560,7 @@ nodes:
|
|
2353
2560
|
type: location
|
2354
2561
|
- name: value
|
2355
2562
|
type: node
|
2563
|
+
kind: non-void expression
|
2356
2564
|
comment: |
|
2357
2565
|
Represents the use of the `&&=` operator for assignment to an instance variable.
|
2358
2566
|
|
@@ -2368,6 +2576,7 @@ nodes:
|
|
2368
2576
|
type: location
|
2369
2577
|
- name: value
|
2370
2578
|
type: node
|
2579
|
+
kind: non-void expression
|
2371
2580
|
- name: binary_operator
|
2372
2581
|
type: constant
|
2373
2582
|
comment: |
|
@@ -2385,6 +2594,7 @@ nodes:
|
|
2385
2594
|
type: location
|
2386
2595
|
- name: value
|
2387
2596
|
type: node
|
2597
|
+
kind: non-void expression
|
2388
2598
|
comment: |
|
2389
2599
|
Represents the use of the `||=` operator for assignment to an instance variable.
|
2390
2600
|
|
@@ -2433,6 +2643,7 @@ nodes:
|
|
2433
2643
|
^^^
|
2434
2644
|
- name: value
|
2435
2645
|
type: node
|
2646
|
+
kind: non-void expression
|
2436
2647
|
comment: |
|
2437
2648
|
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).
|
2438
2649
|
|
@@ -2454,10 +2665,8 @@ nodes:
|
|
2454
2665
|
@foo = 1
|
2455
2666
|
^^^^^^^^
|
2456
2667
|
- name: IntegerNode
|
2668
|
+
flags: IntegerBaseFlags
|
2457
2669
|
fields:
|
2458
|
-
- name: flags
|
2459
|
-
type: flags
|
2460
|
-
kind: IntegerBaseFlags
|
2461
2670
|
- name: value
|
2462
2671
|
type: integer
|
2463
2672
|
comment: The value of the integer literal as a number.
|
@@ -2467,10 +2676,8 @@ nodes:
|
|
2467
2676
|
1
|
2468
2677
|
^
|
2469
2678
|
- name: InterpolatedMatchLastLineNode
|
2679
|
+
flags: RegularExpressionFlags
|
2470
2680
|
fields:
|
2471
|
-
- name: flags
|
2472
|
-
type: flags
|
2473
|
-
kind: RegularExpressionFlags
|
2474
2681
|
- name: opening_loc
|
2475
2682
|
type: location
|
2476
2683
|
- name: parts
|
@@ -2488,10 +2695,8 @@ nodes:
|
|
2488
2695
|
if /foo #{bar} baz/ then end
|
2489
2696
|
^^^^^^^^^^^^^^^^
|
2490
2697
|
- name: InterpolatedRegularExpressionNode
|
2698
|
+
flags: RegularExpressionFlags
|
2491
2699
|
fields:
|
2492
|
-
- name: flags
|
2493
|
-
type: flags
|
2494
|
-
kind: RegularExpressionFlags
|
2495
2700
|
- name: opening_loc
|
2496
2701
|
type: location
|
2497
2702
|
- name: parts
|
@@ -2509,10 +2714,8 @@ nodes:
|
|
2509
2714
|
/foo #{bar} baz/
|
2510
2715
|
^^^^^^^^^^^^^^^^
|
2511
2716
|
- name: InterpolatedStringNode
|
2717
|
+
flags: InterpolatedStringNodeFlags
|
2512
2718
|
fields:
|
2513
|
-
- name: flags
|
2514
|
-
type: flags
|
2515
|
-
kind: InterpolatedStringNodeFlags
|
2516
2719
|
- name: opening_loc
|
2517
2720
|
type: location?
|
2518
2721
|
- name: parts
|
@@ -2566,6 +2769,12 @@ nodes:
|
|
2566
2769
|
|
2567
2770
|
`foo #{bar} baz`
|
2568
2771
|
^^^^^^^^^^^^^^^^
|
2772
|
+
- name: ItLocalVariableReadNode
|
2773
|
+
comment: |
|
2774
|
+
Represents reading from the implicit `it` local variable.
|
2775
|
+
|
2776
|
+
-> { it }
|
2777
|
+
^^
|
2569
2778
|
- name: ItParametersNode
|
2570
2779
|
comment: |
|
2571
2780
|
Represents an implicit set of parameters through the use of the `it` keyword within a block or lambda.
|
@@ -2573,10 +2782,8 @@ nodes:
|
|
2573
2782
|
-> { it + it }
|
2574
2783
|
^^^^^^^^^^^^^^
|
2575
2784
|
- name: KeywordHashNode
|
2785
|
+
flags: KeywordHashNodeFlags
|
2576
2786
|
fields:
|
2577
|
-
- name: flags
|
2578
|
-
type: flags
|
2579
|
-
kind: KeywordHashNodeFlags
|
2580
2787
|
- name: elements
|
2581
2788
|
type: node[]
|
2582
2789
|
kind:
|
@@ -2588,10 +2795,8 @@ nodes:
|
|
2588
2795
|
foo(a: b)
|
2589
2796
|
^^^^
|
2590
2797
|
- name: KeywordRestParameterNode
|
2798
|
+
flags: ParameterFlags
|
2591
2799
|
fields:
|
2592
|
-
- name: flags
|
2593
|
-
type: flags
|
2594
|
-
kind: ParameterFlags
|
2595
2800
|
- name: name
|
2596
2801
|
type: constant?
|
2597
2802
|
- name: name_loc
|
@@ -2616,8 +2821,15 @@ nodes:
|
|
2616
2821
|
type: location
|
2617
2822
|
- name: parameters
|
2618
2823
|
type: node?
|
2824
|
+
kind:
|
2825
|
+
- BlockParametersNode
|
2826
|
+
- NumberedParametersNode
|
2827
|
+
- ItParametersNode
|
2619
2828
|
- name: body
|
2620
2829
|
type: node?
|
2830
|
+
kind:
|
2831
|
+
- StatementsNode
|
2832
|
+
- BeginNode
|
2621
2833
|
comment: |
|
2622
2834
|
Represents using a lambda literal (not the lambda method call).
|
2623
2835
|
|
@@ -2631,6 +2843,7 @@ nodes:
|
|
2631
2843
|
type: location
|
2632
2844
|
- name: value
|
2633
2845
|
type: node
|
2846
|
+
kind: non-void expression
|
2634
2847
|
- name: name
|
2635
2848
|
type: constant
|
2636
2849
|
- name: depth
|
@@ -2648,6 +2861,7 @@ nodes:
|
|
2648
2861
|
type: location
|
2649
2862
|
- name: value
|
2650
2863
|
type: node
|
2864
|
+
kind: non-void expression
|
2651
2865
|
- name: name
|
2652
2866
|
type: constant
|
2653
2867
|
- name: binary_operator
|
@@ -2667,6 +2881,7 @@ nodes:
|
|
2667
2881
|
type: location
|
2668
2882
|
- name: value
|
2669
2883
|
type: node
|
2884
|
+
kind: non-void expression
|
2670
2885
|
- name: name
|
2671
2886
|
type: constant
|
2672
2887
|
- name: depth
|
@@ -2691,10 +2906,6 @@ nodes:
|
|
2691
2906
|
|
2692
2907
|
_1 # name `:_1`
|
2693
2908
|
|
2694
|
-
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.
|
2695
|
-
|
2696
|
-
it # name `:0it`
|
2697
|
-
|
2698
2909
|
- name: depth
|
2699
2910
|
type: uint32
|
2700
2911
|
comment: |
|
@@ -2750,6 +2961,7 @@ nodes:
|
|
2750
2961
|
^^^
|
2751
2962
|
- name: value
|
2752
2963
|
type: node
|
2964
|
+
kind: non-void expression
|
2753
2965
|
comment: |
|
2754
2966
|
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).
|
2755
2967
|
|
@@ -2775,10 +2987,8 @@ nodes:
|
|
2775
2987
|
foo = 1
|
2776
2988
|
^^^^^^^
|
2777
2989
|
- name: MatchLastLineNode
|
2990
|
+
flags: RegularExpressionFlags
|
2778
2991
|
fields:
|
2779
|
-
- name: flags
|
2780
|
-
type: flags
|
2781
|
-
kind: RegularExpressionFlags
|
2782
2992
|
- name: opening_loc
|
2783
2993
|
type: location
|
2784
2994
|
- name: content_loc
|
@@ -2796,8 +3006,10 @@ nodes:
|
|
2796
3006
|
fields:
|
2797
3007
|
- name: value
|
2798
3008
|
type: node
|
3009
|
+
kind: non-void expression
|
2799
3010
|
- name: pattern
|
2800
3011
|
type: node
|
3012
|
+
kind: pattern expression
|
2801
3013
|
- name: operator_loc
|
2802
3014
|
type: location
|
2803
3015
|
comment: |
|
@@ -2809,8 +3021,10 @@ nodes:
|
|
2809
3021
|
fields:
|
2810
3022
|
- name: value
|
2811
3023
|
type: node
|
3024
|
+
kind: non-void expression
|
2812
3025
|
- name: pattern
|
2813
3026
|
type: node
|
3027
|
+
kind: pattern expression
|
2814
3028
|
- name: operator_loc
|
2815
3029
|
type: location
|
2816
3030
|
comment: |
|
@@ -2842,8 +3056,15 @@ nodes:
|
|
2842
3056
|
type: location
|
2843
3057
|
- name: constant_path
|
2844
3058
|
type: node
|
3059
|
+
kind:
|
3060
|
+
- ConstantReadNode
|
3061
|
+
- ConstantPathNode
|
3062
|
+
- on error: MissingNode # module Parent module end
|
2845
3063
|
- name: body
|
2846
3064
|
type: node?
|
3065
|
+
kind:
|
3066
|
+
- StatementsNode
|
3067
|
+
- BeginNode
|
2847
3068
|
- name: end_keyword_loc
|
2848
3069
|
type: location
|
2849
3070
|
- name: name
|
@@ -2867,11 +3088,39 @@ nodes:
|
|
2867
3088
|
- CallTargetNode
|
2868
3089
|
- IndexTargetNode
|
2869
3090
|
- MultiTargetNode
|
2870
|
-
- RequiredParameterNode
|
2871
|
-
- BackReferenceReadNode #
|
2872
|
-
- NumberedReferenceReadNode #
|
3091
|
+
- RequiredParameterNode # def m((a,b)); end
|
3092
|
+
- on error: BackReferenceReadNode # a, (b, $&) = z
|
3093
|
+
- on error: NumberedReferenceReadNode # a, (b, $1) = z
|
3094
|
+
comment: |
|
3095
|
+
Represents the targets expressions before a splat node.
|
3096
|
+
|
3097
|
+
a, (b, c, *) = 1, 2, 3, 4, 5
|
3098
|
+
^^^^
|
3099
|
+
|
3100
|
+
The splat node can be absent, in that case all target expressions are in the left field.
|
3101
|
+
|
3102
|
+
a, (b, c) = 1, 2, 3, 4, 5
|
3103
|
+
^^^^
|
2873
3104
|
- name: rest
|
2874
3105
|
type: node?
|
3106
|
+
kind:
|
3107
|
+
- ImplicitRestNode
|
3108
|
+
- SplatNode
|
3109
|
+
comment: |
|
3110
|
+
Represents a splat node in the target expression.
|
3111
|
+
|
3112
|
+
a, (b, *c) = 1, 2, 3, 4
|
3113
|
+
^^
|
3114
|
+
|
3115
|
+
The variable can be empty, this results in a `SplatNode` with a `nil` expression field.
|
3116
|
+
|
3117
|
+
a, (b, *) = 1, 2, 3, 4
|
3118
|
+
^
|
3119
|
+
|
3120
|
+
If the `*` is omitted, this field will contain an `ImplicitRestNode`
|
3121
|
+
|
3122
|
+
a, (b,) = 1, 2, 3, 4
|
3123
|
+
^
|
2875
3124
|
- name: rights
|
2876
3125
|
type: node[]
|
2877
3126
|
kind:
|
@@ -2884,17 +3133,38 @@ nodes:
|
|
2884
3133
|
- CallTargetNode
|
2885
3134
|
- IndexTargetNode
|
2886
3135
|
- MultiTargetNode
|
2887
|
-
- RequiredParameterNode
|
2888
|
-
- BackReferenceReadNode #
|
3136
|
+
- RequiredParameterNode # def m((*,b)); end
|
3137
|
+
- on error: BackReferenceReadNode # a, (*, $&) = z
|
3138
|
+
- on error: NumberedReferenceReadNode # a, (*, $1) = z
|
3139
|
+
comment: |
|
3140
|
+
Represents the targets expressions after a splat node.
|
3141
|
+
|
3142
|
+
a, (*, b, c) = 1, 2, 3, 4, 5
|
3143
|
+
^^^^
|
2889
3144
|
- name: lparen_loc
|
2890
3145
|
type: location?
|
3146
|
+
comment: |
|
3147
|
+
The location of the opening parenthesis.
|
3148
|
+
|
3149
|
+
a, (b, c) = 1, 2, 3
|
3150
|
+
^
|
2891
3151
|
- name: rparen_loc
|
2892
3152
|
type: location?
|
3153
|
+
comment: |
|
3154
|
+
The location of the closing parenthesis.
|
3155
|
+
|
3156
|
+
a, (b, c) = 1, 2, 3
|
3157
|
+
^
|
2893
3158
|
comment: |
|
2894
3159
|
Represents a multi-target expression.
|
2895
3160
|
|
2896
3161
|
a, (b, c) = 1, 2, 3
|
2897
3162
|
^^^^^^
|
3163
|
+
|
3164
|
+
This can be a part of `MultiWriteNode` as above, or the target of a `for` loop
|
3165
|
+
|
3166
|
+
for a, b in [[1, 2], [3, 4]]
|
3167
|
+
^^^^
|
2898
3168
|
- name: MultiWriteNode
|
2899
3169
|
fields:
|
2900
3170
|
- name: lefts
|
@@ -2909,8 +3179,38 @@ nodes:
|
|
2909
3179
|
- CallTargetNode
|
2910
3180
|
- IndexTargetNode
|
2911
3181
|
- MultiTargetNode
|
3182
|
+
- on error: BackReferenceReadNode # $&, = z
|
3183
|
+
- on error: NumberedReferenceReadNode # $1, = z
|
3184
|
+
comment: |
|
3185
|
+
Represents the targets expressions before a splat node.
|
3186
|
+
|
3187
|
+
a, b, * = 1, 2, 3, 4, 5
|
3188
|
+
^^^^
|
3189
|
+
|
3190
|
+
The splat node can be absent, in that case all target expressions are in the left field.
|
3191
|
+
|
3192
|
+
a, b, c = 1, 2, 3, 4, 5
|
3193
|
+
^^^^^^^
|
2912
3194
|
- name: rest
|
2913
3195
|
type: node?
|
3196
|
+
kind:
|
3197
|
+
- ImplicitRestNode
|
3198
|
+
- SplatNode
|
3199
|
+
comment: |
|
3200
|
+
Represents a splat node in the target expression.
|
3201
|
+
|
3202
|
+
a, b, *c = 1, 2, 3, 4
|
3203
|
+
^^
|
3204
|
+
|
3205
|
+
The variable can be empty, this results in a `SplatNode` with a `nil` expression field.
|
3206
|
+
|
3207
|
+
a, b, * = 1, 2, 3, 4
|
3208
|
+
^
|
3209
|
+
|
3210
|
+
If the `*` is omitted, this field will contain an `ImplicitRestNode`
|
3211
|
+
|
3212
|
+
a, b, = 1, 2, 3, 4
|
3213
|
+
^
|
2914
3214
|
- name: rights
|
2915
3215
|
type: node[]
|
2916
3216
|
kind:
|
@@ -2923,14 +3223,42 @@ nodes:
|
|
2923
3223
|
- CallTargetNode
|
2924
3224
|
- IndexTargetNode
|
2925
3225
|
- MultiTargetNode
|
3226
|
+
- on error: BackReferenceReadNode # *, $& = z
|
3227
|
+
- on error: NumberedReferenceReadNode # *, $1 = z
|
3228
|
+
comment: |
|
3229
|
+
Represents the targets expressions after a splat node.
|
3230
|
+
|
3231
|
+
a, *, b, c = 1, 2, 3, 4, 5
|
3232
|
+
^^^^
|
2926
3233
|
- name: lparen_loc
|
2927
3234
|
type: location?
|
3235
|
+
comment: |
|
3236
|
+
The location of the opening parenthesis.
|
3237
|
+
|
3238
|
+
(a, b, c) = 1, 2, 3
|
3239
|
+
^
|
2928
3240
|
- name: rparen_loc
|
2929
3241
|
type: location?
|
3242
|
+
comment: |
|
3243
|
+
The location of the closing parenthesis.
|
3244
|
+
|
3245
|
+
(a, b, c) = 1, 2, 3
|
3246
|
+
^
|
2930
3247
|
- name: operator_loc
|
2931
3248
|
type: location
|
3249
|
+
comment: |
|
3250
|
+
The location of the operator.
|
3251
|
+
|
3252
|
+
a, b, c = 1, 2, 3
|
3253
|
+
^
|
2932
3254
|
- name: value
|
2933
3255
|
type: node
|
3256
|
+
kind: non-void expression
|
3257
|
+
comment: |
|
3258
|
+
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).
|
3259
|
+
|
3260
|
+
a, b, c = 1, 2, 3
|
3261
|
+
^^^^^^^
|
2934
3262
|
comment: |
|
2935
3263
|
Represents a write to a multi-target expression.
|
2936
3264
|
|
@@ -2993,16 +3321,15 @@ nodes:
|
|
2993
3321
|
$1
|
2994
3322
|
^^
|
2995
3323
|
- name: OptionalKeywordParameterNode
|
3324
|
+
flags: ParameterFlags
|
2996
3325
|
fields:
|
2997
|
-
- name: flags
|
2998
|
-
type: flags
|
2999
|
-
kind: ParameterFlags
|
3000
3326
|
- name: name
|
3001
3327
|
type: constant
|
3002
3328
|
- name: name_loc
|
3003
3329
|
type: location
|
3004
3330
|
- name: value
|
3005
3331
|
type: node
|
3332
|
+
kind: non-void expression
|
3006
3333
|
comment: |
|
3007
3334
|
Represents an optional keyword parameter to a method, block, or lambda definition.
|
3008
3335
|
|
@@ -3010,10 +3337,8 @@ nodes:
|
|
3010
3337
|
^^^^
|
3011
3338
|
end
|
3012
3339
|
- name: OptionalParameterNode
|
3340
|
+
flags: ParameterFlags
|
3013
3341
|
fields:
|
3014
|
-
- name: flags
|
3015
|
-
type: flags
|
3016
|
-
kind: ParameterFlags
|
3017
3342
|
- name: name
|
3018
3343
|
type: constant
|
3019
3344
|
- name: name_loc
|
@@ -3022,6 +3347,7 @@ nodes:
|
|
3022
3347
|
type: location
|
3023
3348
|
- name: value
|
3024
3349
|
type: node
|
3350
|
+
kind: non-void expression
|
3025
3351
|
comment: |
|
3026
3352
|
Represents an optional parameter to a method, block, or lambda definition.
|
3027
3353
|
|
@@ -3032,6 +3358,7 @@ nodes:
|
|
3032
3358
|
fields:
|
3033
3359
|
- name: left
|
3034
3360
|
type: node
|
3361
|
+
kind: non-void expression
|
3035
3362
|
comment: |
|
3036
3363
|
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).
|
3037
3364
|
|
@@ -3042,8 +3369,9 @@ nodes:
|
|
3042
3369
|
^
|
3043
3370
|
- name: right
|
3044
3371
|
type: node
|
3372
|
+
kind: Node
|
3045
3373
|
comment: |
|
3046
|
-
Represents the right side of the expression.
|
3374
|
+
Represents the right side of the expression.
|
3047
3375
|
|
3048
3376
|
left || right
|
3049
3377
|
^^^^^
|
@@ -3083,10 +3411,10 @@ nodes:
|
|
3083
3411
|
- RequiredParameterNode
|
3084
3412
|
- MultiTargetNode
|
3085
3413
|
# On parsing error of `f(**kwargs, ...)` or `f(**nil, ...)`, the keyword_rest value is moved here:
|
3086
|
-
- KeywordRestParameterNode
|
3087
|
-
- NoKeywordsParameterNode
|
3414
|
+
- on error: KeywordRestParameterNode
|
3415
|
+
- on error: NoKeywordsParameterNode
|
3088
3416
|
# On parsing error of `f(..., ...)`, the first forwarding parameter is moved here:
|
3089
|
-
- ForwardingParameterNode
|
3417
|
+
- on error: ForwardingParameterNode
|
3090
3418
|
- name: keywords
|
3091
3419
|
type: node[]
|
3092
3420
|
kind:
|
@@ -3111,6 +3439,7 @@ nodes:
|
|
3111
3439
|
fields:
|
3112
3440
|
- name: body
|
3113
3441
|
type: node?
|
3442
|
+
kind: non-void expression # Usually a StatementsNode but not always e.g. `1 in (..10)`
|
3114
3443
|
- name: opening_loc
|
3115
3444
|
type: location
|
3116
3445
|
- name: closing_loc
|
@@ -3125,6 +3454,7 @@ nodes:
|
|
3125
3454
|
fields:
|
3126
3455
|
- name: expression
|
3127
3456
|
type: node
|
3457
|
+
kind: non-void expression
|
3128
3458
|
- name: operator_loc
|
3129
3459
|
type: location
|
3130
3460
|
- name: lparen_loc
|
@@ -3140,6 +3470,15 @@ nodes:
|
|
3140
3470
|
fields:
|
3141
3471
|
- name: variable
|
3142
3472
|
type: node
|
3473
|
+
kind:
|
3474
|
+
- LocalVariableReadNode
|
3475
|
+
- InstanceVariableReadNode
|
3476
|
+
- ClassVariableReadNode
|
3477
|
+
- GlobalVariableReadNode # foo in ^$a
|
3478
|
+
- BackReferenceReadNode # foo in ^$&
|
3479
|
+
- NumberedReferenceReadNode # foo in ^$1
|
3480
|
+
- ItLocalVariableReadNode # proc { 1 in ^it }
|
3481
|
+
- on error: MissingNode # foo in ^Bar
|
3143
3482
|
- name: operator_loc
|
3144
3483
|
type: location
|
3145
3484
|
comment: |
|
@@ -3188,12 +3527,11 @@ nodes:
|
|
3188
3527
|
kind: StatementsNode
|
3189
3528
|
comment: The top level node of any parse tree.
|
3190
3529
|
- name: RangeNode
|
3530
|
+
flags: RangeFlags
|
3191
3531
|
fields:
|
3192
|
-
- name: flags
|
3193
|
-
type: flags
|
3194
|
-
kind: RangeFlags
|
3195
3532
|
- name: left
|
3196
3533
|
type: node?
|
3534
|
+
kind: non-void expression
|
3197
3535
|
comment: |
|
3198
3536
|
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).
|
3199
3537
|
|
@@ -3204,6 +3542,7 @@ nodes:
|
|
3204
3542
|
^^^^^
|
3205
3543
|
- name: right
|
3206
3544
|
type: node?
|
3545
|
+
kind: non-void expression
|
3207
3546
|
comment: |
|
3208
3547
|
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).
|
3209
3548
|
|
@@ -3226,9 +3565,20 @@ nodes:
|
|
3226
3565
|
c if a =~ /left/ ... b =~ /right/
|
3227
3566
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
3228
3567
|
- name: RationalNode
|
3568
|
+
flags: IntegerBaseFlags
|
3229
3569
|
fields:
|
3230
|
-
- name:
|
3231
|
-
type:
|
3570
|
+
- name: numerator
|
3571
|
+
type: integer
|
3572
|
+
comment: |
|
3573
|
+
The numerator of the rational number.
|
3574
|
+
|
3575
|
+
1.5r # numerator 3
|
3576
|
+
- name: denominator
|
3577
|
+
type: integer
|
3578
|
+
comment: |
|
3579
|
+
The denominator of the rational number.
|
3580
|
+
|
3581
|
+
1.5r # denominator 2
|
3232
3582
|
comment: |
|
3233
3583
|
Represents a rational number literal.
|
3234
3584
|
|
@@ -3241,10 +3591,8 @@ nodes:
|
|
3241
3591
|
redo
|
3242
3592
|
^^^^
|
3243
3593
|
- name: RegularExpressionNode
|
3594
|
+
flags: RegularExpressionFlags
|
3244
3595
|
fields:
|
3245
|
-
- name: flags
|
3246
|
-
type: flags
|
3247
|
-
kind: RegularExpressionFlags
|
3248
3596
|
- name: opening_loc
|
3249
3597
|
type: location
|
3250
3598
|
- name: content_loc
|
@@ -3259,10 +3607,8 @@ nodes:
|
|
3259
3607
|
/foo/i
|
3260
3608
|
^^^^^^
|
3261
3609
|
- name: RequiredKeywordParameterNode
|
3610
|
+
flags: ParameterFlags
|
3262
3611
|
fields:
|
3263
|
-
- name: flags
|
3264
|
-
type: flags
|
3265
|
-
kind: ParameterFlags
|
3266
3612
|
- name: name
|
3267
3613
|
type: constant
|
3268
3614
|
- name: name_loc
|
@@ -3274,10 +3620,8 @@ nodes:
|
|
3274
3620
|
^^
|
3275
3621
|
end
|
3276
3622
|
- name: RequiredParameterNode
|
3623
|
+
flags: ParameterFlags
|
3277
3624
|
fields:
|
3278
|
-
- name: flags
|
3279
|
-
type: flags
|
3280
|
-
kind: ParameterFlags
|
3281
3625
|
- name: name
|
3282
3626
|
type: constant
|
3283
3627
|
comment: |
|
@@ -3290,10 +3634,12 @@ nodes:
|
|
3290
3634
|
fields:
|
3291
3635
|
- name: expression
|
3292
3636
|
type: node
|
3637
|
+
kind: Node
|
3293
3638
|
- name: keyword_loc
|
3294
3639
|
type: location
|
3295
3640
|
- name: rescue_expression
|
3296
3641
|
type: node
|
3642
|
+
kind: Node
|
3297
3643
|
newline: expression
|
3298
3644
|
comment: |
|
3299
3645
|
Represents an expression modified with a rescue.
|
@@ -3306,14 +3652,27 @@ nodes:
|
|
3306
3652
|
type: location
|
3307
3653
|
- name: exceptions
|
3308
3654
|
type: node[]
|
3655
|
+
kind: non-void expression
|
3309
3656
|
- name: operator_loc
|
3310
3657
|
type: location?
|
3311
3658
|
- name: reference
|
3312
3659
|
type: node?
|
3660
|
+
kind:
|
3661
|
+
- LocalVariableTargetNode
|
3662
|
+
- InstanceVariableTargetNode
|
3663
|
+
- ClassVariableTargetNode
|
3664
|
+
- GlobalVariableTargetNode
|
3665
|
+
- ConstantTargetNode
|
3666
|
+
- ConstantPathTargetNode
|
3667
|
+
- CallTargetNode
|
3668
|
+
- IndexTargetNode
|
3669
|
+
- on error: BackReferenceReadNode # => begin; rescue => $&; end
|
3670
|
+
- on error: NumberedReferenceReadNode # => begin; rescue => $1; end
|
3671
|
+
- on error: MissingNode # begin; rescue =>; end
|
3313
3672
|
- name: statements
|
3314
3673
|
type: node?
|
3315
3674
|
kind: StatementsNode
|
3316
|
-
- name:
|
3675
|
+
- name: subsequent
|
3317
3676
|
type: node?
|
3318
3677
|
kind: RescueNode
|
3319
3678
|
comment: |
|
@@ -3327,10 +3686,8 @@ nodes:
|
|
3327
3686
|
|
3328
3687
|
`Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `exception` field.
|
3329
3688
|
- name: RestParameterNode
|
3689
|
+
flags: ParameterFlags
|
3330
3690
|
fields:
|
3331
|
-
- name: flags
|
3332
|
-
type: flags
|
3333
|
-
kind: ParameterFlags
|
3334
3691
|
- name: name
|
3335
3692
|
type: constant?
|
3336
3693
|
- name: name_loc
|
@@ -3351,9 +3708,6 @@ nodes:
|
|
3351
3708
|
^^^^^
|
3352
3709
|
- name: ReturnNode
|
3353
3710
|
fields:
|
3354
|
-
- name: flags
|
3355
|
-
type: flags
|
3356
|
-
kind: ReturnNodeFlags
|
3357
3711
|
- name: keyword_loc
|
3358
3712
|
type: location
|
3359
3713
|
- name: arguments
|
@@ -3371,10 +3725,8 @@ nodes:
|
|
3371
3725
|
self
|
3372
3726
|
^^^^
|
3373
3727
|
- name: ShareableConstantNode
|
3728
|
+
flags: ShareableConstantNodeFlags
|
3374
3729
|
fields:
|
3375
|
-
- name: flags
|
3376
|
-
type: flags
|
3377
|
-
kind: ShareableConstantNodeFlags
|
3378
3730
|
- name: write
|
3379
3731
|
type: node
|
3380
3732
|
kind:
|
@@ -3403,8 +3755,12 @@ nodes:
|
|
3403
3755
|
type: location
|
3404
3756
|
- name: expression
|
3405
3757
|
type: node
|
3758
|
+
kind: non-void expression
|
3406
3759
|
- name: body
|
3407
3760
|
type: node?
|
3761
|
+
kind:
|
3762
|
+
- StatementsNode
|
3763
|
+
- BeginNode
|
3408
3764
|
- name: end_keyword_loc
|
3409
3765
|
type: location
|
3410
3766
|
comment: |
|
@@ -3419,10 +3775,8 @@ nodes:
|
|
3419
3775
|
__ENCODING__
|
3420
3776
|
^^^^^^^^^^^^
|
3421
3777
|
- name: SourceFileNode
|
3778
|
+
flags: StringFlags
|
3422
3779
|
fields:
|
3423
|
-
- name: flags
|
3424
|
-
type: flags
|
3425
|
-
kind: StringFlags
|
3426
3780
|
- name: filepath
|
3427
3781
|
type: string
|
3428
3782
|
comment: Represents the file path being parsed. This corresponds directly to the `filepath` option given to the various `Prism::parse*` APIs.
|
@@ -3443,6 +3797,7 @@ nodes:
|
|
3443
3797
|
type: location
|
3444
3798
|
- name: expression
|
3445
3799
|
type: node?
|
3800
|
+
kind: non-void expression
|
3446
3801
|
comment: |
|
3447
3802
|
Represents the use of the splat operator.
|
3448
3803
|
|
@@ -3452,16 +3807,15 @@ nodes:
|
|
3452
3807
|
fields:
|
3453
3808
|
- name: body
|
3454
3809
|
type: node[]
|
3810
|
+
kind: Node
|
3455
3811
|
comment: |
|
3456
3812
|
Represents a set of statements contained within some scope.
|
3457
3813
|
|
3458
3814
|
foo; bar; baz
|
3459
3815
|
^^^^^^^^^^^^^
|
3460
3816
|
- name: StringNode
|
3817
|
+
flags: StringFlags
|
3461
3818
|
fields:
|
3462
|
-
- name: flags
|
3463
|
-
type: flags
|
3464
|
-
kind: StringFlags
|
3465
3819
|
- name: opening_loc
|
3466
3820
|
type: location?
|
3467
3821
|
- name: content_loc
|
@@ -3494,6 +3848,9 @@ nodes:
|
|
3494
3848
|
type: location?
|
3495
3849
|
- name: block
|
3496
3850
|
type: node?
|
3851
|
+
kind:
|
3852
|
+
- BlockNode
|
3853
|
+
- BlockArgumentNode
|
3497
3854
|
comment: |
|
3498
3855
|
Represents the use of the `super` keyword with parentheses or arguments.
|
3499
3856
|
|
@@ -3503,10 +3860,8 @@ nodes:
|
|
3503
3860
|
super foo, bar
|
3504
3861
|
^^^^^^^^^^^^^^
|
3505
3862
|
- name: SymbolNode
|
3863
|
+
flags: SymbolFlags
|
3506
3864
|
fields:
|
3507
|
-
- name: flags
|
3508
|
-
type: flags
|
3509
|
-
kind: SymbolFlags
|
3510
3865
|
- name: opening_loc
|
3511
3866
|
type: location?
|
3512
3867
|
- name: value_loc
|
@@ -3557,6 +3912,7 @@ nodes:
|
|
3557
3912
|
^^^^^^
|
3558
3913
|
- name: predicate
|
3559
3914
|
type: node
|
3915
|
+
kind: non-void expression
|
3560
3916
|
comment: |
|
3561
3917
|
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).
|
3562
3918
|
|
@@ -3567,7 +3923,7 @@ nodes:
|
|
3567
3923
|
^^^^
|
3568
3924
|
- name: then_keyword_loc
|
3569
3925
|
type: location?
|
3570
|
-
comment:
|
3926
|
+
comment: |
|
3571
3927
|
The location of the `then` keyword, if present.
|
3572
3928
|
|
3573
3929
|
unless cond then bar end
|
@@ -3581,7 +3937,7 @@ nodes:
|
|
3581
3937
|
|
3582
3938
|
unless cond then bar end
|
3583
3939
|
^^^
|
3584
|
-
- name:
|
3940
|
+
- name: else_clause
|
3585
3941
|
type: node?
|
3586
3942
|
kind: ElseNode
|
3587
3943
|
comment: |
|
@@ -3606,16 +3962,15 @@ nodes:
|
|
3606
3962
|
unless foo then bar end
|
3607
3963
|
^^^^^^^^^^^^^^^^^^^^^^^
|
3608
3964
|
- name: UntilNode
|
3965
|
+
flags: LoopFlags
|
3609
3966
|
fields:
|
3610
|
-
- name: flags
|
3611
|
-
type: flags
|
3612
|
-
kind: LoopFlags
|
3613
3967
|
- name: keyword_loc
|
3614
3968
|
type: location
|
3615
3969
|
- name: closing_loc
|
3616
3970
|
type: location?
|
3617
3971
|
- name: predicate
|
3618
3972
|
type: node
|
3973
|
+
kind: non-void expression
|
3619
3974
|
- name: statements
|
3620
3975
|
type: node?
|
3621
3976
|
kind: StatementsNode
|
@@ -3634,6 +3989,7 @@ nodes:
|
|
3634
3989
|
type: location
|
3635
3990
|
- name: conditions
|
3636
3991
|
type: node[]
|
3992
|
+
kind: non-void expression
|
3637
3993
|
- name: then_keyword_loc
|
3638
3994
|
type: location?
|
3639
3995
|
- name: statements
|
@@ -3647,16 +4003,15 @@ nodes:
|
|
3647
4003
|
^^^^^^^^^
|
3648
4004
|
end
|
3649
4005
|
- name: WhileNode
|
4006
|
+
flags: LoopFlags
|
3650
4007
|
fields:
|
3651
|
-
- name: flags
|
3652
|
-
type: flags
|
3653
|
-
kind: LoopFlags
|
3654
4008
|
- name: keyword_loc
|
3655
4009
|
type: location
|
3656
4010
|
- name: closing_loc
|
3657
4011
|
type: location?
|
3658
4012
|
- name: predicate
|
3659
4013
|
type: node
|
4014
|
+
kind: non-void expression
|
3660
4015
|
- name: statements
|
3661
4016
|
type: node?
|
3662
4017
|
kind: StatementsNode
|
@@ -3670,10 +4025,8 @@ nodes:
|
|
3670
4025
|
while foo do bar end
|
3671
4026
|
^^^^^^^^^^^^^^^^^^^^
|
3672
4027
|
- name: XStringNode
|
4028
|
+
flags: EncodingFlags
|
3673
4029
|
fields:
|
3674
|
-
- name: flags
|
3675
|
-
type: flags
|
3676
|
-
kind: EncodingFlags
|
3677
4030
|
- name: opening_loc
|
3678
4031
|
type: location
|
3679
4032
|
- name: content_loc
|