From 672148e5b436f4d2e2ee79d7cdfa248136d81e45 Mon Sep 17 00:00:00 2001 From: Nick Rolfe Date: Tue, 23 Feb 2021 15:36:14 +0000 Subject: [PATCH] Add support for multiple statements in interpolations --- Cargo.lock | 2 +- extractor/Cargo.toml | 2 +- generator/Cargo.toml | 2 +- ql/src/codeql_ruby/ast/internal/Literal.qll | 6 +- .../codeql_ruby/ast/internal/TreeSitter.qll | 4 +- ql/src/codeql_ruby/ast/internal/Variable.qll | 2 +- ql/src/ruby.dbscheme | 8 +- .../interpolation_child.ql | 13 + .../old.dbscheme | 1500 ++++++++++++++++ .../ruby.dbscheme | 1504 +++++++++++++++++ .../upgrade.properties | 3 + 11 files changed, 3033 insertions(+), 13 deletions(-) create mode 100644 upgrades/932cb23dbc167adf4d378a0aba22cf32bb8e7876/interpolation_child.ql create mode 100644 upgrades/932cb23dbc167adf4d378a0aba22cf32bb8e7876/old.dbscheme create mode 100644 upgrades/932cb23dbc167adf4d378a0aba22cf32bb8e7876/ruby.dbscheme create mode 100644 upgrades/932cb23dbc167adf4d378a0aba22cf32bb8e7876/upgrade.properties diff --git a/Cargo.lock b/Cargo.lock index 46d787905b4..20e44a76f26 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -599,7 +599,7 @@ dependencies = [ [[package]] name = "tree-sitter-ruby" version = "0.17.0" -source = "git+https://github.com/tree-sitter/tree-sitter-ruby.git?rev=2503f005d917c7aa4726dfe19398dc1a4a299d94#2503f005d917c7aa4726dfe19398dc1a4a299d94" +source = "git+https://github.com/tree-sitter/tree-sitter-ruby.git?rev=32cd5a04adb4accb0c121f037ab59df3c3488228#32cd5a04adb4accb0c121f037ab59df3c3488228" dependencies = [ "cc", "tree-sitter", diff --git a/extractor/Cargo.toml b/extractor/Cargo.toml index b60822c8602..ebe82e28282 100644 --- a/extractor/Cargo.toml +++ b/extractor/Cargo.toml @@ -11,7 +11,7 @@ flate2 = "1.0" node-types = { path = "../node-types" } tree-sitter = "0.17" tree-sitter-embedded-template = { git = "https://github.com/aibaars/tree-sitter-embedded-template", rev = "d4aac29c08aa7c596633d00b5ec2dd2d247eafe4" } -tree-sitter-ruby = { git = "https://github.com/tree-sitter/tree-sitter-ruby.git", rev = "2503f005d917c7aa4726dfe19398dc1a4a299d94" } +tree-sitter-ruby = { git = "https://github.com/tree-sitter/tree-sitter-ruby.git", rev = "32cd5a04adb4accb0c121f037ab59df3c3488228" } clap = "2.33" tracing = "0.1" tracing-subscriber = { version = "0.2", features = ["env-filter"] } diff --git a/generator/Cargo.toml b/generator/Cargo.toml index 099a2ef83dc..54d8bb077bc 100644 --- a/generator/Cargo.toml +++ b/generator/Cargo.toml @@ -10,4 +10,4 @@ edition = "2018" node-types = { path = "../node-types" } tracing = "0.1" tracing-subscriber = { version = "0.2", features = ["env-filter"] } -tree-sitter-ruby = { git = "https://github.com/tree-sitter/tree-sitter-ruby.git", rev = "2503f005d917c7aa4726dfe19398dc1a4a299d94" } +tree-sitter-ruby = { git = "https://github.com/tree-sitter/tree-sitter-ruby.git", rev = "32cd5a04adb4accb0c121f037ab59df3c3488228" } diff --git a/ql/src/codeql_ruby/ast/internal/Literal.qll b/ql/src/codeql_ruby/ast/internal/Literal.qll index 2aab1ede55e..0f46a1fabd9 100644 --- a/ql/src/codeql_ruby/ast/internal/Literal.qll +++ b/ql/src/codeql_ruby/ast/internal/Literal.qll @@ -121,11 +121,7 @@ module StringInterpolationComponent { final override string toString() { result = "#{...}" } - final override Stmt getStmt(int n) { - // Generated AST can currently only represent a single statement in an interpolation. - n = 0 and - result = generated.getChild() - } + final override Stmt getStmt(int n) { result = generated.getChild(n) } final override string getValueText() { none() } diff --git a/ql/src/codeql_ruby/ast/internal/TreeSitter.qll b/ql/src/codeql_ruby/ast/internal/TreeSitter.qll index b33abbdbdc3..492b03b4b52 100644 --- a/ql/src/codeql_ruby/ast/internal/TreeSitter.qll +++ b/ql/src/codeql_ruby/ast/internal/TreeSitter.qll @@ -803,13 +803,13 @@ module Generated { override Location getLocation() { interpolation_def(this, _, _, result) } - UnderscoreStatement getChild() { interpolation_child(this, result) } + AstNode getChild(int i) { interpolation_child(this, i, result) } override AstNode getParent() { interpolation_def(this, result, _, _) } override int getParentIndex() { interpolation_def(this, _, result, _) } - override AstNode getAFieldOrChild() { interpolation_child(this, result) } + override AstNode getAFieldOrChild() { interpolation_child(this, _, result) } } class KeywordParameter extends @keyword_parameter, AstNode { diff --git a/ql/src/codeql_ruby/ast/internal/Variable.qll b/ql/src/codeql_ruby/ast/internal/Variable.qll index a0e2ea83056..2673dfd057a 100644 --- a/ql/src/codeql_ruby/ast/internal/Variable.qll +++ b/ql/src/codeql_ruby/ast/internal/Variable.qll @@ -243,7 +243,7 @@ private module Cached { or i = any(Generated::In x).getChild() or - i = any(Generated::Interpolation x).getChild() + i = any(Generated::Interpolation x).getChild(_) or i = any(Generated::KeywordParameter x).getValue() or diff --git a/ql/src/ruby.dbscheme b/ql/src/ruby.dbscheme index 932cb23dbc1..9f1ab8aabe2 100644 --- a/ql/src/ruby.dbscheme +++ b/ql/src/ruby.dbscheme @@ -718,9 +718,13 @@ in_def( int loc: @location ref ); +@interpolation_child_type = @token_empty_statement | @underscore_statement + +#keyset[interpolation, index] interpolation_child( - unique int interpolation: @interpolation ref, - unique int child: @underscore_statement ref + int interpolation: @interpolation ref, + int index: int ref, + unique int child: @interpolation_child_type ref ); #keyset[parent, parent_index] diff --git a/upgrades/932cb23dbc167adf4d378a0aba22cf32bb8e7876/interpolation_child.ql b/upgrades/932cb23dbc167adf4d378a0aba22cf32bb8e7876/interpolation_child.ql new file mode 100644 index 00000000000..05182258b67 --- /dev/null +++ b/upgrades/932cb23dbc167adf4d378a0aba22cf32bb8e7876/interpolation_child.ql @@ -0,0 +1,13 @@ +class Stmt extends @underscore_statement { + string toString() { result = "" } +} + +class Interpolation extends @interpolation { + string toString() { result = "" } +} + +// The new table adds an index column, so any interpolation_child tables in the +// old dbscheme were implicitly index 0. +from Interpolation interpolation, int index, Stmt child +where interpolation_child(interpolation, child) and index = 0 +select interpolation, index, child diff --git a/upgrades/932cb23dbc167adf4d378a0aba22cf32bb8e7876/old.dbscheme b/upgrades/932cb23dbc167adf4d378a0aba22cf32bb8e7876/old.dbscheme new file mode 100644 index 00000000000..932cb23dbc1 --- /dev/null +++ b/upgrades/932cb23dbc167adf4d378a0aba22cf32bb8e7876/old.dbscheme @@ -0,0 +1,1500 @@ +// CodeQL database schema for Ruby +// Automatically generated from the tree-sitter grammar; do not edit + +@location = @location_default + +locations_default( + unique int id: @location_default, + int file: @file ref, + int start_line: int ref, + int start_column: int ref, + int end_line: int ref, + int end_column: int ref +); + +@sourceline = @file + +numlines( + int element_id: @sourceline ref, + int num_lines: int ref, + int num_code: int ref, + int num_comment: int ref +); + +files( + unique int id: @file, + string name: string ref, + string simple: string ref, + string ext: string ref, + int fromSource: int ref +); + +folders( + unique int id: @folder, + string name: string ref, + string simple: string ref +); + +@container = @file | @folder + +containerparent( + int parent: @container ref, + unique int child: @container ref +); + +sourceLocationPrefix( + string prefix: string ref +); + +@underscore_arg = @assignment | @binary | @conditional | @operator_assignment | @range | @unary | @underscore_primary + +@underscore_lhs = @call | @element_reference | @scope_resolution | @token_false | @token_nil | @token_true | @underscore_variable + +@underscore_method_name = @delimited_symbol | @setter | @token_class_variable | @token_constant | @token_global_variable | @token_identifier | @token_instance_variable | @token_operator | @token_simple_symbol + +@underscore_primary = @array | @begin | @break | @case__ | @chained_string | @class | @delimited_symbol | @for | @hash | @if | @lambda | @method | @module | @next | @parenthesized_statements | @rational | @redo | @regex | @retry | @return | @singleton_class | @singleton_method | @string__ | @string_array | @subshell | @symbol_array | @token_character | @token_complex | @token_float | @token_heredoc_beginning | @token_integer | @token_simple_symbol | @unary | @underscore_lhs | @unless | @until | @while | @yield + +@underscore_statement = @alias | @assignment | @begin_block | @binary | @break | @call | @end_block | @if_modifier | @next | @operator_assignment | @rescue_modifier | @return | @unary | @undef | @underscore_arg | @unless_modifier | @until_modifier | @while_modifier | @yield + +@underscore_variable = @token_class_variable | @token_constant | @token_global_variable | @token_identifier | @token_instance_variable | @token_self | @token_super + +#keyset[parent, parent_index] +alias_def( + unique int id: @alias, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int alias: @underscore_method_name ref, + int name: @underscore_method_name ref, + int loc: @location ref +); + +@argument_list_child_type = @block_argument | @break | @call | @hash_splat_argument | @next | @pair | @return | @splat_argument | @underscore_arg | @yield + +#keyset[argument_list, index] +argument_list_child( + int argument_list: @argument_list ref, + int index: int ref, + unique int child: @argument_list_child_type ref +); + +#keyset[parent, parent_index] +argument_list_def( + unique int id: @argument_list, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@array_child_type = @block_argument | @break | @call | @hash_splat_argument | @next | @pair | @return | @splat_argument | @underscore_arg | @yield + +#keyset[array, index] +array_child( + int array: @array ref, + int index: int ref, + unique int child: @array_child_type ref +); + +#keyset[parent, parent_index] +array_def( + unique int id: @array, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@assignment_left_type = @left_assignment_list | @underscore_lhs + +@assignment_right_type = @break | @call | @next | @return | @right_assignment_list | @splat_argument | @underscore_arg | @yield + +#keyset[parent, parent_index] +assignment_def( + unique int id: @assignment, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int left: @assignment_left_type ref, + int right: @assignment_right_type ref, + int loc: @location ref +); + +@bare_string_child_type = @interpolation | @token_escape_sequence | @token_string_content + +#keyset[bare_string, index] +bare_string_child( + int bare_string: @bare_string ref, + int index: int ref, + unique int child: @bare_string_child_type ref +); + +#keyset[parent, parent_index] +bare_string_def( + unique int id: @bare_string, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@bare_symbol_child_type = @interpolation | @token_escape_sequence | @token_string_content + +#keyset[bare_symbol, index] +bare_symbol_child( + int bare_symbol: @bare_symbol ref, + int index: int ref, + unique int child: @bare_symbol_child_type ref +); + +#keyset[parent, parent_index] +bare_symbol_def( + unique int id: @bare_symbol, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@begin_child_type = @else | @ensure | @rescue | @token_empty_statement | @underscore_statement + +#keyset[begin, index] +begin_child( + int begin: @begin ref, + int index: int ref, + unique int child: @begin_child_type ref +); + +#keyset[parent, parent_index] +begin_def( + unique int id: @begin, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@begin_block_child_type = @token_empty_statement | @underscore_statement + +#keyset[begin_block, index] +begin_block_child( + int begin_block: @begin_block ref, + int index: int ref, + unique int child: @begin_block_child_type ref +); + +#keyset[parent, parent_index] +begin_block_def( + unique int id: @begin_block, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@binary_left_type = @break | @call | @next | @return | @underscore_arg | @yield + +case @binary.operator of + 0 = @binary_bangequal +| 1 = @binary_bangtilde +| 2 = @binary_percent +| 3 = @binary_ampersand +| 4 = @binary_ampersandampersand +| 5 = @binary_star +| 6 = @binary_starstar +| 7 = @binary_plus +| 8 = @binary_minus +| 9 = @binary_slash +| 10 = @binary_langle +| 11 = @binary_langlelangle +| 12 = @binary_langleequal +| 13 = @binary_langleequalrangle +| 14 = @binary_equalequal +| 15 = @binary_equalequalequal +| 16 = @binary_equaltilde +| 17 = @binary_rangle +| 18 = @binary_rangleequal +| 19 = @binary_ranglerangle +| 20 = @binary_caret +| 21 = @binary_and +| 22 = @binary_or +| 23 = @binary_pipe +| 24 = @binary_pipepipe +; + + +@binary_right_type = @break | @call | @next | @return | @underscore_arg | @yield + +#keyset[parent, parent_index] +binary_def( + unique int id: @binary, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int left: @binary_left_type ref, + int operator: int ref, + int right: @binary_right_type ref, + int loc: @location ref +); + +block_parameters( + unique int block: @block ref, + unique int parameters: @block_parameters ref +); + +@block_child_type = @token_empty_statement | @underscore_statement + +#keyset[block, index] +block_child( + int block: @block ref, + int index: int ref, + unique int child: @block_child_type ref +); + +#keyset[parent, parent_index] +block_def( + unique int id: @block, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +block_argument_def( + unique int id: @block_argument, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int child: @underscore_arg ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +block_parameter_def( + unique int id: @block_parameter, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int name: @token_identifier ref, + int loc: @location ref +); + +@block_parameters_child_type = @block_parameter | @destructured_parameter | @hash_splat_parameter | @keyword_parameter | @optional_parameter | @splat_parameter | @token_identifier + +#keyset[block_parameters, index] +block_parameters_child( + int block_parameters: @block_parameters ref, + int index: int ref, + unique int child: @block_parameters_child_type ref +); + +#keyset[parent, parent_index] +block_parameters_def( + unique int id: @block_parameters, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +break_child( + unique int break: @break ref, + unique int child: @argument_list ref +); + +#keyset[parent, parent_index] +break_def( + unique int id: @break, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +call_arguments( + unique int call: @call ref, + unique int arguments: @argument_list ref +); + +@call_block_type = @block | @do_block + +call_block( + unique int call: @call ref, + unique int block: @call_block_type ref +); + +@call_method_type = @argument_list | @scope_resolution | @token_operator | @underscore_variable + +@call_receiver_type = @call | @underscore_primary + +call_receiver( + unique int call: @call ref, + unique int receiver: @call_receiver_type ref +); + +#keyset[parent, parent_index] +call_def( + unique int id: @call, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int method: @call_method_type ref, + int loc: @location ref +); + +case_value( + unique int case__: @case__ ref, + unique int value: @underscore_statement ref +); + +@case_child_type = @else | @when + +#keyset[case__, index] +case_child( + int case__: @case__ ref, + int index: int ref, + unique int child: @case_child_type ref +); + +#keyset[parent, parent_index] +case_def( + unique int id: @case__, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +#keyset[chained_string, index] +chained_string_child( + int chained_string: @chained_string ref, + int index: int ref, + unique int child: @string__ ref +); + +#keyset[parent, parent_index] +chained_string_def( + unique int id: @chained_string, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@class_name_type = @scope_resolution | @token_constant + +class_superclass( + unique int class: @class ref, + unique int superclass: @superclass ref +); + +@class_child_type = @else | @ensure | @rescue | @token_empty_statement | @underscore_statement + +#keyset[class, index] +class_child( + int class: @class ref, + int index: int ref, + unique int child: @class_child_type ref +); + +#keyset[parent, parent_index] +class_def( + unique int id: @class, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int name: @class_name_type ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +conditional_def( + unique int id: @conditional, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int alternative: @underscore_arg ref, + int condition: @underscore_arg ref, + int consequence: @underscore_arg ref, + int loc: @location ref +); + +@delimited_symbol_child_type = @interpolation | @token_escape_sequence | @token_string_content + +#keyset[delimited_symbol, index] +delimited_symbol_child( + int delimited_symbol: @delimited_symbol ref, + int index: int ref, + unique int child: @delimited_symbol_child_type ref +); + +#keyset[parent, parent_index] +delimited_symbol_def( + unique int id: @delimited_symbol, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@destructured_left_assignment_child_type = @destructured_left_assignment | @rest_assignment | @underscore_lhs + +#keyset[destructured_left_assignment, index] +destructured_left_assignment_child( + int destructured_left_assignment: @destructured_left_assignment ref, + int index: int ref, + unique int child: @destructured_left_assignment_child_type ref +); + +#keyset[parent, parent_index] +destructured_left_assignment_def( + unique int id: @destructured_left_assignment, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@destructured_parameter_child_type = @block_parameter | @destructured_parameter | @hash_splat_parameter | @keyword_parameter | @optional_parameter | @splat_parameter | @token_identifier + +#keyset[destructured_parameter, index] +destructured_parameter_child( + int destructured_parameter: @destructured_parameter ref, + int index: int ref, + unique int child: @destructured_parameter_child_type ref +); + +#keyset[parent, parent_index] +destructured_parameter_def( + unique int id: @destructured_parameter, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@do_child_type = @token_empty_statement | @underscore_statement + +#keyset[do, index] +do_child( + int do: @do ref, + int index: int ref, + unique int child: @do_child_type ref +); + +#keyset[parent, parent_index] +do_def( + unique int id: @do, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +do_block_parameters( + unique int do_block: @do_block ref, + unique int parameters: @block_parameters ref +); + +@do_block_child_type = @else | @ensure | @rescue | @token_empty_statement | @underscore_statement + +#keyset[do_block, index] +do_block_child( + int do_block: @do_block ref, + int index: int ref, + unique int child: @do_block_child_type ref +); + +#keyset[parent, parent_index] +do_block_def( + unique int id: @do_block, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@element_reference_child_type = @block_argument | @break | @call | @hash_splat_argument | @next | @pair | @return | @splat_argument | @underscore_arg | @yield + +#keyset[element_reference, index] +element_reference_child( + int element_reference: @element_reference ref, + int index: int ref, + unique int child: @element_reference_child_type ref +); + +#keyset[parent, parent_index] +element_reference_def( + unique int id: @element_reference, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int object: @underscore_primary ref, + int loc: @location ref +); + +@else_child_type = @token_empty_statement | @underscore_statement + +#keyset[else, index] +else_child( + int else: @else ref, + int index: int ref, + unique int child: @else_child_type ref +); + +#keyset[parent, parent_index] +else_def( + unique int id: @else, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@elsif_alternative_type = @else | @elsif + +elsif_alternative( + unique int elsif: @elsif ref, + unique int alternative: @elsif_alternative_type ref +); + +elsif_consequence( + unique int elsif: @elsif ref, + unique int consequence: @then ref +); + +#keyset[parent, parent_index] +elsif_def( + unique int id: @elsif, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int condition: @underscore_statement ref, + int loc: @location ref +); + +@end_block_child_type = @token_empty_statement | @underscore_statement + +#keyset[end_block, index] +end_block_child( + int end_block: @end_block ref, + int index: int ref, + unique int child: @end_block_child_type ref +); + +#keyset[parent, parent_index] +end_block_def( + unique int id: @end_block, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@ensure_child_type = @token_empty_statement | @underscore_statement + +#keyset[ensure, index] +ensure_child( + int ensure: @ensure ref, + int index: int ref, + unique int child: @ensure_child_type ref +); + +#keyset[parent, parent_index] +ensure_def( + unique int id: @ensure, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +exception_variable_def( + unique int id: @exception_variable, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int child: @underscore_lhs ref, + int loc: @location ref +); + +@exceptions_child_type = @splat_argument | @underscore_arg + +#keyset[exceptions, index] +exceptions_child( + int exceptions: @exceptions ref, + int index: int ref, + unique int child: @exceptions_child_type ref +); + +#keyset[parent, parent_index] +exceptions_def( + unique int id: @exceptions, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@for_pattern_type = @left_assignment_list | @underscore_lhs + +#keyset[parent, parent_index] +for_def( + unique int id: @for, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int body: @do ref, + int pattern: @for_pattern_type ref, + int value: @in ref, + int loc: @location ref +); + +@hash_child_type = @hash_splat_argument | @pair + +#keyset[hash, index] +hash_child( + int hash: @hash ref, + int index: int ref, + unique int child: @hash_child_type ref +); + +#keyset[parent, parent_index] +hash_def( + unique int id: @hash, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +hash_splat_argument_def( + unique int id: @hash_splat_argument, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int child: @underscore_arg ref, + int loc: @location ref +); + +hash_splat_parameter_name( + unique int hash_splat_parameter: @hash_splat_parameter ref, + unique int name: @token_identifier ref +); + +#keyset[parent, parent_index] +hash_splat_parameter_def( + unique int id: @hash_splat_parameter, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@heredoc_body_child_type = @interpolation | @token_escape_sequence | @token_heredoc_content | @token_heredoc_end + +#keyset[heredoc_body, index] +heredoc_body_child( + int heredoc_body: @heredoc_body ref, + int index: int ref, + unique int child: @heredoc_body_child_type ref +); + +#keyset[parent, parent_index] +heredoc_body_def( + unique int id: @heredoc_body, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@if_alternative_type = @else | @elsif + +if_alternative( + unique int if: @if ref, + unique int alternative: @if_alternative_type ref +); + +if_consequence( + unique int if: @if ref, + unique int consequence: @then ref +); + +#keyset[parent, parent_index] +if_def( + unique int id: @if, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int condition: @underscore_statement ref, + int loc: @location ref +); + +@if_modifier_condition_type = @break | @call | @next | @return | @underscore_arg | @yield + +#keyset[parent, parent_index] +if_modifier_def( + unique int id: @if_modifier, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int body: @underscore_statement ref, + int condition: @if_modifier_condition_type ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +in_def( + unique int id: @in, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int child: @underscore_arg ref, + int loc: @location ref +); + +interpolation_child( + unique int interpolation: @interpolation ref, + unique int child: @underscore_statement ref +); + +#keyset[parent, parent_index] +interpolation_def( + unique int id: @interpolation, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +keyword_parameter_value( + unique int keyword_parameter: @keyword_parameter ref, + unique int value: @underscore_arg ref +); + +#keyset[parent, parent_index] +keyword_parameter_def( + unique int id: @keyword_parameter, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int name: @token_identifier ref, + int loc: @location ref +); + +@lambda_body_type = @block | @do_block + +lambda_parameters( + unique int lambda: @lambda ref, + unique int parameters: @lambda_parameters ref +); + +#keyset[parent, parent_index] +lambda_def( + unique int id: @lambda, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int body: @lambda_body_type ref, + int loc: @location ref +); + +@lambda_parameters_child_type = @block_parameter | @destructured_parameter | @hash_splat_parameter | @keyword_parameter | @optional_parameter | @splat_parameter | @token_identifier + +#keyset[lambda_parameters, index] +lambda_parameters_child( + int lambda_parameters: @lambda_parameters ref, + int index: int ref, + unique int child: @lambda_parameters_child_type ref +); + +#keyset[parent, parent_index] +lambda_parameters_def( + unique int id: @lambda_parameters, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@left_assignment_list_child_type = @destructured_left_assignment | @rest_assignment | @underscore_lhs + +#keyset[left_assignment_list, index] +left_assignment_list_child( + int left_assignment_list: @left_assignment_list ref, + int index: int ref, + unique int child: @left_assignment_list_child_type ref +); + +#keyset[parent, parent_index] +left_assignment_list_def( + unique int id: @left_assignment_list, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +method_parameters( + unique int method: @method ref, + unique int parameters: @method_parameters ref +); + +@method_child_type = @else | @ensure | @rescue | @token_empty_statement | @underscore_statement + +#keyset[method, index] +method_child( + int method: @method ref, + int index: int ref, + unique int child: @method_child_type ref +); + +#keyset[parent, parent_index] +method_def( + unique int id: @method, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int name: @underscore_method_name ref, + int loc: @location ref +); + +@method_parameters_child_type = @block_parameter | @destructured_parameter | @hash_splat_parameter | @keyword_parameter | @optional_parameter | @splat_parameter | @token_identifier + +#keyset[method_parameters, index] +method_parameters_child( + int method_parameters: @method_parameters ref, + int index: int ref, + unique int child: @method_parameters_child_type ref +); + +#keyset[parent, parent_index] +method_parameters_def( + unique int id: @method_parameters, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@module_name_type = @scope_resolution | @token_constant + +@module_child_type = @else | @ensure | @rescue | @token_empty_statement | @underscore_statement + +#keyset[module, index] +module_child( + int module: @module ref, + int index: int ref, + unique int child: @module_child_type ref +); + +#keyset[parent, parent_index] +module_def( + unique int id: @module, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int name: @module_name_type ref, + int loc: @location ref +); + +next_child( + unique int next: @next ref, + unique int child: @argument_list ref +); + +#keyset[parent, parent_index] +next_def( + unique int id: @next, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +case @operator_assignment.operator of + 0 = @operator_assignment_percentequal +| 1 = @operator_assignment_ampersandampersandequal +| 2 = @operator_assignment_ampersandequal +| 3 = @operator_assignment_starstarequal +| 4 = @operator_assignment_starequal +| 5 = @operator_assignment_plusequal +| 6 = @operator_assignment_minusequal +| 7 = @operator_assignment_slashequal +| 8 = @operator_assignment_langlelangleequal +| 9 = @operator_assignment_ranglerangleequal +| 10 = @operator_assignment_caretequal +| 11 = @operator_assignment_pipeequal +| 12 = @operator_assignment_pipepipeequal +; + + +@operator_assignment_right_type = @break | @call | @next | @return | @underscore_arg | @yield + +#keyset[parent, parent_index] +operator_assignment_def( + unique int id: @operator_assignment, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int left: @underscore_lhs ref, + int operator: int ref, + int right: @operator_assignment_right_type ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +optional_parameter_def( + unique int id: @optional_parameter, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int name: @token_identifier ref, + int value: @underscore_arg ref, + int loc: @location ref +); + +@pair_key_type = @string__ | @token_hash_key_symbol | @underscore_arg + +#keyset[parent, parent_index] +pair_def( + unique int id: @pair, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int key__: @pair_key_type ref, + int value: @underscore_arg ref, + int loc: @location ref +); + +@parenthesized_statements_child_type = @token_empty_statement | @underscore_statement + +#keyset[parenthesized_statements, index] +parenthesized_statements_child( + int parenthesized_statements: @parenthesized_statements ref, + int index: int ref, + unique int child: @parenthesized_statements_child_type ref +); + +#keyset[parent, parent_index] +parenthesized_statements_def( + unique int id: @parenthesized_statements, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@pattern_child_type = @splat_argument | @underscore_arg + +#keyset[parent, parent_index] +pattern_def( + unique int id: @pattern, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int child: @pattern_child_type ref, + int loc: @location ref +); + +@program_child_type = @token_empty_statement | @token_uninterpreted | @underscore_statement + +#keyset[program, index] +program_child( + int program: @program ref, + int index: int ref, + unique int child: @program_child_type ref +); + +#keyset[parent, parent_index] +program_def( + unique int id: @program, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +range_begin( + unique int range: @range ref, + unique int begin: @underscore_arg ref +); + +range_end( + unique int range: @range ref, + unique int end: @underscore_arg ref +); + +case @range.operator of + 0 = @range_dotdot +| 1 = @range_dotdotdot +; + + +#keyset[parent, parent_index] +range_def( + unique int id: @range, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int operator: int ref, + int loc: @location ref +); + +@rational_child_type = @token_float | @token_integer + +#keyset[parent, parent_index] +rational_def( + unique int id: @rational, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int child: @rational_child_type ref, + int loc: @location ref +); + +redo_child( + unique int redo: @redo ref, + unique int child: @argument_list ref +); + +#keyset[parent, parent_index] +redo_def( + unique int id: @redo, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@regex_child_type = @interpolation | @token_escape_sequence | @token_string_content + +#keyset[regex, index] +regex_child( + int regex: @regex ref, + int index: int ref, + unique int child: @regex_child_type ref +); + +#keyset[parent, parent_index] +regex_def( + unique int id: @regex, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +rescue_body( + unique int rescue: @rescue ref, + unique int body: @then ref +); + +rescue_exceptions( + unique int rescue: @rescue ref, + unique int exceptions: @exceptions ref +); + +rescue_variable( + unique int rescue: @rescue ref, + unique int variable: @exception_variable ref +); + +#keyset[parent, parent_index] +rescue_def( + unique int id: @rescue, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@rescue_modifier_handler_type = @break | @call | @next | @return | @underscore_arg | @yield + +#keyset[parent, parent_index] +rescue_modifier_def( + unique int id: @rescue_modifier, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int body: @underscore_statement ref, + int handler: @rescue_modifier_handler_type ref, + int loc: @location ref +); + +rest_assignment_child( + unique int rest_assignment: @rest_assignment ref, + unique int child: @underscore_lhs ref +); + +#keyset[parent, parent_index] +rest_assignment_def( + unique int id: @rest_assignment, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +retry_child( + unique int retry: @retry ref, + unique int child: @argument_list ref +); + +#keyset[parent, parent_index] +retry_def( + unique int id: @retry, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +return_child( + unique int return: @return ref, + unique int child: @argument_list ref +); + +#keyset[parent, parent_index] +return_def( + unique int id: @return, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@right_assignment_list_child_type = @splat_argument | @underscore_arg + +#keyset[right_assignment_list, index] +right_assignment_list_child( + int right_assignment_list: @right_assignment_list ref, + int index: int ref, + unique int child: @right_assignment_list_child_type ref +); + +#keyset[parent, parent_index] +right_assignment_list_def( + unique int id: @right_assignment_list, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@scope_resolution_name_type = @token_constant | @token_identifier + +scope_resolution_scope( + unique int scope_resolution: @scope_resolution ref, + unique int scope: @underscore_primary ref +); + +#keyset[parent, parent_index] +scope_resolution_def( + unique int id: @scope_resolution, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int name: @scope_resolution_name_type ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +setter_def( + unique int id: @setter, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int name: @token_identifier ref, + int loc: @location ref +); + +@singleton_class_child_type = @else | @ensure | @rescue | @token_empty_statement | @underscore_statement + +#keyset[singleton_class, index] +singleton_class_child( + int singleton_class: @singleton_class ref, + int index: int ref, + unique int child: @singleton_class_child_type ref +); + +#keyset[parent, parent_index] +singleton_class_def( + unique int id: @singleton_class, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int value: @underscore_arg ref, + int loc: @location ref +); + +@singleton_method_object_type = @underscore_arg | @underscore_variable + +singleton_method_parameters( + unique int singleton_method: @singleton_method ref, + unique int parameters: @method_parameters ref +); + +@singleton_method_child_type = @else | @ensure | @rescue | @token_empty_statement | @underscore_statement + +#keyset[singleton_method, index] +singleton_method_child( + int singleton_method: @singleton_method ref, + int index: int ref, + unique int child: @singleton_method_child_type ref +); + +#keyset[parent, parent_index] +singleton_method_def( + unique int id: @singleton_method, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int name: @underscore_method_name ref, + int object: @singleton_method_object_type ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +splat_argument_def( + unique int id: @splat_argument, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int child: @underscore_arg ref, + int loc: @location ref +); + +splat_parameter_name( + unique int splat_parameter: @splat_parameter ref, + unique int name: @token_identifier ref +); + +#keyset[parent, parent_index] +splat_parameter_def( + unique int id: @splat_parameter, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@string_child_type = @interpolation | @token_escape_sequence | @token_string_content + +#keyset[string__, index] +string_child( + int string__: @string__ ref, + int index: int ref, + unique int child: @string_child_type ref +); + +#keyset[parent, parent_index] +string_def( + unique int id: @string__, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +#keyset[string_array, index] +string_array_child( + int string_array: @string_array ref, + int index: int ref, + unique int child: @bare_string ref +); + +#keyset[parent, parent_index] +string_array_def( + unique int id: @string_array, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@subshell_child_type = @interpolation | @token_escape_sequence | @token_string_content + +#keyset[subshell, index] +subshell_child( + int subshell: @subshell ref, + int index: int ref, + unique int child: @subshell_child_type ref +); + +#keyset[parent, parent_index] +subshell_def( + unique int id: @subshell, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@superclass_child_type = @break | @call | @next | @return | @underscore_arg | @yield + +#keyset[parent, parent_index] +superclass_def( + unique int id: @superclass, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int child: @superclass_child_type ref, + int loc: @location ref +); + +#keyset[symbol_array, index] +symbol_array_child( + int symbol_array: @symbol_array ref, + int index: int ref, + unique int child: @bare_symbol ref +); + +#keyset[parent, parent_index] +symbol_array_def( + unique int id: @symbol_array, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@then_child_type = @token_empty_statement | @underscore_statement + +#keyset[then, index] +then_child( + int then: @then ref, + int index: int ref, + unique int child: @then_child_type ref +); + +#keyset[parent, parent_index] +then_def( + unique int id: @then, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@unary_operand_type = @break | @call | @next | @parenthesized_statements | @return | @token_float | @token_integer | @underscore_arg | @yield + +case @unary.operator of + 0 = @unary_bang +| 1 = @unary_plus +| 2 = @unary_minus +| 3 = @unary_definedquestion +| 4 = @unary_not +| 5 = @unary_tilde +; + + +#keyset[parent, parent_index] +unary_def( + unique int id: @unary, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int operand: @unary_operand_type ref, + int operator: int ref, + int loc: @location ref +); + +#keyset[undef, index] +undef_child( + int undef: @undef ref, + int index: int ref, + unique int child: @underscore_method_name ref +); + +#keyset[parent, parent_index] +undef_def( + unique int id: @undef, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@unless_alternative_type = @else | @elsif + +unless_alternative( + unique int unless: @unless ref, + unique int alternative: @unless_alternative_type ref +); + +unless_consequence( + unique int unless: @unless ref, + unique int consequence: @then ref +); + +#keyset[parent, parent_index] +unless_def( + unique int id: @unless, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int condition: @underscore_statement ref, + int loc: @location ref +); + +@unless_modifier_condition_type = @break | @call | @next | @return | @underscore_arg | @yield + +#keyset[parent, parent_index] +unless_modifier_def( + unique int id: @unless_modifier, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int body: @underscore_statement ref, + int condition: @unless_modifier_condition_type ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +until_def( + unique int id: @until, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int body: @do ref, + int condition: @underscore_statement ref, + int loc: @location ref +); + +@until_modifier_condition_type = @break | @call | @next | @return | @underscore_arg | @yield + +#keyset[parent, parent_index] +until_modifier_def( + unique int id: @until_modifier, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int body: @underscore_statement ref, + int condition: @until_modifier_condition_type ref, + int loc: @location ref +); + +when_body( + unique int when: @when ref, + unique int body: @then ref +); + +#keyset[when, index] +when_pattern( + int when: @when ref, + int index: int ref, + unique int pattern: @pattern ref +); + +#keyset[parent, parent_index] +when_def( + unique int id: @when, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +while_def( + unique int id: @while, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int body: @do ref, + int condition: @underscore_statement ref, + int loc: @location ref +); + +@while_modifier_condition_type = @break | @call | @next | @return | @underscore_arg | @yield + +#keyset[parent, parent_index] +while_modifier_def( + unique int id: @while_modifier, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int body: @underscore_statement ref, + int condition: @while_modifier_condition_type ref, + int loc: @location ref +); + +yield_child( + unique int yield: @yield ref, + unique int child: @argument_list ref +); + +#keyset[parent, parent_index] +yield_def( + unique int id: @yield, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +tokeninfo( + unique int id: @token, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int kind: int ref, + int file: @file ref, + int idx: int ref, + string value: string ref, + int loc: @location ref +); + +case @token.kind of + 0 = @reserved_word +| 1 = @token_character +| 2 = @token_class_variable +| 3 = @token_comment +| 4 = @token_complex +| 5 = @token_constant +| 6 = @token_empty_statement +| 7 = @token_escape_sequence +| 8 = @token_false +| 9 = @token_float +| 10 = @token_global_variable +| 11 = @token_hash_key_symbol +| 12 = @token_heredoc_beginning +| 13 = @token_heredoc_content +| 14 = @token_heredoc_end +| 15 = @token_identifier +| 16 = @token_instance_variable +| 17 = @token_integer +| 18 = @token_nil +| 19 = @token_operator +| 20 = @token_self +| 21 = @token_simple_symbol +| 22 = @token_string_content +| 23 = @token_super +| 24 = @token_true +| 25 = @token_uninterpreted +; + + +@ast_node = @alias | @argument_list | @array | @assignment | @bare_string | @bare_symbol | @begin | @begin_block | @binary | @block | @block_argument | @block_parameter | @block_parameters | @break | @call | @case__ | @chained_string | @class | @conditional | @delimited_symbol | @destructured_left_assignment | @destructured_parameter | @do | @do_block | @element_reference | @else | @elsif | @end_block | @ensure | @exception_variable | @exceptions | @for | @hash | @hash_splat_argument | @hash_splat_parameter | @heredoc_body | @if | @if_modifier | @in | @interpolation | @keyword_parameter | @lambda | @lambda_parameters | @left_assignment_list | @method | @method_parameters | @module | @next | @operator_assignment | @optional_parameter | @pair | @parenthesized_statements | @pattern | @program | @range | @rational | @redo | @regex | @rescue | @rescue_modifier | @rest_assignment | @retry | @return | @right_assignment_list | @scope_resolution | @setter | @singleton_class | @singleton_method | @splat_argument | @splat_parameter | @string__ | @string_array | @subshell | @superclass | @symbol_array | @then | @token | @unary | @undef | @unless | @unless_modifier | @until | @until_modifier | @when | @while | @while_modifier | @yield + +@ast_node_parent = @ast_node | @file + diff --git a/upgrades/932cb23dbc167adf4d378a0aba22cf32bb8e7876/ruby.dbscheme b/upgrades/932cb23dbc167adf4d378a0aba22cf32bb8e7876/ruby.dbscheme new file mode 100644 index 00000000000..9f1ab8aabe2 --- /dev/null +++ b/upgrades/932cb23dbc167adf4d378a0aba22cf32bb8e7876/ruby.dbscheme @@ -0,0 +1,1504 @@ +// CodeQL database schema for Ruby +// Automatically generated from the tree-sitter grammar; do not edit + +@location = @location_default + +locations_default( + unique int id: @location_default, + int file: @file ref, + int start_line: int ref, + int start_column: int ref, + int end_line: int ref, + int end_column: int ref +); + +@sourceline = @file + +numlines( + int element_id: @sourceline ref, + int num_lines: int ref, + int num_code: int ref, + int num_comment: int ref +); + +files( + unique int id: @file, + string name: string ref, + string simple: string ref, + string ext: string ref, + int fromSource: int ref +); + +folders( + unique int id: @folder, + string name: string ref, + string simple: string ref +); + +@container = @file | @folder + +containerparent( + int parent: @container ref, + unique int child: @container ref +); + +sourceLocationPrefix( + string prefix: string ref +); + +@underscore_arg = @assignment | @binary | @conditional | @operator_assignment | @range | @unary | @underscore_primary + +@underscore_lhs = @call | @element_reference | @scope_resolution | @token_false | @token_nil | @token_true | @underscore_variable + +@underscore_method_name = @delimited_symbol | @setter | @token_class_variable | @token_constant | @token_global_variable | @token_identifier | @token_instance_variable | @token_operator | @token_simple_symbol + +@underscore_primary = @array | @begin | @break | @case__ | @chained_string | @class | @delimited_symbol | @for | @hash | @if | @lambda | @method | @module | @next | @parenthesized_statements | @rational | @redo | @regex | @retry | @return | @singleton_class | @singleton_method | @string__ | @string_array | @subshell | @symbol_array | @token_character | @token_complex | @token_float | @token_heredoc_beginning | @token_integer | @token_simple_symbol | @unary | @underscore_lhs | @unless | @until | @while | @yield + +@underscore_statement = @alias | @assignment | @begin_block | @binary | @break | @call | @end_block | @if_modifier | @next | @operator_assignment | @rescue_modifier | @return | @unary | @undef | @underscore_arg | @unless_modifier | @until_modifier | @while_modifier | @yield + +@underscore_variable = @token_class_variable | @token_constant | @token_global_variable | @token_identifier | @token_instance_variable | @token_self | @token_super + +#keyset[parent, parent_index] +alias_def( + unique int id: @alias, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int alias: @underscore_method_name ref, + int name: @underscore_method_name ref, + int loc: @location ref +); + +@argument_list_child_type = @block_argument | @break | @call | @hash_splat_argument | @next | @pair | @return | @splat_argument | @underscore_arg | @yield + +#keyset[argument_list, index] +argument_list_child( + int argument_list: @argument_list ref, + int index: int ref, + unique int child: @argument_list_child_type ref +); + +#keyset[parent, parent_index] +argument_list_def( + unique int id: @argument_list, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@array_child_type = @block_argument | @break | @call | @hash_splat_argument | @next | @pair | @return | @splat_argument | @underscore_arg | @yield + +#keyset[array, index] +array_child( + int array: @array ref, + int index: int ref, + unique int child: @array_child_type ref +); + +#keyset[parent, parent_index] +array_def( + unique int id: @array, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@assignment_left_type = @left_assignment_list | @underscore_lhs + +@assignment_right_type = @break | @call | @next | @return | @right_assignment_list | @splat_argument | @underscore_arg | @yield + +#keyset[parent, parent_index] +assignment_def( + unique int id: @assignment, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int left: @assignment_left_type ref, + int right: @assignment_right_type ref, + int loc: @location ref +); + +@bare_string_child_type = @interpolation | @token_escape_sequence | @token_string_content + +#keyset[bare_string, index] +bare_string_child( + int bare_string: @bare_string ref, + int index: int ref, + unique int child: @bare_string_child_type ref +); + +#keyset[parent, parent_index] +bare_string_def( + unique int id: @bare_string, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@bare_symbol_child_type = @interpolation | @token_escape_sequence | @token_string_content + +#keyset[bare_symbol, index] +bare_symbol_child( + int bare_symbol: @bare_symbol ref, + int index: int ref, + unique int child: @bare_symbol_child_type ref +); + +#keyset[parent, parent_index] +bare_symbol_def( + unique int id: @bare_symbol, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@begin_child_type = @else | @ensure | @rescue | @token_empty_statement | @underscore_statement + +#keyset[begin, index] +begin_child( + int begin: @begin ref, + int index: int ref, + unique int child: @begin_child_type ref +); + +#keyset[parent, parent_index] +begin_def( + unique int id: @begin, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@begin_block_child_type = @token_empty_statement | @underscore_statement + +#keyset[begin_block, index] +begin_block_child( + int begin_block: @begin_block ref, + int index: int ref, + unique int child: @begin_block_child_type ref +); + +#keyset[parent, parent_index] +begin_block_def( + unique int id: @begin_block, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@binary_left_type = @break | @call | @next | @return | @underscore_arg | @yield + +case @binary.operator of + 0 = @binary_bangequal +| 1 = @binary_bangtilde +| 2 = @binary_percent +| 3 = @binary_ampersand +| 4 = @binary_ampersandampersand +| 5 = @binary_star +| 6 = @binary_starstar +| 7 = @binary_plus +| 8 = @binary_minus +| 9 = @binary_slash +| 10 = @binary_langle +| 11 = @binary_langlelangle +| 12 = @binary_langleequal +| 13 = @binary_langleequalrangle +| 14 = @binary_equalequal +| 15 = @binary_equalequalequal +| 16 = @binary_equaltilde +| 17 = @binary_rangle +| 18 = @binary_rangleequal +| 19 = @binary_ranglerangle +| 20 = @binary_caret +| 21 = @binary_and +| 22 = @binary_or +| 23 = @binary_pipe +| 24 = @binary_pipepipe +; + + +@binary_right_type = @break | @call | @next | @return | @underscore_arg | @yield + +#keyset[parent, parent_index] +binary_def( + unique int id: @binary, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int left: @binary_left_type ref, + int operator: int ref, + int right: @binary_right_type ref, + int loc: @location ref +); + +block_parameters( + unique int block: @block ref, + unique int parameters: @block_parameters ref +); + +@block_child_type = @token_empty_statement | @underscore_statement + +#keyset[block, index] +block_child( + int block: @block ref, + int index: int ref, + unique int child: @block_child_type ref +); + +#keyset[parent, parent_index] +block_def( + unique int id: @block, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +block_argument_def( + unique int id: @block_argument, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int child: @underscore_arg ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +block_parameter_def( + unique int id: @block_parameter, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int name: @token_identifier ref, + int loc: @location ref +); + +@block_parameters_child_type = @block_parameter | @destructured_parameter | @hash_splat_parameter | @keyword_parameter | @optional_parameter | @splat_parameter | @token_identifier + +#keyset[block_parameters, index] +block_parameters_child( + int block_parameters: @block_parameters ref, + int index: int ref, + unique int child: @block_parameters_child_type ref +); + +#keyset[parent, parent_index] +block_parameters_def( + unique int id: @block_parameters, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +break_child( + unique int break: @break ref, + unique int child: @argument_list ref +); + +#keyset[parent, parent_index] +break_def( + unique int id: @break, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +call_arguments( + unique int call: @call ref, + unique int arguments: @argument_list ref +); + +@call_block_type = @block | @do_block + +call_block( + unique int call: @call ref, + unique int block: @call_block_type ref +); + +@call_method_type = @argument_list | @scope_resolution | @token_operator | @underscore_variable + +@call_receiver_type = @call | @underscore_primary + +call_receiver( + unique int call: @call ref, + unique int receiver: @call_receiver_type ref +); + +#keyset[parent, parent_index] +call_def( + unique int id: @call, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int method: @call_method_type ref, + int loc: @location ref +); + +case_value( + unique int case__: @case__ ref, + unique int value: @underscore_statement ref +); + +@case_child_type = @else | @when + +#keyset[case__, index] +case_child( + int case__: @case__ ref, + int index: int ref, + unique int child: @case_child_type ref +); + +#keyset[parent, parent_index] +case_def( + unique int id: @case__, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +#keyset[chained_string, index] +chained_string_child( + int chained_string: @chained_string ref, + int index: int ref, + unique int child: @string__ ref +); + +#keyset[parent, parent_index] +chained_string_def( + unique int id: @chained_string, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@class_name_type = @scope_resolution | @token_constant + +class_superclass( + unique int class: @class ref, + unique int superclass: @superclass ref +); + +@class_child_type = @else | @ensure | @rescue | @token_empty_statement | @underscore_statement + +#keyset[class, index] +class_child( + int class: @class ref, + int index: int ref, + unique int child: @class_child_type ref +); + +#keyset[parent, parent_index] +class_def( + unique int id: @class, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int name: @class_name_type ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +conditional_def( + unique int id: @conditional, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int alternative: @underscore_arg ref, + int condition: @underscore_arg ref, + int consequence: @underscore_arg ref, + int loc: @location ref +); + +@delimited_symbol_child_type = @interpolation | @token_escape_sequence | @token_string_content + +#keyset[delimited_symbol, index] +delimited_symbol_child( + int delimited_symbol: @delimited_symbol ref, + int index: int ref, + unique int child: @delimited_symbol_child_type ref +); + +#keyset[parent, parent_index] +delimited_symbol_def( + unique int id: @delimited_symbol, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@destructured_left_assignment_child_type = @destructured_left_assignment | @rest_assignment | @underscore_lhs + +#keyset[destructured_left_assignment, index] +destructured_left_assignment_child( + int destructured_left_assignment: @destructured_left_assignment ref, + int index: int ref, + unique int child: @destructured_left_assignment_child_type ref +); + +#keyset[parent, parent_index] +destructured_left_assignment_def( + unique int id: @destructured_left_assignment, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@destructured_parameter_child_type = @block_parameter | @destructured_parameter | @hash_splat_parameter | @keyword_parameter | @optional_parameter | @splat_parameter | @token_identifier + +#keyset[destructured_parameter, index] +destructured_parameter_child( + int destructured_parameter: @destructured_parameter ref, + int index: int ref, + unique int child: @destructured_parameter_child_type ref +); + +#keyset[parent, parent_index] +destructured_parameter_def( + unique int id: @destructured_parameter, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@do_child_type = @token_empty_statement | @underscore_statement + +#keyset[do, index] +do_child( + int do: @do ref, + int index: int ref, + unique int child: @do_child_type ref +); + +#keyset[parent, parent_index] +do_def( + unique int id: @do, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +do_block_parameters( + unique int do_block: @do_block ref, + unique int parameters: @block_parameters ref +); + +@do_block_child_type = @else | @ensure | @rescue | @token_empty_statement | @underscore_statement + +#keyset[do_block, index] +do_block_child( + int do_block: @do_block ref, + int index: int ref, + unique int child: @do_block_child_type ref +); + +#keyset[parent, parent_index] +do_block_def( + unique int id: @do_block, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@element_reference_child_type = @block_argument | @break | @call | @hash_splat_argument | @next | @pair | @return | @splat_argument | @underscore_arg | @yield + +#keyset[element_reference, index] +element_reference_child( + int element_reference: @element_reference ref, + int index: int ref, + unique int child: @element_reference_child_type ref +); + +#keyset[parent, parent_index] +element_reference_def( + unique int id: @element_reference, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int object: @underscore_primary ref, + int loc: @location ref +); + +@else_child_type = @token_empty_statement | @underscore_statement + +#keyset[else, index] +else_child( + int else: @else ref, + int index: int ref, + unique int child: @else_child_type ref +); + +#keyset[parent, parent_index] +else_def( + unique int id: @else, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@elsif_alternative_type = @else | @elsif + +elsif_alternative( + unique int elsif: @elsif ref, + unique int alternative: @elsif_alternative_type ref +); + +elsif_consequence( + unique int elsif: @elsif ref, + unique int consequence: @then ref +); + +#keyset[parent, parent_index] +elsif_def( + unique int id: @elsif, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int condition: @underscore_statement ref, + int loc: @location ref +); + +@end_block_child_type = @token_empty_statement | @underscore_statement + +#keyset[end_block, index] +end_block_child( + int end_block: @end_block ref, + int index: int ref, + unique int child: @end_block_child_type ref +); + +#keyset[parent, parent_index] +end_block_def( + unique int id: @end_block, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@ensure_child_type = @token_empty_statement | @underscore_statement + +#keyset[ensure, index] +ensure_child( + int ensure: @ensure ref, + int index: int ref, + unique int child: @ensure_child_type ref +); + +#keyset[parent, parent_index] +ensure_def( + unique int id: @ensure, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +exception_variable_def( + unique int id: @exception_variable, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int child: @underscore_lhs ref, + int loc: @location ref +); + +@exceptions_child_type = @splat_argument | @underscore_arg + +#keyset[exceptions, index] +exceptions_child( + int exceptions: @exceptions ref, + int index: int ref, + unique int child: @exceptions_child_type ref +); + +#keyset[parent, parent_index] +exceptions_def( + unique int id: @exceptions, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@for_pattern_type = @left_assignment_list | @underscore_lhs + +#keyset[parent, parent_index] +for_def( + unique int id: @for, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int body: @do ref, + int pattern: @for_pattern_type ref, + int value: @in ref, + int loc: @location ref +); + +@hash_child_type = @hash_splat_argument | @pair + +#keyset[hash, index] +hash_child( + int hash: @hash ref, + int index: int ref, + unique int child: @hash_child_type ref +); + +#keyset[parent, parent_index] +hash_def( + unique int id: @hash, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +hash_splat_argument_def( + unique int id: @hash_splat_argument, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int child: @underscore_arg ref, + int loc: @location ref +); + +hash_splat_parameter_name( + unique int hash_splat_parameter: @hash_splat_parameter ref, + unique int name: @token_identifier ref +); + +#keyset[parent, parent_index] +hash_splat_parameter_def( + unique int id: @hash_splat_parameter, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@heredoc_body_child_type = @interpolation | @token_escape_sequence | @token_heredoc_content | @token_heredoc_end + +#keyset[heredoc_body, index] +heredoc_body_child( + int heredoc_body: @heredoc_body ref, + int index: int ref, + unique int child: @heredoc_body_child_type ref +); + +#keyset[parent, parent_index] +heredoc_body_def( + unique int id: @heredoc_body, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@if_alternative_type = @else | @elsif + +if_alternative( + unique int if: @if ref, + unique int alternative: @if_alternative_type ref +); + +if_consequence( + unique int if: @if ref, + unique int consequence: @then ref +); + +#keyset[parent, parent_index] +if_def( + unique int id: @if, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int condition: @underscore_statement ref, + int loc: @location ref +); + +@if_modifier_condition_type = @break | @call | @next | @return | @underscore_arg | @yield + +#keyset[parent, parent_index] +if_modifier_def( + unique int id: @if_modifier, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int body: @underscore_statement ref, + int condition: @if_modifier_condition_type ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +in_def( + unique int id: @in, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int child: @underscore_arg ref, + int loc: @location ref +); + +@interpolation_child_type = @token_empty_statement | @underscore_statement + +#keyset[interpolation, index] +interpolation_child( + int interpolation: @interpolation ref, + int index: int ref, + unique int child: @interpolation_child_type ref +); + +#keyset[parent, parent_index] +interpolation_def( + unique int id: @interpolation, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +keyword_parameter_value( + unique int keyword_parameter: @keyword_parameter ref, + unique int value: @underscore_arg ref +); + +#keyset[parent, parent_index] +keyword_parameter_def( + unique int id: @keyword_parameter, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int name: @token_identifier ref, + int loc: @location ref +); + +@lambda_body_type = @block | @do_block + +lambda_parameters( + unique int lambda: @lambda ref, + unique int parameters: @lambda_parameters ref +); + +#keyset[parent, parent_index] +lambda_def( + unique int id: @lambda, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int body: @lambda_body_type ref, + int loc: @location ref +); + +@lambda_parameters_child_type = @block_parameter | @destructured_parameter | @hash_splat_parameter | @keyword_parameter | @optional_parameter | @splat_parameter | @token_identifier + +#keyset[lambda_parameters, index] +lambda_parameters_child( + int lambda_parameters: @lambda_parameters ref, + int index: int ref, + unique int child: @lambda_parameters_child_type ref +); + +#keyset[parent, parent_index] +lambda_parameters_def( + unique int id: @lambda_parameters, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@left_assignment_list_child_type = @destructured_left_assignment | @rest_assignment | @underscore_lhs + +#keyset[left_assignment_list, index] +left_assignment_list_child( + int left_assignment_list: @left_assignment_list ref, + int index: int ref, + unique int child: @left_assignment_list_child_type ref +); + +#keyset[parent, parent_index] +left_assignment_list_def( + unique int id: @left_assignment_list, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +method_parameters( + unique int method: @method ref, + unique int parameters: @method_parameters ref +); + +@method_child_type = @else | @ensure | @rescue | @token_empty_statement | @underscore_statement + +#keyset[method, index] +method_child( + int method: @method ref, + int index: int ref, + unique int child: @method_child_type ref +); + +#keyset[parent, parent_index] +method_def( + unique int id: @method, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int name: @underscore_method_name ref, + int loc: @location ref +); + +@method_parameters_child_type = @block_parameter | @destructured_parameter | @hash_splat_parameter | @keyword_parameter | @optional_parameter | @splat_parameter | @token_identifier + +#keyset[method_parameters, index] +method_parameters_child( + int method_parameters: @method_parameters ref, + int index: int ref, + unique int child: @method_parameters_child_type ref +); + +#keyset[parent, parent_index] +method_parameters_def( + unique int id: @method_parameters, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@module_name_type = @scope_resolution | @token_constant + +@module_child_type = @else | @ensure | @rescue | @token_empty_statement | @underscore_statement + +#keyset[module, index] +module_child( + int module: @module ref, + int index: int ref, + unique int child: @module_child_type ref +); + +#keyset[parent, parent_index] +module_def( + unique int id: @module, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int name: @module_name_type ref, + int loc: @location ref +); + +next_child( + unique int next: @next ref, + unique int child: @argument_list ref +); + +#keyset[parent, parent_index] +next_def( + unique int id: @next, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +case @operator_assignment.operator of + 0 = @operator_assignment_percentequal +| 1 = @operator_assignment_ampersandampersandequal +| 2 = @operator_assignment_ampersandequal +| 3 = @operator_assignment_starstarequal +| 4 = @operator_assignment_starequal +| 5 = @operator_assignment_plusequal +| 6 = @operator_assignment_minusequal +| 7 = @operator_assignment_slashequal +| 8 = @operator_assignment_langlelangleequal +| 9 = @operator_assignment_ranglerangleequal +| 10 = @operator_assignment_caretequal +| 11 = @operator_assignment_pipeequal +| 12 = @operator_assignment_pipepipeequal +; + + +@operator_assignment_right_type = @break | @call | @next | @return | @underscore_arg | @yield + +#keyset[parent, parent_index] +operator_assignment_def( + unique int id: @operator_assignment, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int left: @underscore_lhs ref, + int operator: int ref, + int right: @operator_assignment_right_type ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +optional_parameter_def( + unique int id: @optional_parameter, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int name: @token_identifier ref, + int value: @underscore_arg ref, + int loc: @location ref +); + +@pair_key_type = @string__ | @token_hash_key_symbol | @underscore_arg + +#keyset[parent, parent_index] +pair_def( + unique int id: @pair, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int key__: @pair_key_type ref, + int value: @underscore_arg ref, + int loc: @location ref +); + +@parenthesized_statements_child_type = @token_empty_statement | @underscore_statement + +#keyset[parenthesized_statements, index] +parenthesized_statements_child( + int parenthesized_statements: @parenthesized_statements ref, + int index: int ref, + unique int child: @parenthesized_statements_child_type ref +); + +#keyset[parent, parent_index] +parenthesized_statements_def( + unique int id: @parenthesized_statements, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@pattern_child_type = @splat_argument | @underscore_arg + +#keyset[parent, parent_index] +pattern_def( + unique int id: @pattern, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int child: @pattern_child_type ref, + int loc: @location ref +); + +@program_child_type = @token_empty_statement | @token_uninterpreted | @underscore_statement + +#keyset[program, index] +program_child( + int program: @program ref, + int index: int ref, + unique int child: @program_child_type ref +); + +#keyset[parent, parent_index] +program_def( + unique int id: @program, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +range_begin( + unique int range: @range ref, + unique int begin: @underscore_arg ref +); + +range_end( + unique int range: @range ref, + unique int end: @underscore_arg ref +); + +case @range.operator of + 0 = @range_dotdot +| 1 = @range_dotdotdot +; + + +#keyset[parent, parent_index] +range_def( + unique int id: @range, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int operator: int ref, + int loc: @location ref +); + +@rational_child_type = @token_float | @token_integer + +#keyset[parent, parent_index] +rational_def( + unique int id: @rational, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int child: @rational_child_type ref, + int loc: @location ref +); + +redo_child( + unique int redo: @redo ref, + unique int child: @argument_list ref +); + +#keyset[parent, parent_index] +redo_def( + unique int id: @redo, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@regex_child_type = @interpolation | @token_escape_sequence | @token_string_content + +#keyset[regex, index] +regex_child( + int regex: @regex ref, + int index: int ref, + unique int child: @regex_child_type ref +); + +#keyset[parent, parent_index] +regex_def( + unique int id: @regex, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +rescue_body( + unique int rescue: @rescue ref, + unique int body: @then ref +); + +rescue_exceptions( + unique int rescue: @rescue ref, + unique int exceptions: @exceptions ref +); + +rescue_variable( + unique int rescue: @rescue ref, + unique int variable: @exception_variable ref +); + +#keyset[parent, parent_index] +rescue_def( + unique int id: @rescue, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@rescue_modifier_handler_type = @break | @call | @next | @return | @underscore_arg | @yield + +#keyset[parent, parent_index] +rescue_modifier_def( + unique int id: @rescue_modifier, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int body: @underscore_statement ref, + int handler: @rescue_modifier_handler_type ref, + int loc: @location ref +); + +rest_assignment_child( + unique int rest_assignment: @rest_assignment ref, + unique int child: @underscore_lhs ref +); + +#keyset[parent, parent_index] +rest_assignment_def( + unique int id: @rest_assignment, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +retry_child( + unique int retry: @retry ref, + unique int child: @argument_list ref +); + +#keyset[parent, parent_index] +retry_def( + unique int id: @retry, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +return_child( + unique int return: @return ref, + unique int child: @argument_list ref +); + +#keyset[parent, parent_index] +return_def( + unique int id: @return, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@right_assignment_list_child_type = @splat_argument | @underscore_arg + +#keyset[right_assignment_list, index] +right_assignment_list_child( + int right_assignment_list: @right_assignment_list ref, + int index: int ref, + unique int child: @right_assignment_list_child_type ref +); + +#keyset[parent, parent_index] +right_assignment_list_def( + unique int id: @right_assignment_list, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@scope_resolution_name_type = @token_constant | @token_identifier + +scope_resolution_scope( + unique int scope_resolution: @scope_resolution ref, + unique int scope: @underscore_primary ref +); + +#keyset[parent, parent_index] +scope_resolution_def( + unique int id: @scope_resolution, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int name: @scope_resolution_name_type ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +setter_def( + unique int id: @setter, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int name: @token_identifier ref, + int loc: @location ref +); + +@singleton_class_child_type = @else | @ensure | @rescue | @token_empty_statement | @underscore_statement + +#keyset[singleton_class, index] +singleton_class_child( + int singleton_class: @singleton_class ref, + int index: int ref, + unique int child: @singleton_class_child_type ref +); + +#keyset[parent, parent_index] +singleton_class_def( + unique int id: @singleton_class, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int value: @underscore_arg ref, + int loc: @location ref +); + +@singleton_method_object_type = @underscore_arg | @underscore_variable + +singleton_method_parameters( + unique int singleton_method: @singleton_method ref, + unique int parameters: @method_parameters ref +); + +@singleton_method_child_type = @else | @ensure | @rescue | @token_empty_statement | @underscore_statement + +#keyset[singleton_method, index] +singleton_method_child( + int singleton_method: @singleton_method ref, + int index: int ref, + unique int child: @singleton_method_child_type ref +); + +#keyset[parent, parent_index] +singleton_method_def( + unique int id: @singleton_method, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int name: @underscore_method_name ref, + int object: @singleton_method_object_type ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +splat_argument_def( + unique int id: @splat_argument, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int child: @underscore_arg ref, + int loc: @location ref +); + +splat_parameter_name( + unique int splat_parameter: @splat_parameter ref, + unique int name: @token_identifier ref +); + +#keyset[parent, parent_index] +splat_parameter_def( + unique int id: @splat_parameter, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@string_child_type = @interpolation | @token_escape_sequence | @token_string_content + +#keyset[string__, index] +string_child( + int string__: @string__ ref, + int index: int ref, + unique int child: @string_child_type ref +); + +#keyset[parent, parent_index] +string_def( + unique int id: @string__, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +#keyset[string_array, index] +string_array_child( + int string_array: @string_array ref, + int index: int ref, + unique int child: @bare_string ref +); + +#keyset[parent, parent_index] +string_array_def( + unique int id: @string_array, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@subshell_child_type = @interpolation | @token_escape_sequence | @token_string_content + +#keyset[subshell, index] +subshell_child( + int subshell: @subshell ref, + int index: int ref, + unique int child: @subshell_child_type ref +); + +#keyset[parent, parent_index] +subshell_def( + unique int id: @subshell, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@superclass_child_type = @break | @call | @next | @return | @underscore_arg | @yield + +#keyset[parent, parent_index] +superclass_def( + unique int id: @superclass, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int child: @superclass_child_type ref, + int loc: @location ref +); + +#keyset[symbol_array, index] +symbol_array_child( + int symbol_array: @symbol_array ref, + int index: int ref, + unique int child: @bare_symbol ref +); + +#keyset[parent, parent_index] +symbol_array_def( + unique int id: @symbol_array, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@then_child_type = @token_empty_statement | @underscore_statement + +#keyset[then, index] +then_child( + int then: @then ref, + int index: int ref, + unique int child: @then_child_type ref +); + +#keyset[parent, parent_index] +then_def( + unique int id: @then, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@unary_operand_type = @break | @call | @next | @parenthesized_statements | @return | @token_float | @token_integer | @underscore_arg | @yield + +case @unary.operator of + 0 = @unary_bang +| 1 = @unary_plus +| 2 = @unary_minus +| 3 = @unary_definedquestion +| 4 = @unary_not +| 5 = @unary_tilde +; + + +#keyset[parent, parent_index] +unary_def( + unique int id: @unary, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int operand: @unary_operand_type ref, + int operator: int ref, + int loc: @location ref +); + +#keyset[undef, index] +undef_child( + int undef: @undef ref, + int index: int ref, + unique int child: @underscore_method_name ref +); + +#keyset[parent, parent_index] +undef_def( + unique int id: @undef, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +@unless_alternative_type = @else | @elsif + +unless_alternative( + unique int unless: @unless ref, + unique int alternative: @unless_alternative_type ref +); + +unless_consequence( + unique int unless: @unless ref, + unique int consequence: @then ref +); + +#keyset[parent, parent_index] +unless_def( + unique int id: @unless, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int condition: @underscore_statement ref, + int loc: @location ref +); + +@unless_modifier_condition_type = @break | @call | @next | @return | @underscore_arg | @yield + +#keyset[parent, parent_index] +unless_modifier_def( + unique int id: @unless_modifier, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int body: @underscore_statement ref, + int condition: @unless_modifier_condition_type ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +until_def( + unique int id: @until, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int body: @do ref, + int condition: @underscore_statement ref, + int loc: @location ref +); + +@until_modifier_condition_type = @break | @call | @next | @return | @underscore_arg | @yield + +#keyset[parent, parent_index] +until_modifier_def( + unique int id: @until_modifier, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int body: @underscore_statement ref, + int condition: @until_modifier_condition_type ref, + int loc: @location ref +); + +when_body( + unique int when: @when ref, + unique int body: @then ref +); + +#keyset[when, index] +when_pattern( + int when: @when ref, + int index: int ref, + unique int pattern: @pattern ref +); + +#keyset[parent, parent_index] +when_def( + unique int id: @when, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +while_def( + unique int id: @while, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int body: @do ref, + int condition: @underscore_statement ref, + int loc: @location ref +); + +@while_modifier_condition_type = @break | @call | @next | @return | @underscore_arg | @yield + +#keyset[parent, parent_index] +while_modifier_def( + unique int id: @while_modifier, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int body: @underscore_statement ref, + int condition: @while_modifier_condition_type ref, + int loc: @location ref +); + +yield_child( + unique int yield: @yield ref, + unique int child: @argument_list ref +); + +#keyset[parent, parent_index] +yield_def( + unique int id: @yield, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int loc: @location ref +); + +#keyset[parent, parent_index] +tokeninfo( + unique int id: @token, + int parent: @ast_node_parent ref, + int parent_index: int ref, + int kind: int ref, + int file: @file ref, + int idx: int ref, + string value: string ref, + int loc: @location ref +); + +case @token.kind of + 0 = @reserved_word +| 1 = @token_character +| 2 = @token_class_variable +| 3 = @token_comment +| 4 = @token_complex +| 5 = @token_constant +| 6 = @token_empty_statement +| 7 = @token_escape_sequence +| 8 = @token_false +| 9 = @token_float +| 10 = @token_global_variable +| 11 = @token_hash_key_symbol +| 12 = @token_heredoc_beginning +| 13 = @token_heredoc_content +| 14 = @token_heredoc_end +| 15 = @token_identifier +| 16 = @token_instance_variable +| 17 = @token_integer +| 18 = @token_nil +| 19 = @token_operator +| 20 = @token_self +| 21 = @token_simple_symbol +| 22 = @token_string_content +| 23 = @token_super +| 24 = @token_true +| 25 = @token_uninterpreted +; + + +@ast_node = @alias | @argument_list | @array | @assignment | @bare_string | @bare_symbol | @begin | @begin_block | @binary | @block | @block_argument | @block_parameter | @block_parameters | @break | @call | @case__ | @chained_string | @class | @conditional | @delimited_symbol | @destructured_left_assignment | @destructured_parameter | @do | @do_block | @element_reference | @else | @elsif | @end_block | @ensure | @exception_variable | @exceptions | @for | @hash | @hash_splat_argument | @hash_splat_parameter | @heredoc_body | @if | @if_modifier | @in | @interpolation | @keyword_parameter | @lambda | @lambda_parameters | @left_assignment_list | @method | @method_parameters | @module | @next | @operator_assignment | @optional_parameter | @pair | @parenthesized_statements | @pattern | @program | @range | @rational | @redo | @regex | @rescue | @rescue_modifier | @rest_assignment | @retry | @return | @right_assignment_list | @scope_resolution | @setter | @singleton_class | @singleton_method | @splat_argument | @splat_parameter | @string__ | @string_array | @subshell | @superclass | @symbol_array | @then | @token | @unary | @undef | @unless | @unless_modifier | @until | @until_modifier | @when | @while | @while_modifier | @yield + +@ast_node_parent = @ast_node | @file + diff --git a/upgrades/932cb23dbc167adf4d378a0aba22cf32bb8e7876/upgrade.properties b/upgrades/932cb23dbc167adf4d378a0aba22cf32bb8e7876/upgrade.properties new file mode 100644 index 00000000000..8cf42192418 --- /dev/null +++ b/upgrades/932cb23dbc167adf4d378a0aba22cf32bb8e7876/upgrade.properties @@ -0,0 +1,3 @@ +description: adds support for multiple statements in interpolations +compatibility: partial +interpolation_child.rel: run interpolation_child.qlo