Add parent field to AstNode

This commit is contained in:
Arthur Baars
2020-11-23 18:35:20 +01:00
parent c7b07b7821
commit b72db8b6f1
5 changed files with 555 additions and 246 deletions

View File

@@ -259,12 +259,13 @@ struct Visitor<'a> {
token_counter: usize,
/// A lookup table from type name to node types
schema: &'a NodeTypeMap,
/// A stack for gathering information from hild nodes. Whenever a node is entered
/// an empty list is pushed. All children append their data (field name, label, type) to
/// the the list. When the visitor leaves a node the list containing the child data is popped
/// from the stack and matched against the dbscheme for the node. If the expectations are met
/// the corresponding row definitions are added to the trap_output.
stack: Vec<Vec<(Option<&'static str>, Label, TypeName)>>,
/// A stack for gathering information from child nodes. Whenever a node is entered
/// the parent's [Label] and an empty list is pushed. All children append their data
/// (field name, label, type) to the the list. When the visitor leaves a node the list
/// containing the child data is popped from the stack and matched against the dbscheme
/// for the node. If the expectations are met the corresponding row definitions are
/// added to the trap_output.
stack: Vec<(Label, Vec<(Option<&'static str>, Label, TypeName)>)>,
}
impl Visitor<'_> {
@@ -287,7 +288,9 @@ impl Visitor<'_> {
return false;
}
self.stack.push(Vec::new());
let id = self.trap_writer.fresh_id();
self.stack.push((id, Vec::new()));
return true;
}
@@ -295,11 +298,10 @@ impl Visitor<'_> {
if node.is_error() || node.is_missing() {
return;
}
let child_nodes = self.stack.pop().expect("Vistor: empty stack");
let id = self.trap_writer.fresh_id();
let (id, child_nodes) = self.stack.pop().expect("Vistor: empty stack");
let (start_line, start_column, end_line, end_column) = location_for(&self.source, node);
let loc = self.trap_writer.location(
self.file_label.clone(),
self.file_label,
start_line,
start_column,
end_line,
@@ -313,12 +315,17 @@ impl Visitor<'_> {
})
.unwrap();
let mut valid = true;
let parent_id = match self.stack.last_mut() {
Some(p) if !node.is_extra() => p.0,
_ => self.file_label,
};
match &table.kind {
EntryKind::Token { kind_id, .. } => {
self.trap_writer.add_tuple(
"tokeninfo",
vec![
Arg::Label(id),
Arg::Label(parent_id),
Arg::Int(*kind_id),
Arg::Label(self.file_label),
Arg::Int(self.token_counter),
@@ -335,6 +342,7 @@ impl Visitor<'_> {
if let Some(args) = self.complex_node(&node, fields, child_nodes, id) {
let mut all_args = Vec::new();
all_args.push(Arg::Label(id));
all_args.push(Arg::Label(parent_id));
all_args.extend(args);
all_args.push(Arg::Label(loc));
self.trap_writer.add_tuple(&table_name, all_args);
@@ -354,7 +362,7 @@ impl Visitor<'_> {
// Extra nodes are independent root nodes and do not belong to the parent node
// Therefore we should not register them in the parent vector
if let Some(parent) = self.stack.last_mut() {
parent.push((
parent.1.push((
field_name,
id,
TypeName {

View File

@@ -136,7 +136,7 @@ fn convert_nodes<'a>(nodes: &'a node_types::NodeTypeMap) -> Vec<dbscheme::Entry<
})
.collect();
ast_node_members.insert("token");
ast_node_members.insert("file");
for (_, node) in nodes {
match &node.kind {
node_types::EntryKind::Union { members: n_members } => {
@@ -155,13 +155,22 @@ fn convert_nodes<'a>(nodes: &'a node_types::NodeTypeMap) -> Vec<dbscheme::Entry<
// It's a product type, defined by a table.
let mut main_table = dbscheme::Table {
name: &name,
columns: vec![dbscheme::Column {
db_type: dbscheme::DbColumnType::Int,
name: "id",
unique: true,
ql_type: ql::Type::AtType(&node.dbscheme_name),
ql_type_is_ref: false,
}],
columns: vec![
dbscheme::Column {
db_type: dbscheme::DbColumnType::Int,
name: "id",
unique: true,
ql_type: ql::Type::AtType(&node.dbscheme_name),
ql_type_is_ref: false,
},
dbscheme::Column {
db_type: dbscheme::DbColumnType::Int,
name: "parent",
unique: false,
ql_type: ql::Type::AtType("ast_node_parent"),
ql_type_is_ref: true,
},
],
keysets: None,
};
ast_node_members.insert(&node.dbscheme_name);
@@ -227,6 +236,11 @@ fn convert_nodes<'a>(nodes: &'a node_types::NodeTypeMap) -> Vec<dbscheme::Entry<
members: ast_node_members,
}));
// Create the ast_node_parent union.
entries.push(dbscheme::Entry::Union(dbscheme::Union {
name: "ast_node_parent",
members: ["ast_node", "file"].iter().cloned().collect(),
}));
entries
}
@@ -244,6 +258,13 @@ fn create_tokeninfo<'a>(
ql_type: ql::Type::AtType("token"),
ql_type_is_ref: false,
},
dbscheme::Column {
db_type: dbscheme::DbColumnType::Int,
name: "parent",
unique: false,
ql_type: ql::Type::AtType("ast_node_parent"),
ql_type_is_ref: true,
},
dbscheme::Column {
unique: false,
db_type: dbscheme::DbColumnType::Int,

View File

@@ -46,31 +46,7 @@ fn create_ast_node_class<'a>() -> ql::Class<'a> {
create_none_predicate("getLocation", false, Some(ql::Type::Normal("Location")));
let get_a_field_or_child =
create_none_predicate("getAFieldOrChild", false, Some(ql::Type::Normal("AstNode")));
let get_parent = ql::Predicate {
name: "getParent",
overridden: false,
return_type: Some(ql::Type::Normal("AstNode")),
formal_parameters: vec![],
body: ql::Expression::Equals(
Box::new(ql::Expression::Var("result")),
Box::new(ql::Expression::Aggregate(
"unique",
vec![ql::FormalParameter {
name: "parent",
param_type: ql::Type::Normal("AstNode"),
}],
Box::new(ql::Expression::Equals(
Box::new(ql::Expression::Var("this")),
Box::new(ql::Expression::Dot(
Box::new(ql::Expression::Var("parent")),
"getAFieldOrChild",
vec![],
)),
)),
Box::new(ql::Expression::Var("parent")),
)),
),
};
let get_parent = create_none_predicate("getParent", false, Some(ql::Type::Normal("AstNode")));
let describe_ql_class = ql::Predicate {
name: "describeQlClass",
overridden: false,
@@ -97,6 +73,24 @@ fn create_ast_node_class<'a>() -> ql::Class<'a> {
}
fn create_token_class<'a>() -> ql::Class<'a> {
let get_parent = ql::Predicate {
name: "getParent",
overridden: true,
return_type: Some(ql::Type::Normal("AstNode")),
formal_parameters: vec![],
body: ql::Expression::Pred(
"tokeninfo",
vec![
ql::Expression::Var("this"),
ql::Expression::Var("result"),
ql::Expression::Var("_"),
ql::Expression::Var("_"),
ql::Expression::Var("_"),
ql::Expression::Var("_"),
ql::Expression::Var("_"),
],
),
};
let get_value = ql::Predicate {
name: "getValue",
overridden: false,
@@ -109,6 +103,7 @@ fn create_token_class<'a>() -> ql::Class<'a> {
ql::Expression::Var("_"),
ql::Expression::Var("_"),
ql::Expression::Var("_"),
ql::Expression::Var("_"),
ql::Expression::Var("result"),
ql::Expression::Var("_"),
],
@@ -127,6 +122,7 @@ fn create_token_class<'a>() -> ql::Class<'a> {
ql::Expression::Var("_"),
ql::Expression::Var("_"),
ql::Expression::Var("_"),
ql::Expression::Var("_"),
ql::Expression::Var("result"),
],
),
@@ -149,6 +145,7 @@ fn create_token_class<'a>() -> ql::Class<'a> {
.collect(),
characteristic_predicate: None,
predicates: vec![
get_parent,
get_value,
get_location,
to_string,
@@ -262,7 +259,7 @@ fn create_get_field_expr_for_column_storage<'a>(
column_index: usize,
arity: usize,
) -> ql::Expression<'a> {
let num_underscores_before = column_index - 1;
let num_underscores_before = column_index;
let num_underscores_after = arity - 2 - num_underscores_before;
ql::Expression::Pred(
table_name,
@@ -436,10 +433,11 @@ pub fn convert_nodes<'a>(nodes: &'a node_types::NodeTypeMap) -> Vec<ql::TopLevel
// Count how many columns there will be in the main table.
// There will be:
// - one for the id
// - one for the parent
// - one for the location
// - one for each field that's stored as a column
// - if there are no fields, one for the text column.
let main_table_arity = 2 + if fields.is_empty() {
let main_table_arity = 3 + if fields.is_empty() {
1
} else {
fields
@@ -489,6 +487,18 @@ pub fn convert_nodes<'a>(nodes: &'a node_types::NodeTypeMap) -> Vec<ql::TopLevel
get_child_exprs.push(get_child_expr);
}
main_class.predicates.push(ql::Predicate {
name: "getParent",
overridden: true,
return_type: Some(ql::Type::Normal("AstNode")),
formal_parameters: vec![],
body: create_get_field_expr_for_column_storage(
&main_table_name,
0,
main_table_arity,
),
});
main_class.predicates.push(ql::Predicate {
name: "getAFieldOrChild",
overridden: true,

File diff suppressed because it is too large Load Diff

View File

@@ -60,6 +60,7 @@ sourceLocationPrefix(
alias_def(
unique int id: @alias,
int parent: @ast_node_parent ref,
int alias: @underscore_method_name ref,
int name: @underscore_method_name ref,
int loc: @location ref
@@ -76,6 +77,7 @@ argument_list_child(
argument_list_def(
unique int id: @argument_list,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -90,6 +92,7 @@ array_child(
array_def(
unique int id: @array,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -99,6 +102,7 @@ array_def(
assignment_def(
unique int id: @assignment,
int parent: @ast_node_parent ref,
int left: @assignment_left_type ref,
int right: @assignment_right_type ref,
int loc: @location ref
@@ -115,6 +119,7 @@ bare_string_child(
bare_string_def(
unique int id: @bare_string,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -129,6 +134,7 @@ bare_symbol_child(
bare_symbol_def(
unique int id: @bare_symbol,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -143,6 +149,7 @@ begin_child(
begin_def(
unique int id: @begin,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -157,6 +164,7 @@ begin_block_child(
begin_block_def(
unique int id: @begin_block,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -168,6 +176,7 @@ begin_block_def(
binary_def(
unique int id: @binary,
int parent: @ast_node_parent ref,
int left: @binary_left_type ref,
int operator: @binary_operator_type ref,
int right: @binary_right_type ref,
@@ -185,17 +194,20 @@ block_child(
block_def(
unique int id: @block,
int parent: @ast_node_parent ref,
int loc: @location ref
);
block_argument_def(
unique int id: @block_argument,
int parent: @ast_node_parent ref,
int child: @underscore_arg ref,
int loc: @location ref
);
block_parameter_def(
unique int id: @block_parameter,
int parent: @ast_node_parent ref,
int name: @token_identifier ref,
int loc: @location ref
);
@@ -211,6 +223,7 @@ block_parameters_child(
block_parameters_def(
unique int id: @block_parameters,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -221,6 +234,7 @@ break_child(
break_def(
unique int id: @break,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -230,6 +244,7 @@ break_def(
call_def(
unique int id: @call,
int parent: @ast_node_parent ref,
int method: @call_method_type ref,
int receiver: @call_receiver_type ref,
int loc: @location ref
@@ -251,6 +266,7 @@ case_child(
case_def(
unique int id: @case__,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -263,6 +279,7 @@ chained_string_child(
chained_string_def(
unique int id: @chained_string,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -279,12 +296,14 @@ class_child(
class_def(
unique int id: @class,
int parent: @ast_node_parent ref,
int name: @class_name_type ref,
int loc: @location ref
);
conditional_def(
unique int id: @conditional,
int parent: @ast_node_parent ref,
int alternative: @underscore_arg ref,
int condition: @underscore_arg ref,
int consequence: @underscore_arg ref,
@@ -302,6 +321,7 @@ destructured_left_assignment_child(
destructured_left_assignment_def(
unique int id: @destructured_left_assignment,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -316,6 +336,7 @@ destructured_parameter_child(
destructured_parameter_def(
unique int id: @destructured_parameter,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -330,6 +351,7 @@ do_child(
do_def(
unique int id: @do,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -344,6 +366,7 @@ do_block_child(
do_block_def(
unique int id: @do_block,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -358,6 +381,7 @@ element_reference_child(
element_reference_def(
unique int id: @element_reference,
int parent: @ast_node_parent ref,
int object: @underscore_primary ref,
int loc: @location ref
);
@@ -373,6 +397,7 @@ else_child(
else_def(
unique int id: @else,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -390,6 +415,7 @@ elsif_consequence(
elsif_def(
unique int id: @elsif,
int parent: @ast_node_parent ref,
int condition: @underscore_statement ref,
int loc: @location ref
);
@@ -405,6 +431,7 @@ end_block_child(
end_block_def(
unique int id: @end_block,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -419,11 +446,13 @@ ensure_child(
ensure_def(
unique int id: @ensure,
int parent: @ast_node_parent ref,
int loc: @location ref
);
exception_variable_def(
unique int id: @exception_variable,
int parent: @ast_node_parent ref,
int child: @underscore_lhs ref,
int loc: @location ref
);
@@ -439,6 +468,7 @@ exceptions_child(
exceptions_def(
unique int id: @exceptions,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -453,6 +483,7 @@ for_pattern(
for_def(
unique int id: @for,
int parent: @ast_node_parent ref,
int body: @do ref,
int value: @in ref,
int loc: @location ref
@@ -469,11 +500,13 @@ hash_child(
hash_def(
unique int id: @hash,
int parent: @ast_node_parent ref,
int loc: @location ref
);
hash_splat_argument_def(
unique int id: @hash_splat_argument,
int parent: @ast_node_parent ref,
int child: @underscore_arg ref,
int loc: @location ref
);
@@ -485,6 +518,7 @@ hash_splat_parameter_name(
hash_splat_parameter_def(
unique int id: @hash_splat_parameter,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -499,6 +533,7 @@ heredoc_body_child(
heredoc_body_def(
unique int id: @heredoc_body,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -516,6 +551,7 @@ if_consequence(
if_def(
unique int id: @if,
int parent: @ast_node_parent ref,
int condition: @underscore_statement ref,
int loc: @location ref
);
@@ -524,6 +560,7 @@ if_def(
if_modifier_def(
unique int id: @if_modifier,
int parent: @ast_node_parent ref,
int body: @underscore_statement ref,
int condition: @if_modifier_condition_type ref,
int loc: @location ref
@@ -531,12 +568,14 @@ if_modifier_def(
in_def(
unique int id: @in,
int parent: @ast_node_parent ref,
int child: @underscore_arg ref,
int loc: @location ref
);
interpolation_def(
unique int id: @interpolation,
int parent: @ast_node_parent ref,
int child: @underscore_statement ref,
int loc: @location ref
);
@@ -548,6 +587,7 @@ keyword_parameter_value(
keyword_parameter_def(
unique int id: @keyword_parameter,
int parent: @ast_node_parent ref,
int name: @token_identifier ref,
int loc: @location ref
);
@@ -561,6 +601,7 @@ lambda_parameters(
lambda_def(
unique int id: @lambda,
int parent: @ast_node_parent ref,
int body: @lambda_body_type ref,
int loc: @location ref
);
@@ -576,6 +617,7 @@ lambda_parameters_child(
lambda_parameters_def(
unique int id: @lambda_parameters,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -590,6 +632,7 @@ left_assignment_list_child(
left_assignment_list_def(
unique int id: @left_assignment_list,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -609,6 +652,7 @@ method_child(
method_def(
unique int id: @method,
int parent: @ast_node_parent ref,
int name: @underscore_method_name ref,
int loc: @location ref
);
@@ -629,6 +673,7 @@ method_call_block(
method_call_def(
unique int id: @method_call,
int parent: @ast_node_parent ref,
int method: @method_call_method_type ref,
int loc: @location ref
);
@@ -644,6 +689,7 @@ method_parameters_child(
method_parameters_def(
unique int id: @method_parameters,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -660,6 +706,7 @@ module_child(
module_def(
unique int id: @module,
int parent: @ast_node_parent ref,
int name: @module_name_type ref,
int loc: @location ref
);
@@ -671,6 +718,7 @@ next_child(
next_def(
unique int id: @next,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -678,6 +726,7 @@ next_def(
operator_assignment_def(
unique int id: @operator_assignment,
int parent: @ast_node_parent ref,
int left: @underscore_lhs ref,
int right: @operator_assignment_right_type ref,
int loc: @location ref
@@ -685,6 +734,7 @@ operator_assignment_def(
optional_parameter_def(
unique int id: @optional_parameter,
int parent: @ast_node_parent ref,
int name: @token_identifier ref,
int value: @underscore_arg ref,
int loc: @location ref
@@ -694,6 +744,7 @@ optional_parameter_def(
pair_def(
unique int id: @pair,
int parent: @ast_node_parent ref,
int key__: @pair_key_type ref,
int value: @underscore_arg ref,
int loc: @location ref
@@ -710,6 +761,7 @@ parenthesized_statements_child(
parenthesized_statements_def(
unique int id: @parenthesized_statements,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -717,6 +769,7 @@ parenthesized_statements_def(
pattern_def(
unique int id: @pattern,
int parent: @ast_node_parent ref,
int child: @pattern_child_type ref,
int loc: @location ref
);
@@ -732,6 +785,7 @@ program_child(
program_def(
unique int id: @program,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -744,11 +798,13 @@ range_child(
range_def(
unique int id: @range,
int parent: @ast_node_parent ref,
int loc: @location ref
);
rational_def(
unique int id: @rational,
int parent: @ast_node_parent ref,
int child: @token_integer ref,
int loc: @location ref
);
@@ -760,6 +816,7 @@ redo_child(
redo_def(
unique int id: @redo,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -774,6 +831,7 @@ regex_child(
regex_def(
unique int id: @regex,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -794,6 +852,7 @@ rescue_variable(
rescue_def(
unique int id: @rescue,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -801,6 +860,7 @@ rescue_def(
rescue_modifier_def(
unique int id: @rescue_modifier,
int parent: @ast_node_parent ref,
int body: @underscore_statement ref,
int handler: @rescue_modifier_handler_type ref,
int loc: @location ref
@@ -813,6 +873,7 @@ rest_assignment_child(
rest_assignment_def(
unique int id: @rest_assignment,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -823,6 +884,7 @@ retry_child(
retry_def(
unique int id: @retry,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -833,6 +895,7 @@ return_child(
return_def(
unique int id: @return,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -847,6 +910,7 @@ right_assignment_list_child(
right_assignment_list_def(
unique int id: @right_assignment_list,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -859,12 +923,14 @@ scope_resolution_scope(
scope_resolution_def(
unique int id: @scope_resolution,
int parent: @ast_node_parent ref,
int name: @scope_resolution_name_type ref,
int loc: @location ref
);
setter_def(
unique int id: @setter,
int parent: @ast_node_parent ref,
int child: @token_identifier ref,
int loc: @location ref
);
@@ -880,6 +946,7 @@ singleton_class_child(
singleton_class_def(
unique int id: @singleton_class,
int parent: @ast_node_parent ref,
int value: @underscore_arg ref,
int loc: @location ref
);
@@ -902,6 +969,7 @@ singleton_method_child(
singleton_method_def(
unique int id: @singleton_method,
int parent: @ast_node_parent ref,
int name: @underscore_method_name ref,
int object: @singleton_method_object_type ref,
int loc: @location ref
@@ -909,6 +977,7 @@ singleton_method_def(
splat_argument_def(
unique int id: @splat_argument,
int parent: @ast_node_parent ref,
int child: @underscore_arg ref,
int loc: @location ref
);
@@ -920,6 +989,7 @@ splat_parameter_name(
splat_parameter_def(
unique int id: @splat_parameter,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -934,6 +1004,7 @@ string_child(
string_def(
unique int id: @string__,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -946,6 +1017,7 @@ string_array_child(
string_array_def(
unique int id: @string_array,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -960,6 +1032,7 @@ subshell_child(
subshell_def(
unique int id: @subshell,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -967,6 +1040,7 @@ subshell_def(
superclass_def(
unique int id: @superclass,
int parent: @ast_node_parent ref,
int child: @superclass_child_type ref,
int loc: @location ref
);
@@ -982,6 +1056,7 @@ symbol_child(
symbol_def(
unique int id: @symbol,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -994,6 +1069,7 @@ symbol_array_child(
symbol_array_def(
unique int id: @symbol_array,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -1008,6 +1084,7 @@ then_child(
then_def(
unique int id: @then,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -1017,6 +1094,7 @@ then_def(
unary_def(
unique int id: @unary,
int parent: @ast_node_parent ref,
int operand: @unary_operand_type ref,
int operator: @unary_operator_type ref,
int loc: @location ref
@@ -1031,6 +1109,7 @@ undef_child(
undef_def(
unique int id: @undef,
int parent: @ast_node_parent ref,
int loc: @location ref
);
@@ -1048,6 +1127,7 @@ unless_consequence(
unless_def(
unique int id: @unless,
int parent: @ast_node_parent ref,
int condition: @underscore_statement ref,
int loc: @location ref
);
@@ -1056,6 +1136,7 @@ unless_def(
unless_modifier_def(
unique int id: @unless_modifier,
int parent: @ast_node_parent ref,
int body: @underscore_statement ref,
int condition: @unless_modifier_condition_type ref,
int loc: @location ref
@@ -1063,6 +1144,7 @@ unless_modifier_def(
until_def(
unique int id: @until,
int parent: @ast_node_parent ref,
int body: @do ref,
int condition: @underscore_statement ref,
int loc: @location ref
@@ -1072,6 +1154,7 @@ until_def(
until_modifier_def(
unique int id: @until_modifier,
int parent: @ast_node_parent ref,
int body: @underscore_statement ref,
int condition: @until_modifier_condition_type ref,
int loc: @location ref
@@ -1093,11 +1176,13 @@ when_pattern(
when_def(
unique int id: @when,
int parent: @ast_node_parent ref,
int loc: @location ref
);
while_def(
unique int id: @while,
int parent: @ast_node_parent ref,
int body: @do ref,
int condition: @underscore_statement ref,
int loc: @location ref
@@ -1107,6 +1192,7 @@ while_def(
while_modifier_def(
unique int id: @while_modifier,
int parent: @ast_node_parent ref,
int body: @underscore_statement ref,
int condition: @while_modifier_condition_type ref,
int loc: @location ref
@@ -1119,11 +1205,13 @@ yield_child(
yield_def(
unique int id: @yield,
int parent: @ast_node_parent ref,
int loc: @location ref
);
tokeninfo(
unique int id: @token,
int parent: @ast_node_parent ref,
int kind: int ref,
int file: @file ref,
int idx: int ref,
@@ -1159,5 +1247,7 @@ case @token.kind of
;
@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 | @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_call | @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 | @symbol_array | @then | @token | @unary | @undef | @unless | @unless_modifier | @until | @until_modifier | @when | @while | @while_modifier | @yield
@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 | @destructured_left_assignment | @destructured_parameter | @do | @do_block | @element_reference | @else | @elsif | @end_block | @ensure | @exception_variable | @exceptions | @file | @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_call | @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 | @symbol_array | @then | @token | @unary | @undef | @unless | @unless_modifier | @until | @until_modifier | @when | @while | @while_modifier | @yield
@ast_node_parent = @ast_node | @file