Add #keyset[parent, parent_index]

This commit is contained in:
Arthur Baars
2020-11-24 14:00:38 +01:00
parent 89953fd87c
commit 00015b0022
2 changed files with 90 additions and 2 deletions

View File

@@ -178,7 +178,7 @@ fn convert_nodes<'a>(nodes: &'a node_types::NodeTypeMap) -> Vec<dbscheme::Entry<
ql_type_is_ref: true,
},
],
keysets: None,
keysets: Some(vec!["parent", "parent_index"]),
};
ast_node_members.insert(&node.dbscheme_name);
@@ -256,7 +256,7 @@ fn create_tokeninfo<'a>(
) -> (dbscheme::Case<'a>, dbscheme::Table<'a>) {
let table = dbscheme::Table {
name: "tokeninfo",
keysets: None,
keysets: Some(vec!["parent", "parent_index"]),
columns: vec![
dbscheme::Column {
db_type: dbscheme::DbColumnType::Int,

View File

@@ -58,6 +58,7 @@ sourceLocationPrefix(
@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,
@@ -76,6 +77,7 @@ argument_list_child(
unique int argument_list_child_type: @argument_list_child_type ref
);
#keyset[parent, parent_index]
argument_list_def(
unique int id: @argument_list,
int parent: @ast_node_parent ref,
@@ -92,6 +94,7 @@ array_child(
unique int array_child_type: @array_child_type ref
);
#keyset[parent, parent_index]
array_def(
unique int id: @array,
int parent: @ast_node_parent ref,
@@ -103,6 +106,7 @@ array_def(
@assignment_right_type = @break | @call | @method_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,
@@ -121,6 +125,7 @@ bare_string_child(
unique int bare_string_child_type: @bare_string_child_type ref
);
#keyset[parent, parent_index]
bare_string_def(
unique int id: @bare_string,
int parent: @ast_node_parent ref,
@@ -137,6 +142,7 @@ bare_symbol_child(
unique int bare_symbol_child_type: @bare_symbol_child_type ref
);
#keyset[parent, parent_index]
bare_symbol_def(
unique int id: @bare_symbol,
int parent: @ast_node_parent ref,
@@ -153,6 +159,7 @@ begin_child(
unique int begin_child_type: @begin_child_type ref
);
#keyset[parent, parent_index]
begin_def(
unique int id: @begin,
int parent: @ast_node_parent ref,
@@ -169,6 +176,7 @@ begin_block_child(
unique int begin_block_child_type: @begin_block_child_type ref
);
#keyset[parent, parent_index]
begin_block_def(
unique int id: @begin_block,
int parent: @ast_node_parent ref,
@@ -182,6 +190,7 @@ begin_block_def(
@binary_right_type = @break | @call | @method_call | @next | @return | @underscore_arg | @yield
#keyset[parent, parent_index]
binary_def(
unique int id: @binary,
int parent: @ast_node_parent ref,
@@ -201,6 +210,7 @@ block_child(
unique int block_child_type: @block_child_type ref
);
#keyset[parent, parent_index]
block_def(
unique int id: @block,
int parent: @ast_node_parent ref,
@@ -208,6 +218,7 @@ block_def(
int loc: @location ref
);
#keyset[parent, parent_index]
block_argument_def(
unique int id: @block_argument,
int parent: @ast_node_parent ref,
@@ -216,6 +227,7 @@ block_argument_def(
int loc: @location ref
);
#keyset[parent, parent_index]
block_parameter_def(
unique int id: @block_parameter,
int parent: @ast_node_parent ref,
@@ -233,6 +245,7 @@ block_parameters_child(
unique int block_parameters_child_type: @block_parameters_child_type ref
);
#keyset[parent, parent_index]
block_parameters_def(
unique int id: @block_parameters,
int parent: @ast_node_parent ref,
@@ -245,6 +258,7 @@ break_child(
unique int argument_list: @argument_list ref
);
#keyset[parent, parent_index]
break_def(
unique int id: @break,
int parent: @ast_node_parent ref,
@@ -256,6 +270,7 @@ break_def(
@call_receiver_type = @method_call | @underscore_primary
#keyset[parent, parent_index]
call_def(
unique int id: @call,
int parent: @ast_node_parent ref,
@@ -279,6 +294,7 @@ case_child(
unique int case_child_type: @case_child_type ref
);
#keyset[parent, parent_index]
case_def(
unique int id: @case__,
int parent: @ast_node_parent ref,
@@ -293,6 +309,7 @@ chained_string_child(
unique int string__: @string__ ref
);
#keyset[parent, parent_index]
chained_string_def(
unique int id: @chained_string,
int parent: @ast_node_parent ref,
@@ -311,6 +328,7 @@ class_child(
unique int class_child_type: @class_child_type ref
);
#keyset[parent, parent_index]
class_def(
unique int id: @class,
int parent: @ast_node_parent ref,
@@ -319,6 +337,7 @@ class_def(
int loc: @location ref
);
#keyset[parent, parent_index]
conditional_def(
unique int id: @conditional,
int parent: @ast_node_parent ref,
@@ -338,6 +357,7 @@ destructured_left_assignment_child(
unique int destructured_left_assignment_child_type: @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,
@@ -354,6 +374,7 @@ destructured_parameter_child(
unique int destructured_parameter_child_type: @destructured_parameter_child_type ref
);
#keyset[parent, parent_index]
destructured_parameter_def(
unique int id: @destructured_parameter,
int parent: @ast_node_parent ref,
@@ -370,6 +391,7 @@ do_child(
unique int do_child_type: @do_child_type ref
);
#keyset[parent, parent_index]
do_def(
unique int id: @do,
int parent: @ast_node_parent ref,
@@ -386,6 +408,7 @@ do_block_child(
unique int do_block_child_type: @do_block_child_type ref
);
#keyset[parent, parent_index]
do_block_def(
unique int id: @do_block,
int parent: @ast_node_parent ref,
@@ -402,6 +425,7 @@ element_reference_child(
unique int element_reference_child_type: @element_reference_child_type ref
);
#keyset[parent, parent_index]
element_reference_def(
unique int id: @element_reference,
int parent: @ast_node_parent ref,
@@ -419,6 +443,7 @@ else_child(
unique int else_child_type: @else_child_type ref
);
#keyset[parent, parent_index]
else_def(
unique int id: @else,
int parent: @ast_node_parent ref,
@@ -438,6 +463,7 @@ elsif_consequence(
unique int then: @then ref
);
#keyset[parent, parent_index]
elsif_def(
unique int id: @elsif,
int parent: @ast_node_parent ref,
@@ -455,6 +481,7 @@ end_block_child(
unique int end_block_child_type: @end_block_child_type ref
);
#keyset[parent, parent_index]
end_block_def(
unique int id: @end_block,
int parent: @ast_node_parent ref,
@@ -471,6 +498,7 @@ ensure_child(
unique int ensure_child_type: @ensure_child_type ref
);
#keyset[parent, parent_index]
ensure_def(
unique int id: @ensure,
int parent: @ast_node_parent ref,
@@ -478,6 +506,7 @@ ensure_def(
int loc: @location ref
);
#keyset[parent, parent_index]
exception_variable_def(
unique int id: @exception_variable,
int parent: @ast_node_parent ref,
@@ -495,6 +524,7 @@ exceptions_child(
unique int exceptions_child_type: @exceptions_child_type ref
);
#keyset[parent, parent_index]
exceptions_def(
unique int id: @exceptions,
int parent: @ast_node_parent ref,
@@ -511,6 +541,7 @@ for_pattern(
unique int for_pattern_type: @for_pattern_type ref
);
#keyset[parent, parent_index]
for_def(
unique int id: @for,
int parent: @ast_node_parent ref,
@@ -529,6 +560,7 @@ hash_child(
unique int hash_child_type: @hash_child_type ref
);
#keyset[parent, parent_index]
hash_def(
unique int id: @hash,
int parent: @ast_node_parent ref,
@@ -536,6 +568,7 @@ hash_def(
int loc: @location ref
);
#keyset[parent, parent_index]
hash_splat_argument_def(
unique int id: @hash_splat_argument,
int parent: @ast_node_parent ref,
@@ -549,6 +582,7 @@ hash_splat_parameter_name(
unique int token_identifier: @token_identifier ref
);
#keyset[parent, parent_index]
hash_splat_parameter_def(
unique int id: @hash_splat_parameter,
int parent: @ast_node_parent ref,
@@ -565,6 +599,7 @@ heredoc_body_child(
unique int heredoc_body_child_type: @heredoc_body_child_type ref
);
#keyset[parent, parent_index]
heredoc_body_def(
unique int id: @heredoc_body,
int parent: @ast_node_parent ref,
@@ -584,6 +619,7 @@ if_consequence(
unique int then: @then ref
);
#keyset[parent, parent_index]
if_def(
unique int id: @if,
int parent: @ast_node_parent ref,
@@ -594,6 +630,7 @@ if_def(
@if_modifier_condition_type = @break | @call | @method_call | @next | @return | @underscore_arg | @yield
#keyset[parent, parent_index]
if_modifier_def(
unique int id: @if_modifier,
int parent: @ast_node_parent ref,
@@ -603,6 +640,7 @@ if_modifier_def(
int loc: @location ref
);
#keyset[parent, parent_index]
in_def(
unique int id: @in,
int parent: @ast_node_parent ref,
@@ -611,6 +649,7 @@ in_def(
int loc: @location ref
);
#keyset[parent, parent_index]
interpolation_def(
unique int id: @interpolation,
int parent: @ast_node_parent ref,
@@ -624,6 +663,7 @@ keyword_parameter_value(
unique int underscore_arg: @underscore_arg ref
);
#keyset[parent, parent_index]
keyword_parameter_def(
unique int id: @keyword_parameter,
int parent: @ast_node_parent ref,
@@ -639,6 +679,7 @@ lambda_parameters(
unique int lambda_parameters: @lambda_parameters ref
);
#keyset[parent, parent_index]
lambda_def(
unique int id: @lambda,
int parent: @ast_node_parent ref,
@@ -656,6 +697,7 @@ lambda_parameters_child(
unique int lambda_parameters_child_type: @lambda_parameters_child_type ref
);
#keyset[parent, parent_index]
lambda_parameters_def(
unique int id: @lambda_parameters,
int parent: @ast_node_parent ref,
@@ -672,6 +714,7 @@ left_assignment_list_child(
unique int left_assignment_list_child_type: @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,
@@ -693,6 +736,7 @@ method_child(
unique int method_child_type: @method_child_type ref
);
#keyset[parent, parent_index]
method_def(
unique int id: @method,
int parent: @ast_node_parent ref,
@@ -715,6 +759,7 @@ method_call_block(
@method_call_method_type = @call | @scope_resolution | @underscore_variable
#keyset[parent, parent_index]
method_call_def(
unique int id: @method_call,
int parent: @ast_node_parent ref,
@@ -732,6 +777,7 @@ method_parameters_child(
unique int method_parameters_child_type: @method_parameters_child_type ref
);
#keyset[parent, parent_index]
method_parameters_def(
unique int id: @method_parameters,
int parent: @ast_node_parent ref,
@@ -750,6 +796,7 @@ module_child(
unique int module_child_type: @module_child_type ref
);
#keyset[parent, parent_index]
module_def(
unique int id: @module,
int parent: @ast_node_parent ref,
@@ -763,6 +810,7 @@ next_child(
unique int argument_list: @argument_list ref
);
#keyset[parent, parent_index]
next_def(
unique int id: @next,
int parent: @ast_node_parent ref,
@@ -772,6 +820,7 @@ next_def(
@operator_assignment_right_type = @break | @call | @method_call | @next | @return | @underscore_arg | @yield
#keyset[parent, parent_index]
operator_assignment_def(
unique int id: @operator_assignment,
int parent: @ast_node_parent ref,
@@ -781,6 +830,7 @@ operator_assignment_def(
int loc: @location ref
);
#keyset[parent, parent_index]
optional_parameter_def(
unique int id: @optional_parameter,
int parent: @ast_node_parent ref,
@@ -792,6 +842,7 @@ optional_parameter_def(
@pair_key_type = @string__ | @symbol | @underscore_arg
#keyset[parent, parent_index]
pair_def(
unique int id: @pair,
int parent: @ast_node_parent ref,
@@ -810,6 +861,7 @@ parenthesized_statements_child(
unique int parenthesized_statements_child_type: @parenthesized_statements_child_type ref
);
#keyset[parent, parent_index]
parenthesized_statements_def(
unique int id: @parenthesized_statements,
int parent: @ast_node_parent ref,
@@ -819,6 +871,7 @@ parenthesized_statements_def(
@pattern_child_type = @splat_argument | @underscore_arg
#keyset[parent, parent_index]
pattern_def(
unique int id: @pattern,
int parent: @ast_node_parent ref,
@@ -836,6 +889,7 @@ program_child(
unique int program_child_type: @program_child_type ref
);
#keyset[parent, parent_index]
program_def(
unique int id: @program,
int parent: @ast_node_parent ref,
@@ -850,6 +904,7 @@ range_child(
unique int underscore_arg: @underscore_arg ref
);
#keyset[parent, parent_index]
range_def(
unique int id: @range,
int parent: @ast_node_parent ref,
@@ -857,6 +912,7 @@ range_def(
int loc: @location ref
);
#keyset[parent, parent_index]
rational_def(
unique int id: @rational,
int parent: @ast_node_parent ref,
@@ -870,6 +926,7 @@ redo_child(
unique int argument_list: @argument_list ref
);
#keyset[parent, parent_index]
redo_def(
unique int id: @redo,
int parent: @ast_node_parent ref,
@@ -886,6 +943,7 @@ regex_child(
unique int regex_child_type: @regex_child_type ref
);
#keyset[parent, parent_index]
regex_def(
unique int id: @regex,
int parent: @ast_node_parent ref,
@@ -908,6 +966,7 @@ rescue_variable(
unique int exception_variable: @exception_variable ref
);
#keyset[parent, parent_index]
rescue_def(
unique int id: @rescue,
int parent: @ast_node_parent ref,
@@ -917,6 +976,7 @@ rescue_def(
@rescue_modifier_handler_type = @break | @call | @method_call | @next | @return | @underscore_arg | @yield
#keyset[parent, parent_index]
rescue_modifier_def(
unique int id: @rescue_modifier,
int parent: @ast_node_parent ref,
@@ -931,6 +991,7 @@ rest_assignment_child(
unique int underscore_lhs: @underscore_lhs ref
);
#keyset[parent, parent_index]
rest_assignment_def(
unique int id: @rest_assignment,
int parent: @ast_node_parent ref,
@@ -943,6 +1004,7 @@ retry_child(
unique int argument_list: @argument_list ref
);
#keyset[parent, parent_index]
retry_def(
unique int id: @retry,
int parent: @ast_node_parent ref,
@@ -955,6 +1017,7 @@ return_child(
unique int argument_list: @argument_list ref
);
#keyset[parent, parent_index]
return_def(
unique int id: @return,
int parent: @ast_node_parent ref,
@@ -971,6 +1034,7 @@ right_assignment_list_child(
unique int right_assignment_list_child_type: @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,
@@ -985,6 +1049,7 @@ scope_resolution_scope(
unique int underscore_primary: @underscore_primary ref
);
#keyset[parent, parent_index]
scope_resolution_def(
unique int id: @scope_resolution,
int parent: @ast_node_parent ref,
@@ -993,6 +1058,7 @@ scope_resolution_def(
int loc: @location ref
);
#keyset[parent, parent_index]
setter_def(
unique int id: @setter,
int parent: @ast_node_parent ref,
@@ -1010,6 +1076,7 @@ singleton_class_child(
unique int singleton_class_child_type: @singleton_class_child_type ref
);
#keyset[parent, parent_index]
singleton_class_def(
unique int id: @singleton_class,
int parent: @ast_node_parent ref,
@@ -1034,6 +1101,7 @@ singleton_method_child(
unique int singleton_method_child_type: @singleton_method_child_type ref
);
#keyset[parent, parent_index]
singleton_method_def(
unique int id: @singleton_method,
int parent: @ast_node_parent ref,
@@ -1043,6 +1111,7 @@ singleton_method_def(
int loc: @location ref
);
#keyset[parent, parent_index]
splat_argument_def(
unique int id: @splat_argument,
int parent: @ast_node_parent ref,
@@ -1056,6 +1125,7 @@ splat_parameter_name(
unique int token_identifier: @token_identifier ref
);
#keyset[parent, parent_index]
splat_parameter_def(
unique int id: @splat_parameter,
int parent: @ast_node_parent ref,
@@ -1072,6 +1142,7 @@ string_child(
unique int string_child_type: @string_child_type ref
);
#keyset[parent, parent_index]
string_def(
unique int id: @string__,
int parent: @ast_node_parent ref,
@@ -1086,6 +1157,7 @@ string_array_child(
unique int bare_string: @bare_string ref
);
#keyset[parent, parent_index]
string_array_def(
unique int id: @string_array,
int parent: @ast_node_parent ref,
@@ -1102,6 +1174,7 @@ subshell_child(
unique int subshell_child_type: @subshell_child_type ref
);
#keyset[parent, parent_index]
subshell_def(
unique int id: @subshell,
int parent: @ast_node_parent ref,
@@ -1111,6 +1184,7 @@ subshell_def(
@superclass_child_type = @break | @call | @method_call | @next | @return | @underscore_arg | @yield
#keyset[parent, parent_index]
superclass_def(
unique int id: @superclass,
int parent: @ast_node_parent ref,
@@ -1128,6 +1202,7 @@ symbol_child(
unique int symbol_child_type: @symbol_child_type ref
);
#keyset[parent, parent_index]
symbol_def(
unique int id: @symbol,
int parent: @ast_node_parent ref,
@@ -1142,6 +1217,7 @@ symbol_array_child(
unique int bare_symbol: @bare_symbol ref
);
#keyset[parent, parent_index]
symbol_array_def(
unique int id: @symbol_array,
int parent: @ast_node_parent ref,
@@ -1158,6 +1234,7 @@ then_child(
unique int then_child_type: @then_child_type ref
);
#keyset[parent, parent_index]
then_def(
unique int id: @then,
int parent: @ast_node_parent ref,
@@ -1169,6 +1246,7 @@ then_def(
@unary_operator_type = @reserved_word
#keyset[parent, parent_index]
unary_def(
unique int id: @unary,
int parent: @ast_node_parent ref,
@@ -1185,6 +1263,7 @@ undef_child(
unique int underscore_method_name: @underscore_method_name ref
);
#keyset[parent, parent_index]
undef_def(
unique int id: @undef,
int parent: @ast_node_parent ref,
@@ -1204,6 +1283,7 @@ unless_consequence(
unique int then: @then ref
);
#keyset[parent, parent_index]
unless_def(
unique int id: @unless,
int parent: @ast_node_parent ref,
@@ -1214,6 +1294,7 @@ unless_def(
@unless_modifier_condition_type = @break | @call | @method_call | @next | @return | @underscore_arg | @yield
#keyset[parent, parent_index]
unless_modifier_def(
unique int id: @unless_modifier,
int parent: @ast_node_parent ref,
@@ -1223,6 +1304,7 @@ unless_modifier_def(
int loc: @location ref
);
#keyset[parent, parent_index]
until_def(
unique int id: @until,
int parent: @ast_node_parent ref,
@@ -1234,6 +1316,7 @@ until_def(
@until_modifier_condition_type = @break | @call | @method_call | @next | @return | @underscore_arg | @yield
#keyset[parent, parent_index]
until_modifier_def(
unique int id: @until_modifier,
int parent: @ast_node_parent ref,
@@ -1257,6 +1340,7 @@ when_pattern(
unique int when_pattern_type: @when_pattern_type ref
);
#keyset[parent, parent_index]
when_def(
unique int id: @when,
int parent: @ast_node_parent ref,
@@ -1264,6 +1348,7 @@ when_def(
int loc: @location ref
);
#keyset[parent, parent_index]
while_def(
unique int id: @while,
int parent: @ast_node_parent ref,
@@ -1275,6 +1360,7 @@ while_def(
@while_modifier_condition_type = @break | @call | @method_call | @next | @return | @underscore_arg | @yield
#keyset[parent, parent_index]
while_modifier_def(
unique int id: @while_modifier,
int parent: @ast_node_parent ref,
@@ -1289,6 +1375,7 @@ yield_child(
unique int argument_list: @argument_list ref
);
#keyset[parent, parent_index]
yield_def(
unique int id: @yield,
int parent: @ast_node_parent ref,
@@ -1296,6 +1383,7 @@ yield_def(
int loc: @location ref
);
#keyset[parent, parent_index]
tokeninfo(
unique int id: @token,
int parent: @ast_node_parent ref,