prism 0.29.0 → 1.3.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 +115 -1
- data/CONTRIBUTING.md +0 -4
- data/Makefile +1 -1
- data/README.md +4 -0
- data/config.yml +920 -148
- data/docs/build_system.md +8 -11
- data/docs/fuzzing.md +1 -1
- data/docs/parsing_rules.md +4 -1
- data/docs/relocation.md +34 -0
- data/docs/ripper_translation.md +22 -0
- data/docs/serialization.md +3 -0
- data/ext/prism/api_node.c +2863 -2079
- data/ext/prism/extconf.rb +14 -37
- data/ext/prism/extension.c +241 -391
- data/ext/prism/extension.h +2 -2
- data/include/prism/ast.h +2156 -453
- data/include/prism/defines.h +58 -7
- data/include/prism/diagnostic.h +24 -6
- data/include/prism/node.h +0 -21
- data/include/prism/options.h +94 -3
- data/include/prism/parser.h +82 -40
- 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 +47 -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 +55 -34
- data/lib/prism/dsl.rb +660 -468
- data/lib/prism/ffi.rb +113 -8
- data/lib/prism/inspect_visitor.rb +296 -64
- data/lib/prism/lex_compat.rb +1 -1
- data/lib/prism/mutation_compiler.rb +11 -6
- data/lib/prism/node.rb +4262 -5023
- 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 +183 -6
- data/lib/prism/reflection.rb +12 -10
- data/lib/prism/relocation.rb +504 -0
- data/lib/prism/serialize.rb +496 -609
- data/lib/prism/string_query.rb +30 -0
- data/lib/prism/translation/parser/compiler.rb +185 -155
- data/lib/prism/translation/parser/lexer.rb +26 -4
- data/lib/prism/translation/parser.rb +9 -4
- data/lib/prism/translation/ripper.rb +23 -25
- data/lib/prism/translation/ruby_parser.rb +86 -17
- data/lib/prism/visitor.rb +3 -0
- data/lib/prism.rb +6 -8
- data/prism.gemspec +9 -5
- data/rbi/prism/dsl.rbi +521 -0
- data/rbi/prism/node.rbi +1115 -1120
- data/rbi/prism/parse_result.rbi +29 -0
- data/rbi/prism/string_query.rbi +12 -0
- 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 +678 -632
- data/sig/prism/parse_result.rbs +22 -0
- data/sig/prism/relocation.rbs +185 -0
- data/sig/prism/string_query.rbs +11 -0
- data/sig/prism/visitor.rbs +1 -0
- data/sig/prism.rbs +103 -64
- data/src/diagnostic.c +64 -28
- data/src/node.c +502 -1739
- data/src/options.c +76 -27
- data/src/prettyprint.c +188 -112
- data/src/prism.c +3376 -2293
- data/src/regexp.c +208 -71
- data/src/serialize.c +182 -50
- data/src/static_literals.c +64 -85
- data/src/token_type.c +4 -4
- data/src/util/pm_char.c +1 -1
- 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 +131 -80
- data/src/util/pm_strpbrk.c +32 -6
- metadata +11 -7
- 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
|
@@ -137,6 +141,7 @@ errors:
|
|
137
141
|
- INSTANCE_VARIABLE_BARE
|
138
142
|
- INVALID_BLOCK_EXIT
|
139
143
|
- INVALID_CHARACTER
|
144
|
+
- INVALID_COMMA
|
140
145
|
- INVALID_ENCODING_MAGIC_COMMENT
|
141
146
|
- INVALID_ESCAPE_CHARACTER
|
142
147
|
- INVALID_FLOAT_EXPONENT
|
@@ -153,6 +158,7 @@ errors:
|
|
153
158
|
- INVALID_NUMBER_UNDERSCORE_INNER
|
154
159
|
- INVALID_NUMBER_UNDERSCORE_TRAILING
|
155
160
|
- INVALID_PERCENT
|
161
|
+
- INVALID_PERCENT_EOF
|
156
162
|
- INVALID_PRINTABLE_CHARACTER
|
157
163
|
- INVALID_RETRY_AFTER_ELSE
|
158
164
|
- INVALID_RETRY_AFTER_ENSURE
|
@@ -181,12 +187,15 @@ errors:
|
|
181
187
|
- MODULE_TERM
|
182
188
|
- MULTI_ASSIGN_MULTI_SPLATS
|
183
189
|
- MULTI_ASSIGN_UNEXPECTED_REST
|
190
|
+
- NESTING_TOO_DEEP
|
184
191
|
- NO_LOCAL_VARIABLE
|
192
|
+
- NON_ASSOCIATIVE_OPERATOR
|
185
193
|
- NOT_EXPRESSION
|
186
194
|
- NUMBER_LITERAL_UNDERSCORE
|
195
|
+
- NUMBERED_PARAMETER_INNER_BLOCK
|
187
196
|
- NUMBERED_PARAMETER_IT
|
188
197
|
- NUMBERED_PARAMETER_ORDINARY
|
189
|
-
-
|
198
|
+
- NUMBERED_PARAMETER_OUTER_BLOCK
|
190
199
|
- OPERATOR_MULTI_ASSIGN
|
191
200
|
- OPERATOR_WRITE_ARGUMENTS
|
192
201
|
- OPERATOR_WRITE_BLOCK
|
@@ -203,8 +212,9 @@ errors:
|
|
203
212
|
- PARAMETER_SPLAT_MULTI
|
204
213
|
- PARAMETER_STAR
|
205
214
|
- PARAMETER_UNEXPECTED_FWD
|
206
|
-
- PARAMETER_WILD_LOOSE_COMMA
|
207
215
|
- PARAMETER_UNEXPECTED_NO_KW
|
216
|
+
- PARAMETER_WILD_LOOSE_COMMA
|
217
|
+
- PATTERN_ARRAY_MULTIPLE_RESTS
|
208
218
|
- PATTERN_CAPTURE_DUPLICATE
|
209
219
|
- PATTERN_EXPRESSION_AFTER_BRACKET
|
210
220
|
- PATTERN_EXPRESSION_AFTER_COMMA
|
@@ -216,6 +226,7 @@ errors:
|
|
216
226
|
- PATTERN_EXPRESSION_AFTER_PIPE
|
217
227
|
- PATTERN_EXPRESSION_AFTER_RANGE
|
218
228
|
- PATTERN_EXPRESSION_AFTER_REST
|
229
|
+
- PATTERN_FIND_MISSING_INNER
|
219
230
|
- PATTERN_HASH_IMPLICIT
|
220
231
|
- PATTERN_HASH_KEY
|
221
232
|
- PATTERN_HASH_KEY_DUPLICATE
|
@@ -233,6 +244,7 @@ errors:
|
|
233
244
|
- REGEXP_INCOMPAT_CHAR_ENCODING
|
234
245
|
- REGEXP_INVALID_UNICODE_RANGE
|
235
246
|
- REGEXP_NON_ESCAPED_MBC
|
247
|
+
- REGEXP_PARSE_ERROR
|
236
248
|
- REGEXP_TERM
|
237
249
|
- REGEXP_UNKNOWN_OPTIONS
|
238
250
|
- REGEXP_UTF8_CHAR_NON_UTF8_REGEXP
|
@@ -257,11 +269,15 @@ errors:
|
|
257
269
|
- TERNARY_COLON
|
258
270
|
- TERNARY_EXPRESSION_FALSE
|
259
271
|
- TERNARY_EXPRESSION_TRUE
|
272
|
+
- UNARY_DISALLOWED
|
260
273
|
- UNARY_RECEIVER
|
261
274
|
- UNDEF_ARGUMENT
|
262
275
|
- UNEXPECTED_BLOCK_ARGUMENT
|
263
276
|
- UNEXPECTED_INDEX_BLOCK
|
264
277
|
- UNEXPECTED_INDEX_KEYWORDS
|
278
|
+
- UNEXPECTED_LABEL
|
279
|
+
- UNEXPECTED_MULTI_WRITE
|
280
|
+
- UNEXPECTED_RANGE_OPERATOR
|
265
281
|
- UNEXPECTED_SAFE_NAVIGATION
|
266
282
|
- UNEXPECTED_TOKEN_CLOSE_CONTEXT
|
267
283
|
- UNEXPECTED_TOKEN_IGNORE
|
@@ -273,6 +289,7 @@ errors:
|
|
273
289
|
- WRITE_TARGET_UNEXPECTED
|
274
290
|
- XSTRING_TERM
|
275
291
|
warnings:
|
292
|
+
- AMBIGUOUS_BINARY_OPERATOR
|
276
293
|
- AMBIGUOUS_FIRST_ARGUMENT_MINUS
|
277
294
|
- AMBIGUOUS_FIRST_ARGUMENT_PLUS
|
278
295
|
- AMBIGUOUS_PREFIX_AMPERSAND
|
@@ -288,10 +305,11 @@ warnings:
|
|
288
305
|
- DUPLICATED_WHEN_CLAUSE
|
289
306
|
- FLOAT_OUT_OF_RANGE
|
290
307
|
- IGNORED_FROZEN_STRING_LITERAL
|
308
|
+
- INDENTATION_MISMATCH
|
291
309
|
- INTEGER_IN_FLIP_FLOP
|
292
310
|
- INVALID_CHARACTER
|
311
|
+
- INVALID_MAGIC_COMMENT_VALUE
|
293
312
|
- INVALID_NUMBERED_REFERENCE
|
294
|
-
- INVALID_SHAREABLE_CONSTANT_VALUE
|
295
313
|
- KEYWORD_EOL
|
296
314
|
- LITERAL_IN_CONDITION_DEFAULT
|
297
315
|
- LITERAL_IN_CONDITION_VERBOSE
|
@@ -634,10 +652,16 @@ tokens:
|
|
634
652
|
flags:
|
635
653
|
- name: ArgumentsNodeFlags
|
636
654
|
values:
|
655
|
+
- name: CONTAINS_FORWARDING
|
656
|
+
comment: "if the arguments contain forwarding"
|
637
657
|
- name: CONTAINS_KEYWORDS
|
638
|
-
comment: "if arguments contain keywords"
|
658
|
+
comment: "if the arguments contain keywords"
|
639
659
|
- name: CONTAINS_KEYWORD_SPLAT
|
640
|
-
comment: "if arguments contain keyword splat"
|
660
|
+
comment: "if the arguments contain a keyword splat"
|
661
|
+
- name: CONTAINS_SPLAT
|
662
|
+
comment: "if the arguments contain a splat"
|
663
|
+
- name: CONTAINS_MULTIPLE_SPLATS
|
664
|
+
comment: "if the arguments contain multiple splats"
|
641
665
|
comment: Flags for arguments nodes.
|
642
666
|
- name: ArrayNodeFlags
|
643
667
|
values:
|
@@ -725,11 +749,6 @@ flags:
|
|
725
749
|
- name: FORCED_US_ASCII_ENCODING
|
726
750
|
comment: "internal bytes forced the encoding to US-ASCII"
|
727
751
|
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
752
|
- name: ShareableConstantNodeFlags
|
734
753
|
values:
|
735
754
|
- name: LITERAL
|
@@ -764,15 +783,25 @@ nodes:
|
|
764
783
|
fields:
|
765
784
|
- name: new_name
|
766
785
|
type: node
|
786
|
+
kind:
|
787
|
+
- GlobalVariableReadNode
|
788
|
+
- BackReferenceReadNode
|
789
|
+
- NumberedReferenceReadNode
|
767
790
|
comment: |
|
768
|
-
Represents the new name of the global variable that can be used after aliasing.
|
791
|
+
Represents the new name of the global variable that can be used after aliasing.
|
769
792
|
|
770
793
|
alias $foo $bar
|
771
794
|
^^^^
|
772
795
|
- name: old_name
|
773
796
|
type: node
|
797
|
+
kind:
|
798
|
+
- GlobalVariableReadNode
|
799
|
+
- BackReferenceReadNode
|
800
|
+
- NumberedReferenceReadNode
|
801
|
+
- on error: SymbolNode # alias $a b
|
802
|
+
- on error: MissingNode # alias $a 42
|
774
803
|
comment: |
|
775
|
-
Represents the old name of the global variable that
|
804
|
+
Represents the old name of the global variable that can be used before aliasing.
|
776
805
|
|
777
806
|
alias $foo $bar
|
778
807
|
^^^^
|
@@ -792,10 +821,45 @@ nodes:
|
|
792
821
|
fields:
|
793
822
|
- name: new_name
|
794
823
|
type: node
|
824
|
+
kind:
|
825
|
+
- SymbolNode
|
826
|
+
- InterpolatedSymbolNode
|
827
|
+
comment: |
|
828
|
+
Represents the new name of the method that will be aliased.
|
829
|
+
|
830
|
+
alias foo bar
|
831
|
+
^^^
|
832
|
+
|
833
|
+
alias :foo :bar
|
834
|
+
^^^^
|
835
|
+
|
836
|
+
alias :"#{foo}" :"#{bar}"
|
837
|
+
^^^^^^^^^
|
795
838
|
- name: old_name
|
796
839
|
type: node
|
840
|
+
kind:
|
841
|
+
- SymbolNode
|
842
|
+
- InterpolatedSymbolNode
|
843
|
+
- on error: GlobalVariableReadNode # alias a $b
|
844
|
+
- on error: MissingNode # alias a 42
|
845
|
+
comment: |
|
846
|
+
Represents the old name of the method that will be aliased.
|
847
|
+
|
848
|
+
alias foo bar
|
849
|
+
^^^
|
850
|
+
|
851
|
+
alias :foo :bar
|
852
|
+
^^^^
|
853
|
+
|
854
|
+
alias :"#{foo}" :"#{bar}"
|
855
|
+
^^^^^^^^^
|
797
856
|
- name: keyword_loc
|
798
857
|
type: location
|
858
|
+
comment: |
|
859
|
+
Represents the location of the `alias` keyword.
|
860
|
+
|
861
|
+
alias foo bar
|
862
|
+
^^^^^
|
799
863
|
comment: |
|
800
864
|
Represents the use of the `alias` keyword to alias a method.
|
801
865
|
|
@@ -805,10 +869,27 @@ nodes:
|
|
805
869
|
fields:
|
806
870
|
- name: left
|
807
871
|
type: node
|
872
|
+
kind: pattern expression
|
873
|
+
comment: |
|
874
|
+
Represents the left side of the expression.
|
875
|
+
|
876
|
+
foo => bar | baz
|
877
|
+
^^^
|
808
878
|
- name: right
|
809
879
|
type: node
|
880
|
+
kind: pattern expression
|
881
|
+
comment: |
|
882
|
+
Represents the right side of the expression.
|
883
|
+
|
884
|
+
foo => bar | baz
|
885
|
+
^^^
|
810
886
|
- name: operator_loc
|
811
887
|
type: location
|
888
|
+
comment: |
|
889
|
+
Represents the alternation operator location.
|
890
|
+
|
891
|
+
foo => bar | baz
|
892
|
+
^
|
812
893
|
comment: |
|
813
894
|
Represents an alternation pattern in pattern matching.
|
814
895
|
|
@@ -818,6 +899,7 @@ nodes:
|
|
818
899
|
fields:
|
819
900
|
- name: left
|
820
901
|
type: node
|
902
|
+
kind: non-void expression
|
821
903
|
comment: |
|
822
904
|
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
905
|
|
@@ -828,8 +910,9 @@ nodes:
|
|
828
910
|
^
|
829
911
|
- name: right
|
830
912
|
type: node
|
913
|
+
kind: Node
|
831
914
|
comment: |
|
832
|
-
Represents the right side of the expression.
|
915
|
+
Represents the right side of the expression.
|
833
916
|
|
834
917
|
left && right
|
835
918
|
^^^^^
|
@@ -849,24 +932,27 @@ nodes:
|
|
849
932
|
left and right
|
850
933
|
^^^^^^^^^^^^^^
|
851
934
|
- name: ArgumentsNode
|
935
|
+
flags: ArgumentsNodeFlags
|
852
936
|
fields:
|
853
|
-
- name: flags
|
854
|
-
type: flags
|
855
|
-
kind: ArgumentsNodeFlags
|
856
937
|
- name: arguments
|
857
938
|
type: node[]
|
939
|
+
kind: non-void expression
|
940
|
+
comment: |
|
941
|
+
The list of arguments, if present. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
942
|
+
|
943
|
+
foo(bar, baz)
|
944
|
+
^^^^^^^^
|
858
945
|
comment: |
|
859
946
|
Represents a set of arguments to a method or a keyword.
|
860
947
|
|
861
948
|
return foo, bar, baz
|
862
949
|
^^^^^^^^^^^^^
|
863
950
|
- name: ArrayNode
|
951
|
+
flags: ArrayNodeFlags
|
864
952
|
fields:
|
865
|
-
- name: flags
|
866
|
-
type: flags
|
867
|
-
kind: ArrayNodeFlags
|
868
953
|
- name: elements
|
869
954
|
type: node[]
|
955
|
+
kind: non-void expression
|
870
956
|
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
957
|
- name: opening_loc
|
872
958
|
type: location?
|
@@ -895,16 +981,47 @@ nodes:
|
|
895
981
|
fields:
|
896
982
|
- name: constant
|
897
983
|
type: node?
|
984
|
+
kind:
|
985
|
+
- ConstantReadNode
|
986
|
+
- ConstantPathNode
|
898
987
|
- name: requireds
|
899
988
|
type: node[]
|
989
|
+
kind: pattern expression
|
990
|
+
comment: |
|
991
|
+
Represents the required elements of the array pattern.
|
992
|
+
|
993
|
+
foo in [1, 2]
|
994
|
+
^ ^
|
900
995
|
- name: rest
|
901
996
|
type: node?
|
997
|
+
kind: pattern expression
|
998
|
+
comment: |
|
999
|
+
Represents the rest element of the array pattern.
|
1000
|
+
|
1001
|
+
foo in *bar
|
1002
|
+
^^^^
|
902
1003
|
- name: posts
|
903
1004
|
type: node[]
|
1005
|
+
kind: pattern expression
|
1006
|
+
comment: |
|
1007
|
+
Represents the elements after the rest element of the array pattern.
|
1008
|
+
|
1009
|
+
foo in *bar, baz
|
1010
|
+
^^^
|
904
1011
|
- name: opening_loc
|
905
1012
|
type: location?
|
1013
|
+
comment: |
|
1014
|
+
Represents the opening location of the array pattern.
|
1015
|
+
|
1016
|
+
foo in [1, 2]
|
1017
|
+
^
|
906
1018
|
- name: closing_loc
|
907
1019
|
type: location?
|
1020
|
+
comment: |
|
1021
|
+
Represents the closing location of the array pattern.
|
1022
|
+
|
1023
|
+
foo in [1, 2]
|
1024
|
+
^
|
908
1025
|
comment: |
|
909
1026
|
Represents an array pattern in pattern matching.
|
910
1027
|
|
@@ -914,8 +1031,8 @@ nodes:
|
|
914
1031
|
foo in [1, 2]
|
915
1032
|
^^^^^^^^^^^^^
|
916
1033
|
|
917
|
-
foo in *
|
918
|
-
|
1034
|
+
foo in *bar
|
1035
|
+
^^^^^^^^^^^
|
919
1036
|
|
920
1037
|
foo in Bar[]
|
921
1038
|
^^^^^^^^^^^^
|
@@ -926,6 +1043,7 @@ nodes:
|
|
926
1043
|
fields:
|
927
1044
|
- name: key
|
928
1045
|
type: node
|
1046
|
+
kind: non-void expression
|
929
1047
|
comment: |
|
930
1048
|
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
1049
|
|
@@ -939,6 +1057,7 @@ nodes:
|
|
939
1057
|
^^^^^^^^^^
|
940
1058
|
- name: value
|
941
1059
|
type: node
|
1060
|
+
kind: non-void expression
|
942
1061
|
comment: |
|
943
1062
|
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
1063
|
|
@@ -963,6 +1082,7 @@ nodes:
|
|
963
1082
|
fields:
|
964
1083
|
- name: value
|
965
1084
|
type: node?
|
1085
|
+
kind: non-void expression
|
966
1086
|
comment: |
|
967
1087
|
The value to be splatted, if present. Will be missing when keyword rest argument forwarding is used.
|
968
1088
|
|
@@ -999,20 +1119,50 @@ nodes:
|
|
999
1119
|
fields:
|
1000
1120
|
- name: begin_keyword_loc
|
1001
1121
|
type: location?
|
1122
|
+
comment: |
|
1123
|
+
Represents the location of the `begin` keyword.
|
1124
|
+
|
1125
|
+
begin x end
|
1126
|
+
^^^^^
|
1002
1127
|
- name: statements
|
1003
1128
|
type: node?
|
1004
1129
|
kind: StatementsNode
|
1130
|
+
comment: |
|
1131
|
+
Represents the statements within the begin block.
|
1132
|
+
|
1133
|
+
begin x end
|
1134
|
+
^
|
1005
1135
|
- name: rescue_clause
|
1006
1136
|
type: node?
|
1007
1137
|
kind: RescueNode
|
1138
|
+
comment: |
|
1139
|
+
Represents the rescue clause within the begin block.
|
1140
|
+
|
1141
|
+
begin x; rescue y; end
|
1142
|
+
^^^^^^^^
|
1008
1143
|
- name: else_clause
|
1009
1144
|
type: node?
|
1010
1145
|
kind: ElseNode
|
1146
|
+
comment: |
|
1147
|
+
Represents the else clause within the begin block.
|
1148
|
+
|
1149
|
+
begin x; rescue y; else z; end
|
1150
|
+
^^^^^^
|
1011
1151
|
- name: ensure_clause
|
1012
1152
|
type: node?
|
1013
1153
|
kind: EnsureNode
|
1154
|
+
comment: |
|
1155
|
+
Represents the ensure clause within the begin block.
|
1156
|
+
|
1157
|
+
begin x; ensure y; end
|
1158
|
+
^^^^^^^^
|
1014
1159
|
- name: end_keyword_loc
|
1015
1160
|
type: location?
|
1161
|
+
comment: |
|
1162
|
+
Represents the location of the `end` keyword.
|
1163
|
+
|
1164
|
+
begin x end
|
1165
|
+
^^^
|
1016
1166
|
newline: false
|
1017
1167
|
comment: |
|
1018
1168
|
Represents a begin statement.
|
@@ -1025,20 +1175,34 @@ nodes:
|
|
1025
1175
|
fields:
|
1026
1176
|
- name: expression
|
1027
1177
|
type: node?
|
1178
|
+
kind: non-void expression
|
1179
|
+
comment: |
|
1180
|
+
The expression that is being passed as a block argument. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1181
|
+
|
1182
|
+
foo(&args)
|
1183
|
+
^^^^^
|
1028
1184
|
- name: operator_loc
|
1029
1185
|
type: location
|
1186
|
+
comment: |
|
1187
|
+
Represents the location of the `&` operator.
|
1188
|
+
|
1189
|
+
foo(&args)
|
1190
|
+
^
|
1030
1191
|
comment: |
|
1031
|
-
Represents block
|
1192
|
+
Represents a block argument using `&`.
|
1032
1193
|
|
1033
1194
|
bar(&args)
|
1034
1195
|
^^^^^^^^^^
|
1035
1196
|
- name: BlockLocalVariableNode
|
1197
|
+
flags: ParameterFlags
|
1036
1198
|
fields:
|
1037
|
-
- name: flags
|
1038
|
-
type: flags
|
1039
|
-
kind: ParameterFlags
|
1040
1199
|
- name: name
|
1041
1200
|
type: constant
|
1201
|
+
comment: |
|
1202
|
+
The name of the block local variable.
|
1203
|
+
|
1204
|
+
a { |; b| } # name `:b`
|
1205
|
+
^
|
1042
1206
|
comment: |
|
1043
1207
|
Represents a block local variable.
|
1044
1208
|
|
@@ -1048,32 +1212,83 @@ nodes:
|
|
1048
1212
|
fields:
|
1049
1213
|
- name: locals
|
1050
1214
|
type: constant[]
|
1215
|
+
comment: |
|
1216
|
+
The local variables declared in the block.
|
1217
|
+
|
1218
|
+
[1, 2, 3].each { |i| puts x } # locals: [:i]
|
1219
|
+
^
|
1051
1220
|
- name: parameters
|
1052
1221
|
type: node?
|
1222
|
+
kind:
|
1223
|
+
- BlockParametersNode
|
1224
|
+
- NumberedParametersNode
|
1225
|
+
- ItParametersNode
|
1226
|
+
comment: |
|
1227
|
+
The parameters of the block.
|
1228
|
+
|
1229
|
+
[1, 2, 3].each { |i| puts x }
|
1230
|
+
^^^
|
1231
|
+
[1, 2, 3].each { puts _1 }
|
1232
|
+
^^^^^^^^^^^
|
1233
|
+
[1, 2, 3].each { puts it }
|
1234
|
+
^^^^^^^^^^^
|
1053
1235
|
- name: body
|
1054
1236
|
type: node?
|
1237
|
+
kind:
|
1238
|
+
- StatementsNode
|
1239
|
+
- BeginNode
|
1240
|
+
comment: |
|
1241
|
+
The body of the block.
|
1242
|
+
|
1243
|
+
[1, 2, 3].each { |i| puts x }
|
1244
|
+
^^^^^^
|
1055
1245
|
- name: opening_loc
|
1056
1246
|
type: location
|
1247
|
+
comment: |
|
1248
|
+
Represents the location of the opening `|`.
|
1249
|
+
|
1250
|
+
[1, 2, 3].each { |i| puts x }
|
1251
|
+
^
|
1057
1252
|
- name: closing_loc
|
1058
1253
|
type: location
|
1254
|
+
comment: |
|
1255
|
+
Represents the location of the closing `|`.
|
1256
|
+
|
1257
|
+
[1, 2, 3].each { |i| puts x }
|
1258
|
+
^
|
1059
1259
|
comment: |
|
1060
1260
|
Represents a block of ruby code.
|
1061
1261
|
|
1062
1262
|
[1, 2, 3].each { |i| puts x }
|
1063
1263
|
^^^^^^^^^^^^^^
|
1064
1264
|
- name: BlockParameterNode
|
1265
|
+
flags: ParameterFlags
|
1065
1266
|
fields:
|
1066
|
-
- name: flags
|
1067
|
-
type: flags
|
1068
|
-
kind: ParameterFlags
|
1069
1267
|
- name: name
|
1070
1268
|
type: constant?
|
1269
|
+
comment: |
|
1270
|
+
The name of the block parameter.
|
1271
|
+
|
1272
|
+
def a(&b) # name `:b`
|
1273
|
+
^
|
1274
|
+
end
|
1071
1275
|
- name: name_loc
|
1072
1276
|
type: location?
|
1277
|
+
comment: |
|
1278
|
+
Represents the location of the block parameter name.
|
1279
|
+
|
1280
|
+
def a(&b)
|
1281
|
+
^
|
1073
1282
|
- name: operator_loc
|
1074
1283
|
type: location
|
1284
|
+
comment: |
|
1285
|
+
Represents the location of the `&` operator.
|
1286
|
+
|
1287
|
+
def a(&b)
|
1288
|
+
^
|
1289
|
+
end
|
1075
1290
|
comment: |
|
1076
|
-
Represents a block parameter
|
1291
|
+
Represents a block parameter of a method, block, or lambda definition.
|
1077
1292
|
|
1078
1293
|
def a(&b)
|
1079
1294
|
^^
|
@@ -1083,13 +1298,49 @@ nodes:
|
|
1083
1298
|
- name: parameters
|
1084
1299
|
type: node?
|
1085
1300
|
kind: ParametersNode
|
1301
|
+
comment: |
|
1302
|
+
Represents the parameters of the block.
|
1303
|
+
|
1304
|
+
-> (a, b = 1; local) { }
|
1305
|
+
^^^^^^^^
|
1306
|
+
|
1307
|
+
foo do |a, b = 1; local|
|
1308
|
+
^^^^^^^^
|
1309
|
+
end
|
1086
1310
|
- name: locals
|
1087
1311
|
type: node[]
|
1088
1312
|
kind: BlockLocalVariableNode
|
1313
|
+
comment: |
|
1314
|
+
Represents the local variables of the block.
|
1315
|
+
|
1316
|
+
-> (a, b = 1; local) { }
|
1317
|
+
^^^^^
|
1318
|
+
|
1319
|
+
foo do |a, b = 1; local|
|
1320
|
+
^^^^^
|
1321
|
+
end
|
1089
1322
|
- name: opening_loc
|
1090
1323
|
type: location?
|
1324
|
+
comment: |
|
1325
|
+
Represents the opening location of the block parameters.
|
1326
|
+
|
1327
|
+
-> (a, b = 1; local) { }
|
1328
|
+
^
|
1329
|
+
|
1330
|
+
foo do |a, b = 1; local|
|
1331
|
+
^
|
1332
|
+
end
|
1091
1333
|
- name: closing_loc
|
1092
1334
|
type: location?
|
1335
|
+
comment: |
|
1336
|
+
Represents the closing location of the block parameters.
|
1337
|
+
|
1338
|
+
-> (a, b = 1; local) { }
|
1339
|
+
^
|
1340
|
+
|
1341
|
+
foo do |a, b = 1; local|
|
1342
|
+
^
|
1343
|
+
end
|
1093
1344
|
comment: |
|
1094
1345
|
Represents a block's parameters declaration.
|
1095
1346
|
|
@@ -1122,36 +1373,70 @@ nodes:
|
|
1122
1373
|
break foo
|
1123
1374
|
^^^^^^^^^
|
1124
1375
|
- name: CallAndWriteNode
|
1376
|
+
flags: CallNodeFlags
|
1125
1377
|
fields:
|
1126
|
-
- name: flags
|
1127
|
-
type: flags
|
1128
|
-
kind: CallNodeFlags
|
1129
1378
|
- name: receiver
|
1130
1379
|
type: node?
|
1380
|
+
kind: non-void expression
|
1381
|
+
comment: |
|
1382
|
+
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).
|
1383
|
+
|
1384
|
+
foo.bar &&= value
|
1385
|
+
^^^
|
1131
1386
|
- name: call_operator_loc
|
1132
1387
|
type: location?
|
1388
|
+
comment: |
|
1389
|
+
Represents the location of the call operator.
|
1390
|
+
|
1391
|
+
foo.bar &&= value
|
1392
|
+
^
|
1133
1393
|
- name: message_loc
|
1134
1394
|
type: location?
|
1395
|
+
comment: |
|
1396
|
+
Represents the location of the message.
|
1397
|
+
|
1398
|
+
foo.bar &&= value
|
1399
|
+
^^^
|
1135
1400
|
- name: read_name
|
1136
1401
|
type: constant
|
1402
|
+
comment: |
|
1403
|
+
Represents the name of the method being called.
|
1404
|
+
|
1405
|
+
foo.bar &&= value # read_name `:bar`
|
1406
|
+
^^^
|
1137
1407
|
- name: write_name
|
1138
1408
|
type: constant
|
1409
|
+
comment: |
|
1410
|
+
Represents the name of the method being written to.
|
1411
|
+
|
1412
|
+
foo.bar &&= value # write_name `:bar=`
|
1413
|
+
^^^
|
1139
1414
|
- name: operator_loc
|
1140
1415
|
type: location
|
1416
|
+
comment: |
|
1417
|
+
Represents the location of the operator.
|
1418
|
+
|
1419
|
+
foo.bar &&= value
|
1420
|
+
^^^
|
1141
1421
|
- name: value
|
1142
1422
|
type: node
|
1423
|
+
kind: non-void expression
|
1424
|
+
comment: |
|
1425
|
+
Represents the value being assigned.
|
1426
|
+
|
1427
|
+
foo.bar &&= value
|
1428
|
+
^^^^^
|
1143
1429
|
comment: |
|
1144
1430
|
Represents the use of the `&&=` operator on a call.
|
1145
1431
|
|
1146
1432
|
foo.bar &&= value
|
1147
1433
|
^^^^^^^^^^^^^^^^^
|
1148
1434
|
- name: CallNode
|
1435
|
+
flags: CallNodeFlags
|
1149
1436
|
fields:
|
1150
|
-
- name: flags
|
1151
|
-
type: flags
|
1152
|
-
kind: CallNodeFlags
|
1153
1437
|
- name: receiver
|
1154
1438
|
type: node?
|
1439
|
+
kind: non-void expression
|
1155
1440
|
comment: |
|
1156
1441
|
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
1442
|
|
@@ -1165,19 +1450,59 @@ nodes:
|
|
1165
1450
|
^^^
|
1166
1451
|
- name: call_operator_loc
|
1167
1452
|
type: location?
|
1453
|
+
comment: |
|
1454
|
+
Represents the location of the call operator.
|
1455
|
+
|
1456
|
+
foo.bar
|
1457
|
+
^
|
1458
|
+
|
1459
|
+
foo&.bar
|
1460
|
+
^^
|
1168
1461
|
- name: name
|
1169
1462
|
type: constant
|
1463
|
+
comment: |
|
1464
|
+
Represents the name of the method being called.
|
1465
|
+
|
1466
|
+
foo.bar # name `:foo`
|
1467
|
+
^^^
|
1170
1468
|
- name: message_loc
|
1171
1469
|
type: location?
|
1470
|
+
comment: |
|
1471
|
+
Represents the location of the message.
|
1472
|
+
|
1473
|
+
foo.bar
|
1474
|
+
^^^
|
1172
1475
|
- name: opening_loc
|
1173
1476
|
type: location?
|
1477
|
+
comment: |
|
1478
|
+
Represents the location of the left parenthesis.
|
1479
|
+
foo(bar)
|
1480
|
+
^
|
1174
1481
|
- name: arguments
|
1175
1482
|
type: node?
|
1176
1483
|
kind: ArgumentsNode
|
1484
|
+
comment: |
|
1485
|
+
Represents the arguments to the method call. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1486
|
+
|
1487
|
+
foo(bar)
|
1488
|
+
^^^
|
1177
1489
|
- name: closing_loc
|
1178
1490
|
type: location?
|
1491
|
+
comment: |
|
1492
|
+
Represents the location of the right parenthesis.
|
1493
|
+
|
1494
|
+
foo(bar)
|
1495
|
+
^
|
1179
1496
|
- name: block
|
1180
1497
|
type: node?
|
1498
|
+
kind:
|
1499
|
+
- BlockNode
|
1500
|
+
- BlockArgumentNode
|
1501
|
+
comment: |
|
1502
|
+
Represents the block that is being passed to the method.
|
1503
|
+
|
1504
|
+
foo { |a| a }
|
1505
|
+
^^^^^^^^^
|
1181
1506
|
comment: |
|
1182
1507
|
Represents a method call, in all of the various forms that can take.
|
1183
1508
|
|
@@ -1199,68 +1524,162 @@ nodes:
|
|
1199
1524
|
foo&.bar
|
1200
1525
|
^^^^^^^^
|
1201
1526
|
- name: CallOperatorWriteNode
|
1527
|
+
flags: CallNodeFlags
|
1202
1528
|
fields:
|
1203
|
-
- name: flags
|
1204
|
-
type: flags
|
1205
|
-
kind: CallNodeFlags
|
1206
1529
|
- name: receiver
|
1207
1530
|
type: node?
|
1531
|
+
kind: non-void expression
|
1532
|
+
comment: |
|
1533
|
+
The object that the method is being called on. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1534
|
+
|
1535
|
+
foo.bar += value
|
1536
|
+
^^^
|
1208
1537
|
- name: call_operator_loc
|
1209
1538
|
type: location?
|
1539
|
+
comment: |
|
1540
|
+
Represents the location of the call operator.
|
1541
|
+
|
1542
|
+
foo.bar += value
|
1543
|
+
^
|
1210
1544
|
- name: message_loc
|
1211
1545
|
type: location?
|
1546
|
+
comment: |
|
1547
|
+
Represents the location of the message.
|
1548
|
+
|
1549
|
+
foo.bar += value
|
1550
|
+
^^^
|
1212
1551
|
- name: read_name
|
1213
1552
|
type: constant
|
1553
|
+
comment: |
|
1554
|
+
Represents the name of the method being called.
|
1555
|
+
|
1556
|
+
foo.bar += value # read_name `:bar`
|
1557
|
+
^^^
|
1214
1558
|
- name: write_name
|
1215
1559
|
type: constant
|
1560
|
+
comment: |
|
1561
|
+
Represents the name of the method being written to.
|
1562
|
+
|
1563
|
+
foo.bar += value # write_name `:bar=`
|
1564
|
+
^^^
|
1216
1565
|
- name: binary_operator
|
1217
1566
|
type: constant
|
1567
|
+
comment: |
|
1568
|
+
Represents the binary operator being used.
|
1569
|
+
|
1570
|
+
foo.bar += value # binary_operator `:+`
|
1571
|
+
^
|
1218
1572
|
- name: binary_operator_loc
|
1219
1573
|
type: location
|
1574
|
+
comment: |
|
1575
|
+
Represents the location of the binary operator.
|
1576
|
+
|
1577
|
+
foo.bar += value
|
1578
|
+
^^
|
1220
1579
|
- name: value
|
1221
1580
|
type: node
|
1581
|
+
kind: non-void expression
|
1582
|
+
comment: |
|
1583
|
+
Represents the value being assigned.
|
1584
|
+
|
1585
|
+
foo.bar += value
|
1586
|
+
^^^^^
|
1222
1587
|
comment: |
|
1223
1588
|
Represents the use of an assignment operator on a call.
|
1224
1589
|
|
1225
1590
|
foo.bar += baz
|
1226
1591
|
^^^^^^^^^^^^^^
|
1227
1592
|
- name: CallOrWriteNode
|
1593
|
+
flags: CallNodeFlags
|
1228
1594
|
fields:
|
1229
|
-
- name: flags
|
1230
|
-
type: flags
|
1231
|
-
kind: CallNodeFlags
|
1232
1595
|
- name: receiver
|
1233
1596
|
type: node?
|
1597
|
+
kind: non-void expression
|
1598
|
+
comment: |
|
1599
|
+
The object that the method is being called on. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1600
|
+
|
1601
|
+
foo.bar ||= value
|
1602
|
+
^^^
|
1234
1603
|
- name: call_operator_loc
|
1235
1604
|
type: location?
|
1605
|
+
comment: |
|
1606
|
+
Represents the location of the call operator.
|
1607
|
+
|
1608
|
+
foo.bar ||= value
|
1609
|
+
^
|
1236
1610
|
- name: message_loc
|
1237
1611
|
type: location?
|
1612
|
+
comment: |
|
1613
|
+
Represents the location of the message.
|
1614
|
+
|
1615
|
+
foo.bar ||= value
|
1616
|
+
^^^
|
1238
1617
|
- name: read_name
|
1239
1618
|
type: constant
|
1619
|
+
comment: |
|
1620
|
+
Represents the name of the method being called.
|
1621
|
+
|
1622
|
+
foo.bar ||= value # read_name `:bar`
|
1623
|
+
^^^
|
1240
1624
|
- name: write_name
|
1241
1625
|
type: constant
|
1626
|
+
comment: |
|
1627
|
+
Represents the name of the method being written to.
|
1628
|
+
|
1629
|
+
foo.bar ||= value # write_name `:bar=`
|
1630
|
+
^^^
|
1242
1631
|
- name: operator_loc
|
1243
1632
|
type: location
|
1633
|
+
comment: |
|
1634
|
+
Represents the location of the operator.
|
1635
|
+
|
1636
|
+
foo.bar ||= value
|
1637
|
+
^^^
|
1244
1638
|
- name: value
|
1245
1639
|
type: node
|
1640
|
+
kind: non-void expression
|
1641
|
+
comment: |
|
1642
|
+
Represents the value being assigned.
|
1643
|
+
|
1644
|
+
foo.bar ||= value
|
1645
|
+
^^^^^
|
1246
1646
|
comment: |
|
1247
1647
|
Represents the use of the `||=` operator on a call.
|
1248
1648
|
|
1249
1649
|
foo.bar ||= value
|
1250
1650
|
^^^^^^^^^^^^^^^^^
|
1251
1651
|
- name: CallTargetNode
|
1652
|
+
flags: CallNodeFlags
|
1252
1653
|
fields:
|
1253
|
-
- name: flags
|
1254
|
-
type: flags
|
1255
|
-
kind: CallNodeFlags
|
1256
1654
|
- name: receiver
|
1257
1655
|
type: node
|
1656
|
+
kind: non-void expression
|
1657
|
+
comment: |
|
1658
|
+
The object that the method is being called on. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1659
|
+
|
1660
|
+
foo.bar = 1
|
1661
|
+
^^^
|
1258
1662
|
- name: call_operator_loc
|
1259
1663
|
type: location
|
1664
|
+
comment: |
|
1665
|
+
Represents the location of the call operator.
|
1666
|
+
|
1667
|
+
foo.bar = 1
|
1668
|
+
^
|
1260
1669
|
- name: name
|
1261
1670
|
type: constant
|
1671
|
+
comment: |
|
1672
|
+
Represents the name of the method being called.
|
1673
|
+
|
1674
|
+
foo.bar = 1 # name `:foo`
|
1675
|
+
^^^
|
1262
1676
|
- name: message_loc
|
1263
1677
|
type: location
|
1678
|
+
comment: |
|
1679
|
+
Represents the location of the message.
|
1680
|
+
|
1681
|
+
foo.bar = 1
|
1682
|
+
^^^
|
1264
1683
|
comment: |
|
1265
1684
|
Represents assigning to a method call.
|
1266
1685
|
|
@@ -1278,10 +1697,27 @@ nodes:
|
|
1278
1697
|
fields:
|
1279
1698
|
- name: value
|
1280
1699
|
type: node
|
1700
|
+
kind: pattern expression
|
1701
|
+
comment: |
|
1702
|
+
Represents the value to capture.
|
1703
|
+
|
1704
|
+
foo => bar
|
1705
|
+
^^^
|
1281
1706
|
- name: target
|
1282
1707
|
type: node
|
1708
|
+
kind: LocalVariableTargetNode
|
1709
|
+
comment: |
|
1710
|
+
Represents the target of the capture.
|
1711
|
+
|
1712
|
+
foo => bar
|
1713
|
+
^^^
|
1283
1714
|
- name: operator_loc
|
1284
1715
|
type: location
|
1716
|
+
comment: |
|
1717
|
+
Represents the location of the `=>` operator.
|
1718
|
+
|
1719
|
+
foo => bar
|
1720
|
+
^^
|
1285
1721
|
comment: |
|
1286
1722
|
Represents assigning to a local variable in pattern matching.
|
1287
1723
|
|
@@ -1291,15 +1727,42 @@ nodes:
|
|
1291
1727
|
fields:
|
1292
1728
|
- name: predicate
|
1293
1729
|
type: node?
|
1730
|
+
kind: non-void expression
|
1731
|
+
comment: |
|
1732
|
+
Represents the predicate of the case match. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1733
|
+
|
1734
|
+
case true; in false; end
|
1735
|
+
^^^^
|
1294
1736
|
- name: conditions
|
1295
1737
|
type: node[]
|
1296
|
-
|
1738
|
+
kind: InNode
|
1739
|
+
comment: |
|
1740
|
+
Represents the conditions of the case match.
|
1741
|
+
|
1742
|
+
case true; in false; end
|
1743
|
+
^^^^^^^^
|
1744
|
+
- name: else_clause
|
1297
1745
|
type: node?
|
1298
1746
|
kind: ElseNode
|
1747
|
+
comment: |
|
1748
|
+
Represents the else clause of the case match.
|
1749
|
+
|
1750
|
+
case true; in false; else; end
|
1751
|
+
^^^^
|
1299
1752
|
- name: case_keyword_loc
|
1300
1753
|
type: location
|
1754
|
+
comment: |
|
1755
|
+
Represents the location of the `case` keyword.
|
1756
|
+
|
1757
|
+
case true; in false; end
|
1758
|
+
^^^^
|
1301
1759
|
- name: end_keyword_loc
|
1302
1760
|
type: location
|
1761
|
+
comment: |
|
1762
|
+
Represents the location of the `end` keyword.
|
1763
|
+
|
1764
|
+
case true; in false; end
|
1765
|
+
^^^
|
1303
1766
|
comment: |
|
1304
1767
|
Represents the use of a case statement for pattern matching.
|
1305
1768
|
|
@@ -1311,15 +1774,42 @@ nodes:
|
|
1311
1774
|
fields:
|
1312
1775
|
- name: predicate
|
1313
1776
|
type: node?
|
1777
|
+
kind: non-void expression
|
1778
|
+
comment: |
|
1779
|
+
Represents the predicate of the case statement. This can be either `nil` or any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1780
|
+
|
1781
|
+
case true; when false; end
|
1782
|
+
^^^^
|
1314
1783
|
- name: conditions
|
1315
1784
|
type: node[]
|
1316
|
-
|
1785
|
+
kind: WhenNode
|
1786
|
+
comment: |
|
1787
|
+
Represents the conditions of the case statement.
|
1788
|
+
|
1789
|
+
case true; when false; end
|
1790
|
+
^^^^^^^^^^
|
1791
|
+
- name: else_clause
|
1317
1792
|
type: node?
|
1318
1793
|
kind: ElseNode
|
1794
|
+
comment: |
|
1795
|
+
Represents the else clause of the case statement.
|
1796
|
+
|
1797
|
+
case true; when false; else; end
|
1798
|
+
^^^^
|
1319
1799
|
- name: case_keyword_loc
|
1320
1800
|
type: location
|
1801
|
+
comment: |
|
1802
|
+
Represents the location of the `case` keyword.
|
1803
|
+
|
1804
|
+
case true; when false; end
|
1805
|
+
^^^^
|
1321
1806
|
- name: end_keyword_loc
|
1322
1807
|
type: location
|
1808
|
+
comment: |
|
1809
|
+
Represents the location of the `end` keyword.
|
1810
|
+
|
1811
|
+
case true; when false; end
|
1812
|
+
^^^
|
1323
1813
|
comment: |
|
1324
1814
|
Represents the use of a case statement.
|
1325
1815
|
|
@@ -1335,12 +1825,20 @@ nodes:
|
|
1335
1825
|
type: location
|
1336
1826
|
- name: constant_path
|
1337
1827
|
type: node
|
1828
|
+
kind:
|
1829
|
+
- ConstantReadNode
|
1830
|
+
- ConstantPathNode
|
1831
|
+
- on error: CallNode # class 0.X end
|
1338
1832
|
- name: inheritance_operator_loc
|
1339
1833
|
type: location?
|
1340
1834
|
- name: superclass
|
1341
1835
|
type: node?
|
1836
|
+
kind: non-void expression
|
1342
1837
|
- name: body
|
1343
1838
|
type: node?
|
1839
|
+
kind:
|
1840
|
+
- StatementsNode
|
1841
|
+
- BeginNode
|
1344
1842
|
- name: end_keyword_loc
|
1345
1843
|
type: location
|
1346
1844
|
- name: name
|
@@ -1354,12 +1852,33 @@ nodes:
|
|
1354
1852
|
fields:
|
1355
1853
|
- name: name
|
1356
1854
|
type: constant
|
1855
|
+
comment: |
|
1856
|
+
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).
|
1857
|
+
|
1858
|
+
@@target &&= value # name `:@@target`
|
1859
|
+
^^^^^^^^
|
1357
1860
|
- name: name_loc
|
1358
1861
|
type: location
|
1862
|
+
comment: |
|
1863
|
+
Represents the location of the variable name.
|
1864
|
+
|
1865
|
+
@@target &&= value
|
1866
|
+
^^^^^^^^
|
1359
1867
|
- name: operator_loc
|
1360
1868
|
type: location
|
1869
|
+
comment: |
|
1870
|
+
Represents the location of the `&&=` operator.
|
1871
|
+
|
1872
|
+
@@target &&= value
|
1873
|
+
^^^
|
1361
1874
|
- name: value
|
1362
1875
|
type: node
|
1876
|
+
kind: non-void expression
|
1877
|
+
comment: |
|
1878
|
+
Represents the value being assigned. This can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
|
1879
|
+
|
1880
|
+
@@target &&= value
|
1881
|
+
^^^^^
|
1363
1882
|
comment: |
|
1364
1883
|
Represents the use of the `&&=` operator for assignment to a class variable.
|
1365
1884
|
|
@@ -1375,6 +1894,7 @@ nodes:
|
|
1375
1894
|
type: location
|
1376
1895
|
- name: value
|
1377
1896
|
type: node
|
1897
|
+
kind: non-void expression
|
1378
1898
|
- name: binary_operator
|
1379
1899
|
type: constant
|
1380
1900
|
comment: |
|
@@ -1392,6 +1912,7 @@ nodes:
|
|
1392
1912
|
type: location
|
1393
1913
|
- name: value
|
1394
1914
|
type: node
|
1915
|
+
kind: non-void expression
|
1395
1916
|
comment: |
|
1396
1917
|
Represents the use of the `||=` operator for assignment to a class variable.
|
1397
1918
|
|
@@ -1440,6 +1961,7 @@ nodes:
|
|
1440
1961
|
^^^^^
|
1441
1962
|
- name: value
|
1442
1963
|
type: node
|
1964
|
+
kind: non-void expression
|
1443
1965
|
comment: |
|
1444
1966
|
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
1967
|
|
@@ -1470,6 +1992,7 @@ nodes:
|
|
1470
1992
|
type: location
|
1471
1993
|
- name: value
|
1472
1994
|
type: node
|
1995
|
+
kind: non-void expression
|
1473
1996
|
comment: |
|
1474
1997
|
Represents the use of the `&&=` operator for assignment to a constant.
|
1475
1998
|
|
@@ -1485,6 +2008,7 @@ nodes:
|
|
1485
2008
|
type: location
|
1486
2009
|
- name: value
|
1487
2010
|
type: node
|
2011
|
+
kind: non-void expression
|
1488
2012
|
- name: binary_operator
|
1489
2013
|
type: constant
|
1490
2014
|
comment: |
|
@@ -1502,6 +2026,7 @@ nodes:
|
|
1502
2026
|
type: location
|
1503
2027
|
- name: value
|
1504
2028
|
type: node
|
2029
|
+
kind: non-void expression
|
1505
2030
|
comment: |
|
1506
2031
|
Represents the use of the `||=` operator for assignment to a constant.
|
1507
2032
|
|
@@ -1516,6 +2041,7 @@ nodes:
|
|
1516
2041
|
type: location
|
1517
2042
|
- name: value
|
1518
2043
|
type: node
|
2044
|
+
kind: non-void expression
|
1519
2045
|
comment: |
|
1520
2046
|
Represents the use of the `&&=` operator for assignment to a constant path.
|
1521
2047
|
|
@@ -1525,6 +2051,7 @@ nodes:
|
|
1525
2051
|
fields:
|
1526
2052
|
- name: parent
|
1527
2053
|
type: node?
|
2054
|
+
kind: non-void expression
|
1528
2055
|
comment: |
|
1529
2056
|
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
2057
|
|
@@ -1573,6 +2100,7 @@ nodes:
|
|
1573
2100
|
type: location
|
1574
2101
|
- name: value
|
1575
2102
|
type: node
|
2103
|
+
kind: non-void expression
|
1576
2104
|
- name: binary_operator
|
1577
2105
|
type: constant
|
1578
2106
|
comment: |
|
@@ -1589,6 +2117,7 @@ nodes:
|
|
1589
2117
|
type: location
|
1590
2118
|
- name: value
|
1591
2119
|
type: node
|
2120
|
+
kind: non-void expression
|
1592
2121
|
comment: |
|
1593
2122
|
Represents the use of the `||=` operator for assignment to a constant path.
|
1594
2123
|
|
@@ -1598,6 +2127,7 @@ nodes:
|
|
1598
2127
|
fields:
|
1599
2128
|
- name: parent
|
1600
2129
|
type: node?
|
2130
|
+
kind: non-void expression
|
1601
2131
|
- name: name
|
1602
2132
|
type: constant?
|
1603
2133
|
- name: delimiter_loc
|
@@ -1631,6 +2161,7 @@ nodes:
|
|
1631
2161
|
^
|
1632
2162
|
- name: value
|
1633
2163
|
type: node
|
2164
|
+
kind: non-void expression
|
1634
2165
|
comment: |
|
1635
2166
|
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
2167
|
|
@@ -1690,6 +2221,7 @@ nodes:
|
|
1690
2221
|
^^^
|
1691
2222
|
- name: value
|
1692
2223
|
type: node
|
2224
|
+
kind: non-void expression
|
1693
2225
|
comment: |
|
1694
2226
|
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
2227
|
|
@@ -1718,11 +2250,15 @@ nodes:
|
|
1718
2250
|
type: location
|
1719
2251
|
- name: receiver
|
1720
2252
|
type: node?
|
2253
|
+
kind: non-void expression
|
1721
2254
|
- name: parameters
|
1722
2255
|
type: node?
|
1723
2256
|
kind: ParametersNode
|
1724
2257
|
- name: body
|
1725
2258
|
type: node?
|
2259
|
+
kind:
|
2260
|
+
- StatementsNode
|
2261
|
+
- BeginNode
|
1726
2262
|
- name: locals
|
1727
2263
|
type: constant[]
|
1728
2264
|
- name: def_keyword_loc
|
@@ -1749,6 +2285,7 @@ nodes:
|
|
1749
2285
|
type: location?
|
1750
2286
|
- name: value
|
1751
2287
|
type: node
|
2288
|
+
kind: Node # More than non-void expression as defined?(return) is allowed, yet defined?(BEGIN{}) is SyntaxError
|
1752
2289
|
- name: rparen_loc
|
1753
2290
|
type: location?
|
1754
2291
|
- name: keyword_loc
|
@@ -1792,6 +2329,12 @@ nodes:
|
|
1792
2329
|
type: location
|
1793
2330
|
- name: variable
|
1794
2331
|
type: node
|
2332
|
+
kind:
|
2333
|
+
- InstanceVariableReadNode
|
2334
|
+
- ClassVariableReadNode
|
2335
|
+
- GlobalVariableReadNode
|
2336
|
+
- BackReferenceReadNode
|
2337
|
+
- NumberedReferenceReadNode
|
1795
2338
|
comment: |
|
1796
2339
|
Represents an interpolated variable.
|
1797
2340
|
|
@@ -1825,12 +2368,20 @@ nodes:
|
|
1825
2368
|
fields:
|
1826
2369
|
- name: constant
|
1827
2370
|
type: node?
|
2371
|
+
kind:
|
2372
|
+
- ConstantReadNode
|
2373
|
+
- ConstantPathNode
|
1828
2374
|
- name: left
|
1829
2375
|
type: node
|
2376
|
+
kind: SplatNode
|
1830
2377
|
- name: requireds
|
1831
2378
|
type: node[]
|
2379
|
+
kind: pattern expression
|
1832
2380
|
- name: right
|
1833
2381
|
type: node
|
2382
|
+
kind:
|
2383
|
+
- SplatNode
|
2384
|
+
- on error: MissingNode
|
1834
2385
|
- name: opening_loc
|
1835
2386
|
type: location?
|
1836
2387
|
- name: closing_loc
|
@@ -1847,14 +2398,14 @@ nodes:
|
|
1847
2398
|
foo in Foo(*bar, baz, *qux)
|
1848
2399
|
^^^^^^^^^^^^^^^^^^^^
|
1849
2400
|
- name: FlipFlopNode
|
2401
|
+
flags: RangeFlags
|
1850
2402
|
fields:
|
1851
|
-
- name: flags
|
1852
|
-
type: flags
|
1853
|
-
kind: RangeFlags
|
1854
2403
|
- name: left
|
1855
2404
|
type: node?
|
2405
|
+
kind: non-void expression
|
1856
2406
|
- name: right
|
1857
2407
|
type: node?
|
2408
|
+
kind: non-void expression
|
1858
2409
|
- name: operator_loc
|
1859
2410
|
type: location
|
1860
2411
|
comment: |
|
@@ -1876,19 +2427,70 @@ nodes:
|
|
1876
2427
|
fields:
|
1877
2428
|
- name: index
|
1878
2429
|
type: node
|
2430
|
+
kind:
|
2431
|
+
- LocalVariableTargetNode
|
2432
|
+
- InstanceVariableTargetNode
|
2433
|
+
- ClassVariableTargetNode
|
2434
|
+
- GlobalVariableTargetNode
|
2435
|
+
- ConstantTargetNode
|
2436
|
+
- ConstantPathTargetNode
|
2437
|
+
- CallTargetNode
|
2438
|
+
- IndexTargetNode
|
2439
|
+
- MultiTargetNode
|
2440
|
+
- on error: BackReferenceReadNode # for $& in a end
|
2441
|
+
- on error: NumberedReferenceReadNode # for $1 in a end
|
2442
|
+
- on error: MissingNode # for in 1..10; end
|
2443
|
+
comment: |
|
2444
|
+
The index expression for `for` loops.
|
2445
|
+
|
2446
|
+
for i in a end
|
2447
|
+
^
|
1879
2448
|
- name: collection
|
1880
2449
|
type: node
|
2450
|
+
kind: non-void expression
|
2451
|
+
comment: |
|
2452
|
+
The collection to iterate over.
|
2453
|
+
|
2454
|
+
for i in a end
|
2455
|
+
^
|
1881
2456
|
- name: statements
|
1882
2457
|
type: node?
|
1883
2458
|
kind: StatementsNode
|
2459
|
+
comment: |
|
2460
|
+
Represents the body of statements to execute for each iteration of the loop.
|
2461
|
+
|
2462
|
+
for i in a
|
2463
|
+
foo(i)
|
2464
|
+
^^^^^^
|
2465
|
+
end
|
1884
2466
|
- name: for_keyword_loc
|
1885
2467
|
type: location
|
2468
|
+
comment: |
|
2469
|
+
The location of the `for` keyword.
|
2470
|
+
|
2471
|
+
for i in a end
|
2472
|
+
^^^
|
1886
2473
|
- name: in_keyword_loc
|
1887
2474
|
type: location
|
2475
|
+
comment: |
|
2476
|
+
The location of the `in` keyword.
|
2477
|
+
|
2478
|
+
for i in a end
|
2479
|
+
^^
|
1888
2480
|
- name: do_keyword_loc
|
1889
2481
|
type: location?
|
2482
|
+
comment: |
|
2483
|
+
The location of the `do` keyword, if present.
|
2484
|
+
|
2485
|
+
for i in a do end
|
2486
|
+
^^
|
1890
2487
|
- name: end_keyword_loc
|
1891
2488
|
type: location
|
2489
|
+
comment: |
|
2490
|
+
The location of the `end` keyword.
|
2491
|
+
|
2492
|
+
for i in a end
|
2493
|
+
^^^
|
1892
2494
|
comment: |
|
1893
2495
|
Represents the use of the `for` keyword.
|
1894
2496
|
|
@@ -1929,6 +2531,7 @@ nodes:
|
|
1929
2531
|
type: location
|
1930
2532
|
- name: value
|
1931
2533
|
type: node
|
2534
|
+
kind: non-void expression
|
1932
2535
|
comment: |
|
1933
2536
|
Represents the use of the `&&=` operator for assignment to a global variable.
|
1934
2537
|
|
@@ -1944,6 +2547,7 @@ nodes:
|
|
1944
2547
|
type: location
|
1945
2548
|
- name: value
|
1946
2549
|
type: node
|
2550
|
+
kind: non-void expression
|
1947
2551
|
- name: binary_operator
|
1948
2552
|
type: constant
|
1949
2553
|
comment: |
|
@@ -1961,6 +2565,7 @@ nodes:
|
|
1961
2565
|
type: location
|
1962
2566
|
- name: value
|
1963
2567
|
type: node
|
2568
|
+
kind: non-void expression
|
1964
2569
|
comment: |
|
1965
2570
|
Represents the use of the `||=` operator for assignment to a global variable.
|
1966
2571
|
|
@@ -2009,6 +2614,7 @@ nodes:
|
|
2009
2614
|
^^^^
|
2010
2615
|
- name: value
|
2011
2616
|
type: node
|
2617
|
+
kind: non-void expression
|
2012
2618
|
comment: |
|
2013
2619
|
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
2620
|
|
@@ -2067,6 +2673,9 @@ nodes:
|
|
2067
2673
|
fields:
|
2068
2674
|
- name: constant
|
2069
2675
|
type: node?
|
2676
|
+
kind:
|
2677
|
+
- ConstantReadNode
|
2678
|
+
- ConstantPathNode
|
2070
2679
|
- name: elements
|
2071
2680
|
type: node[]
|
2072
2681
|
kind: AssocNode
|
@@ -2100,6 +2709,7 @@ nodes:
|
|
2100
2709
|
The `if_keyword_loc` field will be `nil` when the `IfNode` represents a ternary expression.
|
2101
2710
|
- name: predicate
|
2102
2711
|
type: node
|
2712
|
+
kind: non-void expression
|
2103
2713
|
comment: |
|
2104
2714
|
The node for the condition the `IfNode` is testing.
|
2105
2715
|
|
@@ -2135,8 +2745,11 @@ nodes:
|
|
2135
2745
|
baz
|
2136
2746
|
^^^
|
2137
2747
|
end
|
2138
|
-
- name:
|
2748
|
+
- name: subsequent
|
2139
2749
|
type: node?
|
2750
|
+
kind:
|
2751
|
+
- ElseNode
|
2752
|
+
- IfNode
|
2140
2753
|
comment: |
|
2141
2754
|
Represents an `ElseNode` or an `IfNode` when there is an `else` or an `elsif` in the `if` statement.
|
2142
2755
|
|
@@ -2189,6 +2802,11 @@ nodes:
|
|
2189
2802
|
fields:
|
2190
2803
|
- name: value
|
2191
2804
|
type: node
|
2805
|
+
kind:
|
2806
|
+
- LocalVariableReadNode
|
2807
|
+
- CallNode
|
2808
|
+
- ConstantReadNode
|
2809
|
+
- LocalVariableTargetNode
|
2192
2810
|
comment: |
|
2193
2811
|
Represents a node that is implicitly being added to the tree but doesn't correspond directly to a node in the source.
|
2194
2812
|
|
@@ -2219,6 +2837,7 @@ nodes:
|
|
2219
2837
|
fields:
|
2220
2838
|
- name: pattern
|
2221
2839
|
type: node
|
2840
|
+
kind: pattern expression
|
2222
2841
|
- name: statements
|
2223
2842
|
type: node?
|
2224
2843
|
kind: StatementsNode
|
@@ -2232,12 +2851,11 @@ nodes:
|
|
2232
2851
|
case a; in b then c end
|
2233
2852
|
^^^^^^^^^^^
|
2234
2853
|
- name: IndexAndWriteNode
|
2854
|
+
flags: CallNodeFlags
|
2235
2855
|
fields:
|
2236
|
-
- name: flags
|
2237
|
-
type: flags
|
2238
|
-
kind: CallNodeFlags
|
2239
2856
|
- name: receiver
|
2240
2857
|
type: node?
|
2858
|
+
kind: non-void expression
|
2241
2859
|
- name: call_operator_loc
|
2242
2860
|
type: location?
|
2243
2861
|
- name: opening_loc
|
@@ -2249,22 +2867,23 @@ nodes:
|
|
2249
2867
|
type: location
|
2250
2868
|
- name: block
|
2251
2869
|
type: node?
|
2870
|
+
kind: BlockArgumentNode # foo[&b] &&= value, only valid on Ruby < 3.4
|
2252
2871
|
- name: operator_loc
|
2253
2872
|
type: location
|
2254
2873
|
- name: value
|
2255
2874
|
type: node
|
2875
|
+
kind: non-void expression
|
2256
2876
|
comment: |
|
2257
2877
|
Represents the use of the `&&=` operator on a call to the `[]` method.
|
2258
2878
|
|
2259
2879
|
foo.bar[baz] &&= value
|
2260
2880
|
^^^^^^^^^^^^^^^^^^^^^^
|
2261
2881
|
- name: IndexOperatorWriteNode
|
2882
|
+
flags: CallNodeFlags
|
2262
2883
|
fields:
|
2263
|
-
- name: flags
|
2264
|
-
type: flags
|
2265
|
-
kind: CallNodeFlags
|
2266
2884
|
- name: receiver
|
2267
2885
|
type: node?
|
2886
|
+
kind: non-void expression
|
2268
2887
|
- name: call_operator_loc
|
2269
2888
|
type: location?
|
2270
2889
|
- name: opening_loc
|
@@ -2276,24 +2895,25 @@ nodes:
|
|
2276
2895
|
type: location
|
2277
2896
|
- name: block
|
2278
2897
|
type: node?
|
2898
|
+
kind: BlockArgumentNode # foo[&b] += value, only valid on Ruby < 3.4
|
2279
2899
|
- name: binary_operator
|
2280
2900
|
type: constant
|
2281
2901
|
- name: binary_operator_loc
|
2282
2902
|
type: location
|
2283
2903
|
- name: value
|
2284
2904
|
type: node
|
2905
|
+
kind: non-void expression
|
2285
2906
|
comment: |
|
2286
2907
|
Represents the use of an assignment operator on a call to `[]`.
|
2287
2908
|
|
2288
2909
|
foo.bar[baz] += value
|
2289
2910
|
^^^^^^^^^^^^^^^^^^^^^
|
2290
2911
|
- name: IndexOrWriteNode
|
2912
|
+
flags: CallNodeFlags
|
2291
2913
|
fields:
|
2292
|
-
- name: flags
|
2293
|
-
type: flags
|
2294
|
-
kind: CallNodeFlags
|
2295
2914
|
- name: receiver
|
2296
2915
|
type: node?
|
2916
|
+
kind: non-void expression
|
2297
2917
|
- name: call_operator_loc
|
2298
2918
|
type: location?
|
2299
2919
|
- name: opening_loc
|
@@ -2305,22 +2925,23 @@ nodes:
|
|
2305
2925
|
type: location
|
2306
2926
|
- name: block
|
2307
2927
|
type: node?
|
2928
|
+
kind: BlockArgumentNode # foo[&b] ||= value, only valid on Ruby < 3.4
|
2308
2929
|
- name: operator_loc
|
2309
2930
|
type: location
|
2310
2931
|
- name: value
|
2311
2932
|
type: node
|
2933
|
+
kind: non-void expression
|
2312
2934
|
comment: |
|
2313
2935
|
Represents the use of the `||=` operator on a call to `[]`.
|
2314
2936
|
|
2315
2937
|
foo.bar[baz] ||= value
|
2316
2938
|
^^^^^^^^^^^^^^^^^^^^^^
|
2317
2939
|
- name: IndexTargetNode
|
2940
|
+
flags: CallNodeFlags
|
2318
2941
|
fields:
|
2319
|
-
- name: flags
|
2320
|
-
type: flags
|
2321
|
-
kind: CallNodeFlags
|
2322
2942
|
- name: receiver
|
2323
2943
|
type: node
|
2944
|
+
kind: non-void expression
|
2324
2945
|
- name: opening_loc
|
2325
2946
|
type: location
|
2326
2947
|
- name: arguments
|
@@ -2330,6 +2951,7 @@ nodes:
|
|
2330
2951
|
type: location
|
2331
2952
|
- name: block
|
2332
2953
|
type: node?
|
2954
|
+
kind: BlockArgumentNode # foo[&b], = 1, only valid on Ruby < 3.4
|
2333
2955
|
comment: |
|
2334
2956
|
Represents assigning to an index.
|
2335
2957
|
|
@@ -2353,6 +2975,7 @@ nodes:
|
|
2353
2975
|
type: location
|
2354
2976
|
- name: value
|
2355
2977
|
type: node
|
2978
|
+
kind: non-void expression
|
2356
2979
|
comment: |
|
2357
2980
|
Represents the use of the `&&=` operator for assignment to an instance variable.
|
2358
2981
|
|
@@ -2368,6 +2991,7 @@ nodes:
|
|
2368
2991
|
type: location
|
2369
2992
|
- name: value
|
2370
2993
|
type: node
|
2994
|
+
kind: non-void expression
|
2371
2995
|
- name: binary_operator
|
2372
2996
|
type: constant
|
2373
2997
|
comment: |
|
@@ -2385,6 +3009,7 @@ nodes:
|
|
2385
3009
|
type: location
|
2386
3010
|
- name: value
|
2387
3011
|
type: node
|
3012
|
+
kind: non-void expression
|
2388
3013
|
comment: |
|
2389
3014
|
Represents the use of the `||=` operator for assignment to an instance variable.
|
2390
3015
|
|
@@ -2433,6 +3058,7 @@ nodes:
|
|
2433
3058
|
^^^
|
2434
3059
|
- name: value
|
2435
3060
|
type: node
|
3061
|
+
kind: non-void expression
|
2436
3062
|
comment: |
|
2437
3063
|
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
3064
|
|
@@ -2454,10 +3080,8 @@ nodes:
|
|
2454
3080
|
@foo = 1
|
2455
3081
|
^^^^^^^^
|
2456
3082
|
- name: IntegerNode
|
3083
|
+
flags: IntegerBaseFlags
|
2457
3084
|
fields:
|
2458
|
-
- name: flags
|
2459
|
-
type: flags
|
2460
|
-
kind: IntegerBaseFlags
|
2461
3085
|
- name: value
|
2462
3086
|
type: integer
|
2463
3087
|
comment: The value of the integer literal as a number.
|
@@ -2467,10 +3091,8 @@ nodes:
|
|
2467
3091
|
1
|
2468
3092
|
^
|
2469
3093
|
- name: InterpolatedMatchLastLineNode
|
3094
|
+
flags: RegularExpressionFlags
|
2470
3095
|
fields:
|
2471
|
-
- name: flags
|
2472
|
-
type: flags
|
2473
|
-
kind: RegularExpressionFlags
|
2474
3096
|
- name: opening_loc
|
2475
3097
|
type: location
|
2476
3098
|
- name: parts
|
@@ -2488,10 +3110,8 @@ nodes:
|
|
2488
3110
|
if /foo #{bar} baz/ then end
|
2489
3111
|
^^^^^^^^^^^^^^^^
|
2490
3112
|
- name: InterpolatedRegularExpressionNode
|
3113
|
+
flags: RegularExpressionFlags
|
2491
3114
|
fields:
|
2492
|
-
- name: flags
|
2493
|
-
type: flags
|
2494
|
-
kind: RegularExpressionFlags
|
2495
3115
|
- name: opening_loc
|
2496
3116
|
type: location
|
2497
3117
|
- name: parts
|
@@ -2509,10 +3129,8 @@ nodes:
|
|
2509
3129
|
/foo #{bar} baz/
|
2510
3130
|
^^^^^^^^^^^^^^^^
|
2511
3131
|
- name: InterpolatedStringNode
|
3132
|
+
flags: InterpolatedStringNodeFlags
|
2512
3133
|
fields:
|
2513
|
-
- name: flags
|
2514
|
-
type: flags
|
2515
|
-
kind: InterpolatedStringNodeFlags
|
2516
3134
|
- name: opening_loc
|
2517
3135
|
type: location?
|
2518
3136
|
- name: parts
|
@@ -2566,6 +3184,12 @@ nodes:
|
|
2566
3184
|
|
2567
3185
|
`foo #{bar} baz`
|
2568
3186
|
^^^^^^^^^^^^^^^^
|
3187
|
+
- name: ItLocalVariableReadNode
|
3188
|
+
comment: |
|
3189
|
+
Represents reading from the implicit `it` local variable.
|
3190
|
+
|
3191
|
+
-> { it }
|
3192
|
+
^^
|
2569
3193
|
- name: ItParametersNode
|
2570
3194
|
comment: |
|
2571
3195
|
Represents an implicit set of parameters through the use of the `it` keyword within a block or lambda.
|
@@ -2573,10 +3197,8 @@ nodes:
|
|
2573
3197
|
-> { it + it }
|
2574
3198
|
^^^^^^^^^^^^^^
|
2575
3199
|
- name: KeywordHashNode
|
3200
|
+
flags: KeywordHashNodeFlags
|
2576
3201
|
fields:
|
2577
|
-
- name: flags
|
2578
|
-
type: flags
|
2579
|
-
kind: KeywordHashNodeFlags
|
2580
3202
|
- name: elements
|
2581
3203
|
type: node[]
|
2582
3204
|
kind:
|
@@ -2588,10 +3210,8 @@ nodes:
|
|
2588
3210
|
foo(a: b)
|
2589
3211
|
^^^^
|
2590
3212
|
- name: KeywordRestParameterNode
|
3213
|
+
flags: ParameterFlags
|
2591
3214
|
fields:
|
2592
|
-
- name: flags
|
2593
|
-
type: flags
|
2594
|
-
kind: ParameterFlags
|
2595
3215
|
- name: name
|
2596
3216
|
type: constant?
|
2597
3217
|
- name: name_loc
|
@@ -2616,8 +3236,15 @@ nodes:
|
|
2616
3236
|
type: location
|
2617
3237
|
- name: parameters
|
2618
3238
|
type: node?
|
3239
|
+
kind:
|
3240
|
+
- BlockParametersNode
|
3241
|
+
- NumberedParametersNode
|
3242
|
+
- ItParametersNode
|
2619
3243
|
- name: body
|
2620
3244
|
type: node?
|
3245
|
+
kind:
|
3246
|
+
- StatementsNode
|
3247
|
+
- BeginNode
|
2621
3248
|
comment: |
|
2622
3249
|
Represents using a lambda literal (not the lambda method call).
|
2623
3250
|
|
@@ -2631,6 +3258,7 @@ nodes:
|
|
2631
3258
|
type: location
|
2632
3259
|
- name: value
|
2633
3260
|
type: node
|
3261
|
+
kind: non-void expression
|
2634
3262
|
- name: name
|
2635
3263
|
type: constant
|
2636
3264
|
- name: depth
|
@@ -2648,6 +3276,7 @@ nodes:
|
|
2648
3276
|
type: location
|
2649
3277
|
- name: value
|
2650
3278
|
type: node
|
3279
|
+
kind: non-void expression
|
2651
3280
|
- name: name
|
2652
3281
|
type: constant
|
2653
3282
|
- name: binary_operator
|
@@ -2667,6 +3296,7 @@ nodes:
|
|
2667
3296
|
type: location
|
2668
3297
|
- name: value
|
2669
3298
|
type: node
|
3299
|
+
kind: non-void expression
|
2670
3300
|
- name: name
|
2671
3301
|
type: constant
|
2672
3302
|
- name: depth
|
@@ -2691,10 +3321,6 @@ nodes:
|
|
2691
3321
|
|
2692
3322
|
_1 # name `:_1`
|
2693
3323
|
|
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
3324
|
- name: depth
|
2699
3325
|
type: uint32
|
2700
3326
|
comment: |
|
@@ -2750,6 +3376,7 @@ nodes:
|
|
2750
3376
|
^^^
|
2751
3377
|
- name: value
|
2752
3378
|
type: node
|
3379
|
+
kind: non-void expression
|
2753
3380
|
comment: |
|
2754
3381
|
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
3382
|
|
@@ -2775,10 +3402,8 @@ nodes:
|
|
2775
3402
|
foo = 1
|
2776
3403
|
^^^^^^^
|
2777
3404
|
- name: MatchLastLineNode
|
3405
|
+
flags: RegularExpressionFlags
|
2778
3406
|
fields:
|
2779
|
-
- name: flags
|
2780
|
-
type: flags
|
2781
|
-
kind: RegularExpressionFlags
|
2782
3407
|
- name: opening_loc
|
2783
3408
|
type: location
|
2784
3409
|
- name: content_loc
|
@@ -2796,8 +3421,10 @@ nodes:
|
|
2796
3421
|
fields:
|
2797
3422
|
- name: value
|
2798
3423
|
type: node
|
3424
|
+
kind: non-void expression
|
2799
3425
|
- name: pattern
|
2800
3426
|
type: node
|
3427
|
+
kind: pattern expression
|
2801
3428
|
- name: operator_loc
|
2802
3429
|
type: location
|
2803
3430
|
comment: |
|
@@ -2809,8 +3436,10 @@ nodes:
|
|
2809
3436
|
fields:
|
2810
3437
|
- name: value
|
2811
3438
|
type: node
|
3439
|
+
kind: non-void expression
|
2812
3440
|
- name: pattern
|
2813
3441
|
type: node
|
3442
|
+
kind: pattern expression
|
2814
3443
|
- name: operator_loc
|
2815
3444
|
type: location
|
2816
3445
|
comment: |
|
@@ -2842,8 +3471,15 @@ nodes:
|
|
2842
3471
|
type: location
|
2843
3472
|
- name: constant_path
|
2844
3473
|
type: node
|
3474
|
+
kind:
|
3475
|
+
- ConstantReadNode
|
3476
|
+
- ConstantPathNode
|
3477
|
+
- on error: MissingNode # module Parent module end
|
2845
3478
|
- name: body
|
2846
3479
|
type: node?
|
3480
|
+
kind:
|
3481
|
+
- StatementsNode
|
3482
|
+
- BeginNode
|
2847
3483
|
- name: end_keyword_loc
|
2848
3484
|
type: location
|
2849
3485
|
- name: name
|
@@ -2867,11 +3503,39 @@ nodes:
|
|
2867
3503
|
- CallTargetNode
|
2868
3504
|
- IndexTargetNode
|
2869
3505
|
- MultiTargetNode
|
2870
|
-
- RequiredParameterNode
|
2871
|
-
- BackReferenceReadNode #
|
2872
|
-
- NumberedReferenceReadNode #
|
3506
|
+
- RequiredParameterNode # def m((a,b)); end
|
3507
|
+
- on error: BackReferenceReadNode # a, (b, $&) = z
|
3508
|
+
- on error: NumberedReferenceReadNode # a, (b, $1) = z
|
3509
|
+
comment: |
|
3510
|
+
Represents the targets expressions before a splat node.
|
3511
|
+
|
3512
|
+
a, (b, c, *) = 1, 2, 3, 4, 5
|
3513
|
+
^^^^
|
3514
|
+
|
3515
|
+
The splat node can be absent, in that case all target expressions are in the left field.
|
3516
|
+
|
3517
|
+
a, (b, c) = 1, 2, 3, 4, 5
|
3518
|
+
^^^^
|
2873
3519
|
- name: rest
|
2874
3520
|
type: node?
|
3521
|
+
kind:
|
3522
|
+
- ImplicitRestNode
|
3523
|
+
- SplatNode
|
3524
|
+
comment: |
|
3525
|
+
Represents a splat node in the target expression.
|
3526
|
+
|
3527
|
+
a, (b, *c) = 1, 2, 3, 4
|
3528
|
+
^^
|
3529
|
+
|
3530
|
+
The variable can be empty, this results in a `SplatNode` with a `nil` expression field.
|
3531
|
+
|
3532
|
+
a, (b, *) = 1, 2, 3, 4
|
3533
|
+
^
|
3534
|
+
|
3535
|
+
If the `*` is omitted, this field will contain an `ImplicitRestNode`
|
3536
|
+
|
3537
|
+
a, (b,) = 1, 2, 3, 4
|
3538
|
+
^
|
2875
3539
|
- name: rights
|
2876
3540
|
type: node[]
|
2877
3541
|
kind:
|
@@ -2884,17 +3548,38 @@ nodes:
|
|
2884
3548
|
- CallTargetNode
|
2885
3549
|
- IndexTargetNode
|
2886
3550
|
- MultiTargetNode
|
2887
|
-
- RequiredParameterNode
|
2888
|
-
- BackReferenceReadNode #
|
3551
|
+
- RequiredParameterNode # def m((*,b)); end
|
3552
|
+
- on error: BackReferenceReadNode # a, (*, $&) = z
|
3553
|
+
- on error: NumberedReferenceReadNode # a, (*, $1) = z
|
3554
|
+
comment: |
|
3555
|
+
Represents the targets expressions after a splat node.
|
3556
|
+
|
3557
|
+
a, (*, b, c) = 1, 2, 3, 4, 5
|
3558
|
+
^^^^
|
2889
3559
|
- name: lparen_loc
|
2890
3560
|
type: location?
|
3561
|
+
comment: |
|
3562
|
+
The location of the opening parenthesis.
|
3563
|
+
|
3564
|
+
a, (b, c) = 1, 2, 3
|
3565
|
+
^
|
2891
3566
|
- name: rparen_loc
|
2892
3567
|
type: location?
|
3568
|
+
comment: |
|
3569
|
+
The location of the closing parenthesis.
|
3570
|
+
|
3571
|
+
a, (b, c) = 1, 2, 3
|
3572
|
+
^
|
2893
3573
|
comment: |
|
2894
3574
|
Represents a multi-target expression.
|
2895
3575
|
|
2896
3576
|
a, (b, c) = 1, 2, 3
|
2897
3577
|
^^^^^^
|
3578
|
+
|
3579
|
+
This can be a part of `MultiWriteNode` as above, or the target of a `for` loop
|
3580
|
+
|
3581
|
+
for a, b in [[1, 2], [3, 4]]
|
3582
|
+
^^^^
|
2898
3583
|
- name: MultiWriteNode
|
2899
3584
|
fields:
|
2900
3585
|
- name: lefts
|
@@ -2909,8 +3594,38 @@ nodes:
|
|
2909
3594
|
- CallTargetNode
|
2910
3595
|
- IndexTargetNode
|
2911
3596
|
- MultiTargetNode
|
3597
|
+
- on error: BackReferenceReadNode # $&, = z
|
3598
|
+
- on error: NumberedReferenceReadNode # $1, = z
|
3599
|
+
comment: |
|
3600
|
+
Represents the targets expressions before a splat node.
|
3601
|
+
|
3602
|
+
a, b, * = 1, 2, 3, 4, 5
|
3603
|
+
^^^^
|
3604
|
+
|
3605
|
+
The splat node can be absent, in that case all target expressions are in the left field.
|
3606
|
+
|
3607
|
+
a, b, c = 1, 2, 3, 4, 5
|
3608
|
+
^^^^^^^
|
2912
3609
|
- name: rest
|
2913
3610
|
type: node?
|
3611
|
+
kind:
|
3612
|
+
- ImplicitRestNode
|
3613
|
+
- SplatNode
|
3614
|
+
comment: |
|
3615
|
+
Represents a splat node in the target expression.
|
3616
|
+
|
3617
|
+
a, b, *c = 1, 2, 3, 4
|
3618
|
+
^^
|
3619
|
+
|
3620
|
+
The variable can be empty, this results in a `SplatNode` with a `nil` expression field.
|
3621
|
+
|
3622
|
+
a, b, * = 1, 2, 3, 4
|
3623
|
+
^
|
3624
|
+
|
3625
|
+
If the `*` is omitted, this field will contain an `ImplicitRestNode`
|
3626
|
+
|
3627
|
+
a, b, = 1, 2, 3, 4
|
3628
|
+
^
|
2914
3629
|
- name: rights
|
2915
3630
|
type: node[]
|
2916
3631
|
kind:
|
@@ -2923,14 +3638,42 @@ nodes:
|
|
2923
3638
|
- CallTargetNode
|
2924
3639
|
- IndexTargetNode
|
2925
3640
|
- MultiTargetNode
|
3641
|
+
- on error: BackReferenceReadNode # *, $& = z
|
3642
|
+
- on error: NumberedReferenceReadNode # *, $1 = z
|
3643
|
+
comment: |
|
3644
|
+
Represents the targets expressions after a splat node.
|
3645
|
+
|
3646
|
+
a, *, b, c = 1, 2, 3, 4, 5
|
3647
|
+
^^^^
|
2926
3648
|
- name: lparen_loc
|
2927
3649
|
type: location?
|
3650
|
+
comment: |
|
3651
|
+
The location of the opening parenthesis.
|
3652
|
+
|
3653
|
+
(a, b, c) = 1, 2, 3
|
3654
|
+
^
|
2928
3655
|
- name: rparen_loc
|
2929
3656
|
type: location?
|
3657
|
+
comment: |
|
3658
|
+
The location of the closing parenthesis.
|
3659
|
+
|
3660
|
+
(a, b, c) = 1, 2, 3
|
3661
|
+
^
|
2930
3662
|
- name: operator_loc
|
2931
3663
|
type: location
|
3664
|
+
comment: |
|
3665
|
+
The location of the operator.
|
3666
|
+
|
3667
|
+
a, b, c = 1, 2, 3
|
3668
|
+
^
|
2932
3669
|
- name: value
|
2933
3670
|
type: node
|
3671
|
+
kind: non-void expression
|
3672
|
+
comment: |
|
3673
|
+
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).
|
3674
|
+
|
3675
|
+
a, b, c = 1, 2, 3
|
3676
|
+
^^^^^^^
|
2934
3677
|
comment: |
|
2935
3678
|
Represents a write to a multi-target expression.
|
2936
3679
|
|
@@ -2993,16 +3736,15 @@ nodes:
|
|
2993
3736
|
$1
|
2994
3737
|
^^
|
2995
3738
|
- name: OptionalKeywordParameterNode
|
3739
|
+
flags: ParameterFlags
|
2996
3740
|
fields:
|
2997
|
-
- name: flags
|
2998
|
-
type: flags
|
2999
|
-
kind: ParameterFlags
|
3000
3741
|
- name: name
|
3001
3742
|
type: constant
|
3002
3743
|
- name: name_loc
|
3003
3744
|
type: location
|
3004
3745
|
- name: value
|
3005
3746
|
type: node
|
3747
|
+
kind: non-void expression
|
3006
3748
|
comment: |
|
3007
3749
|
Represents an optional keyword parameter to a method, block, or lambda definition.
|
3008
3750
|
|
@@ -3010,10 +3752,8 @@ nodes:
|
|
3010
3752
|
^^^^
|
3011
3753
|
end
|
3012
3754
|
- name: OptionalParameterNode
|
3755
|
+
flags: ParameterFlags
|
3013
3756
|
fields:
|
3014
|
-
- name: flags
|
3015
|
-
type: flags
|
3016
|
-
kind: ParameterFlags
|
3017
3757
|
- name: name
|
3018
3758
|
type: constant
|
3019
3759
|
- name: name_loc
|
@@ -3022,6 +3762,7 @@ nodes:
|
|
3022
3762
|
type: location
|
3023
3763
|
- name: value
|
3024
3764
|
type: node
|
3765
|
+
kind: non-void expression
|
3025
3766
|
comment: |
|
3026
3767
|
Represents an optional parameter to a method, block, or lambda definition.
|
3027
3768
|
|
@@ -3032,6 +3773,7 @@ nodes:
|
|
3032
3773
|
fields:
|
3033
3774
|
- name: left
|
3034
3775
|
type: node
|
3776
|
+
kind: non-void expression
|
3035
3777
|
comment: |
|
3036
3778
|
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
3779
|
|
@@ -3042,8 +3784,9 @@ nodes:
|
|
3042
3784
|
^
|
3043
3785
|
- name: right
|
3044
3786
|
type: node
|
3787
|
+
kind: Node
|
3045
3788
|
comment: |
|
3046
|
-
Represents the right side of the expression.
|
3789
|
+
Represents the right side of the expression.
|
3047
3790
|
|
3048
3791
|
left || right
|
3049
3792
|
^^^^^
|
@@ -3083,10 +3826,10 @@ nodes:
|
|
3083
3826
|
- RequiredParameterNode
|
3084
3827
|
- MultiTargetNode
|
3085
3828
|
# On parsing error of `f(**kwargs, ...)` or `f(**nil, ...)`, the keyword_rest value is moved here:
|
3086
|
-
- KeywordRestParameterNode
|
3087
|
-
- NoKeywordsParameterNode
|
3829
|
+
- on error: KeywordRestParameterNode
|
3830
|
+
- on error: NoKeywordsParameterNode
|
3088
3831
|
# On parsing error of `f(..., ...)`, the first forwarding parameter is moved here:
|
3089
|
-
- ForwardingParameterNode
|
3832
|
+
- on error: ForwardingParameterNode
|
3090
3833
|
- name: keywords
|
3091
3834
|
type: node[]
|
3092
3835
|
kind:
|
@@ -3111,6 +3854,7 @@ nodes:
|
|
3111
3854
|
fields:
|
3112
3855
|
- name: body
|
3113
3856
|
type: node?
|
3857
|
+
kind: non-void expression # Usually a StatementsNode but not always e.g. `1 in (..10)`
|
3114
3858
|
- name: opening_loc
|
3115
3859
|
type: location
|
3116
3860
|
- name: closing_loc
|
@@ -3125,6 +3869,7 @@ nodes:
|
|
3125
3869
|
fields:
|
3126
3870
|
- name: expression
|
3127
3871
|
type: node
|
3872
|
+
kind: non-void expression
|
3128
3873
|
- name: operator_loc
|
3129
3874
|
type: location
|
3130
3875
|
- name: lparen_loc
|
@@ -3140,6 +3885,15 @@ nodes:
|
|
3140
3885
|
fields:
|
3141
3886
|
- name: variable
|
3142
3887
|
type: node
|
3888
|
+
kind:
|
3889
|
+
- LocalVariableReadNode
|
3890
|
+
- InstanceVariableReadNode
|
3891
|
+
- ClassVariableReadNode
|
3892
|
+
- GlobalVariableReadNode # foo in ^$a
|
3893
|
+
- BackReferenceReadNode # foo in ^$&
|
3894
|
+
- NumberedReferenceReadNode # foo in ^$1
|
3895
|
+
- ItLocalVariableReadNode # proc { 1 in ^it }
|
3896
|
+
- on error: MissingNode # foo in ^Bar
|
3143
3897
|
- name: operator_loc
|
3144
3898
|
type: location
|
3145
3899
|
comment: |
|
@@ -3188,12 +3942,11 @@ nodes:
|
|
3188
3942
|
kind: StatementsNode
|
3189
3943
|
comment: The top level node of any parse tree.
|
3190
3944
|
- name: RangeNode
|
3945
|
+
flags: RangeFlags
|
3191
3946
|
fields:
|
3192
|
-
- name: flags
|
3193
|
-
type: flags
|
3194
|
-
kind: RangeFlags
|
3195
3947
|
- name: left
|
3196
3948
|
type: node?
|
3949
|
+
kind: non-void expression
|
3197
3950
|
comment: |
|
3198
3951
|
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
3952
|
|
@@ -3204,6 +3957,7 @@ nodes:
|
|
3204
3957
|
^^^^^
|
3205
3958
|
- name: right
|
3206
3959
|
type: node?
|
3960
|
+
kind: non-void expression
|
3207
3961
|
comment: |
|
3208
3962
|
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
3963
|
|
@@ -3226,9 +3980,20 @@ nodes:
|
|
3226
3980
|
c if a =~ /left/ ... b =~ /right/
|
3227
3981
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
3228
3982
|
- name: RationalNode
|
3983
|
+
flags: IntegerBaseFlags
|
3229
3984
|
fields:
|
3230
|
-
- name:
|
3231
|
-
type:
|
3985
|
+
- name: numerator
|
3986
|
+
type: integer
|
3987
|
+
comment: |
|
3988
|
+
The numerator of the rational number.
|
3989
|
+
|
3990
|
+
1.5r # numerator 3
|
3991
|
+
- name: denominator
|
3992
|
+
type: integer
|
3993
|
+
comment: |
|
3994
|
+
The denominator of the rational number.
|
3995
|
+
|
3996
|
+
1.5r # denominator 2
|
3232
3997
|
comment: |
|
3233
3998
|
Represents a rational number literal.
|
3234
3999
|
|
@@ -3241,10 +4006,8 @@ nodes:
|
|
3241
4006
|
redo
|
3242
4007
|
^^^^
|
3243
4008
|
- name: RegularExpressionNode
|
4009
|
+
flags: RegularExpressionFlags
|
3244
4010
|
fields:
|
3245
|
-
- name: flags
|
3246
|
-
type: flags
|
3247
|
-
kind: RegularExpressionFlags
|
3248
4011
|
- name: opening_loc
|
3249
4012
|
type: location
|
3250
4013
|
- name: content_loc
|
@@ -3259,10 +4022,8 @@ nodes:
|
|
3259
4022
|
/foo/i
|
3260
4023
|
^^^^^^
|
3261
4024
|
- name: RequiredKeywordParameterNode
|
4025
|
+
flags: ParameterFlags
|
3262
4026
|
fields:
|
3263
|
-
- name: flags
|
3264
|
-
type: flags
|
3265
|
-
kind: ParameterFlags
|
3266
4027
|
- name: name
|
3267
4028
|
type: constant
|
3268
4029
|
- name: name_loc
|
@@ -3274,10 +4035,8 @@ nodes:
|
|
3274
4035
|
^^
|
3275
4036
|
end
|
3276
4037
|
- name: RequiredParameterNode
|
4038
|
+
flags: ParameterFlags
|
3277
4039
|
fields:
|
3278
|
-
- name: flags
|
3279
|
-
type: flags
|
3280
|
-
kind: ParameterFlags
|
3281
4040
|
- name: name
|
3282
4041
|
type: constant
|
3283
4042
|
comment: |
|
@@ -3290,10 +4049,12 @@ nodes:
|
|
3290
4049
|
fields:
|
3291
4050
|
- name: expression
|
3292
4051
|
type: node
|
4052
|
+
kind: Node
|
3293
4053
|
- name: keyword_loc
|
3294
4054
|
type: location
|
3295
4055
|
- name: rescue_expression
|
3296
4056
|
type: node
|
4057
|
+
kind: Node
|
3297
4058
|
newline: expression
|
3298
4059
|
comment: |
|
3299
4060
|
Represents an expression modified with a rescue.
|
@@ -3306,14 +4067,27 @@ nodes:
|
|
3306
4067
|
type: location
|
3307
4068
|
- name: exceptions
|
3308
4069
|
type: node[]
|
4070
|
+
kind: non-void expression
|
3309
4071
|
- name: operator_loc
|
3310
4072
|
type: location?
|
3311
4073
|
- name: reference
|
3312
4074
|
type: node?
|
4075
|
+
kind:
|
4076
|
+
- LocalVariableTargetNode
|
4077
|
+
- InstanceVariableTargetNode
|
4078
|
+
- ClassVariableTargetNode
|
4079
|
+
- GlobalVariableTargetNode
|
4080
|
+
- ConstantTargetNode
|
4081
|
+
- ConstantPathTargetNode
|
4082
|
+
- CallTargetNode
|
4083
|
+
- IndexTargetNode
|
4084
|
+
- on error: BackReferenceReadNode # => begin; rescue => $&; end
|
4085
|
+
- on error: NumberedReferenceReadNode # => begin; rescue => $1; end
|
4086
|
+
- on error: MissingNode # begin; rescue =>; end
|
3313
4087
|
- name: statements
|
3314
4088
|
type: node?
|
3315
4089
|
kind: StatementsNode
|
3316
|
-
- name:
|
4090
|
+
- name: subsequent
|
3317
4091
|
type: node?
|
3318
4092
|
kind: RescueNode
|
3319
4093
|
comment: |
|
@@ -3325,12 +4099,10 @@ nodes:
|
|
3325
4099
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
3326
4100
|
end
|
3327
4101
|
|
3328
|
-
`Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `
|
4102
|
+
`Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `reference` field.
|
3329
4103
|
- name: RestParameterNode
|
4104
|
+
flags: ParameterFlags
|
3330
4105
|
fields:
|
3331
|
-
- name: flags
|
3332
|
-
type: flags
|
3333
|
-
kind: ParameterFlags
|
3334
4106
|
- name: name
|
3335
4107
|
type: constant?
|
3336
4108
|
- name: name_loc
|
@@ -3351,9 +4123,6 @@ nodes:
|
|
3351
4123
|
^^^^^
|
3352
4124
|
- name: ReturnNode
|
3353
4125
|
fields:
|
3354
|
-
- name: flags
|
3355
|
-
type: flags
|
3356
|
-
kind: ReturnNodeFlags
|
3357
4126
|
- name: keyword_loc
|
3358
4127
|
type: location
|
3359
4128
|
- name: arguments
|
@@ -3371,10 +4140,8 @@ nodes:
|
|
3371
4140
|
self
|
3372
4141
|
^^^^
|
3373
4142
|
- name: ShareableConstantNode
|
4143
|
+
flags: ShareableConstantNodeFlags
|
3374
4144
|
fields:
|
3375
|
-
- name: flags
|
3376
|
-
type: flags
|
3377
|
-
kind: ShareableConstantNodeFlags
|
3378
4145
|
- name: write
|
3379
4146
|
type: node
|
3380
4147
|
kind:
|
@@ -3403,8 +4170,12 @@ nodes:
|
|
3403
4170
|
type: location
|
3404
4171
|
- name: expression
|
3405
4172
|
type: node
|
4173
|
+
kind: non-void expression
|
3406
4174
|
- name: body
|
3407
4175
|
type: node?
|
4176
|
+
kind:
|
4177
|
+
- StatementsNode
|
4178
|
+
- BeginNode
|
3408
4179
|
- name: end_keyword_loc
|
3409
4180
|
type: location
|
3410
4181
|
comment: |
|
@@ -3419,10 +4190,8 @@ nodes:
|
|
3419
4190
|
__ENCODING__
|
3420
4191
|
^^^^^^^^^^^^
|
3421
4192
|
- name: SourceFileNode
|
4193
|
+
flags: StringFlags
|
3422
4194
|
fields:
|
3423
|
-
- name: flags
|
3424
|
-
type: flags
|
3425
|
-
kind: StringFlags
|
3426
4195
|
- name: filepath
|
3427
4196
|
type: string
|
3428
4197
|
comment: Represents the file path being parsed. This corresponds directly to the `filepath` option given to the various `Prism::parse*` APIs.
|
@@ -3443,6 +4212,7 @@ nodes:
|
|
3443
4212
|
type: location
|
3444
4213
|
- name: expression
|
3445
4214
|
type: node?
|
4215
|
+
kind: non-void expression
|
3446
4216
|
comment: |
|
3447
4217
|
Represents the use of the splat operator.
|
3448
4218
|
|
@@ -3452,16 +4222,15 @@ nodes:
|
|
3452
4222
|
fields:
|
3453
4223
|
- name: body
|
3454
4224
|
type: node[]
|
4225
|
+
kind: Node
|
3455
4226
|
comment: |
|
3456
4227
|
Represents a set of statements contained within some scope.
|
3457
4228
|
|
3458
4229
|
foo; bar; baz
|
3459
4230
|
^^^^^^^^^^^^^
|
3460
4231
|
- name: StringNode
|
4232
|
+
flags: StringFlags
|
3461
4233
|
fields:
|
3462
|
-
- name: flags
|
3463
|
-
type: flags
|
3464
|
-
kind: StringFlags
|
3465
4234
|
- name: opening_loc
|
3466
4235
|
type: location?
|
3467
4236
|
- name: content_loc
|
@@ -3494,6 +4263,9 @@ nodes:
|
|
3494
4263
|
type: location?
|
3495
4264
|
- name: block
|
3496
4265
|
type: node?
|
4266
|
+
kind:
|
4267
|
+
- BlockNode
|
4268
|
+
- BlockArgumentNode
|
3497
4269
|
comment: |
|
3498
4270
|
Represents the use of the `super` keyword with parentheses or arguments.
|
3499
4271
|
|
@@ -3503,10 +4275,8 @@ nodes:
|
|
3503
4275
|
super foo, bar
|
3504
4276
|
^^^^^^^^^^^^^^
|
3505
4277
|
- name: SymbolNode
|
4278
|
+
flags: SymbolFlags
|
3506
4279
|
fields:
|
3507
|
-
- name: flags
|
3508
|
-
type: flags
|
3509
|
-
kind: SymbolFlags
|
3510
4280
|
- name: opening_loc
|
3511
4281
|
type: location?
|
3512
4282
|
- name: value_loc
|
@@ -3557,6 +4327,7 @@ nodes:
|
|
3557
4327
|
^^^^^^
|
3558
4328
|
- name: predicate
|
3559
4329
|
type: node
|
4330
|
+
kind: non-void expression
|
3560
4331
|
comment: |
|
3561
4332
|
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
4333
|
|
@@ -3567,7 +4338,7 @@ nodes:
|
|
3567
4338
|
^^^^
|
3568
4339
|
- name: then_keyword_loc
|
3569
4340
|
type: location?
|
3570
|
-
comment:
|
4341
|
+
comment: |
|
3571
4342
|
The location of the `then` keyword, if present.
|
3572
4343
|
|
3573
4344
|
unless cond then bar end
|
@@ -3581,7 +4352,7 @@ nodes:
|
|
3581
4352
|
|
3582
4353
|
unless cond then bar end
|
3583
4354
|
^^^
|
3584
|
-
- name:
|
4355
|
+
- name: else_clause
|
3585
4356
|
type: node?
|
3586
4357
|
kind: ElseNode
|
3587
4358
|
comment: |
|
@@ -3606,16 +4377,17 @@ nodes:
|
|
3606
4377
|
unless foo then bar end
|
3607
4378
|
^^^^^^^^^^^^^^^^^^^^^^^
|
3608
4379
|
- name: UntilNode
|
4380
|
+
flags: LoopFlags
|
3609
4381
|
fields:
|
3610
|
-
- name: flags
|
3611
|
-
type: flags
|
3612
|
-
kind: LoopFlags
|
3613
4382
|
- name: keyword_loc
|
3614
4383
|
type: location
|
4384
|
+
- name: do_keyword_loc
|
4385
|
+
type: location?
|
3615
4386
|
- name: closing_loc
|
3616
4387
|
type: location?
|
3617
4388
|
- name: predicate
|
3618
4389
|
type: node
|
4390
|
+
kind: non-void expression
|
3619
4391
|
- name: statements
|
3620
4392
|
type: node?
|
3621
4393
|
kind: StatementsNode
|
@@ -3634,6 +4406,7 @@ nodes:
|
|
3634
4406
|
type: location
|
3635
4407
|
- name: conditions
|
3636
4408
|
type: node[]
|
4409
|
+
kind: non-void expression
|
3637
4410
|
- name: then_keyword_loc
|
3638
4411
|
type: location?
|
3639
4412
|
- name: statements
|
@@ -3647,16 +4420,17 @@ nodes:
|
|
3647
4420
|
^^^^^^^^^
|
3648
4421
|
end
|
3649
4422
|
- name: WhileNode
|
4423
|
+
flags: LoopFlags
|
3650
4424
|
fields:
|
3651
|
-
- name: flags
|
3652
|
-
type: flags
|
3653
|
-
kind: LoopFlags
|
3654
4425
|
- name: keyword_loc
|
3655
4426
|
type: location
|
4427
|
+
- name: do_keyword_loc
|
4428
|
+
type: location?
|
3656
4429
|
- name: closing_loc
|
3657
4430
|
type: location?
|
3658
4431
|
- name: predicate
|
3659
4432
|
type: node
|
4433
|
+
kind: non-void expression
|
3660
4434
|
- name: statements
|
3661
4435
|
type: node?
|
3662
4436
|
kind: StatementsNode
|
@@ -3670,10 +4444,8 @@ nodes:
|
|
3670
4444
|
while foo do bar end
|
3671
4445
|
^^^^^^^^^^^^^^^^^^^^
|
3672
4446
|
- name: XStringNode
|
4447
|
+
flags: EncodingFlags
|
3673
4448
|
fields:
|
3674
|
-
- name: flags
|
3675
|
-
type: flags
|
3676
|
-
kind: EncodingFlags
|
3677
4449
|
- name: opening_loc
|
3678
4450
|
type: location
|
3679
4451
|
- name: content_loc
|