Debian Codegraph @

config.yml

raw symbols SCIP
1 errors:
2 - ALIAS_ARGUMENT
3 - ALIAS_ARGUMENT_NUMBERED_REFERENCE
4 - AMPAMPEQ_MULTI_ASSIGN
5 - ARGUMENT_AFTER_BLOCK
6 - ARGUMENT_AFTER_FORWARDING_ELLIPSES
7 - ARGUMENT_BARE_HASH
8 - ARGUMENT_BLOCK_FORWARDING
9 - ARGUMENT_BLOCK_MULTI
10 - ARGUMENT_CONFLICT_AMPERSAND
11 - ARGUMENT_CONFLICT_STAR
12 - ARGUMENT_CONFLICT_STAR_STAR
13 - ARGUMENT_FORMAL_CLASS
14 - ARGUMENT_FORMAL_CONSTANT
15 - ARGUMENT_FORMAL_GLOBAL
16 - ARGUMENT_FORMAL_IVAR
17 - ARGUMENT_FORWARDING_UNBOUND
18 - ARGUMENT_NO_FORWARDING_AMPERSAND
19 - ARGUMENT_NO_FORWARDING_ELLIPSES
20 - ARGUMENT_NO_FORWARDING_STAR
21 - ARGUMENT_NO_FORWARDING_STAR_STAR
22 - ARGUMENT_SPLAT_AFTER_ASSOC_SPLAT
23 - ARGUMENT_SPLAT_AFTER_SPLAT
24 - ARGUMENT_TERM_PAREN
25 - ARGUMENT_UNEXPECTED_BLOCK
26 - ARRAY_ELEMENT
27 - ARRAY_EXPRESSION
28 - ARRAY_EXPRESSION_AFTER_STAR
29 - ARRAY_SEPARATOR
30 - ARRAY_TERM
31 - BEGIN_LONELY_ELSE
32 - BEGIN_TERM
33 - BEGIN_UPCASE_BRACE
34 - BEGIN_UPCASE_TERM
35 - BEGIN_UPCASE_TOPLEVEL
36 - BLOCK_PARAM_LOCAL_VARIABLE
37 - BLOCK_PARAM_PIPE_TERM
38 - BLOCK_TERM_BRACE
39 - BLOCK_TERM_END
40 - CANNOT_PARSE_EXPRESSION
41 - CANNOT_PARSE_STRING_PART
42 - CASE_EXPRESSION_AFTER_CASE
43 - CASE_EXPRESSION_AFTER_WHEN
44 - CASE_MATCH_MISSING_PREDICATE
45 - CASE_MISSING_CONDITIONS
46 - CASE_TERM
47 - CLASS_IN_METHOD
48 - CLASS_NAME
49 - CLASS_SUPERCLASS
50 - CLASS_TERM
51 - CLASS_UNEXPECTED_END
52 - CLASS_VARIABLE_BARE
53 - CONDITIONAL_ELSIF_PREDICATE
54 - CONDITIONAL_IF_PREDICATE
55 - CONDITIONAL_PREDICATE_TERM
56 - CONDITIONAL_TERM
57 - CONDITIONAL_TERM_ELSE
58 - CONDITIONAL_UNLESS_PREDICATE
59 - CONDITIONAL_UNTIL_PREDICATE
60 - CONDITIONAL_WHILE_PREDICATE
61 - CONSTANT_PATH_COLON_COLON_CONSTANT
62 - DEF_ENDLESS
63 - DEF_ENDLESS_PARAMETERS
64 - DEF_ENDLESS_SETTER
65 - DEF_NAME
66 - DEF_PARAMS_TERM
67 - DEF_PARAMS_TERM_PAREN
68 - DEF_RECEIVER
69 - DEF_RECEIVER_TERM
70 - DEF_TERM
71 - DEFINED_EXPRESSION
72 - EMBDOC_TERM
73 - EMBEXPR_END
74 - EMBVAR_INVALID
75 - END_UPCASE_BRACE
76 - END_UPCASE_TERM
77 - ESCAPE_INVALID_CONTROL
78 - ESCAPE_INVALID_CONTROL_REPEAT
79 - ESCAPE_INVALID_HEXADECIMAL
80 - ESCAPE_INVALID_META
81 - ESCAPE_INVALID_META_REPEAT
82 - ESCAPE_INVALID_UNICODE
83 - ESCAPE_INVALID_UNICODE_CM_FLAGS
84 - ESCAPE_INVALID_UNICODE_LIST
85 - ESCAPE_INVALID_UNICODE_LITERAL
86 - ESCAPE_INVALID_UNICODE_LONG
87 - ESCAPE_INVALID_UNICODE_SHORT
88 - ESCAPE_INVALID_UNICODE_TERM
89 - EXPECT_ARGUMENT
90 - EXPECT_EOL_AFTER_STATEMENT
91 - EXPECT_EXPRESSION_AFTER_AMPAMPEQ
92 - EXPECT_EXPRESSION_AFTER_COMMA
93 - EXPECT_EXPRESSION_AFTER_EQUAL
94 - EXPECT_EXPRESSION_AFTER_LESS_LESS
95 - EXPECT_EXPRESSION_AFTER_LPAREN
96 - EXPECT_EXPRESSION_AFTER_OPERATOR
97 - EXPECT_EXPRESSION_AFTER_PIPEPIPEEQ
98 - EXPECT_EXPRESSION_AFTER_QUESTION
99 - EXPECT_EXPRESSION_AFTER_SPLAT
100 - EXPECT_EXPRESSION_AFTER_SPLAT_HASH
101 - EXPECT_EXPRESSION_AFTER_STAR
102 - EXPECT_FOR_DELIMITER
103 - EXPECT_IDENT_REQ_PARAMETER
104 - EXPECT_IN_DELIMITER
105 - EXPECT_LPAREN_AFTER_NOT_LPAREN
106 - EXPECT_LPAREN_AFTER_NOT_OTHER
107 - EXPECT_LPAREN_REQ_PARAMETER
108 - EXPECT_MESSAGE
109 - EXPECT_RBRACKET
110 - EXPECT_RPAREN
111 - EXPECT_RPAREN_AFTER_MULTI
112 - EXPECT_RPAREN_REQ_PARAMETER
113 - EXPECT_SINGLETON_CLASS_DELIMITER
114 - EXPECT_STRING_CONTENT
115 - EXPECT_WHEN_DELIMITER
116 - EXPRESSION_BARE_HASH
117 - EXPRESSION_NOT_WRITABLE
118 - EXPRESSION_NOT_WRITABLE_ENCODING
119 - EXPRESSION_NOT_WRITABLE_FALSE
120 - EXPRESSION_NOT_WRITABLE_FILE
121 - EXPRESSION_NOT_WRITABLE_LINE
122 - EXPRESSION_NOT_WRITABLE_NIL
123 - EXPRESSION_NOT_WRITABLE_NUMBERED
124 - EXPRESSION_NOT_WRITABLE_SELF
125 - EXPRESSION_NOT_WRITABLE_TRUE
126 - FLOAT_PARSE
127 - FOR_COLLECTION
128 - FOR_IN
129 - FOR_INDEX
130 - FOR_TERM
131 - GLOBAL_VARIABLE_BARE
132 - HASH_EXPRESSION_AFTER_LABEL
133 - HASH_KEY
134 - HASH_ROCKET
135 - HASH_TERM
136 - HASH_VALUE
137 - HEREDOC_IDENTIFIER
138 - HEREDOC_TERM
139 - INCOMPLETE_QUESTION_MARK
140 - INCOMPLETE_VARIABLE_CLASS
141 - INCOMPLETE_VARIABLE_CLASS_3_3
142 - INCOMPLETE_VARIABLE_INSTANCE
143 - INCOMPLETE_VARIABLE_INSTANCE_3_3
144 - INSTANCE_VARIABLE_BARE
145 - INVALID_BLOCK_EXIT
146 - INVALID_CHARACTER
147 - INVALID_COMMA
148 - INVALID_ENCODING_MAGIC_COMMENT
149 - INVALID_ESCAPE_CHARACTER
150 - INVALID_FLOAT_EXPONENT
151 - INVALID_LOCAL_VARIABLE_READ
152 - INVALID_LOCAL_VARIABLE_WRITE
153 - INVALID_MULTIBYTE_CHAR
154 - INVALID_MULTIBYTE_CHARACTER
155 - INVALID_MULTIBYTE_ESCAPE
156 - INVALID_NUMBER_BINARY
157 - INVALID_NUMBER_DECIMAL
158 - INVALID_NUMBER_FRACTION
159 - INVALID_NUMBER_HEXADECIMAL
160 - INVALID_NUMBER_OCTAL
161 - INVALID_NUMBER_UNDERSCORE_INNER
162 - INVALID_NUMBER_UNDERSCORE_TRAILING
163 - INVALID_PERCENT
164 - INVALID_PERCENT_EOF
165 - INVALID_PRINTABLE_CHARACTER
166 - INVALID_RETRY_AFTER_ELSE
167 - INVALID_RETRY_AFTER_ENSURE
168 - INVALID_RETRY_WITHOUT_RESCUE
169 - INVALID_SYMBOL
170 - INVALID_VARIABLE_GLOBAL
171 - INVALID_VARIABLE_GLOBAL_3_3
172 - INVALID_YIELD
173 - IT_NOT_ALLOWED_NUMBERED
174 - IT_NOT_ALLOWED_ORDINARY
175 - LAMBDA_OPEN
176 - LAMBDA_TERM_BRACE
177 - LAMBDA_TERM_END
178 - LIST_I_LOWER_ELEMENT
179 - LIST_I_LOWER_TERM
180 - LIST_I_UPPER_ELEMENT
181 - LIST_I_UPPER_TERM
182 - LIST_W_LOWER_ELEMENT
183 - LIST_W_LOWER_TERM
184 - LIST_W_UPPER_ELEMENT
185 - LIST_W_UPPER_TERM
186 - MALLOC_FAILED
187 - MIXED_ENCODING
188 - MODULE_IN_METHOD
189 - MODULE_NAME
190 - MODULE_TERM
191 - MULTI_ASSIGN_MULTI_SPLATS
192 - MULTI_ASSIGN_UNEXPECTED_REST
193 - NESTING_TOO_DEEP
194 - NO_LOCAL_VARIABLE
195 - NON_ASSOCIATIVE_OPERATOR
196 - NOT_EXPRESSION
197 - NUMBER_LITERAL_UNDERSCORE
198 - NUMBERED_PARAMETER_INNER_BLOCK
199 - NUMBERED_PARAMETER_IT
200 - NUMBERED_PARAMETER_ORDINARY
201 - NUMBERED_PARAMETER_OUTER_BLOCK
202 - OPERATOR_MULTI_ASSIGN
203 - OPERATOR_WRITE_ARGUMENTS
204 - OPERATOR_WRITE_BLOCK
205 - PARAMETER_ASSOC_SPLAT_MULTI
206 - PARAMETER_BLOCK_MULTI
207 - PARAMETER_CIRCULAR
208 - PARAMETER_FORWARDING_AFTER_REST
209 - PARAMETER_METHOD_NAME
210 - PARAMETER_NAME_DUPLICATED
211 - PARAMETER_NO_DEFAULT
212 - PARAMETER_NO_DEFAULT_KW
213 - PARAMETER_NUMBERED_RESERVED
214 - PARAMETER_ORDER
215 - PARAMETER_SPLAT_MULTI
216 - PARAMETER_STAR
217 - PARAMETER_UNEXPECTED_FWD
218 - PARAMETER_UNEXPECTED_NO_KW
219 - PARAMETER_WILD_LOOSE_COMMA
220 - PATTERN_ARRAY_MULTIPLE_RESTS
221 - PATTERN_CAPTURE_DUPLICATE
222 - PATTERN_CAPTURE_IN_ALTERNATIVE
223 - PATTERN_EXPRESSION_AFTER_BRACKET
224 - PATTERN_EXPRESSION_AFTER_COMMA
225 - PATTERN_EXPRESSION_AFTER_HROCKET
226 - PATTERN_EXPRESSION_AFTER_IN
227 - PATTERN_EXPRESSION_AFTER_KEY
228 - PATTERN_EXPRESSION_AFTER_PAREN
229 - PATTERN_EXPRESSION_AFTER_PIN
230 - PATTERN_EXPRESSION_AFTER_PIPE
231 - PATTERN_EXPRESSION_AFTER_RANGE
232 - PATTERN_EXPRESSION_AFTER_REST
233 - PATTERN_FIND_MISSING_INNER
234 - PATTERN_HASH_IMPLICIT
235 - PATTERN_HASH_KEY
236 - PATTERN_HASH_KEY_DUPLICATE
237 - PATTERN_HASH_KEY_INTERPOLATED
238 - PATTERN_HASH_KEY_LABEL
239 - PATTERN_HASH_KEY_LOCALS
240 - PATTERN_IDENT_AFTER_HROCKET
241 - PATTERN_LABEL_AFTER_COMMA
242 - PATTERN_REST
243 - PATTERN_TERM_BRACE
244 - PATTERN_TERM_BRACKET
245 - PATTERN_TERM_PAREN
246 - PIPEPIPEEQ_MULTI_ASSIGN
247 - REGEXP_ENCODING_OPTION_MISMATCH
248 - REGEXP_INCOMPAT_CHAR_ENCODING
249 - REGEXP_INVALID_UNICODE_RANGE
250 - REGEXP_NON_ESCAPED_MBC
251 - REGEXP_PARSE_ERROR
252 - REGEXP_TERM
253 - REGEXP_UNKNOWN_OPTIONS
254 - REGEXP_UTF8_CHAR_NON_UTF8_REGEXP
255 - RESCUE_EXPRESSION
256 - RESCUE_MODIFIER_VALUE
257 - RESCUE_TERM
258 - RESCUE_VARIABLE
259 - RETURN_INVALID
260 - SCRIPT_NOT_FOUND
261 - SINGLETON_FOR_LITERALS
262 - STATEMENT_ALIAS
263 - STATEMENT_POSTEXE_END
264 - STATEMENT_PREEXE_BEGIN
265 - STATEMENT_UNDEF
266 - STRING_CONCATENATION
267 - STRING_INTERPOLATED_TERM
268 - STRING_LITERAL_EOF
269 - STRING_LITERAL_TERM
270 - SYMBOL_INVALID
271 - SYMBOL_TERM_DYNAMIC
272 - SYMBOL_TERM_INTERPOLATED
273 - TERNARY_COLON
274 - TERNARY_EXPRESSION_FALSE
275 - TERNARY_EXPRESSION_TRUE
276 - UNARY_DISALLOWED
277 - UNARY_RECEIVER
278 - UNDEF_ARGUMENT
279 - UNEXPECTED_BLOCK_ARGUMENT
280 - UNEXPECTED_INDEX_BLOCK
281 - UNEXPECTED_INDEX_KEYWORDS
282 - UNEXPECTED_LABEL
283 - UNEXPECTED_MULTI_WRITE
284 - UNEXPECTED_PARAMETER_DEFAULT_VALUE
285 - UNEXPECTED_RANGE_OPERATOR
286 - UNEXPECTED_SAFE_NAVIGATION
287 - UNEXPECTED_TOKEN_CLOSE_CONTEXT
288 - UNEXPECTED_TOKEN_IGNORE
289 - UNTIL_TERM
290 - VOID_EXPRESSION
291 - WHILE_TERM
292 - WRITE_TARGET_IN_METHOD
293 - WRITE_TARGET_READONLY
294 - WRITE_TARGET_UNEXPECTED
295 - XSTRING_TERM
296 warnings:
297 - AMBIGUOUS_BINARY_OPERATOR
298 - AMBIGUOUS_FIRST_ARGUMENT_MINUS
299 - AMBIGUOUS_FIRST_ARGUMENT_PLUS
300 - AMBIGUOUS_PREFIX_AMPERSAND
301 - AMBIGUOUS_PREFIX_STAR
302 - AMBIGUOUS_PREFIX_STAR_STAR
303 - AMBIGUOUS_SLASH
304 - COMPARISON_AFTER_COMPARISON
305 - DOT_DOT_DOT_EOL
306 - EQUAL_IN_CONDITIONAL
307 - EQUAL_IN_CONDITIONAL_3_3
308 - END_IN_METHOD
309 - DUPLICATED_HASH_KEY
310 - DUPLICATED_WHEN_CLAUSE
311 - FLOAT_OUT_OF_RANGE
312 - IGNORED_FROZEN_STRING_LITERAL
313 - INDENTATION_MISMATCH
314 - INTEGER_IN_FLIP_FLOP
315 - INVALID_CHARACTER
316 - INVALID_MAGIC_COMMENT_VALUE
317 - INVALID_NUMBERED_REFERENCE
318 - KEYWORD_EOL
319 - LITERAL_IN_CONDITION_DEFAULT
320 - LITERAL_IN_CONDITION_VERBOSE
321 - SHAREABLE_CONSTANT_VALUE_LINE
322 - SHEBANG_CARRIAGE_RETURN
323 - UNEXPECTED_CARRIAGE_RETURN
324 - UNREACHABLE_STATEMENT
325 - UNUSED_LOCAL_VARIABLE
326 - VOID_STATEMENT
327 tokens:
328 # The order of the tokens at the beginning is important, because we use them
329 # for a lookup table.
330 - name: EOF
331 value: 1
332 comment: final token in the file
333 - name: BRACE_RIGHT
334 comment: "}"
335 - name: COMMA
336 comment: ","
337 - name: EMBEXPR_END
338 comment: "}"
339 - name: KEYWORD_DO
340 comment: "do"
341 - name: KEYWORD_ELSE
342 comment: "else"
343 - name: KEYWORD_ELSIF
344 comment: "elsif"
345 - name: KEYWORD_END
346 comment: "end"
347 - name: KEYWORD_ENSURE
348 comment: "ensure"
349 - name: KEYWORD_IN
350 comment: "in"
351 - name: KEYWORD_RESCUE
352 comment: "rescue"
353 - name: KEYWORD_THEN
354 comment: "then"
355 - name: KEYWORD_WHEN
356 comment: "when"
357 - name: NEWLINE
358 comment: "a newline character outside of other tokens"
359 - name: PARENTHESIS_RIGHT
360 comment: ")"
361 - name: PIPE
362 comment: "|"
363 - name: SEMICOLON
364 comment: ";"
365 # Tokens from here on are not used for lookup, and can be in any order.
366 - name: AMPERSAND
367 comment: "&"
368 - name: AMPERSAND_AMPERSAND
369 comment: "&&"
370 - name: AMPERSAND_AMPERSAND_EQUAL
371 comment: "&&="
372 - name: AMPERSAND_DOT
373 comment: "&."
374 - name: AMPERSAND_EQUAL
375 comment: "&="
376 - name: BACKTICK
377 comment: "`"
378 - name: BACK_REFERENCE
379 comment: "a back reference"
380 - name: BANG
381 comment: "! or !@"
382 - name: BANG_EQUAL
383 comment: "!="
384 - name: BANG_TILDE
385 comment: "!~"
386 - name: BRACE_LEFT
387 comment: "{"
388 - name: BRACKET_LEFT
389 comment: "["
390 - name: BRACKET_LEFT_ARRAY
391 comment: "[ for the beginning of an array"
392 - name: BRACKET_LEFT_RIGHT
393 comment: "[]"
394 - name: BRACKET_LEFT_RIGHT_EQUAL
395 comment: "[]="
396 - name: BRACKET_RIGHT
397 comment: "]"
398 - name: CARET
399 comment: "^"
400 - name: CARET_EQUAL
401 comment: "^="
402 - name: CHARACTER_LITERAL
403 comment: "a character literal"
404 - name: CLASS_VARIABLE
405 comment: "a class variable"
406 - name: COLON
407 comment: ":"
408 - name: COLON_COLON
409 comment: "::"
410 - name: COMMENT
411 comment: "a comment"
412 - name: CONSTANT
413 comment: "a constant"
414 - name: DOT
415 comment: "the . call operator"
416 - name: DOT_DOT
417 comment: "the .. range operator"
418 - name: DOT_DOT_DOT
419 comment: "the ... range operator or forwarding parameter"
420 - name: EMBDOC_BEGIN
421 comment: "=begin"
422 - name: EMBDOC_END
423 comment: "=end"
424 - name: EMBDOC_LINE
425 comment: "a line inside of embedded documentation"
426 - name: EMBEXPR_BEGIN
427 comment: "#{"
428 - name: EMBVAR
429 comment: "#"
430 - name: EQUAL
431 comment: "="
432 - name: EQUAL_EQUAL
433 comment: "=="
434 - name: EQUAL_EQUAL_EQUAL
435 comment: "==="
436 - name: EQUAL_GREATER
437 comment: "=>"
438 - name: EQUAL_TILDE
439 comment: "=~"
440 - name: FLOAT
441 comment: "a floating point number"
442 - name: FLOAT_IMAGINARY
443 comment: "a floating pointer number with an imaginary suffix"
444 - name: FLOAT_RATIONAL
445 comment: "a floating pointer number with a rational suffix"
446 - name: FLOAT_RATIONAL_IMAGINARY
447 comment: "a floating pointer number with a rational and imaginary suffix"
448 - name: GLOBAL_VARIABLE
449 comment: "a global variable"
450 - name: GREATER
451 comment: ">"
452 - name: GREATER_EQUAL
453 comment: ">="
454 - name: GREATER_GREATER
455 comment: ">>"
456 - name: GREATER_GREATER_EQUAL
457 comment: ">>="
458 - name: HEREDOC_END
459 comment: "the end of a heredoc"
460 - name: HEREDOC_START
461 comment: "the start of a heredoc"
462 - name: IDENTIFIER
463 comment: "an identifier"
464 - name: IGNORED_NEWLINE
465 comment: "an ignored newline"
466 - name: INSTANCE_VARIABLE
467 comment: "an instance variable"
468 - name: INTEGER
469 comment: "an integer (any base)"
470 - name: INTEGER_IMAGINARY
471 comment: "an integer with an imaginary suffix"
472 - name: INTEGER_RATIONAL
473 comment: "an integer with a rational suffix"
474 - name: INTEGER_RATIONAL_IMAGINARY
475 comment: "an integer with a rational and imaginary suffix"
476 - name: KEYWORD_ALIAS
477 comment: "alias"
478 - name: KEYWORD_AND
479 comment: "and"
480 - name: KEYWORD_BEGIN
481 comment: "begin"
482 - name: KEYWORD_BEGIN_UPCASE
483 comment: "BEGIN"
484 - name: KEYWORD_BREAK
485 comment: "break"
486 - name: KEYWORD_CASE
487 comment: "case"
488 - name: KEYWORD_CLASS
489 comment: "class"
490 - name: KEYWORD_DEF
491 comment: "def"
492 - name: KEYWORD_DEFINED
493 comment: "defined?"
494 - name: KEYWORD_DO_LOOP
495 comment: "do keyword for a predicate in a while, until, or for loop"
496 - name: KEYWORD_END_UPCASE
497 comment: "END"
498 - name: KEYWORD_FALSE
499 comment: "false"
500 - name: KEYWORD_FOR
501 comment: "for"
502 - name: KEYWORD_IF
503 comment: "if"
504 - name: KEYWORD_IF_MODIFIER
505 comment: "if in the modifier form"
506 - name: KEYWORD_MODULE
507 comment: "module"
508 - name: KEYWORD_NEXT
509 comment: "next"
510 - name: KEYWORD_NIL
511 comment: "nil"
512 - name: KEYWORD_NOT
513 comment: "not"
514 - name: KEYWORD_OR
515 comment: "or"
516 - name: KEYWORD_REDO
517 comment: "redo"
518 - name: KEYWORD_RESCUE_MODIFIER
519 comment: "rescue in the modifier form"
520 - name: KEYWORD_RETRY
521 comment: "retry"
522 - name: KEYWORD_RETURN
523 comment: "return"
524 - name: KEYWORD_SELF
525 comment: "self"
526 - name: KEYWORD_SUPER
527 comment: "super"
528 - name: KEYWORD_TRUE
529 comment: "true"
530 - name: KEYWORD_UNDEF
531 comment: "undef"
532 - name: KEYWORD_UNLESS
533 comment: "unless"
534 - name: KEYWORD_UNLESS_MODIFIER
535 comment: "unless in the modifier form"
536 - name: KEYWORD_UNTIL
537 comment: "until"
538 - name: KEYWORD_UNTIL_MODIFIER
539 comment: "until in the modifier form"
540 - name: KEYWORD_WHILE
541 comment: "while"
542 - name: KEYWORD_WHILE_MODIFIER
543 comment: "while in the modifier form"
544 - name: KEYWORD_YIELD
545 comment: "yield"
546 - name: KEYWORD___ENCODING__
547 comment: "__ENCODING__"
548 - name: KEYWORD___FILE__
549 comment: "__FILE__"
550 - name: KEYWORD___LINE__
551 comment: "__LINE__"
552 - name: LABEL
553 comment: "a label"
554 - name: LABEL_END
555 comment: "the end of a label"
556 - name: LAMBDA_BEGIN
557 comment: "{"
558 - name: LESS
559 comment: "<"
560 - name: LESS_EQUAL
561 comment: "<="
562 - name: LESS_EQUAL_GREATER
563 comment: "<=>"
564 - name: LESS_LESS
565 comment: "<<"
566 - name: LESS_LESS_EQUAL
567 comment: "<<="
568 - name: METHOD_NAME
569 comment: "a method name"
570 - name: MINUS
571 comment: "-"
572 - name: MINUS_EQUAL
573 comment: "-="
574 - name: MINUS_GREATER
575 comment: "->"
576 - name: NUMBERED_REFERENCE
577 comment: "a numbered reference to a capture group in the previous regular expression match"
578 - name: PARENTHESIS_LEFT
579 comment: "("
580 - name: PARENTHESIS_LEFT_PARENTHESES
581 comment: "( for a parentheses node"
582 - name: PERCENT
583 comment: "%"
584 - name: PERCENT_EQUAL
585 comment: "%="
586 - name: PERCENT_LOWER_I
587 comment: "%i"
588 - name: PERCENT_LOWER_W
589 comment: "%w"
590 - name: PERCENT_LOWER_X
591 comment: "%x"
592 - name: PERCENT_UPPER_I
593 comment: "%I"
594 - name: PERCENT_UPPER_W
595 comment: "%W"
596 - name: PIPE_EQUAL
597 comment: "|="
598 - name: PIPE_PIPE
599 comment: "||"
600 - name: PIPE_PIPE_EQUAL
601 comment: "||="
602 - name: PLUS
603 comment: "+"
604 - name: PLUS_EQUAL
605 comment: "+="
606 - name: QUESTION_MARK
607 comment: "?"
608 - name: REGEXP_BEGIN
609 comment: "the beginning of a regular expression"
610 - name: REGEXP_END
611 comment: "the end of a regular expression"
612 - name: SLASH
613 comment: "/"
614 - name: SLASH_EQUAL
615 comment: "/="
616 - name: STAR
617 comment: "*"
618 - name: STAR_EQUAL
619 comment: "*="
620 - name: STAR_STAR
621 comment: "**"
622 - name: STAR_STAR_EQUAL
623 comment: "**="
624 - name: STRING_BEGIN
625 comment: "the beginning of a string"
626 - name: STRING_CONTENT
627 comment: "the contents of a string"
628 - name: STRING_END
629 comment: "the end of a string"
630 - name: SYMBOL_BEGIN
631 comment: "the beginning of a symbol"
632 - name: TILDE
633 comment: "~ or ~@"
634 - name: UAMPERSAND
635 comment: "unary &"
636 - name: UCOLON_COLON
637 comment: "unary ::"
638 - name: UDOT_DOT
639 comment: "unary .. operator"
640 - name: UDOT_DOT_DOT
641 comment: "unary ... operator"
642 - name: UMINUS
643 comment: "-@"
644 - name: UMINUS_NUM
645 comment: "-@ for a number"
646 - name: UPLUS
647 comment: "+@"
648 - name: USTAR
649 comment: "unary *"
650 - name: USTAR_STAR
651 comment: "unary **"
652 - name: WORDS_SEP
653 comment: "a separator between words in a list"
654 - name: __END__
655 comment: "marker for the point in the file at which the parser should stop"
656 - name: MISSING
657 comment: "a token that was expected but not found"
658 - name: NOT_PROVIDED
659 comment: "a token that was not present but it is okay"
660 flags:
661 - name: ArgumentsNodeFlags
662 values:
663 - name: CONTAINS_FORWARDING
664 comment: "if the arguments contain forwarding"
665 - name: CONTAINS_KEYWORDS
666 comment: "if the arguments contain keywords"
667 - name: CONTAINS_KEYWORD_SPLAT
668 comment: "if the arguments contain a keyword splat"
669 - name: CONTAINS_SPLAT
670 comment: "if the arguments contain a splat"
671 - name: CONTAINS_MULTIPLE_SPLATS
672 comment: "if the arguments contain multiple splats"
673 comment: Flags for arguments nodes.
674 - name: ArrayNodeFlags
675 values:
676 - name: CONTAINS_SPLAT
677 comment: "if array contains splat nodes"
678 comment: Flags for array nodes.
679 - name: CallNodeFlags
680 values:
681 - name: SAFE_NAVIGATION
682 comment: "&. operator"
683 - name: VARIABLE_CALL
684 comment: "a call that could have been a local variable"
685 - name: ATTRIBUTE_WRITE
686 comment: "a call that is an attribute write, so the value being written should be returned"
687 - name: IGNORE_VISIBILITY
688 comment: "a call that ignores method visibility"
689 comment: Flags for call nodes.
690 - name: EncodingFlags
691 values:
692 - name: FORCED_UTF8_ENCODING
693 comment: "internal bytes forced the encoding to UTF-8"
694 - name: FORCED_BINARY_ENCODING
695 comment: "internal bytes forced the encoding to binary"
696 comment: Flags for nodes that have unescaped content.
697 - name: IntegerBaseFlags
698 values:
699 - name: BINARY
700 comment: "0b prefix"
701 - name: DECIMAL
702 comment: "0d or no prefix"
703 - name: OCTAL
704 comment: "0o or 0 prefix"
705 - name: HEXADECIMAL
706 comment: "0x prefix"
707 comment: Flags for integer nodes that correspond to the base of the integer.
708 - name: InterpolatedStringNodeFlags
709 values:
710 - name: FROZEN
711 comment: "frozen by virtue of a `frozen_string_literal: true` comment or `--enable-frozen-string-literal`; only for adjacent string literals like `'a' 'b'`"
712 - name: MUTABLE
713 comment: "mutable by virtue of a `frozen_string_literal: false` comment or `--disable-frozen-string-literal`; only for adjacent string literals like `'a' 'b'`"
714 comment: Flags for interpolated string nodes that indicated mutability if they are also marked as literals.
715 - name: KeywordHashNodeFlags
716 values:
717 - name: SYMBOL_KEYS
718 comment: "a keyword hash which only has `AssocNode` elements all with symbol keys, which means the elements can be treated as keyword arguments"
719 comment: Flags for keyword hash nodes.
720 - name: LoopFlags
721 values:
722 - name: BEGIN_MODIFIER
723 comment: "a loop after a begin statement, so the body is executed first before the condition"
724 comment: Flags for while and until loop nodes.
725 - name: ParameterFlags
726 values:
727 - name: REPEATED_PARAMETER
728 comment: "a parameter name that has been repeated in the method signature"
729 comment: Flags for parameter nodes.
730 - name: ParenthesesNodeFlags
731 values:
732 - name: MULTIPLE_STATEMENTS
733 comment: "parentheses that contain multiple potentially void statements"
734 comment: Flags for parentheses nodes.
735 - name: RangeFlags
736 values:
737 - name: EXCLUDE_END
738 comment: "... operator"
739 comment: Flags for range and flip-flop nodes.
740 - name: RegularExpressionFlags
741 values:
742 - name: IGNORE_CASE
743 comment: "i - ignores the case of characters when matching"
744 - name: EXTENDED
745 comment: "x - ignores whitespace and allows comments in regular expressions"
746 - name: MULTI_LINE
747 comment: "m - allows $ to match the end of lines within strings"
748 - name: ONCE
749 comment: "o - only interpolates values into the regular expression once"
750 - name: EUC_JP
751 comment: "e - forces the EUC-JP encoding"
752 - name: ASCII_8BIT
753 comment: "n - forces the ASCII-8BIT encoding"
754 - name: WINDOWS_31J
755 comment: "s - forces the Windows-31J encoding"
756 - name: UTF_8
757 comment: "u - forces the UTF-8 encoding"
758 - name: FORCED_UTF8_ENCODING
759 comment: "internal bytes forced the encoding to UTF-8"
760 - name: FORCED_BINARY_ENCODING
761 comment: "internal bytes forced the encoding to binary"
762 - name: FORCED_US_ASCII_ENCODING
763 comment: "internal bytes forced the encoding to US-ASCII"
764 comment: Flags for regular expression and match last line nodes.
765 - name: ShareableConstantNodeFlags
766 values:
767 - name: LITERAL
768 comment: "constant writes that should be modified with shareable constant value literal"
769 - name: EXPERIMENTAL_EVERYTHING
770 comment: "constant writes that should be modified with shareable constant value experimental everything"
771 - name: EXPERIMENTAL_COPY
772 comment: "constant writes that should be modified with shareable constant value experimental copy"
773 comment: Flags for shareable constant nodes.
774 - name: StringFlags
775 values:
776 - name: FORCED_UTF8_ENCODING
777 comment: "internal bytes forced the encoding to UTF-8"
778 - name: FORCED_BINARY_ENCODING
779 comment: "internal bytes forced the encoding to binary"
780 - name: FROZEN
781 comment: "frozen by virtue of a `frozen_string_literal: true` comment or `--enable-frozen-string-literal`"
782 - name: MUTABLE
783 comment: "mutable by virtue of a `frozen_string_literal: false` comment or `--disable-frozen-string-literal`"
784 comment: Flags for string nodes.
785 - name: SymbolFlags
786 values:
787 - name: FORCED_UTF8_ENCODING
788 comment: "internal bytes forced the encoding to UTF-8"
789 - name: FORCED_BINARY_ENCODING
790 comment: "internal bytes forced the encoding to binary"
791 - name: FORCED_US_ASCII_ENCODING
792 comment: "internal bytes forced the encoding to US-ASCII"
793 comment: Flags for symbol nodes.
794 nodes:
795 - name: AliasGlobalVariableNode
796 fields:
797 - name: new_name
798 type: node
799 kind:
800 - GlobalVariableReadNode
801 - BackReferenceReadNode
802 - NumberedReferenceReadNode
803 comment: |
804 Represents the new name of the global variable that can be used after aliasing.
805
806 alias $foo $bar
807 ^^^^
808 - name: old_name
809 type: node
810 kind:
811 - GlobalVariableReadNode
812 - BackReferenceReadNode
813 - NumberedReferenceReadNode
814 - on error: SymbolNode # alias $a b
815 - on error: MissingNode # alias $a 42
816 comment: |
817 Represents the old name of the global variable that can be used before aliasing.
818
819 alias $foo $bar
820 ^^^^
821 - name: keyword_loc
822 type: location
823 comment: |
824 The location of the `alias` keyword.
825
826 alias $foo $bar
827 ^^^^^
828 comment: |
829 Represents the use of the `alias` keyword to alias a global variable.
830
831 alias $foo $bar
832 ^^^^^^^^^^^^^^^
833 - name: AliasMethodNode
834 fields:
835 - name: new_name
836 type: node
837 kind:
838 - SymbolNode
839 - InterpolatedSymbolNode
840 comment: |
841 Represents the new name of the method that will be aliased.
842
843 alias foo bar
844 ^^^
845
846 alias :foo :bar
847 ^^^^
848
849 alias :"#{foo}" :"#{bar}"
850 ^^^^^^^^^
851 - name: old_name
852 type: node
853 kind:
854 - SymbolNode
855 - InterpolatedSymbolNode
856 - on error: GlobalVariableReadNode # alias a $b
857 - on error: MissingNode # alias a 42
858 comment: |
859 Represents the old name of the method that will be aliased.
860
861 alias foo bar
862 ^^^
863
864 alias :foo :bar
865 ^^^^
866
867 alias :"#{foo}" :"#{bar}"
868 ^^^^^^^^^
869 - name: keyword_loc
870 type: location
871 comment: |
872 Represents the location of the `alias` keyword.
873
874 alias foo bar
875 ^^^^^
876 comment: |
877 Represents the use of the `alias` keyword to alias a method.
878
879 alias foo bar
880 ^^^^^^^^^^^^^
881 - name: AlternationPatternNode
882 fields:
883 - name: left
884 type: node
885 kind: pattern expression
886 comment: |
887 Represents the left side of the expression.
888
889 foo => bar | baz
890 ^^^
891 - name: right
892 type: node
893 kind: pattern expression
894 comment: |
895 Represents the right side of the expression.
896
897 foo => bar | baz
898 ^^^
899 - name: operator_loc
900 type: location
901 comment: |
902 Represents the alternation operator location.
903
904 foo => bar | baz
905 ^
906 comment: |
907 Represents an alternation pattern in pattern matching.
908
909 foo => bar | baz
910 ^^^^^^^^^
911 - name: AndNode
912 fields:
913 - name: left
914 type: node
915 kind: non-void expression
916 comment: |
917 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).
918
919 left and right
920 ^^^^
921
922 1 && 2
923 ^
924 - name: right
925 type: node
926 kind: Node
927 comment: |
928 Represents the right side of the expression.
929
930 left && right
931 ^^^^^
932
933 1 and 2
934 ^
935 - name: operator_loc
936 type: location
937 comment: |
938 The location of the `and` keyword or the `&&` operator.
939
940 left and right
941 ^^^
942 comment: |
943 Represents the use of the `&&` operator or the `and` keyword.
944
945 left and right
946 ^^^^^^^^^^^^^^
947 - name: ArgumentsNode
948 flags: ArgumentsNodeFlags
949 fields:
950 - name: arguments
951 type: node[]
952 kind: non-void expression
953 comment: |
954 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).
955
956 foo(bar, baz)
957 ^^^^^^^^
958 comment: |
959 Represents a set of arguments to a method or a keyword.
960
961 return foo, bar, baz
962 ^^^^^^^^^^^^^
963 - name: ArrayNode
964 flags: ArrayNodeFlags
965 fields:
966 - name: elements
967 type: node[]
968 kind: non-void expression
969 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.
970 - name: opening_loc
971 type: location?
972 comment: |
973 Represents the optional source location for the opening token.
974
975 [1,2,3] # "["
976 %w[foo bar baz] # "%w["
977 %I(apple orange banana) # "%I("
978 foo = 1, 2, 3 # nil
979 - name: closing_loc
980 type: location?
981 comment: |
982 Represents the optional source location for the closing token.
983
984 [1,2,3] # "]"
985 %w[foo bar baz] # "]"
986 %I(apple orange banana) # ")"
987 foo = 1, 2, 3 # nil
988 comment: |
989 Represents an array literal. This can be a regular array using brackets or a special array using % like %w or %i.
990
991 [1, 2, 3]
992 ^^^^^^^^^
993 - name: ArrayPatternNode
994 fields:
995 - name: constant
996 type: node?
997 kind:
998 - ConstantPathNode
999 - ConstantReadNode
1000 comment: |
1001 Represents the optional constant preceding the Array
1002
1003 foo in Bar[]
1004 ^^^
1005
1006 foo in Bar[1, 2, 3]
1007 ^^^
1008
1009 foo in Bar::Baz[1, 2, 3]
1010 ^^^^^^^^
1011 - name: requireds
1012 type: node[]
1013 kind: pattern expression
1014 comment: |
1015 Represents the required elements of the array pattern.
1016
1017 foo in [1, 2]
1018 ^ ^
1019 - name: rest
1020 type: node?
1021 kind: pattern expression
1022 comment: |
1023 Represents the rest element of the array pattern.
1024
1025 foo in *bar
1026 ^^^^
1027 - name: posts
1028 type: node[]
1029 kind: pattern expression
1030 comment: |
1031 Represents the elements after the rest element of the array pattern.
1032
1033 foo in *bar, baz
1034 ^^^
1035 - name: opening_loc
1036 type: location?
1037 comment: |
1038 Represents the opening location of the array pattern.
1039
1040 foo in [1, 2]
1041 ^
1042 - name: closing_loc
1043 type: location?
1044 comment: |
1045 Represents the closing location of the array pattern.
1046
1047 foo in [1, 2]
1048 ^
1049 comment: |
1050 Represents an array pattern in pattern matching.
1051
1052 foo in 1, 2
1053 ^^^^^^^^^^^
1054
1055 foo in [1, 2]
1056 ^^^^^^^^^^^^^
1057
1058 foo in *bar
1059 ^^^^^^^^^^^
1060
1061 foo in Bar[]
1062 ^^^^^^^^^^^^
1063
1064 foo in Bar[1, 2, 3]
1065 ^^^^^^^^^^^^^^^^^^^
1066 - name: AssocNode
1067 fields:
1068 - name: key
1069 type: node
1070 kind: non-void expression
1071 comment: |
1072 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).
1073
1074 { a: b }
1075 ^
1076
1077 { foo => bar }
1078 ^^^
1079
1080 { def a; end => 1 }
1081 ^^^^^^^^^^
1082 - name: value
1083 type: node
1084 kind: non-void expression
1085 comment: |
1086 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).
1087
1088 { foo => bar }
1089 ^^^
1090
1091 { x: 1 }
1092 ^
1093 - name: operator_loc
1094 type: location?
1095 comment: |
1096 The location of the `=>` operator, if present.
1097
1098 { foo => bar }
1099 ^^
1100 comment: |
1101 Represents a hash key/value pair.
1102
1103 { a => b }
1104 ^^^^^^
1105 - name: AssocSplatNode
1106 fields:
1107 - name: value
1108 type: node?
1109 kind: non-void expression
1110 comment: |
1111 The value to be splatted, if present. Will be missing when keyword rest argument forwarding is used.
1112
1113 { **foo }
1114 ^^^
1115 - name: operator_loc
1116 type: location
1117 comment: |
1118 The location of the `**` operator.
1119
1120 { **x }
1121 ^^
1122 comment: |
1123 Represents a splat in a hash literal.
1124
1125 { **foo }
1126 ^^^^^
1127 - name: BackReferenceReadNode
1128 fields:
1129 - name: name
1130 type: constant
1131 comment: |
1132 The name of the back-reference variable, including the leading `$`.
1133
1134 $& # name `:$&`
1135
1136 $+ # name `:$+`
1137 comment: |
1138 Represents reading a reference to a field in the previous match.
1139
1140 $'
1141 ^^
1142 - name: BeginNode
1143 fields:
1144 - name: begin_keyword_loc
1145 type: location?
1146 comment: |
1147 Represents the location of the `begin` keyword.
1148
1149 begin x end
1150 ^^^^^
1151 - name: statements
1152 type: node?
1153 kind: StatementsNode
1154 comment: |
1155 Represents the statements within the begin block.
1156
1157 begin x end
1158 ^
1159 - name: rescue_clause
1160 type: node?
1161 kind: RescueNode
1162 comment: |
1163 Represents the rescue clause within the begin block.
1164
1165 begin x; rescue y; end
1166 ^^^^^^^^
1167 - name: else_clause
1168 type: node?
1169 kind: ElseNode
1170 comment: |
1171 Represents the else clause within the begin block.
1172
1173 begin x; rescue y; else z; end
1174 ^^^^^^
1175 - name: ensure_clause
1176 type: node?
1177 kind: EnsureNode
1178 comment: |
1179 Represents the ensure clause within the begin block.
1180
1181 begin x; ensure y; end
1182 ^^^^^^^^
1183 - name: end_keyword_loc
1184 type: location?
1185 comment: |
1186 Represents the location of the `end` keyword.
1187
1188 begin x end
1189 ^^^
1190 newline: false
1191 comment: |
1192 Represents a begin statement.
1193
1194 begin
1195 foo
1196 end
1197 ^^^^^
1198 - name: BlockArgumentNode
1199 fields:
1200 - name: expression
1201 type: node?
1202 kind: non-void expression
1203 comment: |
1204 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).
1205
1206 foo(&args)
1207 ^^^^^
1208 - name: operator_loc
1209 type: location
1210 comment: |
1211 Represents the location of the `&` operator.
1212
1213 foo(&args)
1214 ^
1215 comment: |
1216 Represents a block argument using `&`.
1217
1218 bar(&args)
1219 ^^^^^^^^^^
1220 - name: BlockLocalVariableNode
1221 flags: ParameterFlags
1222 fields:
1223 - name: name
1224 type: constant
1225 comment: |
1226 The name of the block local variable.
1227
1228 a { |; b| } # name `:b`
1229 ^
1230 comment: |
1231 Represents a block local variable.
1232
1233 a { |; b| }
1234 ^
1235 - name: BlockNode
1236 fields:
1237 - name: locals
1238 type: constant[]
1239 comment: |
1240 The local variables declared in the block.
1241
1242 [1, 2, 3].each { |i| puts x } # locals: [:i]
1243 ^
1244 - name: parameters
1245 type: node?
1246 kind:
1247 - BlockParametersNode
1248 - NumberedParametersNode
1249 - ItParametersNode
1250 comment: |
1251 The parameters of the block.
1252
1253 [1, 2, 3].each { |i| puts x }
1254 ^^^
1255 [1, 2, 3].each { puts _1 }
1256 ^^^^^^^^^^^
1257 [1, 2, 3].each { puts it }
1258 ^^^^^^^^^^^
1259 - name: body
1260 type: node?
1261 kind:
1262 - StatementsNode
1263 - BeginNode
1264 comment: |
1265 The body of the block.
1266
1267 [1, 2, 3].each { |i| puts x }
1268 ^^^^^^
1269 - name: opening_loc
1270 type: location
1271 comment: |
1272 Represents the location of the opening `{` or `do`.
1273
1274 [1, 2, 3].each { |i| puts x }
1275 ^
1276 - name: closing_loc
1277 type: location
1278 comment: |
1279 Represents the location of the closing `}` or `end`.
1280
1281 [1, 2, 3].each { |i| puts x }
1282 ^
1283 comment: |
1284 Represents a block of ruby code.
1285
1286 [1, 2, 3].each { |i| puts x }
1287 ^^^^^^^^^^^^^^
1288 - name: BlockParameterNode
1289 flags: ParameterFlags
1290 fields:
1291 - name: name
1292 type: constant?
1293 comment: |
1294 The name of the block parameter.
1295
1296 def a(&b) # name `:b`
1297 ^
1298 end
1299 - name: name_loc
1300 type: location?
1301 comment: |
1302 Represents the location of the block parameter name.
1303
1304 def a(&b)
1305 ^
1306 - name: operator_loc
1307 type: location
1308 comment: |
1309 Represents the location of the `&` operator.
1310
1311 def a(&b)
1312 ^
1313 end
1314 comment: |
1315 Represents a block parameter of a method, block, or lambda definition.
1316
1317 def a(&b)
1318 ^^
1319 end
1320 - name: BlockParametersNode
1321 fields:
1322 - name: parameters
1323 type: node?
1324 kind: ParametersNode
1325 comment: |
1326 Represents the parameters of the block.
1327
1328 -> (a, b = 1; local) { }
1329 ^^^^^^^^
1330
1331 foo do |a, b = 1; local|
1332 ^^^^^^^^
1333 end
1334 - name: locals
1335 type: node[]
1336 kind: BlockLocalVariableNode
1337 comment: |
1338 Represents the local variables of the block.
1339
1340 -> (a, b = 1; local) { }
1341 ^^^^^
1342
1343 foo do |a, b = 1; local|
1344 ^^^^^
1345 end
1346 - name: opening_loc
1347 type: location?
1348 comment: |
1349 Represents the opening location of the block parameters.
1350
1351 -> (a, b = 1; local) { }
1352 ^
1353
1354 foo do |a, b = 1; local|
1355 ^
1356 end
1357 - name: closing_loc
1358 type: location?
1359 comment: |
1360 Represents the closing location of the block parameters.
1361
1362 -> (a, b = 1; local) { }
1363 ^
1364
1365 foo do |a, b = 1; local|
1366 ^
1367 end
1368 comment: |
1369 Represents a block's parameters declaration.
1370
1371 -> (a, b = 1; local) { }
1372 ^^^^^^^^^^^^^^^^^
1373
1374 foo do |a, b = 1; local|
1375 ^^^^^^^^^^^^^^^^^
1376 end
1377 - name: BreakNode
1378 fields:
1379 - name: arguments
1380 type: node?
1381 kind: ArgumentsNode
1382 comment: |
1383 The arguments to the break statement, if present. These can be any [non-void expressions](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).
1384
1385 break foo
1386 ^^^
1387 - name: keyword_loc
1388 type: location
1389 comment: |
1390 The location of the `break` keyword.
1391
1392 break foo
1393 ^^^^^
1394 comment: |
1395 Represents the use of the `break` keyword.
1396
1397 break foo
1398 ^^^^^^^^^
1399 - name: CallAndWriteNode
1400 flags: CallNodeFlags
1401 fields:
1402 - name: receiver
1403 type: node?
1404 kind: non-void expression
1405 comment: |
1406 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).
1407
1408 foo.bar &&= value
1409 ^^^
1410 - name: call_operator_loc
1411 type: location?
1412 comment: |
1413 Represents the location of the call operator.
1414
1415 foo.bar &&= value
1416 ^
1417 - name: message_loc
1418 type: location?
1419 comment: |
1420 Represents the location of the message.
1421
1422 foo.bar &&= value
1423 ^^^
1424 - name: read_name
1425 type: constant
1426 comment: |
1427 Represents the name of the method being called.
1428
1429 foo.bar &&= value # read_name `:bar`
1430 ^^^
1431 - name: write_name
1432 type: constant
1433 comment: |
1434 Represents the name of the method being written to.
1435
1436 foo.bar &&= value # write_name `:bar=`
1437 ^^^
1438 - name: operator_loc
1439 type: location
1440 comment: |
1441 Represents the location of the operator.
1442
1443 foo.bar &&= value
1444 ^^^
1445 - name: value
1446 type: node
1447 kind: non-void expression
1448 comment: |
1449 Represents the value being assigned.
1450
1451 foo.bar &&= value
1452 ^^^^^
1453 comment: |
1454 Represents the use of the `&&=` operator on a call.
1455
1456 foo.bar &&= value
1457 ^^^^^^^^^^^^^^^^^
1458 - name: CallNode
1459 flags: CallNodeFlags
1460 fields:
1461 - name: receiver
1462 type: node?
1463 kind: non-void expression
1464 comment: |
1465 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).
1466
1467 foo.bar
1468 ^^^
1469
1470 +foo
1471 ^^^
1472
1473 foo + bar
1474 ^^^
1475 - name: call_operator_loc
1476 type: location?
1477 comment: |
1478 Represents the location of the call operator.
1479
1480 foo.bar
1481 ^
1482
1483 foo&.bar
1484 ^^
1485 - name: name
1486 type: constant
1487 comment: |
1488 Represents the name of the method being called.
1489
1490 foo.bar # name `:foo`
1491 ^^^
1492 - name: message_loc
1493 type: location?
1494 comment: |
1495 Represents the location of the message.
1496
1497 foo.bar
1498 ^^^
1499 - name: opening_loc
1500 type: location?
1501 comment: |
1502 Represents the location of the left parenthesis.
1503 foo(bar)
1504 ^
1505 - name: arguments
1506 type: node?
1507 kind: ArgumentsNode
1508 comment: |
1509 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).
1510
1511 foo(bar)
1512 ^^^
1513 - name: closing_loc
1514 type: location?
1515 comment: |
1516 Represents the location of the right parenthesis.
1517
1518 foo(bar)
1519 ^
1520 - name: equal_loc
1521 type: location?
1522 comment: |
1523 Represents the location of the equal sign, in the case that this is an attribute write.
1524
1525 foo.bar = value
1526 ^
1527
1528 foo[bar] = value
1529 ^
1530 - name: block
1531 type: node?
1532 kind:
1533 - BlockNode
1534 - BlockArgumentNode
1535 comment: |
1536 Represents the block that is being passed to the method.
1537
1538 foo { |a| a }
1539 ^^^^^^^^^
1540 comment: |
1541 Represents a method call, in all of the various forms that can take.
1542
1543 foo
1544 ^^^
1545
1546 foo()
1547 ^^^^^
1548
1549 +foo
1550 ^^^^
1551
1552 foo + bar
1553 ^^^^^^^^^
1554
1555 foo.bar
1556 ^^^^^^^
1557
1558 foo&.bar
1559 ^^^^^^^^
1560 - name: CallOperatorWriteNode
1561 flags: CallNodeFlags
1562 fields:
1563 - name: receiver
1564 type: node?
1565 kind: non-void expression
1566 comment: |
1567 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).
1568
1569 foo.bar += value
1570 ^^^
1571 - name: call_operator_loc
1572 type: location?
1573 comment: |
1574 Represents the location of the call operator.
1575
1576 foo.bar += value
1577 ^
1578 - name: message_loc
1579 type: location?
1580 comment: |
1581 Represents the location of the message.
1582
1583 foo.bar += value
1584 ^^^
1585 - name: read_name
1586 type: constant
1587 comment: |
1588 Represents the name of the method being called.
1589
1590 foo.bar += value # read_name `:bar`
1591 ^^^
1592 - name: write_name
1593 type: constant
1594 comment: |
1595 Represents the name of the method being written to.
1596
1597 foo.bar += value # write_name `:bar=`
1598 ^^^
1599 - name: binary_operator
1600 type: constant
1601 comment: |
1602 Represents the binary operator being used.
1603
1604 foo.bar += value # binary_operator `:+`
1605 ^
1606 - name: binary_operator_loc
1607 type: location
1608 comment: |
1609 Represents the location of the binary operator.
1610
1611 foo.bar += value
1612 ^^
1613 - name: value
1614 type: node
1615 kind: non-void expression
1616 comment: |
1617 Represents the value being assigned.
1618
1619 foo.bar += value
1620 ^^^^^
1621 comment: |
1622 Represents the use of an assignment operator on a call.
1623
1624 foo.bar += baz
1625 ^^^^^^^^^^^^^^
1626 - name: CallOrWriteNode
1627 flags: CallNodeFlags
1628 fields:
1629 - name: receiver
1630 type: node?
1631 kind: non-void expression
1632 comment: |
1633 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).
1634
1635 foo.bar ||= value
1636 ^^^
1637 - name: call_operator_loc
1638 type: location?
1639 comment: |
1640 Represents the location of the call operator.
1641
1642 foo.bar ||= value
1643 ^
1644 - name: message_loc
1645 type: location?
1646 comment: |
1647 Represents the location of the message.
1648
1649 foo.bar ||= value
1650 ^^^
1651 - name: read_name
1652 type: constant
1653 comment: |
1654 Represents the name of the method being called.
1655
1656 foo.bar ||= value # read_name `:bar`
1657 ^^^
1658 - name: write_name
1659 type: constant
1660 comment: |
1661 Represents the name of the method being written to.
1662
1663 foo.bar ||= value # write_name `:bar=`
1664 ^^^
1665 - name: operator_loc
1666 type: location
1667 comment: |
1668 Represents the location of the operator.
1669
1670 foo.bar ||= value
1671 ^^^
1672 - name: value
1673 type: node
1674 kind: non-void expression
1675 comment: |
1676 Represents the value being assigned.
1677
1678 foo.bar ||= value
1679 ^^^^^
1680 comment: |
1681 Represents the use of the `||=` operator on a call.
1682
1683 foo.bar ||= value
1684 ^^^^^^^^^^^^^^^^^
1685 - name: CallTargetNode
1686 flags: CallNodeFlags
1687 fields:
1688 - name: receiver
1689 type: node
1690 kind: non-void expression
1691 comment: |
1692 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).
1693
1694 foo.bar = 1
1695 ^^^
1696 - name: call_operator_loc
1697 type: location
1698 comment: |
1699 Represents the location of the call operator.
1700
1701 foo.bar = 1
1702 ^
1703 - name: name
1704 type: constant
1705 comment: |
1706 Represents the name of the method being called.
1707
1708 foo.bar = 1 # name `:foo`
1709 ^^^
1710 - name: message_loc
1711 type: location
1712 comment: |
1713 Represents the location of the message.
1714
1715 foo.bar = 1
1716 ^^^
1717 comment: |
1718 Represents assigning to a method call.
1719
1720 foo.bar, = 1
1721 ^^^^^^^
1722
1723 begin
1724 rescue => foo.bar
1725 ^^^^^^^
1726 end
1727
1728 for foo.bar in baz do end
1729 ^^^^^^^
1730 - name: CapturePatternNode
1731 fields:
1732 - name: value
1733 type: node
1734 kind: pattern expression
1735 comment: |
1736 Represents the value to capture.
1737
1738 foo => bar
1739 ^^^
1740 - name: target
1741 type: node
1742 kind: LocalVariableTargetNode
1743 comment: |
1744 Represents the target of the capture.
1745
1746 foo => bar
1747 ^^^
1748 - name: operator_loc
1749 type: location
1750 comment: |
1751 Represents the location of the `=>` operator.
1752
1753 foo => bar
1754 ^^
1755 comment: |
1756 Represents assigning to a local variable in pattern matching.
1757
1758 foo => [bar => baz]
1759 ^^^^^^^^^^^^
1760 - name: CaseMatchNode
1761 fields:
1762 - name: predicate
1763 type: node?
1764 kind: non-void expression
1765 comment: |
1766 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).
1767
1768 case true; in false; end
1769 ^^^^
1770 - name: conditions
1771 type: node[]
1772 kind: InNode
1773 comment: |
1774 Represents the conditions of the case match.
1775
1776 case true; in false; end
1777 ^^^^^^^^
1778 - name: else_clause
1779 type: node?
1780 kind: ElseNode
1781 comment: |
1782 Represents the else clause of the case match.
1783
1784 case true; in false; else; end
1785 ^^^^
1786 - name: case_keyword_loc
1787 type: location
1788 comment: |
1789 Represents the location of the `case` keyword.
1790
1791 case true; in false; end
1792 ^^^^
1793 - name: end_keyword_loc
1794 type: location
1795 comment: |
1796 Represents the location of the `end` keyword.
1797
1798 case true; in false; end
1799 ^^^
1800 comment: |
1801 Represents the use of a case statement for pattern matching.
1802
1803 case true
1804 in false
1805 end
1806 ^^^^^^^^^
1807 - name: CaseNode
1808 fields:
1809 - name: predicate
1810 type: node?
1811 kind: non-void expression
1812 comment: |
1813 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).
1814
1815 case true; when false; end
1816 ^^^^
1817 - name: conditions
1818 type: node[]
1819 kind: WhenNode
1820 comment: |
1821 Represents the conditions of the case statement.
1822
1823 case true; when false; end
1824 ^^^^^^^^^^
1825 - name: else_clause
1826 type: node?
1827 kind: ElseNode
1828 comment: |
1829 Represents the else clause of the case statement.
1830
1831 case true; when false; else; end
1832 ^^^^
1833 - name: case_keyword_loc
1834 type: location
1835 comment: |
1836 Represents the location of the `case` keyword.
1837
1838 case true; when false; end
1839 ^^^^
1840 - name: end_keyword_loc
1841 type: location
1842 comment: |
1843 Represents the location of the `end` keyword.
1844
1845 case true; when false; end
1846 ^^^
1847 comment: |
1848 Represents the use of a case statement.
1849
1850 case true
1851 when false
1852 end
1853 ^^^^^^^^^^
1854 - name: ClassNode
1855 fields:
1856 - name: locals
1857 type: constant[]
1858 - name: class_keyword_loc
1859 type: location
1860 comment: |
1861 Represents the location of the `class` keyword.
1862
1863 class Foo end
1864 ^^^^^
1865 - name: constant_path
1866 type: node
1867 kind:
1868 - ConstantReadNode
1869 - ConstantPathNode
1870 - on error: CallNode # class 0.X end
1871 - name: inheritance_operator_loc
1872 type: location?
1873 comment: |
1874 Represents the location of the `<` operator.
1875
1876 class Foo < Bar
1877 ^
1878 - name: superclass
1879 type: node?
1880 kind: non-void expression
1881 comment: |
1882 Represents the superclass of the class.
1883
1884 class Foo < Bar
1885 ^^^
1886 - name: body
1887 type: node?
1888 kind:
1889 - StatementsNode
1890 - BeginNode
1891 comment: |
1892 Represents the body of the class.
1893
1894 class Foo
1895 foo
1896 ^^^
1897 - name: end_keyword_loc
1898 type: location
1899 comment: |
1900 Represents the location of the `end` keyword.
1901
1902 class Foo end
1903 ^^^
1904 - name: name
1905 type: constant
1906 comment: |
1907 The name of the class.
1908
1909 class Foo end # name `:Foo`
1910 comment: |
1911 Represents a class declaration involving the `class` keyword.
1912
1913 class Foo end
1914 ^^^^^^^^^^^^^
1915 - name: ClassVariableAndWriteNode
1916 fields:
1917 - name: name
1918 type: constant
1919 comment: |
1920 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).
1921
1922 @@target &&= value # name `:@@target`
1923 ^^^^^^^^
1924 - name: name_loc
1925 type: location
1926 comment: |
1927 Represents the location of the variable name.
1928
1929 @@target &&= value
1930 ^^^^^^^^
1931 - name: operator_loc
1932 type: location
1933 comment: |
1934 Represents the location of the `&&=` operator.
1935
1936 @@target &&= value
1937 ^^^
1938 - name: value
1939 type: node
1940 kind: non-void expression
1941 comment: |
1942 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).
1943
1944 @@target &&= value
1945 ^^^^^
1946 comment: |
1947 Represents the use of the `&&=` operator for assignment to a class variable.
1948
1949 @@target &&= value
1950 ^^^^^^^^^^^^^^^^^^
1951 - name: ClassVariableOperatorWriteNode
1952 fields:
1953 - name: name
1954 type: constant
1955 - name: name_loc
1956 type: location
1957 - name: binary_operator_loc
1958 type: location
1959 - name: value
1960 type: node
1961 kind: non-void expression
1962 - name: binary_operator
1963 type: constant
1964 comment: |
1965 Represents assigning to a class variable using an operator that isn't `=`.
1966
1967 @@target += value
1968 ^^^^^^^^^^^^^^^^^
1969 - name: ClassVariableOrWriteNode
1970 fields:
1971 - name: name
1972 type: constant
1973 - name: name_loc
1974 type: location
1975 - name: operator_loc
1976 type: location
1977 - name: value
1978 type: node
1979 kind: non-void expression
1980 comment: |
1981 Represents the use of the `||=` operator for assignment to a class variable.
1982
1983 @@target ||= value
1984 ^^^^^^^^^^^^^^^^^^
1985 - name: ClassVariableReadNode
1986 fields:
1987 - name: name
1988 type: constant
1989 comment: |
1990 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).
1991
1992 @@abc # name `:@@abc`
1993
1994 @@_test # name `:@@_test`
1995 comment: |
1996 Represents referencing a class variable.
1997
1998 @@foo
1999 ^^^^^
2000 - name: ClassVariableTargetNode
2001 fields:
2002 - name: name
2003 type: constant
2004 comment: |
2005 Represents writing to a class variable in a context that doesn't have an explicit value.
2006
2007 @@foo, @@bar = baz
2008 ^^^^^ ^^^^^
2009 - name: ClassVariableWriteNode
2010 fields:
2011 - name: name
2012 type: constant
2013 comment: |
2014 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).
2015
2016 @@abc = 123 # name `@@abc`
2017
2018 @@_test = :test # name `@@_test`
2019 - name: name_loc
2020 type: location
2021 comment: |
2022 The location of the variable name.
2023
2024 @@foo = :bar
2025 ^^^^^
2026 - name: value
2027 type: node
2028 kind: non-void expression
2029 comment: |
2030 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).
2031
2032 @@foo = :bar
2033 ^^^^
2034
2035 @@_xyz = 123
2036 ^^^
2037 - name: operator_loc
2038 type: location
2039 comment: |
2040 The location of the `=` operator.
2041
2042 @@foo = :bar
2043 ^
2044 comment: |
2045 Represents writing to a class variable.
2046
2047 @@foo = 1
2048 ^^^^^^^^^
2049 - name: ConstantAndWriteNode
2050 fields:
2051 - name: name
2052 type: constant
2053 - name: name_loc
2054 type: location
2055 - name: operator_loc
2056 type: location
2057 - name: value
2058 type: node
2059 kind: non-void expression
2060 comment: |
2061 Represents the use of the `&&=` operator for assignment to a constant.
2062
2063 Target &&= value
2064 ^^^^^^^^^^^^^^^^
2065 - name: ConstantOperatorWriteNode
2066 fields:
2067 - name: name
2068 type: constant
2069 - name: name_loc
2070 type: location
2071 - name: binary_operator_loc
2072 type: location
2073 - name: value
2074 type: node
2075 kind: non-void expression
2076 - name: binary_operator
2077 type: constant
2078 comment: |
2079 Represents assigning to a constant using an operator that isn't `=`.
2080
2081 Target += value
2082 ^^^^^^^^^^^^^^^
2083 - name: ConstantOrWriteNode
2084 fields:
2085 - name: name
2086 type: constant
2087 - name: name_loc
2088 type: location
2089 - name: operator_loc
2090 type: location
2091 - name: value
2092 type: node
2093 kind: non-void expression
2094 comment: |
2095 Represents the use of the `||=` operator for assignment to a constant.
2096
2097 Target ||= value
2098 ^^^^^^^^^^^^^^^^
2099 - name: ConstantPathAndWriteNode
2100 fields:
2101 - name: target
2102 type: node
2103 kind: ConstantPathNode
2104 - name: operator_loc
2105 type: location
2106 - name: value
2107 type: node
2108 kind: non-void expression
2109 comment: |
2110 Represents the use of the `&&=` operator for assignment to a constant path.
2111
2112 Parent::Child &&= value
2113 ^^^^^^^^^^^^^^^^^^^^^^^
2114 - name: ConstantPathNode
2115 fields:
2116 - name: parent
2117 type: node?
2118 kind: non-void expression
2119 comment: |
2120 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.
2121
2122 Foo::Bar
2123 ^^^
2124
2125 self::Test
2126 ^^^^
2127
2128 a.b::C
2129 ^^^
2130 - name: name
2131 type: constant?
2132 comment: The name of the constant being accessed. This could be `nil` in the event of a syntax error.
2133 - name: delimiter_loc
2134 type: location
2135 comment: |
2136 The location of the `::` delimiter.
2137
2138 ::Foo
2139 ^^
2140
2141 One::Two
2142 ^^
2143 - name: name_loc
2144 type: location
2145 comment: |
2146 The location of the name of the constant.
2147
2148 ::Foo
2149 ^^^
2150
2151 One::Two
2152 ^^^
2153 comment: |
2154 Represents accessing a constant through a path of `::` operators.
2155
2156 Foo::Bar
2157 ^^^^^^^^
2158 - name: ConstantPathOperatorWriteNode
2159 fields:
2160 - name: target
2161 type: node
2162 kind: ConstantPathNode
2163 - name: binary_operator_loc
2164 type: location
2165 - name: value
2166 type: node
2167 kind: non-void expression
2168 - name: binary_operator
2169 type: constant
2170 comment: |
2171 Represents assigning to a constant path using an operator that isn't `=`.
2172
2173 Parent::Child += value
2174 ^^^^^^^^^^^^^^^^^^^^^^
2175 - name: ConstantPathOrWriteNode
2176 fields:
2177 - name: target
2178 type: node
2179 kind: ConstantPathNode
2180 - name: operator_loc
2181 type: location
2182 - name: value
2183 type: node
2184 kind: non-void expression
2185 comment: |
2186 Represents the use of the `||=` operator for assignment to a constant path.
2187
2188 Parent::Child ||= value
2189 ^^^^^^^^^^^^^^^^^^^^^^^
2190 - name: ConstantPathTargetNode
2191 fields:
2192 - name: parent
2193 type: node?
2194 kind: non-void expression
2195 - name: name
2196 type: constant?
2197 - name: delimiter_loc
2198 type: location
2199 - name: name_loc
2200 type: location
2201 comment: |
2202 Represents writing to a constant path in a context that doesn't have an explicit value.
2203
2204 Foo::Foo, Bar::Bar = baz
2205 ^^^^^^^^ ^^^^^^^^
2206 - name: ConstantPathWriteNode
2207 fields:
2208 - name: target
2209 type: node
2210 kind: ConstantPathNode
2211 comment: |
2212 A node representing the constant path being written to.
2213
2214 Foo::Bar = 1
2215 ^^^^^^^^
2216
2217 ::Foo = :abc
2218 ^^^^^
2219 - name: operator_loc
2220 type: location
2221 comment: |
2222 The location of the `=` operator.
2223
2224 ::ABC = 123
2225 ^
2226 - name: value
2227 type: node
2228 kind: non-void expression
2229 comment: |
2230 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).
2231
2232 FOO::BAR = :abc
2233 ^^^^
2234 comment: |
2235 Represents writing to a constant path.
2236
2237 ::Foo = 1
2238 ^^^^^^^^^
2239
2240 Foo::Bar = 1
2241 ^^^^^^^^^^^^
2242
2243 ::Foo::Bar = 1
2244 ^^^^^^^^^^^^^^
2245 - name: ConstantReadNode
2246 fields:
2247 - name: name
2248 type: constant
2249 comment: |
2250 The name of the [constant](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#constants).
2251
2252 X # name `:X`
2253
2254 SOME_CONSTANT # name `:SOME_CONSTANT`
2255 comment: |
2256 Represents referencing a constant.
2257
2258 Foo
2259 ^^^
2260 - name: ConstantTargetNode
2261 fields:
2262 - name: name
2263 type: constant
2264 comment: |
2265 Represents writing to a constant in a context that doesn't have an explicit value.
2266
2267 Foo, Bar = baz
2268 ^^^ ^^^
2269 - name: ConstantWriteNode
2270 fields:
2271 - name: name
2272 type: constant
2273 comment: |
2274 The name of the [constant](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#constants).
2275
2276 Foo = :bar # name `:Foo`
2277
2278 XYZ = 1 # name `:XYZ`
2279 - name: name_loc
2280 type: location
2281 comment: |
2282 The location of the constant name.
2283
2284 FOO = 1
2285 ^^^
2286 - name: value
2287 type: node
2288 kind: non-void expression
2289 comment: |
2290 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).
2291
2292 FOO = :bar
2293 ^^^^
2294
2295 MyClass = Class.new
2296 ^^^^^^^^^
2297 - name: operator_loc
2298 type: location
2299 comment: |
2300 The location of the `=` operator.
2301
2302 FOO = :bar
2303 ^
2304 comment: |
2305 Represents writing to a constant.
2306
2307 Foo = 1
2308 ^^^^^^^
2309 - name: DefNode
2310 fields:
2311 - name: name
2312 type: constant
2313 - name: name_loc
2314 type: location
2315 - name: receiver
2316 type: node?
2317 kind: non-void expression
2318 - name: parameters
2319 type: node?
2320 kind: ParametersNode
2321 - name: body
2322 type: node?
2323 kind:
2324 - StatementsNode
2325 - BeginNode
2326 - name: locals
2327 type: constant[]
2328 - name: def_keyword_loc
2329 type: location
2330 - name: operator_loc
2331 type: location?
2332 - name: lparen_loc
2333 type: location?
2334 - name: rparen_loc
2335 type: location?
2336 - name: equal_loc
2337 type: location?
2338 - name: end_keyword_loc
2339 type: location?
2340 comment: |
2341 Represents a method definition.
2342
2343 def method
2344 end
2345 ^^^^^^^^^^
2346 - name: DefinedNode
2347 fields:
2348 - name: lparen_loc
2349 type: location?
2350 - name: value
2351 type: node
2352 kind: Node # More than non-void expression as defined?(return) is allowed, yet defined?(BEGIN{}) is SyntaxError
2353 - name: rparen_loc
2354 type: location?
2355 - name: keyword_loc
2356 type: location
2357 comment: |
2358 Represents the use of the `defined?` keyword.
2359
2360 defined?(a)
2361 ^^^^^^^^^^^
2362 - name: ElseNode
2363 fields:
2364 - name: else_keyword_loc
2365 type: location
2366 - name: statements
2367 type: node?
2368 kind: StatementsNode
2369 - name: end_keyword_loc
2370 type: location?
2371 comment: |
2372 Represents an `else` clause in a `case`, `if`, or `unless` statement.
2373
2374 if a then b else c end
2375 ^^^^^^^^^^
2376 - name: EmbeddedStatementsNode
2377 fields:
2378 - name: opening_loc
2379 type: location
2380 - name: statements
2381 type: node?
2382 kind: StatementsNode
2383 - name: closing_loc
2384 type: location
2385 comment: |
2386 Represents an interpolated set of statements.
2387
2388 "foo #{bar}"
2389 ^^^^^^
2390 - name: EmbeddedVariableNode
2391 fields:
2392 - name: operator_loc
2393 type: location
2394 - name: variable
2395 type: node
2396 kind:
2397 - InstanceVariableReadNode
2398 - ClassVariableReadNode
2399 - GlobalVariableReadNode
2400 - BackReferenceReadNode
2401 - NumberedReferenceReadNode
2402 comment: |
2403 Represents an interpolated variable.
2404
2405 "foo #@bar"
2406 ^^^^^
2407 - name: EnsureNode
2408 fields:
2409 - name: ensure_keyword_loc
2410 type: location
2411 - name: statements
2412 type: node?
2413 kind: StatementsNode
2414 - name: end_keyword_loc
2415 type: location
2416 comment: |
2417 Represents an `ensure` clause in a `begin` statement.
2418
2419 begin
2420 foo
2421 ensure
2422 ^^^^^^
2423 bar
2424 end
2425 - name: FalseNode
2426 comment: |
2427 Represents the use of the literal `false` keyword.
2428
2429 false
2430 ^^^^^
2431 - name: FindPatternNode
2432 fields:
2433 - name: constant
2434 type: node?
2435 kind:
2436 - ConstantPathNode
2437 - ConstantReadNode
2438 comment: |
2439 Represents the optional constant preceding the pattern
2440
2441 foo in Foo(*bar, baz, *qux)
2442 ^^^
2443 - name: left
2444 type: node
2445 kind: SplatNode
2446 comment: |
2447 Represents the first wildcard node in the pattern.
2448
2449 foo in *bar, baz, *qux
2450 ^^^^
2451
2452 foo in Foo(*bar, baz, *qux)
2453 ^^^^
2454 - name: requireds
2455 type: node[]
2456 kind: pattern expression
2457 comment: |
2458 Represents the nodes in between the wildcards.
2459
2460 foo in *bar, baz, *qux
2461 ^^^
2462
2463 foo in Foo(*bar, baz, 1, *qux)
2464 ^^^^^^
2465 - name: right
2466 type: node
2467 kind:
2468 - SplatNode
2469 - on error: MissingNode
2470 comment: |
2471 Represents the second wildcard node in the pattern.
2472
2473 foo in *bar, baz, *qux
2474 ^^^^
2475
2476 foo in Foo(*bar, baz, *qux)
2477 ^^^^
2478 - name: opening_loc
2479 type: location?
2480 comment: |
2481 The location of the opening brace.
2482
2483 foo in [*bar, baz, *qux]
2484 ^
2485
2486 foo in Foo(*bar, baz, *qux)
2487 ^
2488 - name: closing_loc
2489 type: location?
2490 comment: |
2491 The location of the closing brace.
2492
2493 foo in [*bar, baz, *qux]
2494 ^
2495
2496 foo in Foo(*bar, baz, *qux)
2497 ^
2498 comment: |
2499 Represents a find pattern in pattern matching.
2500
2501 foo in *bar, baz, *qux
2502 ^^^^^^^^^^^^^^^
2503
2504 foo in [*bar, baz, *qux]
2505 ^^^^^^^^^^^^^^^^^
2506
2507 foo in Foo(*bar, baz, *qux)
2508 ^^^^^^^^^^^^^^^^^^^^
2509
2510 foo => *bar, baz, *qux
2511 ^^^^^^^^^^^^^^^
2512 - name: FlipFlopNode
2513 flags: RangeFlags
2514 fields:
2515 - name: left
2516 type: node?
2517 kind: non-void expression
2518 - name: right
2519 type: node?
2520 kind: non-void expression
2521 - name: operator_loc
2522 type: location
2523 comment: |
2524 Represents the use of the `..` or `...` operators to create flip flops.
2525
2526 baz if foo .. bar
2527 ^^^^^^^^^^
2528 - name: FloatNode
2529 fields:
2530 - name: value
2531 type: double
2532 comment: The value of the floating point number as a Float.
2533 comment: |
2534 Represents a floating point number literal.
2535
2536 1.0
2537 ^^^
2538 - name: ForNode
2539 fields:
2540 - name: index
2541 type: node
2542 kind:
2543 - LocalVariableTargetNode
2544 - InstanceVariableTargetNode
2545 - ClassVariableTargetNode
2546 - GlobalVariableTargetNode
2547 - ConstantTargetNode
2548 - ConstantPathTargetNode
2549 - CallTargetNode
2550 - IndexTargetNode
2551 - MultiTargetNode
2552 - on error: BackReferenceReadNode # for $& in a end
2553 - on error: NumberedReferenceReadNode # for $1 in a end
2554 - on error: MissingNode # for in 1..10; end
2555 comment: |
2556 The index expression for `for` loops.
2557
2558 for i in a end
2559 ^
2560 - name: collection
2561 type: node
2562 kind: non-void expression
2563 comment: |
2564 The collection to iterate over.
2565
2566 for i in a end
2567 ^
2568 - name: statements
2569 type: node?
2570 kind: StatementsNode
2571 comment: |
2572 Represents the body of statements to execute for each iteration of the loop.
2573
2574 for i in a
2575 foo(i)
2576 ^^^^^^
2577 end
2578 - name: for_keyword_loc
2579 type: location
2580 comment: |
2581 The location of the `for` keyword.
2582
2583 for i in a end
2584 ^^^
2585 - name: in_keyword_loc
2586 type: location
2587 comment: |
2588 The location of the `in` keyword.
2589
2590 for i in a end
2591 ^^
2592 - name: do_keyword_loc
2593 type: location?
2594 comment: |
2595 The location of the `do` keyword, if present.
2596
2597 for i in a do end
2598 ^^
2599 - name: end_keyword_loc
2600 type: location
2601 comment: |
2602 The location of the `end` keyword.
2603
2604 for i in a end
2605 ^^^
2606 comment: |
2607 Represents the use of the `for` keyword.
2608
2609 for i in a end
2610 ^^^^^^^^^^^^^^
2611 - name: ForwardingArgumentsNode
2612 comment: |
2613 Represents forwarding all arguments to this method to another method.
2614
2615 def foo(...)
2616 bar(...)
2617 ^^^
2618 end
2619 - name: ForwardingParameterNode
2620 comment: |
2621 Represents the use of the forwarding parameter in a method, block, or lambda declaration.
2622
2623 def foo(...)
2624 ^^^
2625 end
2626 - name: ForwardingSuperNode
2627 fields:
2628 - name: block
2629 type: node?
2630 kind: BlockNode
2631 comment: |
2632 All other arguments are forwarded as normal, except the original block is replaced with the new block.
2633 comment: |
2634 Represents the use of the `super` keyword without parentheses or arguments, but which might have a block.
2635
2636 super
2637 ^^^^^
2638
2639 super { 123 }
2640 ^^^^^^^^^^^^^
2641
2642 If it has any other arguments, it would be a `SuperNode` instead.
2643 - name: GlobalVariableAndWriteNode
2644 fields:
2645 - name: name
2646 type: constant
2647 - name: name_loc
2648 type: location
2649 - name: operator_loc
2650 type: location
2651 - name: value
2652 type: node
2653 kind: non-void expression
2654 comment: |
2655 Represents the use of the `&&=` operator for assignment to a global variable.
2656
2657 $target &&= value
2658 ^^^^^^^^^^^^^^^^^
2659 - name: GlobalVariableOperatorWriteNode
2660 fields:
2661 - name: name
2662 type: constant
2663 - name: name_loc
2664 type: location
2665 - name: binary_operator_loc
2666 type: location
2667 - name: value
2668 type: node
2669 kind: non-void expression
2670 - name: binary_operator
2671 type: constant
2672 comment: |
2673 Represents assigning to a global variable using an operator that isn't `=`.
2674
2675 $target += value
2676 ^^^^^^^^^^^^^^^^
2677 - name: GlobalVariableOrWriteNode
2678 fields:
2679 - name: name
2680 type: constant
2681 - name: name_loc
2682 type: location
2683 - name: operator_loc
2684 type: location
2685 - name: value
2686 type: node
2687 kind: non-void expression
2688 comment: |
2689 Represents the use of the `||=` operator for assignment to a global variable.
2690
2691 $target ||= value
2692 ^^^^^^^^^^^^^^^^^
2693 - name: GlobalVariableReadNode
2694 fields:
2695 - name: name
2696 type: constant
2697 comment: |
2698 The name of the global variable, which is a `$` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifier). Alternatively, it can be one of the special global variables designated by a symbol.
2699
2700 $foo # name `:$foo`
2701
2702 $_Test # name `:$_Test`
2703 comment: |
2704 Represents referencing a global variable.
2705
2706 $foo
2707 ^^^^
2708 - name: GlobalVariableTargetNode
2709 fields:
2710 - name: name
2711 type: constant
2712 comment: |
2713 Represents writing to a global variable in a context that doesn't have an explicit value.
2714
2715 $foo, $bar = baz
2716 ^^^^ ^^^^
2717 - name: GlobalVariableWriteNode
2718 fields:
2719 - name: name
2720 type: constant
2721 comment: |
2722 The name of the global variable, which is a `$` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifier). Alternatively, it can be one of the special global variables designated by a symbol.
2723
2724 $foo = :bar # name `:$foo`
2725
2726 $_Test = 123 # name `:$_Test`
2727 - name: name_loc
2728 type: location
2729 comment: |
2730 The location of the global variable's name.
2731
2732 $foo = :bar
2733 ^^^^
2734 - name: value
2735 type: node
2736 kind: non-void expression
2737 comment: |
2738 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).
2739
2740 $foo = :bar
2741 ^^^^
2742
2743 $-xyz = 123
2744 ^^^
2745 - name: operator_loc
2746 type: location
2747 comment: |
2748 The location of the `=` operator.
2749
2750 $foo = :bar
2751 ^
2752 comment: |
2753 Represents writing to a global variable.
2754
2755 $foo = 1
2756 ^^^^^^^^
2757 - name: HashNode
2758 fields:
2759 - name: opening_loc
2760 type: location
2761 comment: |
2762 The location of the opening brace.
2763
2764 { a => b }
2765 ^
2766 - name: elements
2767 type: node[]
2768 kind:
2769 - AssocNode
2770 - AssocSplatNode
2771 comment: |
2772 The elements of the hash. These can be either `AssocNode`s or `AssocSplatNode`s.
2773
2774 { a: b }
2775 ^^^^
2776
2777 { **foo }
2778 ^^^^^
2779 - name: closing_loc
2780 type: location
2781 comment: |
2782 The location of the closing brace.
2783
2784 { a => b }
2785 ^
2786 comment: |
2787 Represents a hash literal.
2788
2789 { a => b }
2790 ^^^^^^^^^^
2791 - name: HashPatternNode
2792 fields:
2793 - name: constant
2794 type: node?
2795 kind:
2796 - ConstantPathNode
2797 - ConstantReadNode
2798 comment: |
2799 Represents the optional constant preceding the Hash.
2800
2801 foo => Bar[a: 1, b: 2]
2802 ^^^
2803
2804 foo => Bar::Baz[a: 1, b: 2]
2805 ^^^^^^^^
2806 - name: elements
2807 type: node[]
2808 kind: AssocNode
2809 comment: |
2810 Represents the explicit named hash keys and values.
2811
2812 foo => { a: 1, b:, ** }
2813 ^^^^^^^^
2814 - name: rest
2815 type: node?
2816 kind:
2817 - AssocSplatNode
2818 - NoKeywordsParameterNode
2819 comment: |
2820 Represents the rest of the Hash keys and values. This can be named, unnamed, or explicitly forbidden via `**nil`, this last one results in a `NoKeywordsParameterNode`.
2821
2822 foo => { a: 1, b:, **c }
2823 ^^^
2824
2825 foo => { a: 1, b:, ** }
2826 ^^
2827
2828 foo => { a: 1, b:, **nil }
2829 ^^^^^
2830 - name: opening_loc
2831 type: location?
2832 comment: |
2833 The location of the opening brace.
2834
2835 foo => { a: 1 }
2836 ^
2837
2838 foo => Bar[a: 1]
2839 ^
2840 - name: closing_loc
2841 type: location?
2842 comment: |
2843 The location of the closing brace.
2844
2845 foo => { a: 1 }
2846 ^
2847
2848 foo => Bar[a: 1]
2849 ^
2850 comment: |
2851 Represents a hash pattern in pattern matching.
2852
2853 foo => { a: 1, b: 2 }
2854 ^^^^^^^^^^^^^^
2855
2856 foo => { a: 1, b: 2, **c }
2857 ^^^^^^^^^^^^^^^^^^^
2858
2859 foo => Bar[a: 1, b: 2]
2860 ^^^^^^^^^^^^^^^
2861
2862 foo in { a: 1, b: 2 }
2863 ^^^^^^^^^^^^^^
2864 - name: IfNode
2865 fields:
2866 - name: if_keyword_loc
2867 type: location?
2868 comment: |
2869 The location of the `if` keyword if present.
2870
2871 bar if foo
2872 ^^
2873
2874 The `if_keyword_loc` field will be `nil` when the `IfNode` represents a ternary expression.
2875 - name: predicate
2876 type: node
2877 kind: non-void expression
2878 comment: |
2879 The node for the condition the `IfNode` is testing.
2880
2881 if foo
2882 ^^^
2883 bar
2884 end
2885
2886 bar if foo
2887 ^^^
2888
2889 foo ? bar : baz
2890 ^^^
2891 - name: then_keyword_loc
2892 type: location?
2893 comment: |
2894 The location of the `then` keyword (if present) or the `?` in a ternary expression, `nil` otherwise.
2895
2896 if foo then bar end
2897 ^^^^
2898
2899 a ? b : c
2900 ^
2901 - name: statements
2902 type: node?
2903 kind: StatementsNode
2904 comment: |
2905 Represents the body of statements that will be executed when the predicate is evaluated as truthy. Will be `nil` when no body is provided.
2906
2907 if foo
2908 bar
2909 ^^^
2910 baz
2911 ^^^
2912 end
2913 - name: subsequent
2914 type: node?
2915 kind:
2916 - ElseNode
2917 - IfNode
2918 comment: |
2919 Represents an `ElseNode` or an `IfNode` when there is an `else` or an `elsif` in the `if` statement.
2920
2921 if foo
2922 bar
2923 elsif baz
2924 ^^^^^^^^^
2925 qux
2926 ^^^
2927 end
2928 ^^^
2929
2930 if foo then bar else baz end
2931 ^^^^^^^^^^^^
2932 - name: end_keyword_loc
2933 type: location?
2934 comment: |
2935 The location of the `end` keyword if present, `nil` otherwise.
2936
2937 if foo
2938 bar
2939 end
2940 ^^^
2941 newline: predicate
2942 comment: |
2943 Represents the use of the `if` keyword, either in the block form or the modifier form, or a ternary expression.
2944
2945 bar if foo
2946 ^^^^^^^^^^
2947
2948 if foo then bar end
2949 ^^^^^^^^^^^^^^^^^^^
2950
2951 foo ? bar : baz
2952 ^^^^^^^^^^^^^^^
2953 - name: ImaginaryNode
2954 fields:
2955 - name: numeric
2956 type: node
2957 kind:
2958 - FloatNode
2959 - IntegerNode
2960 - RationalNode
2961 comment: |
2962 Represents an imaginary number literal.
2963
2964 1.0i
2965 ^^^^
2966 - name: ImplicitNode
2967 fields:
2968 - name: value
2969 type: node
2970 kind:
2971 - LocalVariableReadNode
2972 - CallNode
2973 - ConstantReadNode
2974 - LocalVariableTargetNode
2975 comment: |
2976 Represents a node that is implicitly being added to the tree but doesn't correspond directly to a node in the source.
2977
2978 { foo: }
2979 ^^^^
2980
2981 { Foo: }
2982 ^^^^
2983
2984 foo in { bar: }
2985 ^^^^
2986 - name: ImplicitRestNode
2987 comment: |
2988 Represents using a trailing comma to indicate an implicit rest parameter.
2989
2990 foo { |bar,| }
2991 ^
2992
2993 foo in [bar,]
2994 ^
2995
2996 for foo, in bar do end
2997 ^
2998
2999 foo, = bar
3000 ^
3001 - name: InNode
3002 fields:
3003 - name: pattern
3004 type: node
3005 kind: pattern expression
3006 - name: statements
3007 type: node?
3008 kind: StatementsNode
3009 - name: in_loc
3010 type: location
3011 - name: then_loc
3012 type: location?
3013 comment: |
3014 Represents the use of the `in` keyword in a case statement.
3015
3016 case a; in b then c end
3017 ^^^^^^^^^^^
3018 - name: IndexAndWriteNode
3019 flags: CallNodeFlags
3020 fields:
3021 - name: receiver
3022 type: node?
3023 kind: non-void expression
3024 - name: call_operator_loc
3025 type: location?
3026 - name: opening_loc
3027 type: location
3028 - name: arguments
3029 type: node?
3030 kind: ArgumentsNode
3031 - name: closing_loc
3032 type: location
3033 - name: block
3034 type: node?
3035 kind: BlockArgumentNode # foo[&b] &&= value, only valid on Ruby < 3.4
3036 - name: operator_loc
3037 type: location
3038 - name: value
3039 type: node
3040 kind: non-void expression
3041 comment: |
3042 Represents the use of the `&&=` operator on a call to the `[]` method.
3043
3044 foo.bar[baz] &&= value
3045 ^^^^^^^^^^^^^^^^^^^^^^
3046 - name: IndexOperatorWriteNode
3047 flags: CallNodeFlags
3048 fields:
3049 - name: receiver
3050 type: node?
3051 kind: non-void expression
3052 - name: call_operator_loc
3053 type: location?
3054 - name: opening_loc
3055 type: location
3056 - name: arguments
3057 type: node?
3058 kind: ArgumentsNode
3059 - name: closing_loc
3060 type: location
3061 - name: block
3062 type: node?
3063 kind: BlockArgumentNode # foo[&b] += value, only valid on Ruby < 3.4
3064 - name: binary_operator
3065 type: constant
3066 - name: binary_operator_loc
3067 type: location
3068 - name: value
3069 type: node
3070 kind: non-void expression
3071 comment: |
3072 Represents the use of an assignment operator on a call to `[]`.
3073
3074 foo.bar[baz] += value
3075 ^^^^^^^^^^^^^^^^^^^^^
3076 - name: IndexOrWriteNode
3077 flags: CallNodeFlags
3078 fields:
3079 - name: receiver
3080 type: node?
3081 kind: non-void expression
3082 - name: call_operator_loc
3083 type: location?
3084 - name: opening_loc
3085 type: location
3086 - name: arguments
3087 type: node?
3088 kind: ArgumentsNode
3089 - name: closing_loc
3090 type: location
3091 - name: block
3092 type: node?
3093 kind: BlockArgumentNode # foo[&b] ||= value, only valid on Ruby < 3.4
3094 - name: operator_loc
3095 type: location
3096 - name: value
3097 type: node
3098 kind: non-void expression
3099 comment: |
3100 Represents the use of the `||=` operator on a call to `[]`.
3101
3102 foo.bar[baz] ||= value
3103 ^^^^^^^^^^^^^^^^^^^^^^
3104 - name: IndexTargetNode
3105 flags: CallNodeFlags
3106 fields:
3107 - name: receiver
3108 type: node
3109 kind: non-void expression
3110 - name: opening_loc
3111 type: location
3112 - name: arguments
3113 type: node?
3114 kind: ArgumentsNode
3115 - name: closing_loc
3116 type: location
3117 - name: block
3118 type: node?
3119 kind: BlockArgumentNode # foo[&b], = 1, only valid on Ruby < 3.4
3120 comment: |
3121 Represents assigning to an index.
3122
3123 foo[bar], = 1
3124 ^^^^^^^^
3125
3126 begin
3127 rescue => foo[bar]
3128 ^^^^^^^^
3129 end
3130
3131 for foo[bar] in baz do end
3132 ^^^^^^^^
3133 - name: InstanceVariableAndWriteNode
3134 fields:
3135 - name: name
3136 type: constant
3137 - name: name_loc
3138 type: location
3139 - name: operator_loc
3140 type: location
3141 - name: value
3142 type: node
3143 kind: non-void expression
3144 comment: |
3145 Represents the use of the `&&=` operator for assignment to an instance variable.
3146
3147 @target &&= value
3148 ^^^^^^^^^^^^^^^^^
3149 - name: InstanceVariableOperatorWriteNode
3150 fields:
3151 - name: name
3152 type: constant
3153 - name: name_loc
3154 type: location
3155 - name: binary_operator_loc
3156 type: location
3157 - name: value
3158 type: node
3159 kind: non-void expression
3160 - name: binary_operator
3161 type: constant
3162 comment: |
3163 Represents assigning to an instance variable using an operator that isn't `=`.
3164
3165 @target += value
3166 ^^^^^^^^^^^^^^^^
3167 - name: InstanceVariableOrWriteNode
3168 fields:
3169 - name: name
3170 type: constant
3171 - name: name_loc
3172 type: location
3173 - name: operator_loc
3174 type: location
3175 - name: value
3176 type: node
3177 kind: non-void expression
3178 comment: |
3179 Represents the use of the `||=` operator for assignment to an instance variable.
3180
3181 @target ||= value
3182 ^^^^^^^^^^^^^^^^^
3183 - name: InstanceVariableReadNode
3184 fields:
3185 - name: name
3186 type: constant
3187 comment: |
3188 The name of the instance variable, which is a `@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
3189
3190 @x # name `:@x`
3191
3192 @_test # name `:@_test`
3193 comment: |
3194 Represents referencing an instance variable.
3195
3196 @foo
3197 ^^^^
3198 - name: InstanceVariableTargetNode
3199 fields:
3200 - name: name
3201 type: constant
3202 comment: |
3203 Represents writing to an instance variable in a context that doesn't have an explicit value.
3204
3205 @foo, @bar = baz
3206 ^^^^ ^^^^
3207 - name: InstanceVariableWriteNode
3208 fields:
3209 - name: name
3210 type: constant
3211 comment: |
3212 The name of the instance variable, which is a `@` followed by an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
3213
3214 @x = :y # name `:@x`
3215
3216 @_foo = "bar" # name `@_foo`
3217 - name: name_loc
3218 type: location
3219 comment: |
3220 The location of the variable name.
3221
3222 @_x = 1
3223 ^^^
3224 - name: value
3225 type: node
3226 kind: non-void expression
3227 comment: |
3228 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).
3229
3230 @foo = :bar
3231 ^^^^
3232
3233 @_x = 1234
3234 ^^^^
3235 - name: operator_loc
3236 type: location
3237 comment: |
3238 The location of the `=` operator.
3239
3240 @x = y
3241 ^
3242 comment: |
3243 Represents writing to an instance variable.
3244
3245 @foo = 1
3246 ^^^^^^^^
3247 - name: IntegerNode
3248 flags: IntegerBaseFlags
3249 fields:
3250 - name: value
3251 type: integer
3252 comment: The value of the integer literal as a number.
3253 comment: |
3254 Represents an integer number literal.
3255
3256 1
3257 ^
3258 - name: InterpolatedMatchLastLineNode
3259 flags: RegularExpressionFlags
3260 fields:
3261 - name: opening_loc
3262 type: location
3263 - name: parts
3264 type: node[]
3265 kind:
3266 - StringNode
3267 - EmbeddedStatementsNode
3268 - EmbeddedVariableNode
3269 - name: closing_loc
3270 type: location
3271 newline: parts
3272 comment: |
3273 Represents a regular expression literal that contains interpolation that is being used in the predicate of a conditional to implicitly match against the last line read by an IO object.
3274
3275 if /foo #{bar} baz/ then end
3276 ^^^^^^^^^^^^^^^^
3277 - name: InterpolatedRegularExpressionNode
3278 flags: RegularExpressionFlags
3279 fields:
3280 - name: opening_loc
3281 type: location
3282 - name: parts
3283 type: node[]
3284 kind:
3285 - StringNode
3286 - EmbeddedStatementsNode
3287 - EmbeddedVariableNode
3288 - name: closing_loc
3289 type: location
3290 newline: parts
3291 comment: |
3292 Represents a regular expression literal that contains interpolation.
3293
3294 /foo #{bar} baz/
3295 ^^^^^^^^^^^^^^^^
3296 - name: InterpolatedStringNode
3297 flags: InterpolatedStringNodeFlags
3298 fields:
3299 - name: opening_loc
3300 type: location?
3301 - name: parts
3302 type: node[]
3303 kind:
3304 - StringNode
3305 - EmbeddedStatementsNode
3306 - EmbeddedVariableNode
3307 - InterpolatedStringNode # `"a" "#{b}"`
3308 - on error: XStringNode # `<<`FOO` "bar"
3309 - on error: InterpolatedXStringNode
3310 - on error: SymbolNode
3311 - on error: InterpolatedSymbolNode
3312 - name: closing_loc
3313 type: location?
3314 newline: parts
3315 comment: |
3316 Represents a string literal that contains interpolation.
3317
3318 "foo #{bar} baz"
3319 ^^^^^^^^^^^^^^^^
3320 - name: InterpolatedSymbolNode
3321 fields:
3322 - name: opening_loc
3323 type: location?
3324 - name: parts
3325 type: node[]
3326 kind:
3327 - StringNode
3328 - EmbeddedStatementsNode
3329 - EmbeddedVariableNode
3330 - name: closing_loc
3331 type: location?
3332 newline: parts
3333 comment: |
3334 Represents a symbol literal that contains interpolation.
3335
3336 :"foo #{bar} baz"
3337 ^^^^^^^^^^^^^^^^^
3338 - name: InterpolatedXStringNode
3339 fields:
3340 - name: opening_loc
3341 type: location
3342 - name: parts
3343 type: node[]
3344 kind:
3345 - StringNode
3346 - EmbeddedStatementsNode
3347 - EmbeddedVariableNode
3348 - name: closing_loc
3349 type: location
3350 newline: parts
3351 comment: |
3352 Represents an xstring literal that contains interpolation.
3353
3354 `foo #{bar} baz`
3355 ^^^^^^^^^^^^^^^^
3356 - name: ItLocalVariableReadNode
3357 comment: |
3358 Represents reading from the implicit `it` local variable.
3359
3360 -> { it }
3361 ^^
3362 - name: ItParametersNode
3363 comment: |
3364 Represents an implicit set of parameters through the use of the `it` keyword within a block or lambda.
3365
3366 -> { it + it }
3367 ^^^^^^^^^^^^^^
3368 - name: KeywordHashNode
3369 flags: KeywordHashNodeFlags
3370 fields:
3371 - name: elements
3372 type: node[]
3373 kind:
3374 - AssocNode
3375 - AssocSplatNode
3376 comment: |
3377 Represents a hash literal without opening and closing braces.
3378
3379 foo(a: b)
3380 ^^^^
3381 - name: KeywordRestParameterNode
3382 flags: ParameterFlags
3383 fields:
3384 - name: name
3385 type: constant?
3386 - name: name_loc
3387 type: location?
3388 - name: operator_loc
3389 type: location
3390 comment: |
3391 Represents a keyword rest parameter to a method, block, or lambda definition.
3392
3393 def a(**b)
3394 ^^^
3395 end
3396 - name: LambdaNode
3397 fields:
3398 - name: locals
3399 type: constant[]
3400 - name: operator_loc
3401 type: location
3402 - name: opening_loc
3403 type: location
3404 - name: closing_loc
3405 type: location
3406 - name: parameters
3407 type: node?
3408 kind:
3409 - BlockParametersNode
3410 - NumberedParametersNode
3411 - ItParametersNode
3412 - name: body
3413 type: node?
3414 kind:
3415 - StatementsNode
3416 - BeginNode
3417 comment: |
3418 Represents using a lambda literal (not the lambda method call).
3419
3420 ->(value) { value * 2 }
3421 ^^^^^^^^^^^^^^^^^^^^^^^
3422 - name: LocalVariableAndWriteNode
3423 fields:
3424 - name: name_loc
3425 type: location
3426 - name: operator_loc
3427 type: location
3428 - name: value
3429 type: node
3430 kind: non-void expression
3431 - name: name
3432 type: constant
3433 - name: depth
3434 type: uint32
3435 comment: |
3436 Represents the use of the `&&=` operator for assignment to a local variable.
3437
3438 target &&= value
3439 ^^^^^^^^^^^^^^^^
3440 - name: LocalVariableOperatorWriteNode
3441 fields:
3442 - name: name_loc
3443 type: location
3444 - name: binary_operator_loc
3445 type: location
3446 - name: value
3447 type: node
3448 kind: non-void expression
3449 - name: name
3450 type: constant
3451 - name: binary_operator
3452 type: constant
3453 - name: depth
3454 type: uint32
3455 comment: |
3456 Represents assigning to a local variable using an operator that isn't `=`.
3457
3458 target += value
3459 ^^^^^^^^^^^^^^^
3460 - name: LocalVariableOrWriteNode
3461 fields:
3462 - name: name_loc
3463 type: location
3464 - name: operator_loc
3465 type: location
3466 - name: value
3467 type: node
3468 kind: non-void expression
3469 - name: name
3470 type: constant
3471 - name: depth
3472 type: uint32
3473 comment: |
3474 Represents the use of the `||=` operator for assignment to a local variable.
3475
3476 target ||= value
3477 ^^^^^^^^^^^^^^^^
3478 - name: LocalVariableReadNode
3479 fields:
3480 - name: name
3481 type: constant
3482 comment: |
3483 The name of the local variable, which is an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
3484
3485 x # name `:x`
3486
3487 _Test # name `:_Test`
3488
3489 Note that this can also be an underscore followed by a number for the default block parameters.
3490
3491 _1 # name `:_1`
3492
3493 - name: depth
3494 type: uint32
3495 comment: |
3496 The number of visible scopes that should be searched to find the origin of this local variable.
3497
3498 foo = 1; foo # depth 0
3499
3500 bar = 2; tap { bar } # depth 1
3501
3502 The specific rules for calculating the depth may differ from individual Ruby implementations, as they are not specified by the language. For more information, see [the Prism documentation](https://github.com/ruby/prism/blob/main/docs/local_variable_depth.md).
3503 comment: |
3504 Represents reading a local variable. Note that this requires that a local variable of the same name has already been written to in the same scope, otherwise it is parsed as a method call.
3505
3506 foo
3507 ^^^
3508 - name: LocalVariableTargetNode
3509 fields:
3510 - name: name
3511 type: constant
3512 - name: depth
3513 type: uint32
3514 comment: |
3515 Represents writing to a local variable in a context that doesn't have an explicit value.
3516
3517 foo, bar = baz
3518 ^^^ ^^^
3519
3520 foo => baz
3521 ^^^
3522 - name: LocalVariableWriteNode
3523 fields:
3524 - name: name
3525 type: constant
3526 comment: |
3527 The name of the local variable, which is an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).
3528
3529 foo = :bar # name `:foo`
3530
3531 abc = 123 # name `:abc`
3532 - name: depth
3533 type: uint32
3534 comment: |
3535 The number of semantic scopes we have to traverse to find the declaration of this variable.
3536
3537 foo = 1 # depth 0
3538
3539 tap { foo = 1 } # depth 1
3540
3541 The specific rules for calculating the depth may differ from individual Ruby implementations, as they are not specified by the language. For more information, see [the Prism documentation](https://github.com/ruby/prism/blob/main/docs/local_variable_depth.md).
3542 - name: name_loc
3543 type: location
3544 comment: |
3545 The location of the variable name.
3546
3547 foo = :bar
3548 ^^^
3549 - name: value
3550 type: node
3551 kind: non-void expression
3552 comment: |
3553 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).
3554
3555 foo = :bar
3556 ^^^^
3557
3558 abc = 1234
3559 ^^^^
3560
3561 Note that since the name of a local variable is known before the value is parsed, it is valid for a local variable to appear within the value of its own write.
3562
3563 foo = foo
3564 - name: operator_loc
3565 type: location
3566 comment: |
3567 The location of the `=` operator.
3568
3569 x = :y
3570 ^
3571 comment: |
3572 Represents writing to a local variable.
3573
3574 foo = 1
3575 ^^^^^^^
3576 - name: MatchLastLineNode
3577 flags: RegularExpressionFlags
3578 fields:
3579 - name: opening_loc
3580 type: location
3581 - name: content_loc
3582 type: location
3583 - name: closing_loc
3584 type: location
3585 - name: unescaped
3586 type: string
3587 comment: |
3588 Represents a regular expression literal used in the predicate of a conditional to implicitly match against the last line read by an IO object.
3589
3590 if /foo/i then end
3591 ^^^^^^
3592 - name: MatchPredicateNode
3593 fields:
3594 - name: value
3595 type: node
3596 kind: non-void expression
3597 - name: pattern
3598 type: node
3599 kind: pattern expression
3600 - name: operator_loc
3601 type: location
3602 comment: |
3603 Represents the use of the modifier `in` operator.
3604
3605 foo in bar
3606 ^^^^^^^^^^
3607 - name: MatchRequiredNode
3608 fields:
3609 - name: value
3610 type: node
3611 kind: non-void expression
3612 comment: |
3613 Represents the left-hand side of the operator.
3614
3615 foo => bar
3616 ^^^
3617 - name: pattern
3618 type: node
3619 kind: pattern expression
3620 comment: |
3621 Represents the right-hand side of the operator. The type of the node depends on the expression.
3622
3623 Anything that looks like a local variable name (including `_`) will result in a `LocalVariableTargetNode`.
3624
3625 foo => a # This is equivalent to writing `a = foo`
3626 ^
3627
3628 Using an explicit `Array` or combining expressions with `,` will result in a `ArrayPatternNode`. This can be preceded by a constant.
3629
3630 foo => [a]
3631 ^^^
3632
3633 foo => a, b
3634 ^^^^
3635
3636 foo => Bar[a, b]
3637 ^^^^^^^^^
3638
3639 If the array pattern contains at least two wildcard matches, a `FindPatternNode` is created instead.
3640
3641 foo => *, 1, *a
3642 ^^^^^
3643
3644 Using an explicit `Hash` or a constant with square brackets and hash keys in the square brackets will result in a `HashPatternNode`.
3645
3646 foo => { a: 1, b: }
3647
3648 foo => Bar[a: 1, b:]
3649
3650 foo => Bar[**]
3651
3652 To use any variable that needs run time evaluation, pinning is required. This results in a `PinnedVariableNode`
3653
3654 foo => ^a
3655 ^^
3656
3657 Similar, any expression can be used with pinning. This results in a `PinnedExpressionNode`.
3658
3659 foo => ^(a + 1)
3660
3661 Anything else will result in the regular node for that expression, for example a `ConstantReadNode`.
3662
3663 foo => CONST
3664 - name: operator_loc
3665 type: location
3666 comment: |
3667 The location of the operator.
3668
3669 foo => bar
3670 ^^
3671 comment: |
3672 Represents the use of the `=>` operator.
3673
3674 foo => bar
3675 ^^^^^^^^^^
3676 - name: MatchWriteNode
3677 fields:
3678 - name: call
3679 type: node
3680 kind: CallNode
3681 - name: targets
3682 type: node[]
3683 kind: LocalVariableTargetNode
3684 comment: |
3685 Represents writing local variables using a regular expression match with named capture groups.
3686
3687 /(?<foo>bar)/ =~ baz
3688 ^^^^^^^^^^^^^^^^^^^^
3689 - name: MissingNode
3690 comment: |
3691 Represents a node that is missing from the source and results in a syntax error.
3692 - name: ModuleNode
3693 fields:
3694 - name: locals
3695 type: constant[]
3696 - name: module_keyword_loc
3697 type: location
3698 - name: constant_path
3699 type: node
3700 kind:
3701 - ConstantReadNode
3702 - ConstantPathNode
3703 - on error: MissingNode # module Parent module end
3704 - name: body
3705 type: node?
3706 kind:
3707 - StatementsNode
3708 - BeginNode
3709 - name: end_keyword_loc
3710 type: location
3711 - name: name
3712 type: constant
3713 comment: |
3714 Represents a module declaration involving the `module` keyword.
3715
3716 module Foo end
3717 ^^^^^^^^^^^^^^
3718 - name: MultiTargetNode
3719 fields:
3720 - name: lefts
3721 type: node[]
3722 kind:
3723 - LocalVariableTargetNode
3724 - InstanceVariableTargetNode
3725 - ClassVariableTargetNode
3726 - GlobalVariableTargetNode
3727 - ConstantTargetNode
3728 - ConstantPathTargetNode
3729 - CallTargetNode
3730 - IndexTargetNode
3731 - MultiTargetNode
3732 - RequiredParameterNode # def m((a,b)); end
3733 - on error: BackReferenceReadNode # a, (b, $&) = z
3734 - on error: NumberedReferenceReadNode # a, (b, $1) = z
3735 comment: |
3736 Represents the targets expressions before a splat node.
3737
3738 a, (b, c, *) = 1, 2, 3, 4, 5
3739 ^^^^
3740
3741 The splat node can be absent, in that case all target expressions are in the left field.
3742
3743 a, (b, c) = 1, 2, 3, 4, 5
3744 ^^^^
3745 - name: rest
3746 type: node?
3747 kind:
3748 - ImplicitRestNode
3749 - SplatNode
3750 comment: |
3751 Represents a splat node in the target expression.
3752
3753 a, (b, *c) = 1, 2, 3, 4
3754 ^^
3755
3756 The variable can be empty, this results in a `SplatNode` with a `nil` expression field.
3757
3758 a, (b, *) = 1, 2, 3, 4
3759 ^
3760
3761 If the `*` is omitted, this field will contain an `ImplicitRestNode`
3762
3763 a, (b,) = 1, 2, 3, 4
3764 ^
3765 - name: rights
3766 type: node[]
3767 kind:
3768 - LocalVariableTargetNode
3769 - InstanceVariableTargetNode
3770 - ClassVariableTargetNode
3771 - GlobalVariableTargetNode
3772 - ConstantTargetNode
3773 - ConstantPathTargetNode
3774 - CallTargetNode
3775 - IndexTargetNode
3776 - MultiTargetNode
3777 - RequiredParameterNode # def m((*,b)); end
3778 - on error: BackReferenceReadNode # a, (*, $&) = z
3779 - on error: NumberedReferenceReadNode # a, (*, $1) = z
3780 comment: |
3781 Represents the targets expressions after a splat node.
3782
3783 a, (*, b, c) = 1, 2, 3, 4, 5
3784 ^^^^
3785 - name: lparen_loc
3786 type: location?
3787 comment: |
3788 The location of the opening parenthesis.
3789
3790 a, (b, c) = 1, 2, 3
3791 ^
3792 - name: rparen_loc
3793 type: location?
3794 comment: |
3795 The location of the closing parenthesis.
3796
3797 a, (b, c) = 1, 2, 3
3798 ^
3799 comment: |
3800 Represents a multi-target expression.
3801
3802 a, (b, c) = 1, 2, 3
3803 ^^^^^^
3804
3805 This can be a part of `MultiWriteNode` as above, or the target of a `for` loop
3806
3807 for a, b in [[1, 2], [3, 4]]
3808 ^^^^
3809 - name: MultiWriteNode
3810 fields:
3811 - name: lefts
3812 type: node[]
3813 kind:
3814 - LocalVariableTargetNode
3815 - InstanceVariableTargetNode
3816 - ClassVariableTargetNode
3817 - GlobalVariableTargetNode
3818 - ConstantTargetNode
3819 - ConstantPathTargetNode
3820 - CallTargetNode
3821 - IndexTargetNode
3822 - MultiTargetNode
3823 - on error: BackReferenceReadNode # $&, = z
3824 - on error: NumberedReferenceReadNode # $1, = z
3825 comment: |
3826 Represents the targets expressions before a splat node.
3827
3828 a, b, * = 1, 2, 3, 4, 5
3829 ^^^^
3830
3831 The splat node can be absent, in that case all target expressions are in the left field.
3832
3833 a, b, c = 1, 2, 3, 4, 5
3834 ^^^^^^^
3835 - name: rest
3836 type: node?
3837 kind:
3838 - ImplicitRestNode
3839 - SplatNode
3840 comment: |
3841 Represents a splat node in the target expression.
3842
3843 a, b, *c = 1, 2, 3, 4
3844 ^^
3845
3846 The variable can be empty, this results in a `SplatNode` with a `nil` expression field.
3847
3848 a, b, * = 1, 2, 3, 4
3849 ^
3850
3851 If the `*` is omitted, this field will contain an `ImplicitRestNode`
3852
3853 a, b, = 1, 2, 3, 4
3854 ^
3855 - name: rights
3856 type: node[]
3857 kind:
3858 - LocalVariableTargetNode
3859 - InstanceVariableTargetNode
3860 - ClassVariableTargetNode
3861 - GlobalVariableTargetNode
3862 - ConstantTargetNode
3863 - ConstantPathTargetNode
3864 - CallTargetNode
3865 - IndexTargetNode
3866 - MultiTargetNode
3867 - on error: BackReferenceReadNode # *, $& = z
3868 - on error: NumberedReferenceReadNode # *, $1 = z
3869 comment: |
3870 Represents the targets expressions after a splat node.
3871
3872 a, *, b, c = 1, 2, 3, 4, 5
3873 ^^^^
3874 - name: lparen_loc
3875 type: location?
3876 comment: |
3877 The location of the opening parenthesis.
3878
3879 (a, b, c) = 1, 2, 3
3880 ^
3881 - name: rparen_loc
3882 type: location?
3883 comment: |
3884 The location of the closing parenthesis.
3885
3886 (a, b, c) = 1, 2, 3
3887 ^
3888 - name: operator_loc
3889 type: location
3890 comment: |
3891 The location of the operator.
3892
3893 a, b, c = 1, 2, 3
3894 ^
3895 - name: value
3896 type: node
3897 kind: non-void expression
3898 comment: |
3899 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).
3900
3901 a, b, c = 1, 2, 3
3902 ^^^^^^^
3903 comment: |
3904 Represents a write to a multi-target expression.
3905
3906 a, b, c = 1, 2, 3
3907 ^^^^^^^^^^^^^^^^^
3908 - name: NextNode
3909 fields:
3910 - name: arguments
3911 type: node?
3912 kind: ArgumentsNode
3913 - name: keyword_loc
3914 type: location
3915 comment: |
3916 Represents the use of the `next` keyword.
3917
3918 next 1
3919 ^^^^^^
3920 - name: NilNode
3921 comment: |
3922 Represents the use of the `nil` keyword.
3923
3924 nil
3925 ^^^
3926 - name: NoKeywordsParameterNode
3927 fields:
3928 - name: operator_loc
3929 type: location
3930 - name: keyword_loc
3931 type: location
3932 comment: |
3933 Represents the use of `**nil` inside method arguments.
3934
3935 def a(**nil)
3936 ^^^^^
3937 end
3938 - name: NumberedParametersNode
3939 fields:
3940 - name: maximum
3941 type: uint8
3942 comment: |
3943 Represents an implicit set of parameters through the use of numbered parameters within a block or lambda.
3944
3945 -> { _1 + _2 }
3946 ^^^^^^^^^^^^^^
3947 - name: NumberedReferenceReadNode
3948 fields:
3949 - name: number
3950 type: uint32
3951 comment: |
3952 The (1-indexed, from the left) number of the capture group. Numbered references that are too large result in this value being `0`.
3953
3954 $1 # number `1`
3955
3956 $5432 # number `5432`
3957
3958 $4294967296 # number `0`
3959 comment: |
3960 Represents reading a numbered reference to a capture in the previous match.
3961
3962 $1
3963 ^^
3964 - name: OptionalKeywordParameterNode
3965 flags: ParameterFlags
3966 fields:
3967 - name: name
3968 type: constant
3969 - name: name_loc
3970 type: location
3971 - name: value
3972 type: node
3973 kind: non-void expression
3974 comment: |
3975 Represents an optional keyword parameter to a method, block, or lambda definition.
3976
3977 def a(b: 1)
3978 ^^^^
3979 end
3980 - name: OptionalParameterNode
3981 flags: ParameterFlags
3982 fields:
3983 - name: name
3984 type: constant
3985 - name: name_loc
3986 type: location
3987 - name: operator_loc
3988 type: location
3989 - name: value
3990 type: node
3991 kind: non-void expression
3992 comment: |
3993 Represents an optional parameter to a method, block, or lambda definition.
3994
3995 def a(b = 1)
3996 ^^^^^
3997 end
3998 - name: OrNode
3999 fields:
4000 - name: left
4001 type: node
4002 kind: non-void expression
4003 comment: |
4004 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).
4005
4006 left or right
4007 ^^^^
4008
4009 1 || 2
4010 ^
4011 - name: right
4012 type: node
4013 kind: Node
4014 comment: |
4015 Represents the right side of the expression.
4016
4017 left || right
4018 ^^^^^
4019
4020 1 or 2
4021 ^
4022 - name: operator_loc
4023 type: location
4024 comment: |
4025 The location of the `or` keyword or the `||` operator.
4026
4027 left or right
4028 ^^
4029 comment: |
4030 Represents the use of the `||` operator or the `or` keyword.
4031
4032 left or right
4033 ^^^^^^^^^^^^^
4034 - name: ParametersNode
4035 fields:
4036 - name: requireds
4037 type: node[]
4038 kind:
4039 - RequiredParameterNode
4040 - MultiTargetNode
4041 - name: optionals
4042 type: node[]
4043 kind: OptionalParameterNode
4044 - name: rest
4045 type: node?
4046 kind:
4047 - RestParameterNode
4048 - ImplicitRestNode # Only in block parameters
4049 - name: posts
4050 type: node[]
4051 kind:
4052 - RequiredParameterNode
4053 - MultiTargetNode
4054 # On parsing error of `f(**kwargs, ...)` or `f(**nil, ...)`, the keyword_rest value is moved here:
4055 - on error: KeywordRestParameterNode
4056 - on error: NoKeywordsParameterNode
4057 # On parsing error of `f(..., ...)`, the first forwarding parameter is moved here:
4058 - on error: ForwardingParameterNode
4059 - name: keywords
4060 type: node[]
4061 kind:
4062 - RequiredKeywordParameterNode
4063 - OptionalKeywordParameterNode
4064 - name: keyword_rest
4065 type: node?
4066 kind:
4067 - KeywordRestParameterNode
4068 - ForwardingParameterNode
4069 - NoKeywordsParameterNode
4070 - name: block
4071 type: node?
4072 kind: BlockParameterNode
4073 comment: |
4074 Represents the list of parameters on a method, block, or lambda definition.
4075
4076 def a(b, c, d)
4077 ^^^^^^^
4078 end
4079 - name: ParenthesesNode
4080 flags: ParenthesesNodeFlags
4081 fields:
4082 - name: body
4083 type: node?
4084 kind: non-void expression # Usually a StatementsNode but not always e.g. `1 in (..10)`
4085 - name: opening_loc
4086 type: location
4087 - name: closing_loc
4088 type: location
4089 newline: false
4090 comment: |
4091 Represents a parenthesized expression
4092
4093 (10 + 34)
4094 ^^^^^^^^^
4095 - name: PinnedExpressionNode
4096 fields:
4097 - name: expression
4098 type: node
4099 kind: non-void expression
4100 comment: |
4101 The expression used in the pinned expression
4102
4103 foo in ^(bar)
4104 ^^^
4105 - name: operator_loc
4106 type: location
4107 comment: |
4108 The location of the `^` operator
4109
4110 foo in ^(bar)
4111 ^
4112 - name: lparen_loc
4113 type: location
4114 comment: |
4115 The location of the opening parenthesis.
4116
4117 foo in ^(bar)
4118 ^
4119 - name: rparen_loc
4120 type: location
4121 comment: |
4122 The location of the closing parenthesis.
4123
4124 foo in ^(bar)
4125 ^
4126 comment: |
4127 Represents the use of the `^` operator for pinning an expression in a pattern matching expression.
4128
4129 foo in ^(bar)
4130 ^^^^^^
4131 - name: PinnedVariableNode
4132 fields:
4133 - name: variable
4134 type: node
4135 kind:
4136 - LocalVariableReadNode
4137 - InstanceVariableReadNode
4138 - ClassVariableReadNode
4139 - GlobalVariableReadNode # foo in ^$a
4140 - BackReferenceReadNode # foo in ^$&
4141 - NumberedReferenceReadNode # foo in ^$1
4142 - ItLocalVariableReadNode # proc { 1 in ^it }
4143 - on error: MissingNode # foo in ^Bar
4144 comment: |
4145 The variable used in the pinned expression
4146
4147 foo in ^bar
4148 ^^^
4149 - name: operator_loc
4150 type: location
4151 comment: |
4152 The location of the `^` operator
4153
4154 foo in ^bar
4155 ^
4156 comment: |
4157 Represents the use of the `^` operator for pinning a variable in a pattern matching expression.
4158
4159 foo in ^bar
4160 ^^^^
4161 - name: PostExecutionNode
4162 fields:
4163 - name: statements
4164 type: node?
4165 kind: StatementsNode
4166 - name: keyword_loc
4167 type: location
4168 - name: opening_loc
4169 type: location
4170 - name: closing_loc
4171 type: location
4172 comment: |
4173 Represents the use of the `END` keyword.
4174
4175 END { foo }
4176 ^^^^^^^^^^^
4177 - name: PreExecutionNode
4178 fields:
4179 - name: statements
4180 type: node?
4181 kind: StatementsNode
4182 - name: keyword_loc
4183 type: location
4184 - name: opening_loc
4185 type: location
4186 - name: closing_loc
4187 type: location
4188 comment: |
4189 Represents the use of the `BEGIN` keyword.
4190
4191 BEGIN { foo }
4192 ^^^^^^^^^^^^^
4193 - name: ProgramNode
4194 fields:
4195 - name: locals
4196 type: constant[]
4197 - name: statements
4198 type: node
4199 kind: StatementsNode
4200 comment: The top level node of any parse tree.
4201 - name: RangeNode
4202 flags: RangeFlags
4203 fields:
4204 - name: left
4205 type: node?
4206 kind: non-void expression
4207 comment: |
4208 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).
4209
4210 1...
4211 ^
4212
4213 hello...goodbye
4214 ^^^^^
4215 - name: right
4216 type: node?
4217 kind: non-void expression
4218 comment: |
4219 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).
4220
4221 ..5
4222 ^
4223
4224 1...foo
4225 ^^^
4226 If neither right-hand or left-hand side was included, this will be a MissingNode.
4227 - name: operator_loc
4228 type: location
4229 comment: |
4230 The location of the `..` or `...` operator.
4231 comment: |
4232 Represents the use of the `..` or `...` operators.
4233
4234 1..2
4235 ^^^^
4236
4237 c if a =~ /left/ ... b =~ /right/
4238 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4239 - name: RationalNode
4240 flags: IntegerBaseFlags
4241 fields:
4242 - name: numerator
4243 type: integer
4244 comment: |
4245 The numerator of the rational number.
4246
4247 1.5r # numerator 3
4248 - name: denominator
4249 type: integer
4250 comment: |
4251 The denominator of the rational number.
4252
4253 1.5r # denominator 2
4254 comment: |
4255 Represents a rational number literal.
4256
4257 1.0r
4258 ^^^^
4259 - name: RedoNode
4260 comment: |
4261 Represents the use of the `redo` keyword.
4262
4263 redo
4264 ^^^^
4265 - name: RegularExpressionNode
4266 flags: RegularExpressionFlags
4267 fields:
4268 - name: opening_loc
4269 type: location
4270 - name: content_loc
4271 type: location
4272 - name: closing_loc
4273 type: location
4274 - name: unescaped
4275 type: string
4276 comment: |
4277 Represents a regular expression literal with no interpolation.
4278
4279 /foo/i
4280 ^^^^^^
4281 - name: RequiredKeywordParameterNode
4282 flags: ParameterFlags
4283 fields:
4284 - name: name
4285 type: constant
4286 - name: name_loc
4287 type: location
4288 comment: |
4289 Represents a required keyword parameter to a method, block, or lambda definition.
4290
4291 def a(b: )
4292 ^^
4293 end
4294 - name: RequiredParameterNode
4295 flags: ParameterFlags
4296 fields:
4297 - name: name
4298 type: constant
4299 comment: |
4300 Represents a required parameter to a method, block, or lambda definition.
4301
4302 def a(b)
4303 ^
4304 end
4305 - name: RescueModifierNode
4306 fields:
4307 - name: expression
4308 type: node
4309 kind: Node
4310 - name: keyword_loc
4311 type: location
4312 - name: rescue_expression
4313 type: node
4314 kind: Node
4315 newline: expression
4316 comment: |
4317 Represents an expression modified with a rescue.
4318
4319 foo rescue nil
4320 ^^^^^^^^^^^^^^
4321 - name: RescueNode
4322 fields:
4323 - name: keyword_loc
4324 type: location
4325 - name: exceptions
4326 type: node[]
4327 kind: non-void expression
4328 - name: operator_loc
4329 type: location?
4330 - name: reference
4331 type: node?
4332 kind:
4333 - LocalVariableTargetNode
4334 - InstanceVariableTargetNode
4335 - ClassVariableTargetNode
4336 - GlobalVariableTargetNode
4337 - ConstantTargetNode
4338 - ConstantPathTargetNode
4339 - CallTargetNode
4340 - IndexTargetNode
4341 - on error: BackReferenceReadNode # => begin; rescue => $&; end
4342 - on error: NumberedReferenceReadNode # => begin; rescue => $1; end
4343 - on error: MissingNode # begin; rescue =>; end
4344 - name: then_keyword_loc
4345 type: location?
4346 - name: statements
4347 type: node?
4348 kind: StatementsNode
4349 - name: subsequent
4350 type: node?
4351 kind: RescueNode
4352 comment: |
4353 Represents a rescue statement.
4354
4355 begin
4356 rescue Foo, *splat, Bar => ex
4357 foo
4358 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4359 end
4360
4361 `Foo, *splat, Bar` are in the `exceptions` field. `ex` is in the `reference` field.
4362 - name: RestParameterNode
4363 flags: ParameterFlags
4364 fields:
4365 - name: name
4366 type: constant?
4367 - name: name_loc
4368 type: location?
4369 - name: operator_loc
4370 type: location
4371 comment: |
4372 Represents a rest parameter to a method, block, or lambda definition.
4373
4374 def a(*b)
4375 ^^
4376 end
4377 - name: RetryNode
4378 comment: |
4379 Represents the use of the `retry` keyword.
4380
4381 retry
4382 ^^^^^
4383 - name: ReturnNode
4384 fields:
4385 - name: keyword_loc
4386 type: location
4387 - name: arguments
4388 type: node?
4389 kind: ArgumentsNode
4390 comment: |
4391 Represents the use of the `return` keyword.
4392
4393 return 1
4394 ^^^^^^^^
4395 - name: SelfNode
4396 comment: |
4397 Represents the `self` keyword.
4398
4399 self
4400 ^^^^
4401 - name: ShareableConstantNode
4402 flags: ShareableConstantNodeFlags
4403 fields:
4404 - name: write
4405 type: node
4406 kind:
4407 - ConstantWriteNode
4408 - ConstantAndWriteNode
4409 - ConstantOrWriteNode
4410 - ConstantOperatorWriteNode
4411 - ConstantPathWriteNode
4412 - ConstantPathAndWriteNode
4413 - ConstantPathOrWriteNode
4414 - ConstantPathOperatorWriteNode
4415 comment: The constant write that should be modified with the shareability state.
4416 comment: |
4417 This node wraps a constant write to indicate that when the value is written, it should have its shareability state modified.
4418
4419 # shareable_constant_value: literal
4420 C = { a: 1 }
4421 ^^^^^^^^^^^^
4422 - name: SingletonClassNode
4423 fields:
4424 - name: locals
4425 type: constant[]
4426 - name: class_keyword_loc
4427 type: location
4428 - name: operator_loc
4429 type: location
4430 - name: expression
4431 type: node
4432 kind: non-void expression
4433 - name: body
4434 type: node?
4435 kind:
4436 - StatementsNode
4437 - BeginNode
4438 - name: end_keyword_loc
4439 type: location
4440 comment: |
4441 Represents a singleton class declaration involving the `class` keyword.
4442
4443 class << self end
4444 ^^^^^^^^^^^^^^^^^
4445 - name: SourceEncodingNode
4446 comment: |
4447 Represents the use of the `__ENCODING__` keyword.
4448
4449 __ENCODING__
4450 ^^^^^^^^^^^^
4451 - name: SourceFileNode
4452 flags: StringFlags
4453 fields:
4454 - name: filepath
4455 type: string
4456 comment: Represents the file path being parsed. This corresponds directly to the `filepath` option given to the various `Prism::parse*` APIs.
4457 comment: |
4458 Represents the use of the `__FILE__` keyword.
4459
4460 __FILE__
4461 ^^^^^^^^
4462 - name: SourceLineNode
4463 comment: |
4464 Represents the use of the `__LINE__` keyword.
4465
4466 __LINE__
4467 ^^^^^^^^
4468 - name: SplatNode
4469 fields:
4470 - name: operator_loc
4471 type: location
4472 - name: expression
4473 type: node?
4474 kind: non-void expression
4475 comment: |
4476 Represents the use of the splat operator.
4477
4478 [*a]
4479 ^^
4480 - name: StatementsNode
4481 fields:
4482 - name: body
4483 type: node[]
4484 kind: Node
4485 comment: |
4486 Represents a set of statements contained within some scope.
4487
4488 foo; bar; baz
4489 ^^^^^^^^^^^^^
4490 - name: StringNode
4491 flags: StringFlags
4492 fields:
4493 - name: opening_loc
4494 type: location?
4495 - name: content_loc
4496 type: location
4497 - name: closing_loc
4498 type: location?
4499 - name: unescaped
4500 type: string
4501 comment: |
4502 Represents a string literal, a string contained within a `%w` list, or plain string content within an interpolated string.
4503
4504 "foo"
4505 ^^^^^
4506
4507 %w[foo]
4508 ^^^
4509
4510 "foo #{bar} baz"
4511 ^^^^ ^^^^
4512 - name: SuperNode
4513 fields:
4514 - name: keyword_loc
4515 type: location
4516 - name: lparen_loc
4517 type: location?
4518 - name: arguments
4519 type: node?
4520 kind: ArgumentsNode
4521 comment: "Can be only `nil` when there are empty parentheses, like `super()`."
4522 - name: rparen_loc
4523 type: location?
4524 - name: block
4525 type: node?
4526 kind:
4527 - BlockNode
4528 - BlockArgumentNode
4529 comment: |
4530 Represents the use of the `super` keyword with parentheses or arguments.
4531
4532 super()
4533 ^^^^^^^
4534
4535 super foo, bar
4536 ^^^^^^^^^^^^^^
4537
4538 If no arguments are provided (except for a block), it would be a `ForwardingSuperNode` instead.
4539 - name: SymbolNode
4540 flags: SymbolFlags
4541 fields:
4542 - name: opening_loc
4543 type: location?
4544 - name: value_loc
4545 type: location?
4546 - name: closing_loc
4547 type: location?
4548 - name: unescaped
4549 type: string
4550 comment: |
4551 Represents a symbol literal or a symbol contained within a `%i` list.
4552
4553 :foo
4554 ^^^^
4555
4556 %i[foo]
4557 ^^^
4558 - name: TrueNode
4559 comment: |
4560 Represents the use of the literal `true` keyword.
4561
4562 true
4563 ^^^^
4564 - name: UndefNode
4565 fields:
4566 - name: names
4567 type: node[]
4568 kind:
4569 - SymbolNode
4570 - InterpolatedSymbolNode
4571 - name: keyword_loc
4572 type: location
4573 comment: |
4574 Represents the use of the `undef` keyword.
4575
4576 undef :foo, :bar, :baz
4577 ^^^^^^^^^^^^^^^^^^^^^^
4578 - name: UnlessNode
4579 fields:
4580 - name: keyword_loc
4581 type: location
4582 comment: |
4583 The location of the `unless` keyword.
4584
4585 unless cond then bar end
4586 ^^^^^^
4587
4588 bar unless cond
4589 ^^^^^^
4590 - name: predicate
4591 type: node
4592 kind: non-void expression
4593 comment: |
4594 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).
4595
4596 unless cond then bar end
4597 ^^^^
4598
4599 bar unless cond
4600 ^^^^
4601 - name: then_keyword_loc
4602 type: location?
4603 comment: |
4604 The location of the `then` keyword, if present.
4605
4606 unless cond then bar end
4607 ^^^^
4608 - name: statements
4609 type: node?
4610 kind: StatementsNode
4611 comment: |
4612 The body of statements that will executed if the unless condition is
4613 falsey. Will be `nil` if no body is provided.
4614
4615 unless cond then bar end
4616 ^^^
4617 - name: else_clause
4618 type: node?
4619 kind: ElseNode
4620 comment: |
4621 The else clause of the unless expression, if present.
4622
4623 unless cond then bar else baz end
4624 ^^^^^^^^
4625 - name: end_keyword_loc
4626 type: location?
4627 comment: |
4628 The location of the `end` keyword, if present.
4629
4630 unless cond then bar end
4631 ^^^
4632 newline: predicate
4633 comment: |
4634 Represents the use of the `unless` keyword, either in the block form or the modifier form.
4635
4636 bar unless foo
4637 ^^^^^^^^^^^^^^
4638
4639 unless foo then bar end
4640 ^^^^^^^^^^^^^^^^^^^^^^^
4641 - name: UntilNode
4642 flags: LoopFlags
4643 fields:
4644 - name: keyword_loc
4645 type: location
4646 - name: do_keyword_loc
4647 type: location?
4648 - name: closing_loc
4649 type: location?
4650 - name: predicate
4651 type: node
4652 kind: non-void expression
4653 - name: statements
4654 type: node?
4655 kind: StatementsNode
4656 newline: predicate
4657 comment: |
4658 Represents the use of the `until` keyword, either in the block form or the modifier form.
4659
4660 bar until foo
4661 ^^^^^^^^^^^^^
4662
4663 until foo do bar end
4664 ^^^^^^^^^^^^^^^^^^^^
4665 - name: WhenNode
4666 fields:
4667 - name: keyword_loc
4668 type: location
4669 - name: conditions
4670 type: node[]
4671 kind: non-void expression
4672 - name: then_keyword_loc
4673 type: location?
4674 - name: statements
4675 type: node?
4676 kind: StatementsNode
4677 comment: |
4678 Represents the use of the `when` keyword within a case statement.
4679
4680 case true
4681 when true
4682 ^^^^^^^^^
4683 end
4684 - name: WhileNode
4685 flags: LoopFlags
4686 fields:
4687 - name: keyword_loc
4688 type: location
4689 - name: do_keyword_loc
4690 type: location?
4691 - name: closing_loc
4692 type: location?
4693 - name: predicate
4694 type: node
4695 kind: non-void expression
4696 - name: statements
4697 type: node?
4698 kind: StatementsNode
4699 newline: predicate
4700 comment: |
4701 Represents the use of the `while` keyword, either in the block form or the modifier form.
4702
4703 bar while foo
4704 ^^^^^^^^^^^^^
4705
4706 while foo do bar end
4707 ^^^^^^^^^^^^^^^^^^^^
4708 - name: XStringNode
4709 flags: EncodingFlags
4710 fields:
4711 - name: opening_loc
4712 type: location
4713 - name: content_loc
4714 type: location
4715 - name: closing_loc
4716 type: location
4717 - name: unescaped
4718 type: string
4719 comment: |
4720 Represents an xstring literal with no interpolation.
4721
4722 `foo`
4723 ^^^^^
4724 - name: YieldNode
4725 fields:
4726 - name: keyword_loc
4727 type: location
4728 - name: lparen_loc
4729 type: location?
4730 - name: arguments
4731 type: node?
4732 kind: ArgumentsNode
4733 - name: rparen_loc
4734 type: location?
4735 comment: |
4736 Represents the use of the `yield` keyword.
4737
4738 yield 1
4739 ^^^^^^^