2023-08-18 00:39:04 +03:00
|
|
|
tokens:
|
|
|
|
- name: EOF
|
|
|
|
value: 1
|
|
|
|
comment: final token in the file
|
|
|
|
- name: MISSING
|
|
|
|
comment: "a token that was expected but not found"
|
|
|
|
- name: NOT_PROVIDED
|
|
|
|
comment: "a token that was not present but it is okay"
|
|
|
|
- name: AMPERSAND
|
|
|
|
comment: "&"
|
|
|
|
- name: AMPERSAND_AMPERSAND
|
|
|
|
comment: "&&"
|
|
|
|
- name: AMPERSAND_AMPERSAND_EQUAL
|
|
|
|
comment: "&&="
|
|
|
|
- name: AMPERSAND_DOT
|
|
|
|
comment: "&."
|
|
|
|
- name: AMPERSAND_EQUAL
|
|
|
|
comment: "&="
|
|
|
|
- name: BACKTICK
|
|
|
|
comment: "`"
|
|
|
|
- name: BACK_REFERENCE
|
|
|
|
comment: "a back reference"
|
|
|
|
- name: BANG
|
|
|
|
comment: "! or !@"
|
|
|
|
- name: BANG_EQUAL
|
|
|
|
comment: "!="
|
|
|
|
- name: BANG_TILDE
|
|
|
|
comment: "!~"
|
|
|
|
- name: BRACE_LEFT
|
|
|
|
comment: "{"
|
|
|
|
- name: BRACE_RIGHT
|
|
|
|
comment: "}"
|
|
|
|
- name: BRACKET_LEFT
|
|
|
|
comment: "["
|
|
|
|
- name: BRACKET_LEFT_ARRAY
|
|
|
|
comment: "[ for the beginning of an array"
|
|
|
|
- name: BRACKET_LEFT_RIGHT
|
|
|
|
comment: "[]"
|
|
|
|
- name: BRACKET_LEFT_RIGHT_EQUAL
|
|
|
|
comment: "[]="
|
|
|
|
- name: BRACKET_RIGHT
|
|
|
|
comment: "]"
|
|
|
|
- name: CARET
|
|
|
|
comment: "^"
|
|
|
|
- name: CARET_EQUAL
|
|
|
|
comment: "^="
|
|
|
|
- name: CHARACTER_LITERAL
|
|
|
|
comment: "a character literal"
|
|
|
|
- name: CLASS_VARIABLE
|
|
|
|
comment: "a class variable"
|
|
|
|
- name: COLON
|
|
|
|
comment: ":"
|
|
|
|
- name: COLON_COLON
|
|
|
|
comment: "::"
|
|
|
|
- name: COMMA
|
|
|
|
comment: ","
|
|
|
|
- name: COMMENT
|
|
|
|
comment: "a comment"
|
|
|
|
- name: CONSTANT
|
|
|
|
comment: "a constant"
|
|
|
|
- name: DOT
|
2023-10-31 20:26:31 +03:00
|
|
|
comment: "the . call operator"
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: DOT_DOT
|
2023-10-31 20:26:31 +03:00
|
|
|
comment: "the .. range operator"
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: DOT_DOT_DOT
|
2023-10-31 20:26:31 +03:00
|
|
|
comment: "the ... range operator or forwarding parameter"
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: EMBDOC_BEGIN
|
|
|
|
comment: "=begin"
|
|
|
|
- name: EMBDOC_END
|
|
|
|
comment: "=end"
|
|
|
|
- name: EMBDOC_LINE
|
|
|
|
comment: "a line inside of embedded documentation"
|
|
|
|
- name: EMBEXPR_BEGIN
|
|
|
|
comment: "#{"
|
|
|
|
- name: EMBEXPR_END
|
|
|
|
comment: "}"
|
|
|
|
- name: EMBVAR
|
|
|
|
comment: "#"
|
|
|
|
- name: EQUAL
|
|
|
|
comment: "="
|
|
|
|
- name: EQUAL_EQUAL
|
|
|
|
comment: "=="
|
|
|
|
- name: EQUAL_EQUAL_EQUAL
|
|
|
|
comment: "==="
|
|
|
|
- name: EQUAL_GREATER
|
|
|
|
comment: "=>"
|
|
|
|
- name: EQUAL_TILDE
|
|
|
|
comment: "=~"
|
|
|
|
- name: FLOAT
|
|
|
|
comment: "a floating point number"
|
|
|
|
- name: FLOAT_IMAGINARY
|
|
|
|
comment: "a floating pointer number with an imaginary suffix"
|
|
|
|
- name: FLOAT_RATIONAL
|
|
|
|
comment: "a floating pointer number with a rational suffix"
|
|
|
|
- name: FLOAT_RATIONAL_IMAGINARY
|
|
|
|
comment: "a floating pointer number with a rational and imaginary suffix"
|
|
|
|
- name: GLOBAL_VARIABLE
|
|
|
|
comment: "a global variable"
|
|
|
|
- name: GREATER
|
|
|
|
comment: ">"
|
|
|
|
- name: GREATER_EQUAL
|
|
|
|
comment: ">="
|
|
|
|
- name: GREATER_GREATER
|
|
|
|
comment: ">>"
|
|
|
|
- name: GREATER_GREATER_EQUAL
|
|
|
|
comment: ">>="
|
|
|
|
- name: HEREDOC_END
|
|
|
|
comment: "the end of a heredoc"
|
|
|
|
- name: HEREDOC_START
|
|
|
|
comment: "the start of a heredoc"
|
|
|
|
- name: IDENTIFIER
|
|
|
|
comment: "an identifier"
|
|
|
|
- name: IGNORED_NEWLINE
|
|
|
|
comment: "an ignored newline"
|
|
|
|
- name: INSTANCE_VARIABLE
|
|
|
|
comment: "an instance variable"
|
|
|
|
- name: INTEGER
|
|
|
|
comment: "an integer (any base)"
|
|
|
|
- name: INTEGER_IMAGINARY
|
|
|
|
comment: "an integer with an imaginary suffix"
|
|
|
|
- name: INTEGER_RATIONAL
|
|
|
|
comment: "an integer with a rational suffix"
|
|
|
|
- name: INTEGER_RATIONAL_IMAGINARY
|
|
|
|
comment: "an integer with a rational and imaginary suffix"
|
|
|
|
- name: KEYWORD_ALIAS
|
|
|
|
comment: "alias"
|
|
|
|
- name: KEYWORD_AND
|
|
|
|
comment: "and"
|
|
|
|
- name: KEYWORD_BEGIN
|
|
|
|
comment: "begin"
|
|
|
|
- name: KEYWORD_BEGIN_UPCASE
|
|
|
|
comment: "BEGIN"
|
|
|
|
- name: KEYWORD_BREAK
|
|
|
|
comment: "break"
|
|
|
|
- name: KEYWORD_CASE
|
|
|
|
comment: "case"
|
|
|
|
- name: KEYWORD_CLASS
|
|
|
|
comment: "class"
|
|
|
|
- name: KEYWORD_DEF
|
|
|
|
comment: "def"
|
|
|
|
- name: KEYWORD_DEFINED
|
|
|
|
comment: "defined?"
|
|
|
|
- name: KEYWORD_DO
|
|
|
|
comment: "do"
|
|
|
|
- name: KEYWORD_DO_LOOP
|
|
|
|
comment: "do keyword for a predicate in a while, until, or for loop"
|
|
|
|
- name: KEYWORD_ELSE
|
|
|
|
comment: "else"
|
|
|
|
- name: KEYWORD_ELSIF
|
|
|
|
comment: "elsif"
|
|
|
|
- name: KEYWORD_END
|
|
|
|
comment: "end"
|
|
|
|
- name: KEYWORD_END_UPCASE
|
|
|
|
comment: "END"
|
|
|
|
- name: KEYWORD_ENSURE
|
|
|
|
comment: "ensure"
|
|
|
|
- name: KEYWORD_FALSE
|
|
|
|
comment: "false"
|
|
|
|
- name: KEYWORD_FOR
|
|
|
|
comment: "for"
|
|
|
|
- name: KEYWORD_IF
|
|
|
|
comment: "if"
|
|
|
|
- name: KEYWORD_IF_MODIFIER
|
|
|
|
comment: "if in the modifier form"
|
|
|
|
- name: KEYWORD_IN
|
|
|
|
comment: "in"
|
|
|
|
- name: KEYWORD_MODULE
|
|
|
|
comment: "module"
|
|
|
|
- name: KEYWORD_NEXT
|
|
|
|
comment: "next"
|
|
|
|
- name: KEYWORD_NIL
|
|
|
|
comment: "nil"
|
|
|
|
- name: KEYWORD_NOT
|
|
|
|
comment: "not"
|
|
|
|
- name: KEYWORD_OR
|
|
|
|
comment: "or"
|
|
|
|
- name: KEYWORD_REDO
|
|
|
|
comment: "redo"
|
|
|
|
- name: KEYWORD_RESCUE
|
|
|
|
comment: "rescue"
|
|
|
|
- name: KEYWORD_RESCUE_MODIFIER
|
|
|
|
comment: "rescue in the modifier form"
|
|
|
|
- name: KEYWORD_RETRY
|
|
|
|
comment: "retry"
|
|
|
|
- name: KEYWORD_RETURN
|
|
|
|
comment: "return"
|
|
|
|
- name: KEYWORD_SELF
|
|
|
|
comment: "self"
|
|
|
|
- name: KEYWORD_SUPER
|
|
|
|
comment: "super"
|
|
|
|
- name: KEYWORD_THEN
|
|
|
|
comment: "then"
|
|
|
|
- name: KEYWORD_TRUE
|
|
|
|
comment: "true"
|
|
|
|
- name: KEYWORD_UNDEF
|
|
|
|
comment: "undef"
|
|
|
|
- name: KEYWORD_UNLESS
|
|
|
|
comment: "unless"
|
|
|
|
- name: KEYWORD_UNLESS_MODIFIER
|
|
|
|
comment: "unless in the modifier form"
|
|
|
|
- name: KEYWORD_UNTIL
|
|
|
|
comment: "until"
|
|
|
|
- name: KEYWORD_UNTIL_MODIFIER
|
|
|
|
comment: "until in the modifier form"
|
|
|
|
- name: KEYWORD_WHEN
|
|
|
|
comment: "when"
|
|
|
|
- name: KEYWORD_WHILE
|
|
|
|
comment: "while"
|
|
|
|
- name: KEYWORD_WHILE_MODIFIER
|
|
|
|
comment: "while in the modifier form"
|
|
|
|
- name: KEYWORD_YIELD
|
|
|
|
comment: "yield"
|
|
|
|
- name: KEYWORD___ENCODING__
|
|
|
|
comment: "__ENCODING__"
|
|
|
|
- name: KEYWORD___FILE__
|
|
|
|
comment: "__FILE__"
|
|
|
|
- name: KEYWORD___LINE__
|
|
|
|
comment: "__LINE__"
|
|
|
|
- name: LABEL
|
|
|
|
comment: "a label"
|
|
|
|
- name: LABEL_END
|
|
|
|
comment: "the end of a label"
|
|
|
|
- name: LAMBDA_BEGIN
|
|
|
|
comment: "{"
|
|
|
|
- name: LESS
|
|
|
|
comment: "<"
|
|
|
|
- name: LESS_EQUAL
|
|
|
|
comment: "<="
|
|
|
|
- name: LESS_EQUAL_GREATER
|
|
|
|
comment: "<=>"
|
|
|
|
- name: LESS_LESS
|
|
|
|
comment: "<<"
|
|
|
|
- name: LESS_LESS_EQUAL
|
|
|
|
comment: "<<="
|
2023-09-22 18:18:02 +03:00
|
|
|
- name: METHOD_NAME
|
|
|
|
comment: "a method name"
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: MINUS
|
|
|
|
comment: "-"
|
|
|
|
- name: MINUS_EQUAL
|
|
|
|
comment: "-="
|
|
|
|
- name: MINUS_GREATER
|
|
|
|
comment: "->"
|
|
|
|
- name: NEWLINE
|
|
|
|
comment: "a newline character outside of other tokens"
|
|
|
|
- name: NUMBERED_REFERENCE
|
|
|
|
comment: "a numbered reference to a capture group in the previous regular expression match"
|
|
|
|
- name: PARENTHESIS_LEFT
|
|
|
|
comment: "("
|
|
|
|
- name: PARENTHESIS_LEFT_PARENTHESES
|
|
|
|
comment: "( for a parentheses node"
|
|
|
|
- name: PARENTHESIS_RIGHT
|
|
|
|
comment: ")"
|
|
|
|
- name: PERCENT
|
|
|
|
comment: "%"
|
|
|
|
- name: PERCENT_EQUAL
|
|
|
|
comment: "%="
|
|
|
|
- name: PERCENT_LOWER_I
|
|
|
|
comment: "%i"
|
|
|
|
- name: PERCENT_LOWER_W
|
|
|
|
comment: "%w"
|
|
|
|
- name: PERCENT_LOWER_X
|
|
|
|
comment: "%x"
|
|
|
|
- name: PERCENT_UPPER_I
|
|
|
|
comment: "%I"
|
|
|
|
- name: PERCENT_UPPER_W
|
|
|
|
comment: "%W"
|
|
|
|
- name: PIPE
|
|
|
|
comment: "|"
|
|
|
|
- name: PIPE_EQUAL
|
|
|
|
comment: "|="
|
|
|
|
- name: PIPE_PIPE
|
|
|
|
comment: "||"
|
|
|
|
- name: PIPE_PIPE_EQUAL
|
|
|
|
comment: "||="
|
|
|
|
- name: PLUS
|
|
|
|
comment: "+"
|
|
|
|
- name: PLUS_EQUAL
|
|
|
|
comment: "+="
|
|
|
|
- name: QUESTION_MARK
|
|
|
|
comment: "?"
|
|
|
|
- name: REGEXP_BEGIN
|
|
|
|
comment: "the beginning of a regular expression"
|
|
|
|
- name: REGEXP_END
|
|
|
|
comment: "the end of a regular expression"
|
|
|
|
- name: SEMICOLON
|
|
|
|
comment: ";"
|
|
|
|
- name: SLASH
|
|
|
|
comment: "/"
|
|
|
|
- name: SLASH_EQUAL
|
|
|
|
comment: "/="
|
|
|
|
- name: STAR
|
|
|
|
comment: "*"
|
|
|
|
- name: STAR_EQUAL
|
|
|
|
comment: "*="
|
|
|
|
- name: STAR_STAR
|
|
|
|
comment: "**"
|
|
|
|
- name: STAR_STAR_EQUAL
|
|
|
|
comment: "**="
|
|
|
|
- name: STRING_BEGIN
|
|
|
|
comment: "the beginning of a string"
|
|
|
|
- name: STRING_CONTENT
|
|
|
|
comment: "the contents of a string"
|
|
|
|
- name: STRING_END
|
|
|
|
comment: "the end of a string"
|
|
|
|
- name: SYMBOL_BEGIN
|
|
|
|
comment: "the beginning of a symbol"
|
|
|
|
- name: TILDE
|
|
|
|
comment: "~ or ~@"
|
|
|
|
- name: UAMPERSAND
|
|
|
|
comment: "unary &"
|
|
|
|
- name: UCOLON_COLON
|
|
|
|
comment: "unary ::"
|
|
|
|
- name: UDOT_DOT
|
2023-10-31 20:26:31 +03:00
|
|
|
comment: "unary .. operator"
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: UDOT_DOT_DOT
|
2023-10-31 20:26:31 +03:00
|
|
|
comment: "unary ... operator"
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: UMINUS
|
|
|
|
comment: "-@"
|
|
|
|
- name: UMINUS_NUM
|
|
|
|
comment: "-@ for a number"
|
|
|
|
- name: UPLUS
|
|
|
|
comment: "+@"
|
|
|
|
- name: USTAR
|
|
|
|
comment: "unary *"
|
|
|
|
- name: USTAR_STAR
|
|
|
|
comment: "unary **"
|
|
|
|
- name: WORDS_SEP
|
|
|
|
comment: "a separator between words in a list"
|
|
|
|
- name: __END__
|
|
|
|
comment: "marker for the point in the file at which the parser should stop"
|
|
|
|
flags:
|
2023-10-26 21:02:27 +03:00
|
|
|
- name: ArgumentsNodeFlags
|
|
|
|
values:
|
2023-11-21 23:46:48 +03:00
|
|
|
- name: CONTAINS_KEYWORD_SPLAT
|
2023-10-26 21:02:27 +03:00
|
|
|
comment: "if arguments contain keyword splat"
|
2023-10-30 21:00:44 +03:00
|
|
|
comment: Flags for arguments nodes.
|
2023-11-21 23:17:09 +03:00
|
|
|
- name: ArrayNodeFlags
|
|
|
|
values:
|
|
|
|
- name: CONTAINS_SPLAT
|
|
|
|
comment: "if array contains splat nodes"
|
|
|
|
comment: Flags for array nodes.
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: CallNodeFlags
|
|
|
|
values:
|
|
|
|
- name: SAFE_NAVIGATION
|
|
|
|
comment: "&. operator"
|
|
|
|
- name: VARIABLE_CALL
|
|
|
|
comment: "a call that could have been a local variable"
|
2023-12-12 18:39:41 +03:00
|
|
|
- name: ATTRIBUTE_WRITE
|
|
|
|
comment: "a call that is an attribute write, so the value being written should be returned"
|
2024-01-02 22:54:45 +03:00
|
|
|
- name: IGNORE_VISIBILITY
|
|
|
|
comment: "a call that ignores method visibility"
|
2023-10-30 21:00:44 +03:00
|
|
|
comment: Flags for call nodes.
|
2023-12-04 20:51:22 +03:00
|
|
|
- name: EncodingFlags
|
|
|
|
values:
|
|
|
|
- name: FORCED_UTF8_ENCODING
|
|
|
|
comment: "internal bytes forced the encoding to UTF-8"
|
|
|
|
- name: FORCED_BINARY_ENCODING
|
|
|
|
comment: "internal bytes forced the encoding to binary"
|
|
|
|
comment: Flags for nodes that have unescaped content.
|
2023-09-11 19:05:14 +03:00
|
|
|
- name: IntegerBaseFlags
|
|
|
|
values:
|
|
|
|
- name: BINARY
|
|
|
|
comment: "0b prefix"
|
|
|
|
- name: DECIMAL
|
|
|
|
comment: "0d or no prefix"
|
2023-12-07 18:39:21 +03:00
|
|
|
- name: OCTAL
|
|
|
|
comment: "0o or 0 prefix"
|
2023-09-11 19:05:14 +03:00
|
|
|
- name: HEXADECIMAL
|
|
|
|
comment: "0x prefix"
|
2023-10-30 21:00:44 +03:00
|
|
|
comment: Flags for integer nodes that correspond to the base of the integer.
|
2023-12-11 23:26:06 +03:00
|
|
|
- name: KeywordHashNodeFlags
|
|
|
|
values:
|
2023-12-25 11:34:06 +03:00
|
|
|
- name: SYMBOL_KEYS
|
|
|
|
comment: "a keyword hash which only has `AssocNode` elements all with symbol keys, which means the elements can be treated as keyword arguments"
|
2023-12-11 23:26:06 +03:00
|
|
|
comment: Flags for keyword hash nodes.
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: LoopFlags
|
|
|
|
values:
|
|
|
|
- name: BEGIN_MODIFIER
|
|
|
|
comment: "a loop after a begin statement, so the body is executed first before the condition"
|
2023-10-30 21:00:44 +03:00
|
|
|
comment: Flags for while and until loop nodes.
|
2024-01-09 21:12:03 +03:00
|
|
|
- name: ParameterFlags
|
|
|
|
values:
|
|
|
|
- name: REPEATED_PARAMETER
|
|
|
|
comment: "a parameter name that has been repeated in the method signature"
|
|
|
|
comment: Flags for parameter nodes.
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: RangeFlags
|
|
|
|
values:
|
|
|
|
- name: EXCLUDE_END
|
|
|
|
comment: "... operator"
|
2023-10-30 21:00:44 +03:00
|
|
|
comment: Flags for range and flip-flop nodes.
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: RegularExpressionFlags
|
|
|
|
values:
|
|
|
|
- name: IGNORE_CASE
|
|
|
|
comment: "i - ignores the case of characters when matching"
|
|
|
|
- name: EXTENDED
|
|
|
|
comment: "x - ignores whitespace and allows comments in regular expressions"
|
2023-09-11 14:01:36 +03:00
|
|
|
- name: MULTI_LINE
|
|
|
|
comment: "m - allows $ to match the end of lines within strings"
|
2023-10-13 20:30:02 +03:00
|
|
|
- name: ONCE
|
|
|
|
comment: "o - only interpolates values into the regular expression once"
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: EUC_JP
|
|
|
|
comment: "e - forces the EUC-JP encoding"
|
|
|
|
- name: ASCII_8BIT
|
|
|
|
comment: "n - forces the ASCII-8BIT encoding"
|
|
|
|
- name: WINDOWS_31J
|
|
|
|
comment: "s - forces the Windows-31J encoding"
|
|
|
|
- name: UTF_8
|
|
|
|
comment: "u - forces the UTF-8 encoding"
|
2023-12-08 18:10:43 +03:00
|
|
|
- name: FORCED_UTF8_ENCODING
|
|
|
|
comment: "internal bytes forced the encoding to UTF-8"
|
|
|
|
- name: FORCED_BINARY_ENCODING
|
|
|
|
comment: "internal bytes forced the encoding to binary"
|
|
|
|
- name: FORCED_US_ASCII_ENCODING
|
|
|
|
comment: "internal bytes forced the encoding to US-ASCII"
|
2023-10-30 21:00:44 +03:00
|
|
|
comment: Flags for regular expression and match last line nodes.
|
2023-09-12 20:06:41 +03:00
|
|
|
- name: StringFlags
|
|
|
|
values:
|
2023-12-04 20:51:22 +03:00
|
|
|
- name: FORCED_UTF8_ENCODING
|
|
|
|
comment: "internal bytes forced the encoding to UTF-8"
|
|
|
|
- name: FORCED_BINARY_ENCODING
|
|
|
|
comment: "internal bytes forced the encoding to binary"
|
2023-09-12 20:06:41 +03:00
|
|
|
- name: FROZEN
|
2023-10-03 23:34:24 +03:00
|
|
|
comment: "frozen by virtue of a `frozen_string_literal` comment"
|
2023-10-30 21:00:44 +03:00
|
|
|
comment: Flags for string nodes.
|
2023-12-08 18:10:43 +03:00
|
|
|
- name: SymbolFlags
|
|
|
|
values:
|
|
|
|
- name: FORCED_UTF8_ENCODING
|
|
|
|
comment: "internal bytes forced the encoding to UTF-8"
|
|
|
|
- name: FORCED_BINARY_ENCODING
|
|
|
|
comment: "internal bytes forced the encoding to binary"
|
|
|
|
- name: FORCED_US_ASCII_ENCODING
|
|
|
|
comment: "internal bytes forced the encoding to US-ASCII"
|
|
|
|
comment: Flags for symbol nodes.
|
2023-08-18 00:39:04 +03:00
|
|
|
nodes:
|
2023-09-11 18:52:01 +03:00
|
|
|
- name: AliasGlobalVariableNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: new_name
|
|
|
|
type: node
|
|
|
|
- name: old_name
|
|
|
|
type: node
|
|
|
|
- name: keyword_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
2023-09-11 18:52:01 +03:00
|
|
|
Represents the use of the `alias` keyword to alias a global variable.
|
|
|
|
|
|
|
|
alias $foo $bar
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
- name: AliasMethodNode
|
|
|
|
fields:
|
|
|
|
- name: new_name
|
|
|
|
type: node
|
|
|
|
- name: old_name
|
|
|
|
type: node
|
|
|
|
- name: keyword_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `alias` keyword to alias a method.
|
2023-08-18 00:39:04 +03:00
|
|
|
|
|
|
|
alias foo bar
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
- name: AlternationPatternNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: left
|
|
|
|
type: node
|
|
|
|
- name: right
|
|
|
|
type: node
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents an alternation pattern in pattern matching.
|
|
|
|
|
|
|
|
foo => bar | baz
|
|
|
|
^^^^^^^^^
|
|
|
|
- name: AndNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: left
|
|
|
|
type: node
|
2024-01-14 11:58:30 +03:00
|
|
|
comment: |
|
2024-01-17 06:09:40 +03:00
|
|
|
Represents left side of expression. It includes any kind of node that returns a non-void value.
|
2024-01-14 11:58:30 +03:00
|
|
|
|
|
|
|
left and right
|
|
|
|
^^^^
|
2024-01-17 06:09:40 +03:00
|
|
|
1 && 2
|
|
|
|
^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: right
|
|
|
|
type: node
|
2024-01-14 11:58:30 +03:00
|
|
|
comment: |
|
2024-01-17 06:09:40 +03:00
|
|
|
Represents right side of expression. It includes any kind of node that returns non-void value.
|
|
|
|
If nothing is given, it will be replaced by MissingNode.
|
2024-01-14 11:58:30 +03:00
|
|
|
|
|
|
|
left && right
|
|
|
|
^^^^^
|
2024-01-17 06:09:40 +03:00
|
|
|
1 and 2
|
|
|
|
^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
2024-01-14 11:58:30 +03:00
|
|
|
comment: |
|
|
|
|
The Location of `and` keyword or `&&` operator.
|
2024-01-17 06:09:40 +03:00
|
|
|
The only difference between the two is that `&&` has higher precedence than `and`.
|
2024-01-14 11:58:30 +03:00
|
|
|
|
|
|
|
left and right
|
|
|
|
^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents the use of the `&&` operator or the `and` keyword.
|
|
|
|
|
|
|
|
left and right
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
- name: ArgumentsNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-10-26 21:02:27 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: ArgumentsNodeFlags
|
2023-12-06 23:32:53 +03:00
|
|
|
- name: arguments
|
|
|
|
type: node[]
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents a set of arguments to a method or a keyword.
|
|
|
|
|
|
|
|
return foo, bar, baz
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
- name: ArrayNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-12-06 23:32:53 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: ArrayNodeFlags
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: elements
|
|
|
|
type: node[]
|
|
|
|
- name: opening_loc
|
|
|
|
type: location?
|
|
|
|
- name: closing_loc
|
|
|
|
type: location?
|
|
|
|
comment: |
|
|
|
|
Represents an array literal. This can be a regular array using brackets or
|
|
|
|
a special array using % like %w or %i.
|
|
|
|
|
|
|
|
[1, 2, 3]
|
|
|
|
^^^^^^^^^
|
|
|
|
- name: ArrayPatternNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: constant
|
|
|
|
type: node?
|
|
|
|
- name: requireds
|
|
|
|
type: node[]
|
|
|
|
- name: rest
|
|
|
|
type: node?
|
|
|
|
- name: posts
|
|
|
|
type: node[]
|
|
|
|
- name: opening_loc
|
|
|
|
type: location?
|
|
|
|
- name: closing_loc
|
|
|
|
type: location?
|
|
|
|
comment: |
|
|
|
|
Represents an array pattern in pattern matching.
|
|
|
|
|
|
|
|
foo in 1, 2
|
|
|
|
^^^^^^^^^^^
|
|
|
|
|
|
|
|
foo in [1, 2]
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
foo in *1
|
|
|
|
^^^^^^^^^
|
|
|
|
|
|
|
|
foo in Bar[]
|
|
|
|
^^^^^^^^^^^^
|
|
|
|
|
|
|
|
foo in Bar[1, 2, 3]
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
- name: AssocNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: key
|
|
|
|
type: node
|
2024-01-07 12:56:22 +03:00
|
|
|
comment: |
|
2024-01-08 17:51:28 +03:00
|
|
|
The key of the association. This can be any node that represents a non-void expression.
|
2024-01-07 12:56:22 +03:00
|
|
|
|
|
|
|
{ a: b }
|
|
|
|
^
|
|
|
|
|
|
|
|
{ foo => bar }
|
|
|
|
^^^
|
|
|
|
|
|
|
|
{ def a; end => 1 }
|
|
|
|
^^^^^^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: value
|
|
|
|
type: node?
|
2024-01-07 12:56:22 +03:00
|
|
|
comment: |
|
2024-01-08 17:51:28 +03:00
|
|
|
The value of the association, if present. This can be any node that
|
|
|
|
represents a non-void expression. It can be optionally omitted if this
|
|
|
|
node is an element in a `HashPatternNode`.
|
2024-01-07 12:56:22 +03:00
|
|
|
|
|
|
|
{ foo => bar }
|
|
|
|
^^^
|
|
|
|
|
|
|
|
{ x: 1 }
|
|
|
|
^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: operator_loc
|
|
|
|
type: location?
|
2024-01-07 12:56:22 +03:00
|
|
|
comment: |
|
|
|
|
The location of the `=>` operator, if present.
|
|
|
|
|
|
|
|
{ foo => bar }
|
|
|
|
^^
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents a hash key/value pair.
|
|
|
|
|
|
|
|
{ a => b }
|
|
|
|
^^^^^^
|
|
|
|
- name: AssocSplatNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: value
|
|
|
|
type: node?
|
2024-01-07 13:07:55 +03:00
|
|
|
comment: |
|
|
|
|
The value to be splatted, if present. Will be missing when keyword
|
|
|
|
rest argument forwarding is used.
|
|
|
|
|
|
|
|
{ **foo }
|
|
|
|
^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
2024-01-07 13:07:55 +03:00
|
|
|
comment: |
|
|
|
|
The location of the `**` operator.
|
|
|
|
|
|
|
|
{ **x }
|
|
|
|
^^
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents a splat in a hash literal.
|
|
|
|
|
|
|
|
{ **foo }
|
|
|
|
^^^^^
|
|
|
|
- name: BackReferenceReadNode
|
2023-10-14 03:23:13 +03:00
|
|
|
fields:
|
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents reading a reference to a field in the previous match.
|
|
|
|
|
|
|
|
$'
|
|
|
|
^^
|
|
|
|
- name: BeginNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: begin_keyword_loc
|
|
|
|
type: location?
|
|
|
|
- name: statements
|
|
|
|
type: node?
|
|
|
|
kind: StatementsNode
|
|
|
|
- name: rescue_clause
|
|
|
|
type: node?
|
|
|
|
kind: RescueNode
|
|
|
|
- name: else_clause
|
|
|
|
type: node?
|
|
|
|
kind: ElseNode
|
|
|
|
- name: ensure_clause
|
|
|
|
type: node?
|
|
|
|
kind: EnsureNode
|
|
|
|
- name: end_keyword_loc
|
|
|
|
type: location?
|
|
|
|
newline: false
|
|
|
|
comment: |
|
|
|
|
Represents a begin statement.
|
|
|
|
|
|
|
|
begin
|
|
|
|
foo
|
|
|
|
end
|
|
|
|
^^^^^
|
|
|
|
- name: BlockArgumentNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: expression
|
|
|
|
type: node?
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents block method arguments.
|
|
|
|
|
|
|
|
bar(&args)
|
|
|
|
^^^^^^^^^^
|
2023-09-05 19:34:16 +03:00
|
|
|
- name: BlockLocalVariableNode
|
|
|
|
fields:
|
2024-01-09 21:12:03 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: ParameterFlags
|
2023-09-05 19:34:16 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
|
|
|
comment: |
|
|
|
|
Represents a block local variable.
|
|
|
|
|
|
|
|
a { |; b| }
|
|
|
|
^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: BlockNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: locals
|
|
|
|
type: constant[]
|
2023-12-05 00:40:59 +03:00
|
|
|
- name: locals_body_index
|
|
|
|
type: uint32
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: parameters
|
|
|
|
type: node?
|
2023-08-19 03:47:58 +03:00
|
|
|
- name: body
|
2023-08-18 00:39:04 +03:00
|
|
|
type: node?
|
|
|
|
- name: opening_loc
|
|
|
|
type: location
|
|
|
|
- name: closing_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents a block of ruby code.
|
|
|
|
|
|
|
|
[1, 2, 3].each { |i| puts x }
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
- name: BlockParameterNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2024-01-09 21:12:03 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: ParameterFlags
|
2023-09-06 17:46:20 +03:00
|
|
|
- name: name
|
|
|
|
type: constant?
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location?
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents a block parameter to a method, block, or lambda definition.
|
|
|
|
|
|
|
|
def a(&b)
|
|
|
|
^^
|
|
|
|
end
|
|
|
|
- name: BlockParametersNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: parameters
|
|
|
|
type: node?
|
|
|
|
kind: ParametersNode
|
|
|
|
- name: locals
|
2023-09-05 19:34:16 +03:00
|
|
|
type: node[]
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: opening_loc
|
|
|
|
type: location?
|
|
|
|
- name: closing_loc
|
|
|
|
type: location?
|
|
|
|
comment: |
|
|
|
|
Represents a block's parameters declaration.
|
|
|
|
|
|
|
|
-> (a, b = 1; local) { }
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
foo do |a, b = 1; local|
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
end
|
|
|
|
- name: BreakNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: arguments
|
|
|
|
type: node?
|
|
|
|
kind: ArgumentsNode
|
|
|
|
- name: keyword_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `break` keyword.
|
|
|
|
|
|
|
|
break foo
|
|
|
|
^^^^^^^^^
|
2023-09-05 21:16:33 +03:00
|
|
|
- name: CallAndWriteNode
|
|
|
|
fields:
|
2023-12-06 23:32:53 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: CallNodeFlags
|
2023-09-05 21:16:33 +03:00
|
|
|
- name: receiver
|
|
|
|
type: node?
|
|
|
|
- name: call_operator_loc
|
|
|
|
type: location?
|
|
|
|
- name: message_loc
|
|
|
|
type: location?
|
|
|
|
- name: read_name
|
2023-10-01 13:34:55 +03:00
|
|
|
type: constant
|
2023-09-05 21:16:33 +03:00
|
|
|
- name: write_name
|
2023-10-01 13:34:55 +03:00
|
|
|
type: constant
|
2023-09-05 21:16:33 +03:00
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `&&=` operator on a call.
|
|
|
|
|
|
|
|
foo.bar &&= value
|
|
|
|
^^^^^^^^^^^^^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: CallNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-12-06 23:32:53 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: CallNodeFlags
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: receiver
|
|
|
|
type: node?
|
2024-01-02 23:26:21 +03:00
|
|
|
comment: |
|
|
|
|
The object that the method is being called on. This can be either
|
|
|
|
`nil` or a node representing any kind of expression that returns a
|
|
|
|
non-void value.
|
|
|
|
|
|
|
|
foo.bar
|
|
|
|
^^^
|
|
|
|
|
|
|
|
+foo
|
|
|
|
^^^
|
|
|
|
|
|
|
|
foo + bar
|
|
|
|
^^^
|
2023-09-05 20:58:48 +03:00
|
|
|
- name: call_operator_loc
|
2023-08-18 00:39:04 +03:00
|
|
|
type: location?
|
2023-11-20 19:43:26 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: message_loc
|
|
|
|
type: location?
|
|
|
|
- name: opening_loc
|
|
|
|
type: location?
|
|
|
|
- name: arguments
|
|
|
|
type: node?
|
|
|
|
kind: ArgumentsNode
|
|
|
|
- name: closing_loc
|
|
|
|
type: location?
|
|
|
|
- name: block
|
|
|
|
type: node?
|
|
|
|
comment: |
|
|
|
|
Represents a method call, in all of the various forms that can take.
|
|
|
|
|
|
|
|
foo
|
|
|
|
^^^
|
|
|
|
|
|
|
|
foo()
|
|
|
|
^^^^^
|
|
|
|
|
|
|
|
+foo
|
|
|
|
^^^^
|
|
|
|
|
|
|
|
foo + bar
|
|
|
|
^^^^^^^^^
|
|
|
|
|
|
|
|
foo.bar
|
|
|
|
^^^^^^^
|
|
|
|
|
|
|
|
foo&.bar
|
|
|
|
^^^^^^^^
|
2023-09-05 21:16:33 +03:00
|
|
|
- name: CallOperatorWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-12-06 23:32:53 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: CallNodeFlags
|
2023-09-05 21:16:33 +03:00
|
|
|
- name: receiver
|
|
|
|
type: node?
|
|
|
|
- name: call_operator_loc
|
|
|
|
type: location?
|
|
|
|
- name: message_loc
|
|
|
|
type: location?
|
|
|
|
- name: read_name
|
2023-10-01 13:34:55 +03:00
|
|
|
type: constant
|
2023-09-05 21:16:33 +03:00
|
|
|
- name: write_name
|
2023-10-01 13:34:55 +03:00
|
|
|
type: constant
|
2023-09-05 21:16:33 +03:00
|
|
|
- name: operator
|
|
|
|
type: constant
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
comment: |
|
2023-09-05 21:16:33 +03:00
|
|
|
Represents the use of an assignment operator on a call.
|
2023-08-18 00:39:04 +03:00
|
|
|
|
2023-09-05 21:16:33 +03:00
|
|
|
foo.bar += baz
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
- name: CallOrWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-12-06 23:32:53 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: CallNodeFlags
|
2023-09-05 21:16:33 +03:00
|
|
|
- name: receiver
|
|
|
|
type: node?
|
|
|
|
- name: call_operator_loc
|
|
|
|
type: location?
|
|
|
|
- name: message_loc
|
|
|
|
type: location?
|
|
|
|
- name: read_name
|
2023-10-01 13:34:55 +03:00
|
|
|
type: constant
|
2023-09-05 21:16:33 +03:00
|
|
|
- name: write_name
|
2023-10-01 13:34:55 +03:00
|
|
|
type: constant
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
2023-09-05 21:16:33 +03:00
|
|
|
- name: value
|
|
|
|
type: node
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents the use of the `||=` operator on a call.
|
|
|
|
|
|
|
|
foo.bar ||= value
|
|
|
|
^^^^^^^^^^^^^^^^^
|
[ruby/prism] Split up CallNode in target position
In this commit we're splitting up the call nodes that were in target
positions (that is, for loop indices, rescue error captures, and
multi assign targets).
Previously, we would simply leave the call nodes in place. This had
the benefit of keeping the AST relatively simple, but had the
downside of not being very explicit. If a static analysis tool wanted
to only look at call nodes, it could easily be confused because the
method would have 1 fewer argument than it would actually be called
with.
This also brings some consistency to the AST. All of the nodes in
a target position are now *TargetNode nodes. These should all be
treated the same, and the call nodes can now be treated the same.
Finally, there is benefit to memory. Because being in a target
position ensures we don't have some fields, we can strip down the
number of fields on these nodes.
So this commit introduces two new nodes: CallTargetNode and
IndexTargetNode. For CallTargetNode we get to drop the opening_loc,
closing_loc, arguments, and block. Those can never be present. We
also get to mark their fields as non-null, so they will always be
seen as present.
The IndexTargetNode keeps around most of its fields but gets to
drop both the name (because it will always be []=) and the
message_loc (which was always super confusing because it included
the arguments by virtue of being inside the []).
Overall, this adds complexity to the AST at the expense of memory
savings and explicitness. I believe this tradeoff is worth it in
this case, especially because these are very much not common nodes
in the first place.
https://github.com/ruby/prism/commit/3ef71cdb45
2023-12-08 17:57:31 +03:00
|
|
|
- name: CallTargetNode
|
|
|
|
fields:
|
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: CallNodeFlags
|
|
|
|
- name: receiver
|
|
|
|
type: node
|
|
|
|
- name: call_operator_loc
|
|
|
|
type: location
|
|
|
|
- name: name
|
|
|
|
type: constant
|
|
|
|
- name: message_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents assigning to a method call.
|
|
|
|
|
|
|
|
foo.bar, = 1
|
|
|
|
^^^^^^^
|
|
|
|
|
|
|
|
begin
|
|
|
|
rescue => foo.bar
|
|
|
|
^^^^^^^
|
|
|
|
end
|
|
|
|
|
|
|
|
for foo.bar in baz do end
|
|
|
|
^^^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: CapturePatternNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
- name: target
|
|
|
|
type: node
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents assigning to a local variable in pattern matching.
|
|
|
|
|
|
|
|
foo => [bar => baz]
|
|
|
|
^^^^^^^^^^^^
|
2023-11-21 05:38:03 +03:00
|
|
|
- name: CaseMatchNode
|
|
|
|
fields:
|
|
|
|
- name: predicate
|
|
|
|
type: node?
|
|
|
|
- name: conditions
|
|
|
|
type: node[]
|
|
|
|
- name: consequent
|
|
|
|
type: node?
|
|
|
|
kind: ElseNode
|
|
|
|
- name: case_keyword_loc
|
|
|
|
type: location
|
|
|
|
- name: end_keyword_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents the use of a case statement for pattern matching.
|
|
|
|
|
|
|
|
case true
|
|
|
|
in false
|
|
|
|
end
|
|
|
|
^^^^^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: CaseNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: predicate
|
|
|
|
type: node?
|
|
|
|
- name: conditions
|
|
|
|
type: node[]
|
|
|
|
- name: consequent
|
|
|
|
type: node?
|
|
|
|
kind: ElseNode
|
|
|
|
- name: case_keyword_loc
|
|
|
|
type: location
|
|
|
|
- name: end_keyword_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents the use of a case statement.
|
|
|
|
|
2023-10-30 20:01:35 +03:00
|
|
|
case true
|
|
|
|
when false
|
|
|
|
end
|
|
|
|
^^^^^^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: ClassNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: locals
|
|
|
|
type: constant[]
|
|
|
|
- name: class_keyword_loc
|
|
|
|
type: location
|
|
|
|
- name: constant_path
|
|
|
|
type: node
|
|
|
|
- name: inheritance_operator_loc
|
|
|
|
type: location?
|
|
|
|
- name: superclass
|
|
|
|
type: node?
|
2023-08-19 03:47:58 +03:00
|
|
|
- name: body
|
2023-08-18 00:39:04 +03:00
|
|
|
type: node?
|
|
|
|
- name: end_keyword_loc
|
|
|
|
type: location
|
2023-08-25 04:22:20 +03:00
|
|
|
- name: name
|
2023-09-06 19:19:38 +03:00
|
|
|
type: constant
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents a class declaration involving the `class` keyword.
|
|
|
|
|
|
|
|
class Foo end
|
|
|
|
^^^^^^^^^^^^^
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: ClassVariableAndWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-30 22:28:10 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `&&=` operator for assignment to a class variable.
|
|
|
|
|
|
|
|
@@target &&= value
|
2023-10-30 20:01:35 +03:00
|
|
|
^^^^^^^^^^^^^^^^^^
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: ClassVariableOperatorWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-30 22:28:10 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
- name: operator
|
|
|
|
type: constant
|
|
|
|
comment: |
|
|
|
|
Represents assigning to a class variable using an operator that isn't `=`.
|
|
|
|
|
|
|
|
@@target += value
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
- name: ClassVariableOrWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-30 22:28:10 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `||=` operator for assignment to a class variable.
|
|
|
|
|
|
|
|
@@target ||= value
|
|
|
|
^^^^^^^^^^^^^^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: ClassVariableReadNode
|
2023-08-30 23:12:50 +03:00
|
|
|
fields:
|
2023-08-30 22:28:10 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents referencing a class variable.
|
|
|
|
|
|
|
|
@@foo
|
|
|
|
^^^^^
|
2023-08-25 18:57:37 +03:00
|
|
|
- name: ClassVariableTargetNode
|
2023-08-30 23:12:50 +03:00
|
|
|
fields:
|
2023-08-30 22:28:10 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-25 18:57:37 +03:00
|
|
|
comment: |
|
|
|
|
Represents writing to a class variable in a context that doesn't have an explicit value.
|
|
|
|
|
|
|
|
@@foo, @@bar = baz
|
|
|
|
^^^^^ ^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: ClassVariableWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-30 22:28:10 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
2023-09-04 13:46:06 +03:00
|
|
|
type: node
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: operator_loc
|
|
|
|
type: location?
|
|
|
|
comment: |
|
|
|
|
Represents writing to a class variable.
|
|
|
|
|
|
|
|
@@foo = 1
|
|
|
|
^^^^^^^^^
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: ConstantAndWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-09-05 20:53:37 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `&&=` operator for assignment to a constant.
|
|
|
|
|
|
|
|
Target &&= value
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
- name: ConstantOperatorWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-09-05 20:53:37 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
- name: operator
|
|
|
|
type: constant
|
|
|
|
comment: |
|
|
|
|
Represents assigning to a constant using an operator that isn't `=`.
|
|
|
|
|
|
|
|
Target += value
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
- name: ConstantOrWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-09-05 20:53:37 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `||=` operator for assignment to a constant.
|
|
|
|
|
|
|
|
Target ||= value
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
- name: ConstantPathAndWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: target
|
|
|
|
type: node
|
|
|
|
kind: ConstantPathNode
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `&&=` operator for assignment to a constant path.
|
|
|
|
|
|
|
|
Parent::Child &&= value
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: ConstantPathNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: parent
|
|
|
|
type: node?
|
|
|
|
- name: child
|
|
|
|
type: node
|
|
|
|
- name: delimiter_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents accessing a constant through a path of `::` operators.
|
|
|
|
|
|
|
|
Foo::Bar
|
|
|
|
^^^^^^^^
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: ConstantPathOperatorWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: target
|
|
|
|
type: node
|
|
|
|
kind: ConstantPathNode
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
- name: operator
|
|
|
|
type: constant
|
|
|
|
comment: |
|
|
|
|
Represents assigning to a constant path using an operator that isn't `=`.
|
|
|
|
|
|
|
|
Parent::Child += value
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
- name: ConstantPathOrWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: target
|
|
|
|
type: node
|
|
|
|
kind: ConstantPathNode
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `||=` operator for assignment to a constant path.
|
|
|
|
|
|
|
|
Parent::Child ||= value
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-25 18:57:37 +03:00
|
|
|
- name: ConstantPathTargetNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-25 18:57:37 +03:00
|
|
|
- name: parent
|
|
|
|
type: node?
|
|
|
|
- name: child
|
|
|
|
type: node
|
|
|
|
- name: delimiter_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents writing to a constant path in a context that doesn't have an explicit value.
|
|
|
|
|
|
|
|
Foo::Foo, Bar::Bar = baz
|
|
|
|
^^^^^^^^ ^^^^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: ConstantPathWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: target
|
|
|
|
type: node
|
|
|
|
kind: ConstantPathNode
|
|
|
|
- name: operator_loc
|
2023-08-25 20:03:16 +03:00
|
|
|
type: location
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: value
|
2023-08-25 20:03:16 +03:00
|
|
|
type: node
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents writing to a constant path.
|
|
|
|
|
|
|
|
::Foo = 1
|
|
|
|
^^^^^^^^^
|
|
|
|
|
|
|
|
Foo::Bar = 1
|
|
|
|
^^^^^^^^^^^^
|
|
|
|
|
|
|
|
::Foo::Bar = 1
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
- name: ConstantReadNode
|
2023-09-05 20:53:37 +03:00
|
|
|
fields:
|
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents referencing a constant.
|
|
|
|
|
|
|
|
Foo
|
|
|
|
^^^
|
2023-08-25 18:57:37 +03:00
|
|
|
- name: ConstantTargetNode
|
2023-09-05 20:53:37 +03:00
|
|
|
fields:
|
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-25 18:57:37 +03:00
|
|
|
comment: |
|
|
|
|
Represents writing to a constant in a context that doesn't have an explicit value.
|
|
|
|
|
|
|
|
Foo, Bar = baz
|
|
|
|
^^^ ^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: ConstantWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-09-05 20:53:37 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
2023-08-25 20:03:16 +03:00
|
|
|
type: node
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: operator_loc
|
2023-08-25 20:03:16 +03:00
|
|
|
type: location
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents writing to a constant.
|
|
|
|
|
|
|
|
Foo = 1
|
|
|
|
^^^^^^^
|
|
|
|
- name: DefNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-09-06 18:27:00 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: receiver
|
|
|
|
type: node?
|
|
|
|
- name: parameters
|
|
|
|
type: node?
|
|
|
|
kind: ParametersNode
|
2023-08-19 03:47:58 +03:00
|
|
|
- name: body
|
2023-08-18 00:39:04 +03:00
|
|
|
type: node?
|
|
|
|
- name: locals
|
|
|
|
type: constant[]
|
2023-12-05 00:40:59 +03:00
|
|
|
- name: locals_body_index
|
|
|
|
type: uint32
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: def_keyword_loc
|
|
|
|
type: location
|
|
|
|
- name: operator_loc
|
|
|
|
type: location?
|
|
|
|
- name: lparen_loc
|
|
|
|
type: location?
|
|
|
|
- name: rparen_loc
|
|
|
|
type: location?
|
|
|
|
- name: equal_loc
|
|
|
|
type: location?
|
|
|
|
- name: end_keyword_loc
|
|
|
|
type: location?
|
|
|
|
comment: |
|
|
|
|
Represents a method definition.
|
|
|
|
|
|
|
|
def method
|
|
|
|
end
|
|
|
|
^^^^^^^^^^
|
|
|
|
- name: DefinedNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: lparen_loc
|
|
|
|
type: location?
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
- name: rparen_loc
|
|
|
|
type: location?
|
|
|
|
- name: keyword_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `defined?` keyword.
|
|
|
|
|
|
|
|
defined?(a)
|
|
|
|
^^^^^^^^^^^
|
|
|
|
- name: ElseNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: else_keyword_loc
|
|
|
|
type: location
|
|
|
|
- name: statements
|
|
|
|
type: node?
|
|
|
|
kind: StatementsNode
|
|
|
|
- name: end_keyword_loc
|
|
|
|
type: location?
|
|
|
|
comment: |
|
|
|
|
Represents an `else` clause in a `case`, `if`, or `unless` statement.
|
|
|
|
|
|
|
|
if a then b else c end
|
|
|
|
^^^^^^^^^^
|
|
|
|
- name: EmbeddedStatementsNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: opening_loc
|
|
|
|
type: location
|
|
|
|
- name: statements
|
|
|
|
type: node?
|
|
|
|
kind: StatementsNode
|
|
|
|
- name: closing_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents an interpolated set of statements.
|
|
|
|
|
|
|
|
"foo #{bar}"
|
|
|
|
^^^^^^
|
|
|
|
- name: EmbeddedVariableNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: variable
|
|
|
|
type: node
|
|
|
|
comment: |
|
|
|
|
Represents an interpolated variable.
|
|
|
|
|
|
|
|
"foo #@bar"
|
|
|
|
^^^^^
|
|
|
|
- name: EnsureNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: ensure_keyword_loc
|
|
|
|
type: location
|
|
|
|
- name: statements
|
|
|
|
type: node?
|
|
|
|
kind: StatementsNode
|
|
|
|
- name: end_keyword_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents an `ensure` clause in a `begin` statement.
|
|
|
|
|
|
|
|
begin
|
|
|
|
foo
|
|
|
|
ensure
|
|
|
|
^^^^^^
|
|
|
|
bar
|
|
|
|
end
|
|
|
|
- name: FalseNode
|
|
|
|
comment: |
|
|
|
|
Represents the use of the literal `false` keyword.
|
|
|
|
|
|
|
|
false
|
|
|
|
^^^^^
|
|
|
|
- name: FindPatternNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: constant
|
|
|
|
type: node?
|
|
|
|
- name: left
|
|
|
|
type: node
|
|
|
|
- name: requireds
|
|
|
|
type: node[]
|
|
|
|
- name: right
|
|
|
|
type: node
|
|
|
|
- name: opening_loc
|
|
|
|
type: location?
|
|
|
|
- name: closing_loc
|
|
|
|
type: location?
|
|
|
|
comment: |
|
|
|
|
Represents a find pattern in pattern matching.
|
|
|
|
|
|
|
|
foo in *bar, baz, *qux
|
2023-10-30 20:01:35 +03:00
|
|
|
^^^^^^^^^^^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
|
|
|
|
foo in [*bar, baz, *qux]
|
2023-10-30 20:01:35 +03:00
|
|
|
^^^^^^^^^^^^^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
|
|
|
|
foo in Foo(*bar, baz, *qux)
|
2023-10-30 20:01:35 +03:00
|
|
|
^^^^^^^^^^^^^^^^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: FlipFlopNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-12-06 23:32:53 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: RangeFlags
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: left
|
|
|
|
type: node?
|
|
|
|
- name: right
|
|
|
|
type: node?
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `..` or `...` operators to create flip flops.
|
|
|
|
|
|
|
|
baz if foo .. bar
|
|
|
|
^^^^^^^^^^
|
|
|
|
- name: FloatNode
|
|
|
|
comment: |
|
|
|
|
Represents a floating point number literal.
|
|
|
|
|
|
|
|
1.0
|
|
|
|
^^^
|
|
|
|
- name: ForNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: index
|
|
|
|
type: node
|
|
|
|
- name: collection
|
|
|
|
type: node
|
|
|
|
- name: statements
|
|
|
|
type: node?
|
|
|
|
kind: StatementsNode
|
|
|
|
- name: for_keyword_loc
|
|
|
|
type: location
|
|
|
|
- name: in_keyword_loc
|
|
|
|
type: location
|
|
|
|
- name: do_keyword_loc
|
|
|
|
type: location?
|
|
|
|
- name: end_keyword_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `for` keyword.
|
|
|
|
|
|
|
|
for i in a end
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
- name: ForwardingArgumentsNode
|
|
|
|
comment: |
|
|
|
|
Represents forwarding all arguments to this method to another method.
|
|
|
|
|
|
|
|
def foo(...)
|
|
|
|
bar(...)
|
2023-10-30 20:01:35 +03:00
|
|
|
^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
end
|
|
|
|
- name: ForwardingParameterNode
|
|
|
|
comment: |
|
|
|
|
Represents the use of the forwarding parameter in a method, block, or lambda declaration.
|
|
|
|
|
|
|
|
def foo(...)
|
|
|
|
^^^
|
|
|
|
end
|
|
|
|
- name: ForwardingSuperNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: block
|
|
|
|
type: node?
|
|
|
|
kind: BlockNode
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `super` keyword without parentheses or arguments.
|
|
|
|
|
|
|
|
super
|
|
|
|
^^^^^
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: GlobalVariableAndWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-09-01 16:40:08 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `&&=` operator for assignment to a global variable.
|
|
|
|
|
|
|
|
$target &&= value
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
- name: GlobalVariableOperatorWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-09-01 16:40:08 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
- name: operator
|
|
|
|
type: constant
|
|
|
|
comment: |
|
|
|
|
Represents assigning to a global variable using an operator that isn't `=`.
|
|
|
|
|
|
|
|
$target += value
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
- name: GlobalVariableOrWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-09-01 16:40:08 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `||=` operator for assignment to a global variable.
|
|
|
|
|
|
|
|
$target ||= value
|
|
|
|
^^^^^^^^^^^^^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: GlobalVariableReadNode
|
2023-09-01 16:40:08 +03:00
|
|
|
fields:
|
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents referencing a global variable.
|
|
|
|
|
|
|
|
$foo
|
|
|
|
^^^^
|
2023-08-25 18:57:37 +03:00
|
|
|
- name: GlobalVariableTargetNode
|
2023-09-01 16:40:08 +03:00
|
|
|
fields:
|
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-25 18:57:37 +03:00
|
|
|
comment: |
|
|
|
|
Represents writing to a global variable in a context that doesn't have an explicit value.
|
|
|
|
|
|
|
|
$foo, $bar = baz
|
|
|
|
^^^^ ^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: GlobalVariableWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-09-01 16:40:08 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
2023-08-25 20:03:16 +03:00
|
|
|
type: node
|
2023-08-30 23:43:40 +03:00
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents writing to a global variable.
|
|
|
|
|
|
|
|
$foo = 1
|
|
|
|
^^^^^^^^
|
|
|
|
- name: HashNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: opening_loc
|
|
|
|
type: location
|
2024-01-07 12:26:21 +03:00
|
|
|
comment: |
|
|
|
|
The location of the opening brace.
|
|
|
|
|
|
|
|
{ a => b }
|
|
|
|
^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: elements
|
|
|
|
type: node[]
|
2024-01-07 12:26:21 +03:00
|
|
|
comment: |
|
|
|
|
The elements of the hash. These can be either `AssocNode`s or `AssocSplatNode`s.
|
|
|
|
|
|
|
|
{ a: b }
|
|
|
|
^^^^
|
|
|
|
|
|
|
|
{ **foo }
|
|
|
|
^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: closing_loc
|
|
|
|
type: location
|
2024-01-07 12:26:21 +03:00
|
|
|
comment: |
|
|
|
|
The location of the closing brace.
|
|
|
|
|
|
|
|
{ a => b }
|
|
|
|
^
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents a hash literal.
|
|
|
|
|
|
|
|
{ a => b }
|
|
|
|
^^^^^^^^^^
|
|
|
|
- name: HashPatternNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: constant
|
|
|
|
type: node?
|
2023-10-23 17:42:55 +03:00
|
|
|
- name: elements
|
2023-08-18 00:39:04 +03:00
|
|
|
type: node[]
|
2023-10-23 17:42:55 +03:00
|
|
|
- name: rest
|
2023-08-18 00:39:04 +03:00
|
|
|
type: node?
|
|
|
|
- name: opening_loc
|
|
|
|
type: location?
|
|
|
|
- name: closing_loc
|
|
|
|
type: location?
|
|
|
|
comment: |
|
|
|
|
Represents a hash pattern in pattern matching.
|
|
|
|
|
|
|
|
foo => { a: 1, b: 2 }
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
foo => { a: 1, b: 2, **c }
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
- name: IfNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: if_keyword_loc
|
|
|
|
type: location?
|
|
|
|
- name: predicate
|
|
|
|
type: node
|
2023-11-16 01:55:16 +03:00
|
|
|
- name: then_keyword_loc
|
|
|
|
type: location?
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: statements
|
|
|
|
type: node?
|
|
|
|
kind: StatementsNode
|
|
|
|
- name: consequent
|
|
|
|
type: node?
|
|
|
|
- name: end_keyword_loc
|
|
|
|
type: location?
|
|
|
|
newline: predicate
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `if` keyword, either in the block form or the modifier form.
|
|
|
|
|
|
|
|
bar if foo
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
|
|
|
if foo then bar end
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
- name: ImaginaryNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: numeric
|
|
|
|
type: node
|
|
|
|
comment: |
|
|
|
|
Represents an imaginary number literal.
|
|
|
|
|
|
|
|
1.0i
|
|
|
|
^^^^
|
2023-09-13 16:39:20 +03:00
|
|
|
- name: ImplicitNode
|
|
|
|
fields:
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
comment: |
|
|
|
|
Represents a node that is implicitly being added to the tree but doesn't
|
|
|
|
correspond directly to a node in the source.
|
|
|
|
|
|
|
|
{ foo: }
|
|
|
|
^^^^
|
|
|
|
|
|
|
|
{ Foo: }
|
|
|
|
^^^^
|
[ruby/prism] Implicit rest nodes
Fundamentally, `foo { |bar,| }` is different from `foo { |bar, *| }`
because of arity checks. This PR introduces a new node to handle
that, `ImplicitRestNode`, which goes in the `rest` slot of parameter
nodes instead of `RestParameterNode` instances.
This is also used in a couple of other places, namely:
* pattern matching: `foo in [bar,]`
* multi target: `for foo, in bar do end`
* multi write: `foo, = bar`
Now the only splat nodes with a `NULL` value are when you're
forwarding, as in: `def foo(*) = bar(*)`.
https://github.com/ruby/prism/commit/dba2a3b652
2023-11-28 23:49:04 +03:00
|
|
|
- name: ImplicitRestNode
|
|
|
|
comment: |
|
|
|
|
Represents using a trailing comma to indicate an implicit rest parameter.
|
|
|
|
|
|
|
|
foo { |bar,| }
|
|
|
|
^
|
|
|
|
|
|
|
|
foo in [bar,]
|
|
|
|
^
|
|
|
|
|
|
|
|
for foo, in bar do end
|
|
|
|
^
|
|
|
|
|
|
|
|
foo, = bar
|
|
|
|
^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: InNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: pattern
|
|
|
|
type: node
|
|
|
|
- name: statements
|
|
|
|
type: node?
|
|
|
|
kind: StatementsNode
|
|
|
|
- name: in_loc
|
|
|
|
type: location
|
|
|
|
- name: then_loc
|
|
|
|
type: location?
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `in` keyword in a case statement.
|
|
|
|
|
|
|
|
case a; in b then c end
|
|
|
|
^^^^^^^^^^^
|
[ruby/prism] Index{Operator,And,Or}WriteNode
Right now, our Call{Operator,And,Or}WriteNode nodes represent two
different concepts:
```ruby
foo.bar += 1
foo[bar] += 1
```
These two statements are different in what they can support. The
former can never have arguments (or an opening_loc or closing_loc).
The former can also never have a block. Also, the former is a
variable method name.
The latter is always going to be []/[]=, it can have any number of
arguments including blocks (`foo[&bar] ||= 1`), and will always
have an opening_loc and closing_loc.
Furthermore, these statements end of having to take different paths
through the various compilers because with the latter you have to
consider the arguments and the block, whereas the former can
perform some additional peephole optimizations since there are
fewer values on the stack.
For these reasons, I'm introducing Index{Operator,And,Or}WriteNode.
These nodes never have a read_name or write_name on them because
they are always []/[]=. They also support blocks, which the previous
write nodes didn't. As a benefit of introducing these nodes, I've
removed the opening_loc, closing_loc, and arguments from the older
write nodes because they will always be null.
For the serialized format, both of these nodes end up being
smaller, and for in-memory we're storing fewer things in general,
so we have savings all around.
I don't love that we are introducing another node that is a call
node since we generally want consumers to only have to handle a
single call, but these nodes are so specific that they would have
to be handled separately anyway since in fact call 2 methods.
https://github.com/ruby/prism/commit/70155db9cd
2023-10-17 18:15:56 +03:00
|
|
|
- name: IndexAndWriteNode
|
|
|
|
fields:
|
2023-12-06 23:32:53 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: CallNodeFlags
|
[ruby/prism] Index{Operator,And,Or}WriteNode
Right now, our Call{Operator,And,Or}WriteNode nodes represent two
different concepts:
```ruby
foo.bar += 1
foo[bar] += 1
```
These two statements are different in what they can support. The
former can never have arguments (or an opening_loc or closing_loc).
The former can also never have a block. Also, the former is a
variable method name.
The latter is always going to be []/[]=, it can have any number of
arguments including blocks (`foo[&bar] ||= 1`), and will always
have an opening_loc and closing_loc.
Furthermore, these statements end of having to take different paths
through the various compilers because with the latter you have to
consider the arguments and the block, whereas the former can
perform some additional peephole optimizations since there are
fewer values on the stack.
For these reasons, I'm introducing Index{Operator,And,Or}WriteNode.
These nodes never have a read_name or write_name on them because
they are always []/[]=. They also support blocks, which the previous
write nodes didn't. As a benefit of introducing these nodes, I've
removed the opening_loc, closing_loc, and arguments from the older
write nodes because they will always be null.
For the serialized format, both of these nodes end up being
smaller, and for in-memory we're storing fewer things in general,
so we have savings all around.
I don't love that we are introducing another node that is a call
node since we generally want consumers to only have to handle a
single call, but these nodes are so specific that they would have
to be handled separately anyway since in fact call 2 methods.
https://github.com/ruby/prism/commit/70155db9cd
2023-10-17 18:15:56 +03:00
|
|
|
- name: receiver
|
|
|
|
type: node?
|
|
|
|
- name: call_operator_loc
|
|
|
|
type: location?
|
|
|
|
- name: opening_loc
|
|
|
|
type: location
|
|
|
|
- name: arguments
|
|
|
|
type: node?
|
|
|
|
kind: ArgumentsNode
|
|
|
|
- name: closing_loc
|
|
|
|
type: location
|
|
|
|
- name: block
|
|
|
|
type: node?
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `&&=` operator on a call to the `[]` method.
|
|
|
|
|
|
|
|
foo.bar[baz] &&= value
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
- name: IndexOperatorWriteNode
|
|
|
|
fields:
|
2023-12-06 23:32:53 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: CallNodeFlags
|
[ruby/prism] Index{Operator,And,Or}WriteNode
Right now, our Call{Operator,And,Or}WriteNode nodes represent two
different concepts:
```ruby
foo.bar += 1
foo[bar] += 1
```
These two statements are different in what they can support. The
former can never have arguments (or an opening_loc or closing_loc).
The former can also never have a block. Also, the former is a
variable method name.
The latter is always going to be []/[]=, it can have any number of
arguments including blocks (`foo[&bar] ||= 1`), and will always
have an opening_loc and closing_loc.
Furthermore, these statements end of having to take different paths
through the various compilers because with the latter you have to
consider the arguments and the block, whereas the former can
perform some additional peephole optimizations since there are
fewer values on the stack.
For these reasons, I'm introducing Index{Operator,And,Or}WriteNode.
These nodes never have a read_name or write_name on them because
they are always []/[]=. They also support blocks, which the previous
write nodes didn't. As a benefit of introducing these nodes, I've
removed the opening_loc, closing_loc, and arguments from the older
write nodes because they will always be null.
For the serialized format, both of these nodes end up being
smaller, and for in-memory we're storing fewer things in general,
so we have savings all around.
I don't love that we are introducing another node that is a call
node since we generally want consumers to only have to handle a
single call, but these nodes are so specific that they would have
to be handled separately anyway since in fact call 2 methods.
https://github.com/ruby/prism/commit/70155db9cd
2023-10-17 18:15:56 +03:00
|
|
|
- name: receiver
|
|
|
|
type: node?
|
|
|
|
- name: call_operator_loc
|
|
|
|
type: location?
|
|
|
|
- name: opening_loc
|
|
|
|
type: location
|
|
|
|
- name: arguments
|
|
|
|
type: node?
|
|
|
|
kind: ArgumentsNode
|
|
|
|
- name: closing_loc
|
|
|
|
type: location
|
|
|
|
- name: block
|
|
|
|
type: node?
|
|
|
|
- name: operator
|
|
|
|
type: constant
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
comment: |
|
|
|
|
Represents the use of an assignment operator on a call to `[]`.
|
|
|
|
|
|
|
|
foo.bar[baz] += value
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
- name: IndexOrWriteNode
|
|
|
|
fields:
|
2023-12-06 23:32:53 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: CallNodeFlags
|
[ruby/prism] Index{Operator,And,Or}WriteNode
Right now, our Call{Operator,And,Or}WriteNode nodes represent two
different concepts:
```ruby
foo.bar += 1
foo[bar] += 1
```
These two statements are different in what they can support. The
former can never have arguments (or an opening_loc or closing_loc).
The former can also never have a block. Also, the former is a
variable method name.
The latter is always going to be []/[]=, it can have any number of
arguments including blocks (`foo[&bar] ||= 1`), and will always
have an opening_loc and closing_loc.
Furthermore, these statements end of having to take different paths
through the various compilers because with the latter you have to
consider the arguments and the block, whereas the former can
perform some additional peephole optimizations since there are
fewer values on the stack.
For these reasons, I'm introducing Index{Operator,And,Or}WriteNode.
These nodes never have a read_name or write_name on them because
they are always []/[]=. They also support blocks, which the previous
write nodes didn't. As a benefit of introducing these nodes, I've
removed the opening_loc, closing_loc, and arguments from the older
write nodes because they will always be null.
For the serialized format, both of these nodes end up being
smaller, and for in-memory we're storing fewer things in general,
so we have savings all around.
I don't love that we are introducing another node that is a call
node since we generally want consumers to only have to handle a
single call, but these nodes are so specific that they would have
to be handled separately anyway since in fact call 2 methods.
https://github.com/ruby/prism/commit/70155db9cd
2023-10-17 18:15:56 +03:00
|
|
|
- name: receiver
|
|
|
|
type: node?
|
|
|
|
- name: call_operator_loc
|
|
|
|
type: location?
|
|
|
|
- name: opening_loc
|
|
|
|
type: location
|
|
|
|
- name: arguments
|
|
|
|
type: node?
|
|
|
|
kind: ArgumentsNode
|
|
|
|
- name: closing_loc
|
|
|
|
type: location
|
|
|
|
- name: block
|
|
|
|
type: node?
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `||=` operator on a call to `[]`.
|
|
|
|
|
|
|
|
foo.bar[baz] ||= value
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^
|
[ruby/prism] Split up CallNode in target position
In this commit we're splitting up the call nodes that were in target
positions (that is, for loop indices, rescue error captures, and
multi assign targets).
Previously, we would simply leave the call nodes in place. This had
the benefit of keeping the AST relatively simple, but had the
downside of not being very explicit. If a static analysis tool wanted
to only look at call nodes, it could easily be confused because the
method would have 1 fewer argument than it would actually be called
with.
This also brings some consistency to the AST. All of the nodes in
a target position are now *TargetNode nodes. These should all be
treated the same, and the call nodes can now be treated the same.
Finally, there is benefit to memory. Because being in a target
position ensures we don't have some fields, we can strip down the
number of fields on these nodes.
So this commit introduces two new nodes: CallTargetNode and
IndexTargetNode. For CallTargetNode we get to drop the opening_loc,
closing_loc, arguments, and block. Those can never be present. We
also get to mark their fields as non-null, so they will always be
seen as present.
The IndexTargetNode keeps around most of its fields but gets to
drop both the name (because it will always be []=) and the
message_loc (which was always super confusing because it included
the arguments by virtue of being inside the []).
Overall, this adds complexity to the AST at the expense of memory
savings and explicitness. I believe this tradeoff is worth it in
this case, especially because these are very much not common nodes
in the first place.
https://github.com/ruby/prism/commit/3ef71cdb45
2023-12-08 17:57:31 +03:00
|
|
|
- name: IndexTargetNode
|
|
|
|
fields:
|
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: CallNodeFlags
|
|
|
|
- name: receiver
|
|
|
|
type: node
|
|
|
|
- name: opening_loc
|
|
|
|
type: location
|
|
|
|
- name: arguments
|
|
|
|
type: node?
|
|
|
|
kind: ArgumentsNode
|
|
|
|
- name: closing_loc
|
|
|
|
type: location
|
|
|
|
- name: block
|
|
|
|
type: node?
|
|
|
|
comment: |
|
|
|
|
Represents assigning to an index.
|
|
|
|
|
|
|
|
foo[bar], = 1
|
|
|
|
^^^^^^^^
|
|
|
|
|
|
|
|
begin
|
|
|
|
rescue => foo[bar]
|
|
|
|
^^^^^^^^
|
|
|
|
end
|
|
|
|
|
|
|
|
for foo[bar] in baz do end
|
|
|
|
^^^^^^^^
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: InstanceVariableAndWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-29 16:17:34 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `&&=` operator for assignment to an instance variable.
|
|
|
|
|
|
|
|
@target &&= value
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
- name: InstanceVariableOperatorWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-29 16:17:34 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
- name: operator
|
|
|
|
type: constant
|
|
|
|
comment: |
|
|
|
|
Represents assigning to an instance variable using an operator that isn't `=`.
|
|
|
|
|
|
|
|
@target += value
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
- name: InstanceVariableOrWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-29 16:17:34 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `||=` operator for assignment to an instance variable.
|
|
|
|
|
|
|
|
@target ||= value
|
|
|
|
^^^^^^^^^^^^^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: InstanceVariableReadNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-29 16:17:34 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents referencing an instance variable.
|
|
|
|
|
|
|
|
@foo
|
|
|
|
^^^^
|
2023-08-25 18:57:37 +03:00
|
|
|
- name: InstanceVariableTargetNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-29 16:17:34 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-25 18:57:37 +03:00
|
|
|
comment: |
|
|
|
|
Represents writing to an instance variable in a context that doesn't have an explicit value.
|
|
|
|
|
|
|
|
@foo, @bar = baz
|
|
|
|
^^^^ ^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: InstanceVariableWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-29 16:17:34 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
2023-08-25 20:03:16 +03:00
|
|
|
type: node
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: operator_loc
|
2023-08-25 20:03:16 +03:00
|
|
|
type: location
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents writing to an instance variable.
|
|
|
|
|
|
|
|
@foo = 1
|
|
|
|
^^^^^^^^
|
|
|
|
- name: IntegerNode
|
2023-09-11 19:05:14 +03:00
|
|
|
fields:
|
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: IntegerBaseFlags
|
2024-01-03 08:28:03 +03:00
|
|
|
comment: |
|
|
|
|
Represents flag indicating the base of the integer
|
2024-01-03 19:44:19 +03:00
|
|
|
|
2024-01-03 08:28:03 +03:00
|
|
|
10 base decimal, value 10
|
|
|
|
0d10 base decimal, value 10
|
|
|
|
0b10 base binary, value 2
|
|
|
|
0o10 base octal, value 8
|
|
|
|
010 base octal, value 8
|
|
|
|
0x10 base hexidecimal, value 16
|
2024-01-03 19:44:26 +03:00
|
|
|
|
2024-01-03 08:28:03 +03:00
|
|
|
A 0 prefix indicates the number has a different base.
|
|
|
|
The d, b, o, and x prefixes indicate the base. If one of those
|
|
|
|
four letters is omitted, the base is assumed to be octal.
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents an integer number literal.
|
|
|
|
|
|
|
|
1
|
|
|
|
^
|
2023-09-11 19:32:25 +03:00
|
|
|
- name: InterpolatedMatchLastLineNode
|
|
|
|
fields:
|
2023-12-06 23:32:53 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: RegularExpressionFlags
|
2023-09-11 19:32:25 +03:00
|
|
|
- name: opening_loc
|
|
|
|
type: location
|
|
|
|
- name: parts
|
|
|
|
type: node[]
|
|
|
|
- name: closing_loc
|
|
|
|
type: location
|
|
|
|
newline: parts
|
|
|
|
comment: |
|
|
|
|
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.
|
|
|
|
|
|
|
|
if /foo #{bar} baz/ then end
|
|
|
|
^^^^^^^^^^^^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: InterpolatedRegularExpressionNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-12-06 23:32:53 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: RegularExpressionFlags
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: opening_loc
|
|
|
|
type: location
|
|
|
|
- name: parts
|
|
|
|
type: node[]
|
|
|
|
- name: closing_loc
|
|
|
|
type: location
|
|
|
|
newline: parts
|
|
|
|
comment: |
|
|
|
|
Represents a regular expression literal that contains interpolation.
|
|
|
|
|
|
|
|
/foo #{bar} baz/
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
- name: InterpolatedStringNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: opening_loc
|
|
|
|
type: location?
|
|
|
|
- name: parts
|
|
|
|
type: node[]
|
|
|
|
- name: closing_loc
|
|
|
|
type: location?
|
|
|
|
newline: parts
|
|
|
|
comment: |
|
|
|
|
Represents a string literal that contains interpolation.
|
|
|
|
|
|
|
|
"foo #{bar} baz"
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
- name: InterpolatedSymbolNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: opening_loc
|
|
|
|
type: location?
|
|
|
|
- name: parts
|
|
|
|
type: node[]
|
|
|
|
- name: closing_loc
|
|
|
|
type: location?
|
|
|
|
newline: parts
|
|
|
|
comment: |
|
|
|
|
Represents a symbol literal that contains interpolation.
|
|
|
|
|
|
|
|
:"foo #{bar} baz"
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
- name: InterpolatedXStringNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: opening_loc
|
|
|
|
type: location
|
|
|
|
- name: parts
|
|
|
|
type: node[]
|
|
|
|
- name: closing_loc
|
|
|
|
type: location
|
|
|
|
newline: parts
|
|
|
|
comment: |
|
|
|
|
Represents an xstring literal that contains interpolation.
|
|
|
|
|
|
|
|
`foo #{bar} baz`
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
- name: KeywordHashNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-12-11 23:26:06 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: KeywordHashNodeFlags
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: elements
|
|
|
|
type: node[]
|
|
|
|
comment: |
|
|
|
|
Represents a hash literal without opening and closing braces.
|
|
|
|
|
|
|
|
foo(a: b)
|
|
|
|
^^^^
|
|
|
|
- name: KeywordRestParameterNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2024-01-09 21:12:03 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: ParameterFlags
|
2023-09-06 18:14:38 +03:00
|
|
|
- name: name
|
|
|
|
type: constant?
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location?
|
2023-09-06 18:14:38 +03:00
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents a keyword rest parameter to a method, block, or lambda definition.
|
|
|
|
|
|
|
|
def a(**b)
|
|
|
|
^^^
|
|
|
|
end
|
|
|
|
- name: LambdaNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: locals
|
|
|
|
type: constant[]
|
2023-12-05 00:40:59 +03:00
|
|
|
- name: locals_body_index
|
|
|
|
type: uint32
|
2023-08-22 04:12:52 +03:00
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: opening_loc
|
|
|
|
type: location
|
2023-08-22 04:12:52 +03:00
|
|
|
- name: closing_loc
|
|
|
|
type: location
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: parameters
|
|
|
|
type: node?
|
2023-08-19 03:47:58 +03:00
|
|
|
- name: body
|
2023-08-18 00:39:04 +03:00
|
|
|
type: node?
|
|
|
|
comment: |
|
|
|
|
Represents using a lambda literal (not the lambda method call).
|
|
|
|
|
|
|
|
->(value) { value * 2 }
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: LocalVariableAndWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
2023-08-27 18:56:53 +03:00
|
|
|
- name: name
|
2023-08-25 17:49:00 +03:00
|
|
|
type: constant
|
|
|
|
- name: depth
|
|
|
|
type: uint32
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `&&=` operator for assignment to a local variable.
|
|
|
|
|
|
|
|
target &&= value
|
|
|
|
^^^^^^^^^^^^^^^^
|
|
|
|
- name: LocalVariableOperatorWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
2023-08-27 18:56:53 +03:00
|
|
|
- name: name
|
2023-08-25 17:49:00 +03:00
|
|
|
type: constant
|
2023-08-27 18:56:53 +03:00
|
|
|
- name: operator
|
2023-08-25 17:49:00 +03:00
|
|
|
type: constant
|
|
|
|
- name: depth
|
|
|
|
type: uint32
|
|
|
|
comment: |
|
|
|
|
Represents assigning to a local variable using an operator that isn't `=`.
|
|
|
|
|
|
|
|
target += value
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
- name: LocalVariableOrWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-25 17:49:00 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
2023-08-27 18:56:53 +03:00
|
|
|
- name: name
|
2023-08-25 17:49:00 +03:00
|
|
|
type: constant
|
|
|
|
- name: depth
|
|
|
|
type: uint32
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `||=` operator for assignment to a local variable.
|
|
|
|
|
|
|
|
target ||= value
|
|
|
|
^^^^^^^^^^^^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: LocalVariableReadNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-27 18:56:53 +03:00
|
|
|
- name: name
|
2023-08-18 00:39:04 +03:00
|
|
|
type: constant
|
|
|
|
- name: depth
|
|
|
|
type: uint32
|
|
|
|
comment: |
|
|
|
|
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.
|
|
|
|
|
|
|
|
foo
|
|
|
|
^^^
|
2023-08-25 18:57:37 +03:00
|
|
|
- name: LocalVariableTargetNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-27 18:56:53 +03:00
|
|
|
- name: name
|
2023-08-25 18:57:37 +03:00
|
|
|
type: constant
|
|
|
|
- name: depth
|
|
|
|
type: uint32
|
|
|
|
comment: |
|
|
|
|
Represents writing to a local variable in a context that doesn't have an explicit value.
|
|
|
|
|
|
|
|
foo, bar = baz
|
|
|
|
^^^ ^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: LocalVariableWriteNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-27 18:56:53 +03:00
|
|
|
- name: name
|
2023-08-18 00:39:04 +03:00
|
|
|
type: constant
|
|
|
|
- name: depth
|
|
|
|
type: uint32
|
|
|
|
- name: name_loc
|
|
|
|
type: location
|
2023-08-30 23:48:17 +03:00
|
|
|
- name: value
|
|
|
|
type: node
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: operator_loc
|
2023-08-25 20:03:16 +03:00
|
|
|
type: location
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents writing to a local variable.
|
|
|
|
|
|
|
|
foo = 1
|
|
|
|
^^^^^^^
|
2023-09-11 19:32:25 +03:00
|
|
|
- name: MatchLastLineNode
|
|
|
|
fields:
|
2023-12-06 23:32:53 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: RegularExpressionFlags
|
2023-09-11 19:32:25 +03:00
|
|
|
- name: opening_loc
|
|
|
|
type: location
|
|
|
|
- name: content_loc
|
|
|
|
type: location
|
|
|
|
- name: closing_loc
|
|
|
|
type: location
|
|
|
|
- name: unescaped
|
|
|
|
type: string
|
|
|
|
comment: |
|
|
|
|
Represents a regular expression literal used in the predicate of a
|
|
|
|
conditional to implicitly match against the last line read by an IO
|
|
|
|
object.
|
|
|
|
|
|
|
|
if /foo/i then end
|
|
|
|
^^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: MatchPredicateNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
- name: pattern
|
|
|
|
type: node
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents the use of the modifier `in` operator.
|
|
|
|
|
|
|
|
foo in bar
|
|
|
|
^^^^^^^^^^
|
|
|
|
- name: MatchRequiredNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
- name: pattern
|
|
|
|
type: node
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `=>` operator.
|
|
|
|
|
|
|
|
foo => bar
|
|
|
|
^^^^^^^^^^
|
2023-09-14 16:01:20 +03:00
|
|
|
- name: MatchWriteNode
|
|
|
|
fields:
|
|
|
|
- name: call
|
|
|
|
type: node
|
|
|
|
kind: CallNode
|
2023-11-10 06:59:35 +03:00
|
|
|
- name: targets
|
|
|
|
type: node[]
|
2023-09-14 16:01:20 +03:00
|
|
|
comment: |
|
|
|
|
Represents writing local variables using a regular expression match with
|
|
|
|
named capture groups.
|
|
|
|
|
|
|
|
/(?<foo>bar)/ =~ baz
|
|
|
|
^^^^^^^^^^^^^^^^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: MissingNode
|
|
|
|
comment: |
|
|
|
|
Represents a node that is missing from the source and results in a syntax
|
|
|
|
error.
|
|
|
|
- name: ModuleNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: locals
|
|
|
|
type: constant[]
|
|
|
|
- name: module_keyword_loc
|
|
|
|
type: location
|
|
|
|
- name: constant_path
|
|
|
|
type: node
|
2023-08-19 03:47:58 +03:00
|
|
|
- name: body
|
2023-08-18 00:39:04 +03:00
|
|
|
type: node?
|
|
|
|
- name: end_keyword_loc
|
|
|
|
type: location
|
2023-08-25 04:22:20 +03:00
|
|
|
- name: name
|
2023-09-06 19:19:38 +03:00
|
|
|
type: constant
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents a module declaration involving the `module` keyword.
|
|
|
|
|
|
|
|
module Foo end
|
|
|
|
^^^^^^^^^^^^^^
|
2023-09-07 20:00:45 +03:00
|
|
|
- name: MultiTargetNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-10-26 21:56:21 +03:00
|
|
|
- name: lefts
|
2023-10-23 19:06:21 +03:00
|
|
|
type: node[]
|
|
|
|
- name: rest
|
|
|
|
type: node?
|
2023-10-26 21:56:21 +03:00
|
|
|
- name: rights
|
2023-08-18 00:39:04 +03:00
|
|
|
type: node[]
|
|
|
|
- name: lparen_loc
|
|
|
|
type: location?
|
|
|
|
- name: rparen_loc
|
|
|
|
type: location?
|
|
|
|
comment: |
|
|
|
|
Represents a multi-target expression.
|
|
|
|
|
2023-10-26 21:02:27 +03:00
|
|
|
a, (b, c) = 1, 2, 3
|
|
|
|
^^^^^^
|
2023-09-07 20:00:45 +03:00
|
|
|
- name: MultiWriteNode
|
|
|
|
fields:
|
2023-10-26 21:56:21 +03:00
|
|
|
- name: lefts
|
2023-10-23 19:06:21 +03:00
|
|
|
type: node[]
|
|
|
|
- name: rest
|
|
|
|
type: node?
|
2023-10-26 21:56:21 +03:00
|
|
|
- name: rights
|
2023-09-07 21:20:18 +03:00
|
|
|
type: node[]
|
|
|
|
- name: lparen_loc
|
|
|
|
type: location?
|
|
|
|
- name: rparen_loc
|
|
|
|
type: location?
|
2023-09-07 20:00:45 +03:00
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
comment: |
|
|
|
|
Represents a write to a multi-target expression.
|
|
|
|
|
2023-08-18 00:39:04 +03:00
|
|
|
a, b, c = 1, 2, 3
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
- name: NextNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: arguments
|
|
|
|
type: node?
|
|
|
|
kind: ArgumentsNode
|
|
|
|
- name: keyword_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `next` keyword.
|
|
|
|
|
|
|
|
next 1
|
|
|
|
^^^^^^
|
|
|
|
- name: NilNode
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `nil` keyword.
|
|
|
|
|
|
|
|
nil
|
|
|
|
^^^
|
|
|
|
- name: NoKeywordsParameterNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: keyword_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents the use of `**nil` inside method arguments.
|
|
|
|
|
|
|
|
def a(**nil)
|
|
|
|
^^^^^
|
|
|
|
end
|
2023-12-01 04:47:08 +03:00
|
|
|
- name: NumberedParametersNode
|
|
|
|
fields:
|
|
|
|
- name: maximum
|
|
|
|
type: uint8
|
|
|
|
comment: |
|
|
|
|
Represents an implicit set of parameters through the use of numbered
|
|
|
|
parameters within a block or lambda.
|
|
|
|
|
|
|
|
-> { _1 + _2 }
|
|
|
|
^^^^^^^^^^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: NumberedReferenceReadNode
|
2023-08-31 00:21:50 +03:00
|
|
|
fields:
|
|
|
|
- name: number
|
|
|
|
type: uint32
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents reading a numbered reference to a capture in the previous match.
|
|
|
|
|
|
|
|
$1
|
|
|
|
^^
|
2023-10-31 23:00:28 +03:00
|
|
|
- name: OptionalKeywordParameterNode
|
|
|
|
fields:
|
2024-01-09 21:12:03 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: ParameterFlags
|
2023-10-31 23:00:28 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
|
|
|
- name: name_loc
|
|
|
|
type: location
|
2023-11-01 15:36:15 +03:00
|
|
|
- name: value
|
|
|
|
type: node
|
2023-10-31 23:00:28 +03:00
|
|
|
comment: |
|
|
|
|
Represents an optional keyword parameter to a method, block, or lambda definition.
|
|
|
|
|
2023-11-01 15:36:15 +03:00
|
|
|
def a(b: 1)
|
|
|
|
^^^^
|
2023-10-31 23:00:28 +03:00
|
|
|
end
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: OptionalParameterNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2024-01-09 21:12:03 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: ParameterFlags
|
2023-08-27 18:56:53 +03:00
|
|
|
- name: name
|
2023-08-18 00:39:04 +03:00
|
|
|
type: constant
|
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: value
|
|
|
|
type: node
|
|
|
|
comment: |
|
|
|
|
Represents an optional parameter to a method, block, or lambda definition.
|
|
|
|
|
|
|
|
def a(b = 1)
|
|
|
|
^^^^^
|
|
|
|
end
|
|
|
|
- name: OrNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: left
|
|
|
|
type: node
|
2024-01-14 11:58:30 +03:00
|
|
|
comment: |
|
2024-01-17 06:09:40 +03:00
|
|
|
Represents left side of expression. It includes any kind of node that returns a non-void value.
|
2024-01-14 11:58:30 +03:00
|
|
|
|
|
|
|
left or right
|
|
|
|
^^^^
|
2024-01-17 06:09:40 +03:00
|
|
|
1 || 2
|
|
|
|
^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: right
|
|
|
|
type: node
|
2024-01-14 11:58:30 +03:00
|
|
|
comment: |
|
2024-01-17 06:09:40 +03:00
|
|
|
Represents right side of expression. It includes any kind of node that returns a non-void value.
|
|
|
|
If nothing is given, it will be replaced by MissingNode.
|
2024-01-14 11:58:30 +03:00
|
|
|
|
|
|
|
left || right
|
|
|
|
^^^^^
|
2024-01-17 06:09:40 +03:00
|
|
|
1 or 2
|
|
|
|
^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
2024-01-14 11:58:30 +03:00
|
|
|
comment: |
|
|
|
|
The Location of `or` keyword or `||` operator.
|
2024-01-17 06:09:40 +03:00
|
|
|
The only difference between the two is that `||` has higher precedence than `or`.
|
2024-01-14 11:58:30 +03:00
|
|
|
|
|
|
|
left or right
|
|
|
|
^^
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents the use of the `||` operator or the `or` keyword.
|
|
|
|
|
|
|
|
left or right
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
- name: ParametersNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: requireds
|
|
|
|
type: node[]
|
|
|
|
- name: optionals
|
|
|
|
type: node[]
|
|
|
|
- name: rest
|
|
|
|
type: node?
|
2023-09-12 13:36:12 +03:00
|
|
|
- name: posts
|
|
|
|
type: node[]
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: keywords
|
|
|
|
type: node[]
|
|
|
|
- name: keyword_rest
|
|
|
|
type: node?
|
|
|
|
- name: block
|
|
|
|
type: node?
|
|
|
|
kind: BlockParameterNode
|
|
|
|
comment: |
|
|
|
|
Represents the list of parameters on a method, block, or lambda definition.
|
|
|
|
|
|
|
|
def a(b, c, d)
|
|
|
|
^^^^^^^
|
|
|
|
end
|
|
|
|
- name: ParenthesesNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-19 03:47:58 +03:00
|
|
|
- name: body
|
2023-08-18 00:39:04 +03:00
|
|
|
type: node?
|
|
|
|
- name: opening_loc
|
|
|
|
type: location
|
|
|
|
- name: closing_loc
|
|
|
|
type: location
|
|
|
|
newline: false
|
|
|
|
comment: |
|
|
|
|
Represents a parenthesized expression
|
|
|
|
|
|
|
|
(10 + 34)
|
|
|
|
^^^^^^^^^
|
|
|
|
- name: PinnedExpressionNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: expression
|
|
|
|
type: node
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: lparen_loc
|
|
|
|
type: location
|
|
|
|
- name: rparen_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `^` operator for pinning an expression in a
|
|
|
|
pattern matching expression.
|
|
|
|
|
|
|
|
foo in ^(bar)
|
|
|
|
^^^^^^
|
|
|
|
- name: PinnedVariableNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: variable
|
|
|
|
type: node
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `^` operator for pinning a variable in a pattern
|
|
|
|
matching expression.
|
|
|
|
|
|
|
|
foo in ^bar
|
|
|
|
^^^^
|
|
|
|
- name: PostExecutionNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: statements
|
|
|
|
type: node?
|
|
|
|
kind: StatementsNode
|
|
|
|
- name: keyword_loc
|
|
|
|
type: location
|
|
|
|
- name: opening_loc
|
|
|
|
type: location
|
|
|
|
- name: closing_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `END` keyword.
|
|
|
|
|
|
|
|
END { foo }
|
|
|
|
^^^^^^^^^^^
|
|
|
|
- name: PreExecutionNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: statements
|
|
|
|
type: node?
|
|
|
|
kind: StatementsNode
|
|
|
|
- name: keyword_loc
|
|
|
|
type: location
|
|
|
|
- name: opening_loc
|
|
|
|
type: location
|
|
|
|
- name: closing_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `BEGIN` keyword.
|
|
|
|
|
|
|
|
BEGIN { foo }
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
- name: ProgramNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: locals
|
|
|
|
type: constant[]
|
|
|
|
- name: statements
|
|
|
|
type: node
|
|
|
|
kind: StatementsNode
|
|
|
|
comment: The top level node of any parse tree.
|
|
|
|
- name: RangeNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-12-06 23:32:53 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: RangeFlags
|
2024-01-07 15:54:43 +03:00
|
|
|
comment: |
|
|
|
|
A flag indicating whether the range excludes the end value.
|
|
|
|
|
|
|
|
1..3 # includes 3
|
|
|
|
|
|
|
|
1...3 # excludes 3
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: left
|
|
|
|
type: node?
|
2024-01-07 15:54:43 +03:00
|
|
|
comment: |
|
|
|
|
The left-hand side of the range, if present. Can be either `nil` or
|
|
|
|
a node representing any kind of expression that returns a non-void
|
|
|
|
value.
|
2024-01-08 17:52:58 +03:00
|
|
|
|
2024-01-07 15:54:43 +03:00
|
|
|
1...
|
|
|
|
^
|
|
|
|
|
|
|
|
hello...goodbye
|
|
|
|
^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: right
|
|
|
|
type: node?
|
2024-01-08 18:01:01 +03:00
|
|
|
comment: |
|
2024-01-07 15:54:43 +03:00
|
|
|
The right-hand side of the range, if present. Can be either `nil` or
|
|
|
|
a node representing any kind of expression that returns a non-void
|
|
|
|
value.
|
|
|
|
|
|
|
|
..5
|
|
|
|
^
|
|
|
|
|
|
|
|
1...foo
|
|
|
|
^^^
|
|
|
|
If neither right-hand or left-hand side was included, this will be a
|
|
|
|
MissingNode.
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
2024-01-07 15:54:43 +03:00
|
|
|
comment: |
|
|
|
|
The location of the `..` or `...` operator.
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents the use of the `..` or `...` operators.
|
|
|
|
|
|
|
|
1..2
|
|
|
|
^^^^
|
|
|
|
|
|
|
|
c if a =~ /left/ ... b =~ /right/
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
- name: RationalNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: numeric
|
|
|
|
type: node
|
|
|
|
comment: |
|
|
|
|
Represents a rational number literal.
|
|
|
|
|
|
|
|
1.0r
|
|
|
|
^^^^
|
|
|
|
- name: RedoNode
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `redo` keyword.
|
|
|
|
|
|
|
|
redo
|
|
|
|
^^^^
|
|
|
|
- name: RegularExpressionNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-12-06 23:32:53 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: RegularExpressionFlags
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: opening_loc
|
|
|
|
type: location
|
|
|
|
- name: content_loc
|
|
|
|
type: location
|
|
|
|
- name: closing_loc
|
|
|
|
type: location
|
|
|
|
- name: unescaped
|
|
|
|
type: string
|
|
|
|
comment: |
|
|
|
|
Represents a regular expression literal with no interpolation.
|
|
|
|
|
|
|
|
/foo/i
|
|
|
|
^^^^^^
|
2023-10-31 23:00:28 +03:00
|
|
|
- name: RequiredKeywordParameterNode
|
|
|
|
fields:
|
2024-01-09 21:12:03 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: ParameterFlags
|
2023-10-31 23:00:28 +03:00
|
|
|
- name: name
|
|
|
|
type: constant
|
|
|
|
- name: name_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents a required keyword parameter to a method, block, or lambda definition.
|
|
|
|
|
2023-11-01 15:36:15 +03:00
|
|
|
def a(b: )
|
|
|
|
^^
|
2023-10-31 23:00:28 +03:00
|
|
|
end
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: RequiredParameterNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2024-01-09 21:12:03 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: ParameterFlags
|
2023-08-27 18:56:53 +03:00
|
|
|
- name: name
|
2023-08-18 00:39:04 +03:00
|
|
|
type: constant
|
|
|
|
comment: |
|
|
|
|
Represents a required parameter to a method, block, or lambda definition.
|
|
|
|
|
|
|
|
def a(b)
|
|
|
|
^
|
|
|
|
end
|
|
|
|
- name: RescueModifierNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: expression
|
|
|
|
type: node
|
|
|
|
- name: keyword_loc
|
|
|
|
type: location
|
|
|
|
- name: rescue_expression
|
|
|
|
type: node
|
|
|
|
newline: expression
|
|
|
|
comment: |
|
|
|
|
Represents an expression modified with a rescue.
|
|
|
|
|
2023-11-01 20:02:04 +03:00
|
|
|
foo rescue nil
|
|
|
|
^^^^^^^^^^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: RescueNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: keyword_loc
|
|
|
|
type: location
|
|
|
|
- name: exceptions
|
|
|
|
type: node[]
|
|
|
|
- name: operator_loc
|
|
|
|
type: location?
|
|
|
|
- name: reference
|
|
|
|
type: node?
|
|
|
|
- name: statements
|
|
|
|
type: node?
|
|
|
|
kind: StatementsNode
|
|
|
|
- name: consequent
|
|
|
|
type: node?
|
|
|
|
kind: RescueNode
|
|
|
|
comment: |
|
|
|
|
Represents a rescue statement.
|
|
|
|
|
|
|
|
begin
|
|
|
|
rescue Foo, *splat, Bar => ex
|
|
|
|
foo
|
2023-10-30 20:01:35 +03:00
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-18 00:39:04 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
`Foo, *splat, Bar` are in the `exceptions` field.
|
|
|
|
`ex` is in the `exception` field.
|
|
|
|
- name: RestParameterNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2024-01-09 21:12:03 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: ParameterFlags
|
2023-09-06 18:22:27 +03:00
|
|
|
- name: name
|
|
|
|
type: constant?
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: name_loc
|
|
|
|
type: location?
|
2023-09-06 18:22:27 +03:00
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
2023-08-18 00:39:04 +03:00
|
|
|
comment: |
|
|
|
|
Represents a rest parameter to a method, block, or lambda definition.
|
|
|
|
|
|
|
|
def a(*b)
|
|
|
|
^^
|
|
|
|
end
|
|
|
|
- name: RetryNode
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `retry` keyword.
|
|
|
|
|
|
|
|
retry
|
|
|
|
^^^^^
|
|
|
|
- name: ReturnNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: keyword_loc
|
|
|
|
type: location
|
|
|
|
- name: arguments
|
|
|
|
type: node?
|
|
|
|
kind: ArgumentsNode
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `return` keyword.
|
|
|
|
|
|
|
|
return 1
|
|
|
|
^^^^^^^^
|
|
|
|
- name: SelfNode
|
|
|
|
comment: |
|
|
|
|
Represents the `self` keyword.
|
|
|
|
|
|
|
|
self
|
|
|
|
^^^^
|
|
|
|
- name: SingletonClassNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: locals
|
|
|
|
type: constant[]
|
|
|
|
- name: class_keyword_loc
|
|
|
|
type: location
|
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: expression
|
|
|
|
type: node
|
2023-08-19 03:47:58 +03:00
|
|
|
- name: body
|
2023-08-18 00:39:04 +03:00
|
|
|
type: node?
|
|
|
|
- name: end_keyword_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents a singleton class declaration involving the `class` keyword.
|
|
|
|
|
|
|
|
class << self end
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
- name: SourceEncodingNode
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `__ENCODING__` keyword.
|
|
|
|
|
|
|
|
__ENCODING__
|
|
|
|
^^^^^^^^^^^^
|
|
|
|
- name: SourceFileNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: filepath
|
|
|
|
type: string
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `__FILE__` keyword.
|
|
|
|
|
|
|
|
__FILE__
|
|
|
|
^^^^^^^^
|
|
|
|
- name: SourceLineNode
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `__LINE__` keyword.
|
|
|
|
|
|
|
|
__LINE__
|
|
|
|
^^^^^^^^
|
|
|
|
- name: SplatNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: operator_loc
|
|
|
|
type: location
|
|
|
|
- name: expression
|
|
|
|
type: node?
|
|
|
|
comment: |
|
|
|
|
Represents the use of the splat operator.
|
|
|
|
|
|
|
|
[*a]
|
|
|
|
^^
|
|
|
|
- name: StatementsNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: body
|
|
|
|
type: node[]
|
|
|
|
comment: |
|
|
|
|
Represents a set of statements contained within some scope.
|
|
|
|
|
|
|
|
foo; bar; baz
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
- name: StringNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-09-12 20:06:41 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: StringFlags
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: opening_loc
|
|
|
|
type: location?
|
|
|
|
- name: content_loc
|
|
|
|
type: location
|
|
|
|
- name: closing_loc
|
|
|
|
type: location?
|
|
|
|
- name: unescaped
|
|
|
|
type: string
|
|
|
|
comment: |
|
|
|
|
Represents a string literal, a string contained within a `%w` list, or
|
|
|
|
plain string content within an interpolated string.
|
|
|
|
|
|
|
|
"foo"
|
|
|
|
^^^^^
|
|
|
|
|
|
|
|
%w[foo]
|
|
|
|
^^^
|
|
|
|
|
|
|
|
"foo #{bar} baz"
|
|
|
|
^^^^ ^^^^
|
|
|
|
- name: SuperNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: keyword_loc
|
|
|
|
type: location
|
|
|
|
- name: lparen_loc
|
|
|
|
type: location?
|
|
|
|
- name: arguments
|
|
|
|
type: node?
|
|
|
|
kind: ArgumentsNode
|
|
|
|
- name: rparen_loc
|
|
|
|
type: location?
|
|
|
|
- name: block
|
|
|
|
type: node?
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `super` keyword with parentheses or arguments.
|
|
|
|
|
|
|
|
super()
|
|
|
|
^^^^^^^
|
|
|
|
|
|
|
|
super foo, bar
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
- name: SymbolNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-12-08 18:10:43 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: SymbolFlags
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: opening_loc
|
|
|
|
type: location?
|
|
|
|
- name: value_loc
|
2023-08-22 04:00:00 +03:00
|
|
|
type: location?
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: closing_loc
|
|
|
|
type: location?
|
|
|
|
- name: unescaped
|
|
|
|
type: string
|
|
|
|
comment: |
|
|
|
|
Represents a symbol literal or a symbol contained within a `%i` list.
|
|
|
|
|
|
|
|
:foo
|
|
|
|
^^^^
|
|
|
|
|
|
|
|
%i[foo]
|
|
|
|
^^^
|
|
|
|
- name: TrueNode
|
|
|
|
comment: |
|
|
|
|
Represents the use of the literal `true` keyword.
|
|
|
|
|
|
|
|
true
|
|
|
|
^^^^
|
|
|
|
- name: UndefNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: names
|
|
|
|
type: node[]
|
|
|
|
- name: keyword_loc
|
|
|
|
type: location
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `undef` keyword.
|
|
|
|
|
|
|
|
undef :foo, :bar, :baz
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
- name: UnlessNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: keyword_loc
|
|
|
|
type: location
|
|
|
|
- name: predicate
|
|
|
|
type: node
|
2023-11-16 01:55:16 +03:00
|
|
|
- name: then_keyword_loc
|
|
|
|
type: location?
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: statements
|
|
|
|
type: node?
|
|
|
|
kind: StatementsNode
|
|
|
|
- name: consequent
|
|
|
|
type: node?
|
|
|
|
kind: ElseNode
|
|
|
|
- name: end_keyword_loc
|
|
|
|
type: location?
|
|
|
|
newline: predicate
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `unless` keyword, either in the block form or the modifier form.
|
|
|
|
|
|
|
|
bar unless foo
|
|
|
|
^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
unless foo then bar end
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
- name: UntilNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-12-06 23:32:53 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: LoopFlags
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: keyword_loc
|
|
|
|
type: location
|
2023-08-22 01:07:32 +03:00
|
|
|
- name: closing_loc
|
|
|
|
type: location?
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: predicate
|
|
|
|
type: node
|
|
|
|
- name: statements
|
|
|
|
type: node?
|
|
|
|
kind: StatementsNode
|
|
|
|
newline: predicate
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `until` keyword, either in the block form or the modifier form.
|
|
|
|
|
|
|
|
bar until foo
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
until foo do bar end
|
|
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
|
|
- name: WhenNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: keyword_loc
|
|
|
|
type: location
|
|
|
|
- name: conditions
|
|
|
|
type: node[]
|
|
|
|
- name: statements
|
|
|
|
type: node?
|
|
|
|
kind: StatementsNode
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `when` keyword within a case statement.
|
|
|
|
|
|
|
|
case true
|
|
|
|
when true
|
|
|
|
^^^^^^^^^
|
|
|
|
end
|
|
|
|
- name: WhileNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-12-06 23:32:53 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: LoopFlags
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: keyword_loc
|
|
|
|
type: location
|
2023-08-22 01:10:47 +03:00
|
|
|
- name: closing_loc
|
|
|
|
type: location?
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: predicate
|
|
|
|
type: node
|
|
|
|
- name: statements
|
|
|
|
type: node?
|
|
|
|
kind: StatementsNode
|
|
|
|
newline: predicate
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `while` keyword, either in the block form or the modifier form.
|
|
|
|
|
|
|
|
bar while foo
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
while foo do bar end
|
|
|
|
^^^^^^^^^^^^^^^^^^^^
|
|
|
|
- name: XStringNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-12-04 20:51:22 +03:00
|
|
|
- name: flags
|
|
|
|
type: flags
|
|
|
|
kind: EncodingFlags
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: opening_loc
|
|
|
|
type: location
|
|
|
|
- name: content_loc
|
|
|
|
type: location
|
|
|
|
- name: closing_loc
|
|
|
|
type: location
|
|
|
|
- name: unescaped
|
|
|
|
type: string
|
|
|
|
comment: |
|
|
|
|
Represents an xstring literal with no interpolation.
|
|
|
|
|
|
|
|
`foo`
|
|
|
|
^^^^^
|
|
|
|
- name: YieldNode
|
2023-08-30 23:09:51 +03:00
|
|
|
fields:
|
2023-08-18 00:39:04 +03:00
|
|
|
- name: keyword_loc
|
|
|
|
type: location
|
|
|
|
- name: lparen_loc
|
|
|
|
type: location?
|
|
|
|
- name: arguments
|
|
|
|
type: node?
|
|
|
|
kind: ArgumentsNode
|
|
|
|
- name: rparen_loc
|
|
|
|
type: location?
|
|
|
|
comment: |
|
|
|
|
Represents the use of the `yield` keyword.
|
|
|
|
|
|
|
|
yield 1
|
|
|
|
^^^^^^^
|