diff --git a/extractor/src/extractor.rs b/extractor/src/extractor.rs index 12d4509d659..179f1c52815 100644 --- a/extractor/src/extractor.rs +++ b/extractor/src/extractor.rs @@ -187,6 +187,7 @@ impl Extractor { // TODO: should we handle path strings that are not valid UTF8 better? path: format!("{}", path.display()), file_label: *file_label, + token_counter: 0, stack: Vec::new(), tables: build_schema_lookup(&self.schema), union_types: build_union_type_lookup(&self.schema), @@ -248,7 +249,7 @@ fn full_id_for_folder(path: &Path) -> String { fn build_schema_lookup<'a>(schema: &'a Vec) -> Map<&'a TypeName, &'a Entry> { let mut map = std::collections::BTreeMap::new(); for entry in schema { - if let Entry::Table { type_name, .. } = entry { + if let Entry::Token { type_name, .. } | Entry::Table { type_name, .. } = entry { map.insert(type_name, entry); } } @@ -275,6 +276,8 @@ struct Visitor<'a> { source: &'a Vec, /// A TrapWriter to accumulate trap entries trap_writer: TrapWriter, + /// A counter for tokens + token_counter: usize, /// A lookup table from type name to dbscheme table entries tables: Map<&'a TypeName, &'a Entry>, /// A lookup table for union types mapping a type name to its direct members @@ -312,31 +315,48 @@ impl Visitor<'_> { return; } let child_nodes = self.stack.pop().expect("Vistor: empty stack"); + let id = self.trap_writer.fresh_id(); + let (start_line, start_column, end_line, end_column) = location_for(&self.source, node); + let loc = self.trap_writer.location( + self.file_label.clone(), + start_line, + start_column, + end_line, + end_column, + ); let table = self.tables.get(&TypeName { kind: node.kind().to_owned(), named: node.is_named(), }); - if let Some(Entry::Table { fields, .. }) = table { - let id = self.trap_writer.fresh_id(); - let (start_line, start_column, end_line, end_column) = location_for(&self.source, node); - let loc = self.trap_writer.location( - self.file_label.clone(), - start_line, - start_column, - end_line, - end_column, + if let Some(Entry::Token { kind_id, .. }) = table { + self.trap_writer.add_tuple( + "tokeninfo", + vec![ + Arg::Label(id), + Arg::Int(*kind_id), + Arg::Label(self.file_label), + Arg::Int(self.token_counter), + sliced_source_arg(self.source, node), + Arg::Label(loc), + ], ); + self.token_counter += 1; + if let Some(parent) = self.stack.last_mut() { + parent.push(( + field_name, + id, + TypeName { + kind: node.kind().to_owned(), + named: node.is_named(), + }, + )) + }; + } else if let Some(Entry::Table { fields, .. }) = table { let table_name = escape_name(&format!( "{}_def", node_type_name(node.kind(), node.is_named()) )); - let args: Option>; - if fields.is_empty() { - args = Some(vec![sliced_source_arg(self.source, node)]); - } else { - args = self.complex_node(&node, fields, child_nodes, id); - } - if let Some(args) = args { + 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.extend(args); diff --git a/generator/src/dbscheme.rs b/generator/src/dbscheme.rs index 88b06400418..818b24da0e8 100644 --- a/generator/src/dbscheme.rs +++ b/generator/src/dbscheme.rs @@ -5,7 +5,8 @@ use std::fmt; pub enum Entry { /// An entry defining a database table. Table(Table), - + /// An entry defining a database table. + Case(Case), /// An entry defining type that is a union of other types. Union(Union), } @@ -23,6 +24,13 @@ pub struct Union { pub members: Vec, } +/// A table in the database schema. +pub struct Case { + pub name: String, + pub column: String, + pub branches: Vec<(usize, String)>, +} + /// A column in a table. pub struct Column { pub db_type: DbColumnType, @@ -38,6 +46,18 @@ pub enum DbColumnType { String, } +impl fmt::Display for Case { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + writeln!(f, "case @{}.{} of", &self.name, &self.column)?; + let mut sep = " "; + for (c, tp) in &self.branches { + writeln!(f, "{} {} = @{}", sep, c, tp)?; + sep = "|"; + } + writeln!(f, ";") + } +} + impl fmt::Display for Table { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if let Some(keyset) = &self.keysets { @@ -110,6 +130,7 @@ pub fn write( for entry in entries { match entry { + Entry::Case(case) => write!(file, "{}\n\n", case)?, Entry::Table(table) => write!(file, "{}\n\n", table)?, Entry::Union(union) => write!(file, "{}\n\n", union)?, } diff --git a/generator/src/main.rs b/generator/src/main.rs index fb7eb112a98..f16962382df 100644 --- a/generator/src/main.rs +++ b/generator/src/main.rs @@ -4,16 +4,31 @@ mod ql; mod ql_gen; use language::Language; +use std::collections::BTreeMap as Map; use std::collections::BTreeSet as Set; use std::fs::File; use std::io::LineWriter; use std::path::PathBuf; use tracing::{error, info}; +fn child_node_type_name(token_types: &Map, t: &node_types::TypeName) -> String { + if !t.named { + // an unnamed token + "reserved_word".to_owned() + } else if token_types.contains_key(&t.kind) { + // a named token + format!("token_{}", t.kind) + } else { + // a normal node + node_types::node_type_name(&t.kind, t.named) + } +} + /// Given the name of the parent node, and its field information, returns the /// name of the field's type. This may be an ad-hoc union of all the possible /// types the field can take, in which case the union is added to `entries`. fn make_field_type( + token_types: &Map, parent_name: &str, field_name: &str, types: &Set, @@ -22,7 +37,7 @@ fn make_field_type( if types.len() == 1 { // This field can only have a single type. let t = types.iter().next().unwrap(); - node_types::escape_name(&node_types::node_type_name(&t.kind, t.named)) + node_types::escape_name(&child_node_type_name(token_types, t)) } else { // This field can have one of several types. Create an ad-hoc QL union // type to represent them. @@ -30,7 +45,7 @@ fn make_field_type( let field_union_name = node_types::escape_name(&field_union_name); let members: Vec = types .iter() - .map(|t| node_types::escape_name(&node_types::node_type_name(&t.kind, t.named))) + .map(|t| node_types::escape_name(&child_node_type_name(token_types, t))) .collect(); entries.push(dbscheme::Entry::Union(dbscheme::Union { name: field_union_name.clone(), @@ -43,6 +58,7 @@ fn make_field_type( /// Adds the appropriate dbscheme information for the given field, either as a /// column on `main_table`, or as an auxiliary table. fn add_field( + token_types: &Map, main_table: &mut dbscheme::Table, field: &node_types::Field, entries: &mut Vec, @@ -53,7 +69,13 @@ fn add_field( node_types::Storage::Table(has_index) => { // This field can appear zero or multiple times, so put // it in an auxiliary table. - let field_type = make_field_type(&parent_name, &field_name, &field.types, entries); + let field_type = make_field_type( + token_types, + &parent_name, + &field_name, + &field.types, + entries, + ); let parent_column = dbscheme::Column { unique: !*has_index, db_type: dbscheme::DbColumnType::Int, @@ -98,7 +120,13 @@ fn add_field( node_types::Storage::Column => { // This field must appear exactly once, so we add it as // a column to the main table for the node type. - let field_type = make_field_type(&parent_name, &field_name, &field.types, entries); + let field_type = make_field_type( + token_types, + &parent_name, + &field_name, + &field.types, + entries, + ); main_table.columns.push(dbscheme::Column { unique: false, db_type: dbscheme::DbColumnType::Int, @@ -124,6 +152,15 @@ fn convert_nodes(nodes: &Vec) -> Vec { create_source_location_prefix_table(), ]; let mut ast_node_members: Vec = Vec::new(); + let mut token_kinds: Map = Map::new(); + ast_node_members.push(node_types::escape_name("token")); + for node in nodes { + if let node_types::Entry::Token { type_name, kind_id } = node { + if type_name.named { + token_kinds.insert(type_name.kind.to_owned(), *kind_id); + } + } + } for node in nodes { match &node { @@ -135,9 +172,9 @@ fn convert_nodes(nodes: &Vec) -> Vec { // type. let mut members: Vec = Vec::new(); for n_member in n_members { - members.push(node_types::escape_name(&node_types::node_type_name( - &n_member.kind, - n_member.named, + members.push(node_types::escape_name(&child_node_type_name( + &token_kinds, + n_member, ))) } entries.push(dbscheme::Entry::Union(dbscheme::Union { @@ -167,7 +204,7 @@ fn convert_nodes(nodes: &Vec) -> Vec { // If the type also has fields or children, then we create either // auxiliary tables or columns in the defining table for them. for field in fields { - add_field(&mut main_table, &field, &mut entries); + add_field(&token_kinds, &mut main_table, &field, &mut entries); } if fields.is_empty() { @@ -193,9 +230,13 @@ fn convert_nodes(nodes: &Vec) -> Vec { entries.push(dbscheme::Entry::Table(main_table)); } + node_types::Entry::Token { .. } => {} } } + // Add the tokeninfo table + add_tokeninf_table(&mut entries, token_kinds); + // Create a union of all database types. entries.push(dbscheme::Entry::Union(dbscheme::Union { name: "ast_node".to_string(), @@ -205,6 +246,71 @@ fn convert_nodes(nodes: &Vec) -> Vec { entries } +fn add_tokeninf_table(entries: &mut Vec, token_kinds: Map) { + entries.push(dbscheme::Entry::Table(dbscheme::Table { + name: "tokeninfo".to_owned(), + keysets: None, + columns: vec![ + dbscheme::Column { + db_type: dbscheme::DbColumnType::Int, + name: "id".to_string(), + unique: true, + ql_type: ql::Type::AtType("token".to_owned()), + ql_type_is_ref: false, + }, + dbscheme::Column { + unique: false, + db_type: dbscheme::DbColumnType::Int, + name: "kind".to_string(), + ql_type: ql::Type::Int, + ql_type_is_ref: true, + }, + dbscheme::Column { + unique: false, + db_type: dbscheme::DbColumnType::Int, + name: "file".to_string(), + ql_type: ql::Type::AtType("file".to_string()), + ql_type_is_ref: true, + }, + dbscheme::Column { + unique: false, + db_type: dbscheme::DbColumnType::Int, + name: "idx".to_string(), + ql_type: ql::Type::Int, + ql_type_is_ref: true, + }, + dbscheme::Column { + unique: false, + db_type: dbscheme::DbColumnType::String, + name: "value".to_string(), + ql_type: ql::Type::String, + ql_type_is_ref: true, + }, + dbscheme::Column { + unique: false, + db_type: dbscheme::DbColumnType::Int, + name: "loc".to_string(), + ql_type: ql::Type::AtType("location".to_string()), + ql_type_is_ref: true, + }, + ], + })); + let mut branches: Vec<(usize, String)> = Vec::new(); + branches.push((0, "reserved_word".to_owned())); + for (token_kind, idx) in token_kinds.iter() { + branches.push(( + *idx, + node_types::escape_name(&format!("token_{}", token_kind)), + )); + } + + entries.push(dbscheme::Entry::Case(dbscheme::Case { + name: "token".to_owned(), + column: "kind".to_owned(), + branches: branches, + })); +} + fn write_dbscheme(language: &Language, entries: &[dbscheme::Entry]) -> std::io::Result<()> { info!( "Writing database schema for {} to '{}'", diff --git a/generator/src/ql_gen.rs b/generator/src/ql_gen.rs index 132632f11d9..d0a951b8307 100644 --- a/generator/src/ql_gen.rs +++ b/generator/src/ql_gen.rs @@ -69,6 +69,7 @@ fn create_supertype_map(nodes: &[node_types::Entry]) -> SupertypeMap { } } } + node_types::Entry::Token { .. } => {} } } @@ -142,7 +143,62 @@ fn create_ast_node_class() -> ql::Class { ], } } - +fn create_token_class() -> ql::Class { + let get_value = ql::Predicate { + name: "getValue".to_owned(), + overridden: false, + return_type: Some(ql::Type::String), + formal_parameters: vec![], + body: ql::Expression::Pred( + "tokeninfo".to_owned(), + vec![ + ql::Expression::Var("this".to_owned()), + ql::Expression::Var("_".to_owned()), + ql::Expression::Var("_".to_owned()), + ql::Expression::Var("_".to_owned()), + ql::Expression::Var("result".to_owned()), + ql::Expression::Var("_".to_owned()), + ], + ), + }; + let get_location = ql::Predicate { + name: "getLocation".to_owned(), + overridden: true, + return_type: Some(ql::Type::Normal("Location".to_owned())), + formal_parameters: vec![], + body: ql::Expression::Pred( + "tokeninfo".to_owned(), + vec![ + ql::Expression::Var("this".to_owned()), + ql::Expression::Var("_".to_owned()), + ql::Expression::Var("_".to_owned()), + ql::Expression::Var("_".to_owned()), + ql::Expression::Var("_".to_owned()), + ql::Expression::Var("result".to_owned()), + ], + ), + }; + let describe_ql_class = ql::Predicate { + name: "describeQlClass".to_owned(), + overridden: true, + return_type: Some(ql::Type::String), + formal_parameters: vec![], + body: ql::Expression::Equals( + Box::new(ql::Expression::Var("result".to_owned())), + Box::new(ql::Expression::Pred("getValue".to_owned(), vec![])), + ), + }; + ql::Class { + name: "Token".to_owned(), + is_abstract: false, + supertypes: vec![ + ql::Type::AtType("token".to_owned()), + ql::Type::Normal("AstNode".to_owned()), + ], + characteristic_predicate: None, + predicates: vec![get_value, get_location, describe_ql_class], + } +} /// Creates a predicate whose body is `none()`. fn create_none_predicate( name: &str, @@ -164,6 +220,7 @@ fn create_none_predicate( /// types the field can take, in which case we create a new class and push it to /// `classes`. fn create_field_class( + token_kinds: &BTreeSet, parent_name: &str, field: &node_types::Field, classes: &mut Vec, @@ -172,7 +229,11 @@ fn create_field_class( if field.types.len() == 1 { // This field can only have a single type. let t = field.types.iter().next().unwrap(); - node_types::escape_name(&node_types::node_type_name(&t.kind, t.named)) + if !t.named || token_kinds.contains(&t.kind) { + "Token".to_owned() + } else { + node_types::escape_name(&node_types::node_type_name(&t.kind, t.named)) + } } else { // This field can have one of several types. The dbscheme contains a // union type, so we create a QL class to wrap that. @@ -351,16 +412,18 @@ fn create_field_getters( field: &node_types::Field, field_type: &str, ) -> (ql::Predicate, ql::Expression) { + let predicate_name = format!( + "get{}", + dbscheme_name_to_class_name(&node_types::escape_name(&field.get_name())) + ); + let return_type = Some(ql::Type::Normal(dbscheme_name_to_class_name(field_type))); match &field.storage { node_types::Storage::Column => { let result = ( ql::Predicate { - name: format!( - "get{}", - dbscheme_name_to_class_name(&node_types::escape_name(&field.get_name())) - ), + name: predicate_name, overridden: false, - return_type: Some(ql::Type::Normal(dbscheme_name_to_class_name(field_type))), + return_type: return_type, formal_parameters: vec![], body: create_get_field_expr_for_column_storage( &main_table_name, @@ -381,12 +444,9 @@ fn create_field_getters( let field_table_name = format!("{}_{}", parent_name, &field.get_name()); ( ql::Predicate { - name: format!( - "get{}", - dbscheme_name_to_class_name(&node_types::escape_name(&field.get_name())) - ), + name: predicate_name, overridden: false, - return_type: Some(ql::Type::Normal(dbscheme_name_to_class_name(field_type))), + return_type: return_type, formal_parameters: if *has_index { vec![ql::FormalParameter { name: "i".to_owned(), @@ -416,10 +476,22 @@ pub fn convert_nodes(nodes: &Vec) -> Vec { ql::TopLevel::Import("codeql.files.FileSystem".to_owned()), ql::TopLevel::Import("codeql.Locations".to_owned()), ql::TopLevel::Class(create_ast_node_class()), + ql::TopLevel::Class(create_token_class()), ]; + let mut token_kinds = BTreeSet::new(); + for node in nodes { + if let node_types::Entry::Token { type_name, .. } = node { + if type_name.named { + token_kinds.insert(type_name.kind.to_owned()); + } + } + } for node in nodes { match &node { + node_types::Entry::Token { .. } => { + // don't generate any QL code for tokens + } node_types::Entry::Union { type_name, members: _, @@ -492,8 +564,13 @@ pub fn convert_nodes(nodes: &Vec) -> Vec { // - predicates to access the fields, // - the QL expressions to access the fields that will be part of getAFieldOrChild. for field in fields { - let field_type = - create_field_class(&name, field, &mut classes, &supertype_map); + let field_type = create_field_class( + &token_kinds, + &name, + field, + &mut classes, + &supertype_map, + ); let (get_pred, get_child_expr) = create_field_getters( &main_table_name, main_table_arity, diff --git a/node-types/src/lib.rs b/node-types/src/lib.rs index fffd94c8d1d..e2de9df31f3 100644 --- a/node-types/src/lib.rs +++ b/node-types/src/lib.rs @@ -15,6 +15,10 @@ pub enum Entry { type_name: TypeName, fields: Vec, }, + Token { + type_name: TypeName, + kind_id: usize, + }, } #[derive(Debug, Ord, PartialOrd, Eq, PartialEq)] @@ -75,7 +79,7 @@ fn convert_types(node_types: &Vec) -> Set { } pub fn convert_nodes(nodes: Vec) -> Vec { let mut entries: Vec = Vec::new(); - + let mut token_kinds = Set::new(); for node in nodes { if let Some(subtypes) = &node.subtypes { // It's a tree-sitter supertype node, for which we create a union @@ -87,6 +91,12 @@ pub fn convert_nodes(nodes: Vec) -> Vec { }, members: convert_types(&subtypes), }); + } else if node.fields.as_ref().map_or(0, |x| x.len()) == 0 && node.children.is_none() { + let type_name = TypeName { + kind: node.kind, + named: node.named, + }; + token_kinds.insert(type_name); } else { // It's a product type, defined by a table. let type_name = TypeName { @@ -114,6 +124,16 @@ pub fn convert_nodes(nodes: Vec) -> Vec { entries.push(Entry::Table { type_name, fields }); } } + let mut counter = 0; + for type_name in token_kinds { + let kind_id = if type_name.named { + counter += 1; + counter + } else { + 0 + }; + entries.push(Entry::Token { type_name, kind_id }); + } entries } diff --git a/ql/src/codeql_ruby/ast.qll b/ql/src/codeql_ruby/ast.qll index fef06b9850f..f47223f6880 100644 --- a/ql/src/codeql_ruby/ast.qll +++ b/ql/src/codeql_ruby/ast.qll @@ -16,6 +16,14 @@ class AstNode extends @ast_node { string describeQlClass() { result = "???" } } +class Token extends @token, AstNode { + string getValue() { tokeninfo(this, _, _, _, result, _) } + + override Location getLocation() { tokeninfo(this, _, _, _, _, result) } + + override string describeQlClass() { result = getValue() } +} + class UnderscoreArg extends @underscore_arg, AstNode, ArgumentListChildType, ArrayChildType, AssignmentRightType, BinaryLeftType, BinaryRightType, ElementReferenceChildType, ExceptionsChildType, IfModifierConditionType, OperatorAssignmentRightType, PairKeyType, @@ -233,7 +241,7 @@ class BlockParameter extends @block_parameter, AstNode, BlockParametersChildType override Location getLocation() { block_parameter_def(this, _, result) } - Identifier getName() { block_parameter_def(this, result, _) } + Token getName() { block_parameter_def(this, result, _) } override AstNode getAFieldOrChild() { block_parameter_def(this, result, _) } } @@ -445,7 +453,7 @@ class Else extends @else, AstNode, BeginChildType, CaseChildType, ClassChildType override Location getLocation() { else_def(this, result) } - SemicolonUnnamed getCondition() { else_condition(this, result) } + Token getCondition() { else_condition(this, result) } ElseChildType getChild(int i) { else_child(this, i, result) } @@ -474,17 +482,6 @@ class Elsif extends @elsif, AstNode, ElsifAlternativeType, IfAlternativeType, Un } } -class EmptyStatement extends @empty_statement, AstNode, BeginBlockChildType, BeginChildType, - BlockChildType, ClassChildType, DoBlockChildType, DoChildType, ElseChildType, EndBlockChildType, - EnsureChildType, MethodChildType, ModuleChildType, ParenthesizedStatementsChildType, - ProgramChildType, SingletonClassChildType, SingletonMethodChildType, ThenChildType { - override string describeQlClass() { result = "EmptyStatement" } - - override Location getLocation() { empty_statement_def(this, _, result) } - - string getText() { empty_statement_def(this, result, _) } -} - class EndBlockChildType extends @end_block_child_type, AstNode { override string describeQlClass() { result = "EndBlockChildType" } } @@ -589,7 +586,7 @@ class HashSplatParameter extends @hash_splat_parameter, AstNode, BlockParameters override Location getLocation() { hash_splat_parameter_def(this, result) } - Identifier getName() { hash_splat_parameter_name(this, result) } + Token getName() { hash_splat_parameter_name(this, result) } override AstNode getAFieldOrChild() { hash_splat_parameter_name(this, result) } } @@ -673,7 +670,7 @@ class KeywordParameter extends @keyword_parameter, AstNode, BlockParametersChild override Location getLocation() { keyword_parameter_def(this, _, result) } - Identifier getName() { keyword_parameter_def(this, result, _) } + Token getName() { keyword_parameter_def(this, result, _) } UnderscoreArg getValue() { keyword_parameter_value(this, result) } @@ -828,14 +825,6 @@ class Next extends @next, AstNode, ArgumentListChildType, ArrayChildType, Assign override AstNode getAFieldOrChild() { next_child(this, result) } } -class Operator extends @operator, AstNode, CallMethodType, UnderscoreMethodName { - override string describeQlClass() { result = "Operator" } - - override Location getLocation() { operator_def(this, _, result) } - - string getText() { operator_def(this, result, _) } -} - class OperatorAssignmentRightType extends @operator_assignment_right_type, AstNode { override string describeQlClass() { result = "OperatorAssignmentRightType" } } @@ -860,7 +849,7 @@ class OptionalParameter extends @optional_parameter, AstNode, BlockParametersChi override Location getLocation() { optional_parameter_def(this, _, _, result) } - Identifier getName() { optional_parameter_def(this, result, _, _) } + Token getName() { optional_parameter_def(this, result, _, _) } UnderscoreArg getValue() { optional_parameter_def(this, _, result, _) } @@ -948,7 +937,7 @@ class Rational extends @rational, AstNode, UnderscorePrimary { override Location getLocation() { rational_def(this, _, result) } - Integer getChild() { rational_def(this, result, _) } + Token getChild() { rational_def(this, result, _) } override AstNode getAFieldOrChild() { rational_def(this, result, _) } } @@ -1085,7 +1074,7 @@ class Setter extends @setter, AstNode, UnderscoreMethodName { override Location getLocation() { setter_def(this, _, result) } - Identifier getChild() { setter_def(this, result, _) } + Token getChild() { setter_def(this, result, _) } override AstNode getAFieldOrChild() { setter_def(this, result, _) } } @@ -1155,7 +1144,7 @@ class SplatParameter extends @splat_parameter, AstNode, BlockParametersChildType override Location getLocation() { splat_parameter_def(this, result) } - Identifier getName() { splat_parameter_name(this, result) } + Token getName() { splat_parameter_name(this, result) } override AstNode getAFieldOrChild() { splat_parameter_name(this, result) } } @@ -1407,967 +1396,3 @@ class Yield extends @yield, AstNode, ArgumentListChildType, ArrayChildType, Assi override AstNode getAFieldOrChild() { yield_child(this, result) } } - -class BangUnnamed extends @bang_unnamed, AstNode { - override string describeQlClass() { result = "BangUnnamed" } - - override Location getLocation() { bang_unnamed_def(this, _, result) } - - string getText() { bang_unnamed_def(this, result, _) } -} - -class BangequalUnnamed extends @bangequal_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "BangequalUnnamed" } - - override Location getLocation() { bangequal_unnamed_def(this, _, result) } - - string getText() { bangequal_unnamed_def(this, result, _) } -} - -class BangtildeUnnamed extends @bangtilde_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "BangtildeUnnamed" } - - override Location getLocation() { bangtilde_unnamed_def(this, _, result) } - - string getText() { bangtilde_unnamed_def(this, result, _) } -} - -class DquoteUnnamed extends @dquote_unnamed, AstNode { - override string describeQlClass() { result = "DquoteUnnamed" } - - override Location getLocation() { dquote_unnamed_def(this, _, result) } - - string getText() { dquote_unnamed_def(this, result, _) } -} - -class HashlbraceUnnamed extends @hashlbrace_unnamed, AstNode { - override string describeQlClass() { result = "HashlbraceUnnamed" } - - override Location getLocation() { hashlbrace_unnamed_def(this, _, result) } - - string getText() { hashlbrace_unnamed_def(this, result, _) } -} - -class PercentUnnamed extends @percent_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "PercentUnnamed" } - - override Location getLocation() { percent_unnamed_def(this, _, result) } - - string getText() { percent_unnamed_def(this, result, _) } -} - -class PercentequalUnnamed extends @percentequal_unnamed, AstNode { - override string describeQlClass() { result = "PercentequalUnnamed" } - - override Location getLocation() { percentequal_unnamed_def(this, _, result) } - - string getText() { percentequal_unnamed_def(this, result, _) } -} - -class PercentilparenUnnamed extends @percentilparen_unnamed, AstNode { - override string describeQlClass() { result = "PercentilparenUnnamed" } - - override Location getLocation() { percentilparen_unnamed_def(this, _, result) } - - string getText() { percentilparen_unnamed_def(this, result, _) } -} - -class PercentwlparenUnnamed extends @percentwlparen_unnamed, AstNode { - override string describeQlClass() { result = "PercentwlparenUnnamed" } - - override Location getLocation() { percentwlparen_unnamed_def(this, _, result) } - - string getText() { percentwlparen_unnamed_def(this, result, _) } -} - -class AmpersandUnnamed extends @ampersand_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "AmpersandUnnamed" } - - override Location getLocation() { ampersand_unnamed_def(this, _, result) } - - string getText() { ampersand_unnamed_def(this, result, _) } -} - -class AmpersandampersandUnnamed extends @ampersandampersand_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "AmpersandampersandUnnamed" } - - override Location getLocation() { ampersandampersand_unnamed_def(this, _, result) } - - string getText() { ampersandampersand_unnamed_def(this, result, _) } -} - -class AmpersandampersandequalUnnamed extends @ampersandampersandequal_unnamed, AstNode { - override string describeQlClass() { result = "AmpersandampersandequalUnnamed" } - - override Location getLocation() { ampersandampersandequal_unnamed_def(this, _, result) } - - string getText() { ampersandampersandequal_unnamed_def(this, result, _) } -} - -class AmpersanddotUnnamed extends @ampersanddot_unnamed, AstNode { - override string describeQlClass() { result = "AmpersanddotUnnamed" } - - override Location getLocation() { ampersanddot_unnamed_def(this, _, result) } - - string getText() { ampersanddot_unnamed_def(this, result, _) } -} - -class AmpersandequalUnnamed extends @ampersandequal_unnamed, AstNode { - override string describeQlClass() { result = "AmpersandequalUnnamed" } - - override Location getLocation() { ampersandequal_unnamed_def(this, _, result) } - - string getText() { ampersandequal_unnamed_def(this, result, _) } -} - -class LparenUnnamed extends @lparen_unnamed, AstNode { - override string describeQlClass() { result = "LparenUnnamed" } - - override Location getLocation() { lparen_unnamed_def(this, _, result) } - - string getText() { lparen_unnamed_def(this, result, _) } -} - -class RparenUnnamed extends @rparen_unnamed, AstNode { - override string describeQlClass() { result = "RparenUnnamed" } - - override Location getLocation() { rparen_unnamed_def(this, _, result) } - - string getText() { rparen_unnamed_def(this, result, _) } -} - -class StarUnnamed extends @star_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "StarUnnamed" } - - override Location getLocation() { star_unnamed_def(this, _, result) } - - string getText() { star_unnamed_def(this, result, _) } -} - -class StarstarUnnamed extends @starstar_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "StarstarUnnamed" } - - override Location getLocation() { starstar_unnamed_def(this, _, result) } - - string getText() { starstar_unnamed_def(this, result, _) } -} - -class StarstarequalUnnamed extends @starstarequal_unnamed, AstNode { - override string describeQlClass() { result = "StarstarequalUnnamed" } - - override Location getLocation() { starstarequal_unnamed_def(this, _, result) } - - string getText() { starstarequal_unnamed_def(this, result, _) } -} - -class StarequalUnnamed extends @starequal_unnamed, AstNode { - override string describeQlClass() { result = "StarequalUnnamed" } - - override Location getLocation() { starequal_unnamed_def(this, _, result) } - - string getText() { starequal_unnamed_def(this, result, _) } -} - -class PlusUnnamed extends @plus_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "PlusUnnamed" } - - override Location getLocation() { plus_unnamed_def(this, _, result) } - - string getText() { plus_unnamed_def(this, result, _) } -} - -class PlusequalUnnamed extends @plusequal_unnamed, AstNode { - override string describeQlClass() { result = "PlusequalUnnamed" } - - override Location getLocation() { plusequal_unnamed_def(this, _, result) } - - string getText() { plusequal_unnamed_def(this, result, _) } -} - -class PlusatUnnamed extends @plusat_unnamed, AstNode { - override string describeQlClass() { result = "PlusatUnnamed" } - - override Location getLocation() { plusat_unnamed_def(this, _, result) } - - string getText() { plusat_unnamed_def(this, result, _) } -} - -class CommaUnnamed extends @comma_unnamed, AstNode, WhenPatternType { - override string describeQlClass() { result = "CommaUnnamed" } - - override Location getLocation() { comma_unnamed_def(this, _, result) } - - string getText() { comma_unnamed_def(this, result, _) } -} - -class MinusUnnamed extends @minus_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "MinusUnnamed" } - - override Location getLocation() { minus_unnamed_def(this, _, result) } - - string getText() { minus_unnamed_def(this, result, _) } -} - -class MinusequalUnnamed extends @minusequal_unnamed, AstNode { - override string describeQlClass() { result = "MinusequalUnnamed" } - - override Location getLocation() { minusequal_unnamed_def(this, _, result) } - - string getText() { minusequal_unnamed_def(this, result, _) } -} - -class MinusrangleUnnamed extends @minusrangle_unnamed, AstNode { - override string describeQlClass() { result = "MinusrangleUnnamed" } - - override Location getLocation() { minusrangle_unnamed_def(this, _, result) } - - string getText() { minusrangle_unnamed_def(this, result, _) } -} - -class MinusatUnnamed extends @minusat_unnamed, AstNode { - override string describeQlClass() { result = "MinusatUnnamed" } - - override Location getLocation() { minusat_unnamed_def(this, _, result) } - - string getText() { minusat_unnamed_def(this, result, _) } -} - -class DotUnnamed extends @dot_unnamed, AstNode { - override string describeQlClass() { result = "DotUnnamed" } - - override Location getLocation() { dot_unnamed_def(this, _, result) } - - string getText() { dot_unnamed_def(this, result, _) } -} - -class DotdotUnnamed extends @dotdot_unnamed, AstNode { - override string describeQlClass() { result = "DotdotUnnamed" } - - override Location getLocation() { dotdot_unnamed_def(this, _, result) } - - string getText() { dotdot_unnamed_def(this, result, _) } -} - -class DotdotdotUnnamed extends @dotdotdot_unnamed, AstNode { - override string describeQlClass() { result = "DotdotdotUnnamed" } - - override Location getLocation() { dotdotdot_unnamed_def(this, _, result) } - - string getText() { dotdotdot_unnamed_def(this, result, _) } -} - -class SlashUnnamed extends @slash_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "SlashUnnamed" } - - override Location getLocation() { slash_unnamed_def(this, _, result) } - - string getText() { slash_unnamed_def(this, result, _) } -} - -class SlashequalUnnamed extends @slashequal_unnamed, AstNode { - override string describeQlClass() { result = "SlashequalUnnamed" } - - override Location getLocation() { slashequal_unnamed_def(this, _, result) } - - string getText() { slashequal_unnamed_def(this, result, _) } -} - -class ColonUnnamed extends @colon_unnamed, AstNode { - override string describeQlClass() { result = "ColonUnnamed" } - - override Location getLocation() { colon_unnamed_def(this, _, result) } - - string getText() { colon_unnamed_def(this, result, _) } -} - -class ColondquoteUnnamed extends @colondquote_unnamed, AstNode { - override string describeQlClass() { result = "ColondquoteUnnamed" } - - override Location getLocation() { colondquote_unnamed_def(this, _, result) } - - string getText() { colondquote_unnamed_def(this, result, _) } -} - -class ColoncolonUnnamed extends @coloncolon_unnamed, AstNode { - override string describeQlClass() { result = "ColoncolonUnnamed" } - - override Location getLocation() { coloncolon_unnamed_def(this, _, result) } - - string getText() { coloncolon_unnamed_def(this, result, _) } -} - -class SemicolonUnnamed extends @semicolon_unnamed, AstNode { - override string describeQlClass() { result = "SemicolonUnnamed" } - - override Location getLocation() { semicolon_unnamed_def(this, _, result) } - - string getText() { semicolon_unnamed_def(this, result, _) } -} - -class LangleUnnamed extends @langle_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "LangleUnnamed" } - - override Location getLocation() { langle_unnamed_def(this, _, result) } - - string getText() { langle_unnamed_def(this, result, _) } -} - -class LanglelangleUnnamed extends @langlelangle_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "LanglelangleUnnamed" } - - override Location getLocation() { langlelangle_unnamed_def(this, _, result) } - - string getText() { langlelangle_unnamed_def(this, result, _) } -} - -class LanglelangleequalUnnamed extends @langlelangleequal_unnamed, AstNode { - override string describeQlClass() { result = "LanglelangleequalUnnamed" } - - override Location getLocation() { langlelangleequal_unnamed_def(this, _, result) } - - string getText() { langlelangleequal_unnamed_def(this, result, _) } -} - -class LangleequalUnnamed extends @langleequal_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "LangleequalUnnamed" } - - override Location getLocation() { langleequal_unnamed_def(this, _, result) } - - string getText() { langleequal_unnamed_def(this, result, _) } -} - -class LangleequalrangleUnnamed extends @langleequalrangle_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "LangleequalrangleUnnamed" } - - override Location getLocation() { langleequalrangle_unnamed_def(this, _, result) } - - string getText() { langleequalrangle_unnamed_def(this, result, _) } -} - -class EqualUnnamed extends @equal_unnamed, AstNode { - override string describeQlClass() { result = "EqualUnnamed" } - - override Location getLocation() { equal_unnamed_def(this, _, result) } - - string getText() { equal_unnamed_def(this, result, _) } -} - -class EqualequalUnnamed extends @equalequal_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "EqualequalUnnamed" } - - override Location getLocation() { equalequal_unnamed_def(this, _, result) } - - string getText() { equalequal_unnamed_def(this, result, _) } -} - -class EqualequalequalUnnamed extends @equalequalequal_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "EqualequalequalUnnamed" } - - override Location getLocation() { equalequalequal_unnamed_def(this, _, result) } - - string getText() { equalequalequal_unnamed_def(this, result, _) } -} - -class EqualrangleUnnamed extends @equalrangle_unnamed, AstNode { - override string describeQlClass() { result = "EqualrangleUnnamed" } - - override Location getLocation() { equalrangle_unnamed_def(this, _, result) } - - string getText() { equalrangle_unnamed_def(this, result, _) } -} - -class EqualtildeUnnamed extends @equaltilde_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "EqualtildeUnnamed" } - - override Location getLocation() { equaltilde_unnamed_def(this, _, result) } - - string getText() { equaltilde_unnamed_def(this, result, _) } -} - -class RangleUnnamed extends @rangle_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "RangleUnnamed" } - - override Location getLocation() { rangle_unnamed_def(this, _, result) } - - string getText() { rangle_unnamed_def(this, result, _) } -} - -class RangleequalUnnamed extends @rangleequal_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "RangleequalUnnamed" } - - override Location getLocation() { rangleequal_unnamed_def(this, _, result) } - - string getText() { rangleequal_unnamed_def(this, result, _) } -} - -class RanglerangleUnnamed extends @ranglerangle_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "RanglerangleUnnamed" } - - override Location getLocation() { ranglerangle_unnamed_def(this, _, result) } - - string getText() { ranglerangle_unnamed_def(this, result, _) } -} - -class RanglerangleequalUnnamed extends @ranglerangleequal_unnamed, AstNode { - override string describeQlClass() { result = "RanglerangleequalUnnamed" } - - override Location getLocation() { ranglerangleequal_unnamed_def(this, _, result) } - - string getText() { ranglerangleequal_unnamed_def(this, result, _) } -} - -class QuestionUnnamed extends @question_unnamed, AstNode { - override string describeQlClass() { result = "QuestionUnnamed" } - - override Location getLocation() { question_unnamed_def(this, _, result) } - - string getText() { question_unnamed_def(this, result, _) } -} - -class BEGINUnnamed extends @b_e_g_i_n__unnamed, AstNode { - override string describeQlClass() { result = "BEGINUnnamed" } - - override Location getLocation() { b_e_g_i_n__unnamed_def(this, _, result) } - - string getText() { b_e_g_i_n__unnamed_def(this, result, _) } -} - -class ENDUnnamed extends @e_n_d__unnamed, AstNode { - override string describeQlClass() { result = "ENDUnnamed" } - - override Location getLocation() { e_n_d__unnamed_def(this, _, result) } - - string getText() { e_n_d__unnamed_def(this, result, _) } -} - -class LbracketUnnamed extends @lbracket_unnamed, AstNode { - override string describeQlClass() { result = "LbracketUnnamed" } - - override Location getLocation() { lbracket_unnamed_def(this, _, result) } - - string getText() { lbracket_unnamed_def(this, result, _) } -} - -class LbracketrbracketUnnamed extends @lbracketrbracket_unnamed, AstNode { - override string describeQlClass() { result = "LbracketrbracketUnnamed" } - - override Location getLocation() { lbracketrbracket_unnamed_def(this, _, result) } - - string getText() { lbracketrbracket_unnamed_def(this, result, _) } -} - -class LbracketrbracketequalUnnamed extends @lbracketrbracketequal_unnamed, AstNode { - override string describeQlClass() { result = "LbracketrbracketequalUnnamed" } - - override Location getLocation() { lbracketrbracketequal_unnamed_def(this, _, result) } - - string getText() { lbracketrbracketequal_unnamed_def(this, result, _) } -} - -class RbracketUnnamed extends @rbracket_unnamed, AstNode { - override string describeQlClass() { result = "RbracketUnnamed" } - - override Location getLocation() { rbracket_unnamed_def(this, _, result) } - - string getText() { rbracket_unnamed_def(this, result, _) } -} - -class CaretUnnamed extends @caret_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "CaretUnnamed" } - - override Location getLocation() { caret_unnamed_def(this, _, result) } - - string getText() { caret_unnamed_def(this, result, _) } -} - -class CaretequalUnnamed extends @caretequal_unnamed, AstNode { - override string describeQlClass() { result = "CaretequalUnnamed" } - - override Location getLocation() { caretequal_unnamed_def(this, _, result) } - - string getText() { caretequal_unnamed_def(this, result, _) } -} - -class UnderscoreENDUnnamed extends @underscore__e_n_d____unnamed, AstNode { - override string describeQlClass() { result = "UnderscoreENDUnnamed" } - - override Location getLocation() { underscore__e_n_d____unnamed_def(this, _, result) } - - string getText() { underscore__e_n_d____unnamed_def(this, result, _) } -} - -class BacktickUnnamed extends @backtick_unnamed, AstNode { - override string describeQlClass() { result = "BacktickUnnamed" } - - override Location getLocation() { backtick_unnamed_def(this, _, result) } - - string getText() { backtick_unnamed_def(this, result, _) } -} - -class AliasUnnamed extends @alias_unnamed, AstNode { - override string describeQlClass() { result = "AliasUnnamed" } - - override Location getLocation() { alias_unnamed_def(this, _, result) } - - string getText() { alias_unnamed_def(this, result, _) } -} - -class AndUnnamed extends @and_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "AndUnnamed" } - - override Location getLocation() { and_unnamed_def(this, _, result) } - - string getText() { and_unnamed_def(this, result, _) } -} - -class BeginUnnamed extends @begin_unnamed, AstNode { - override string describeQlClass() { result = "BeginUnnamed" } - - override Location getLocation() { begin_unnamed_def(this, _, result) } - - string getText() { begin_unnamed_def(this, result, _) } -} - -class BreakUnnamed extends @break_unnamed, AstNode { - override string describeQlClass() { result = "BreakUnnamed" } - - override Location getLocation() { break_unnamed_def(this, _, result) } - - string getText() { break_unnamed_def(this, result, _) } -} - -class CaseUnnamed extends @case_unnamed, AstNode { - override string describeQlClass() { result = "CaseUnnamed" } - - override Location getLocation() { case_unnamed_def(this, _, result) } - - string getText() { case_unnamed_def(this, result, _) } -} - -class Character extends @character, AstNode, UnderscorePrimary { - override string describeQlClass() { result = "Character" } - - override Location getLocation() { character_def(this, _, result) } - - string getText() { character_def(this, result, _) } -} - -class ClassUnnamed extends @class_unnamed, AstNode { - override string describeQlClass() { result = "ClassUnnamed" } - - override Location getLocation() { class_unnamed_def(this, _, result) } - - string getText() { class_unnamed_def(this, result, _) } -} - -class ClassVariable extends @class_variable, AstNode, UnderscoreMethodName, UnderscoreVariable { - override string describeQlClass() { result = "ClassVariable" } - - override Location getLocation() { class_variable_def(this, _, result) } - - string getText() { class_variable_def(this, result, _) } -} - -class Comment extends @comment, AstNode { - override string describeQlClass() { result = "Comment" } - - override Location getLocation() { comment_def(this, _, result) } - - string getText() { comment_def(this, result, _) } -} - -class Complex extends @complex, AstNode, UnderscorePrimary { - override string describeQlClass() { result = "Complex" } - - override Location getLocation() { complex_def(this, _, result) } - - string getText() { complex_def(this, result, _) } -} - -class Constant extends @constant, AstNode, CallMethodType, ClassNameType, ModuleNameType, - ScopeResolutionNameType, UnderscoreMethodName, UnderscoreVariable { - override string describeQlClass() { result = "Constant" } - - override Location getLocation() { constant_def(this, _, result) } - - string getText() { constant_def(this, result, _) } -} - -class DefUnnamed extends @def_unnamed, AstNode { - override string describeQlClass() { result = "DefUnnamed" } - - override Location getLocation() { def_unnamed_def(this, _, result) } - - string getText() { def_unnamed_def(this, result, _) } -} - -class DefinedquestionUnnamed extends @definedquestion_unnamed, AstNode { - override string describeQlClass() { result = "DefinedquestionUnnamed" } - - override Location getLocation() { definedquestion_unnamed_def(this, _, result) } - - string getText() { definedquestion_unnamed_def(this, result, _) } -} - -class DoUnnamed extends @do_unnamed, AstNode { - override string describeQlClass() { result = "DoUnnamed" } - - override Location getLocation() { do_unnamed_def(this, _, result) } - - string getText() { do_unnamed_def(this, result, _) } -} - -class ElseUnnamed extends @else_unnamed, AstNode { - override string describeQlClass() { result = "ElseUnnamed" } - - override Location getLocation() { else_unnamed_def(this, _, result) } - - string getText() { else_unnamed_def(this, result, _) } -} - -class ElsifUnnamed extends @elsif_unnamed, AstNode { - override string describeQlClass() { result = "ElsifUnnamed" } - - override Location getLocation() { elsif_unnamed_def(this, _, result) } - - string getText() { elsif_unnamed_def(this, result, _) } -} - -class EndUnnamed extends @end_unnamed, AstNode { - override string describeQlClass() { result = "EndUnnamed" } - - override Location getLocation() { end_unnamed_def(this, _, result) } - - string getText() { end_unnamed_def(this, result, _) } -} - -class EnsureUnnamed extends @ensure_unnamed, AstNode { - override string describeQlClass() { result = "EnsureUnnamed" } - - override Location getLocation() { ensure_unnamed_def(this, _, result) } - - string getText() { ensure_unnamed_def(this, result, _) } -} - -class EscapeSequence extends @escape_sequence, AstNode, BareStringChildType, BareSymbolChildType, - HeredocBodyChildType, RegexChildType, StringChildType, SubshellChildType, SymbolChildType { - override string describeQlClass() { result = "EscapeSequence" } - - override Location getLocation() { escape_sequence_def(this, _, result) } - - string getText() { escape_sequence_def(this, result, _) } -} - -class False extends @false, AstNode, UnderscoreLhs { - override string describeQlClass() { result = "False" } - - override Location getLocation() { false_def(this, _, result) } - - string getText() { false_def(this, result, _) } -} - -class Float extends @float__, AstNode, UnaryChildType, UnderscorePrimary { - override string describeQlClass() { result = "Float" } - - override Location getLocation() { float_def(this, _, result) } - - string getText() { float_def(this, result, _) } -} - -class ForUnnamed extends @for_unnamed, AstNode { - override string describeQlClass() { result = "ForUnnamed" } - - override Location getLocation() { for_unnamed_def(this, _, result) } - - string getText() { for_unnamed_def(this, result, _) } -} - -class GlobalVariable extends @global_variable, AstNode, UnderscoreMethodName, UnderscoreVariable { - override string describeQlClass() { result = "GlobalVariable" } - - override Location getLocation() { global_variable_def(this, _, result) } - - string getText() { global_variable_def(this, result, _) } -} - -class HeredocBeginning extends @heredoc_beginning, AstNode, UnderscorePrimary { - override string describeQlClass() { result = "HeredocBeginning" } - - override Location getLocation() { heredoc_beginning_def(this, _, result) } - - string getText() { heredoc_beginning_def(this, result, _) } -} - -class HeredocEnd extends @heredoc_end, AstNode, HeredocBodyChildType { - override string describeQlClass() { result = "HeredocEnd" } - - override Location getLocation() { heredoc_end_def(this, _, result) } - - string getText() { heredoc_end_def(this, result, _) } -} - -class Identifier extends @identifier, AstNode, BlockParametersChildType, CallMethodType, - DestructuredParameterChildType, LambdaParametersChildType, MethodParametersChildType, - ScopeResolutionNameType, UnderscoreMethodName, UnderscoreVariable { - override string describeQlClass() { result = "Identifier" } - - override Location getLocation() { identifier_def(this, _, result) } - - string getText() { identifier_def(this, result, _) } -} - -class IfUnnamed extends @if_unnamed, AstNode { - override string describeQlClass() { result = "IfUnnamed" } - - override Location getLocation() { if_unnamed_def(this, _, result) } - - string getText() { if_unnamed_def(this, result, _) } -} - -class InUnnamed extends @in_unnamed, AstNode { - override string describeQlClass() { result = "InUnnamed" } - - override Location getLocation() { in_unnamed_def(this, _, result) } - - string getText() { in_unnamed_def(this, result, _) } -} - -class InstanceVariable extends @instance_variable, AstNode, UnderscoreMethodName, UnderscoreVariable { - override string describeQlClass() { result = "InstanceVariable" } - - override Location getLocation() { instance_variable_def(this, _, result) } - - string getText() { instance_variable_def(this, result, _) } -} - -class Integer extends @integer, AstNode, UnaryChildType, UnderscorePrimary { - override string describeQlClass() { result = "Integer" } - - override Location getLocation() { integer_def(this, _, result) } - - string getText() { integer_def(this, result, _) } -} - -class ModuleUnnamed extends @module_unnamed, AstNode { - override string describeQlClass() { result = "ModuleUnnamed" } - - override Location getLocation() { module_unnamed_def(this, _, result) } - - string getText() { module_unnamed_def(this, result, _) } -} - -class NextUnnamed extends @next_unnamed, AstNode { - override string describeQlClass() { result = "NextUnnamed" } - - override Location getLocation() { next_unnamed_def(this, _, result) } - - string getText() { next_unnamed_def(this, result, _) } -} - -class Nil extends @nil, AstNode, UnderscoreLhs { - override string describeQlClass() { result = "Nil" } - - override Location getLocation() { nil_def(this, _, result) } - - string getText() { nil_def(this, result, _) } -} - -class NotUnnamed extends @not_unnamed, AstNode { - override string describeQlClass() { result = "NotUnnamed" } - - override Location getLocation() { not_unnamed_def(this, _, result) } - - string getText() { not_unnamed_def(this, result, _) } -} - -class OrUnnamed extends @or_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "OrUnnamed" } - - override Location getLocation() { or_unnamed_def(this, _, result) } - - string getText() { or_unnamed_def(this, result, _) } -} - -class RUnnamed extends @r_unnamed, AstNode { - override string describeQlClass() { result = "RUnnamed" } - - override Location getLocation() { r_unnamed_def(this, _, result) } - - string getText() { r_unnamed_def(this, result, _) } -} - -class RedoUnnamed extends @redo_unnamed, AstNode { - override string describeQlClass() { result = "RedoUnnamed" } - - override Location getLocation() { redo_unnamed_def(this, _, result) } - - string getText() { redo_unnamed_def(this, result, _) } -} - -class RescueUnnamed extends @rescue_unnamed, AstNode { - override string describeQlClass() { result = "RescueUnnamed" } - - override Location getLocation() { rescue_unnamed_def(this, _, result) } - - string getText() { rescue_unnamed_def(this, result, _) } -} - -class RetryUnnamed extends @retry_unnamed, AstNode { - override string describeQlClass() { result = "RetryUnnamed" } - - override Location getLocation() { retry_unnamed_def(this, _, result) } - - string getText() { retry_unnamed_def(this, result, _) } -} - -class ReturnUnnamed extends @return_unnamed, AstNode { - override string describeQlClass() { result = "ReturnUnnamed" } - - override Location getLocation() { return_unnamed_def(this, _, result) } - - string getText() { return_unnamed_def(this, result, _) } -} - -class Self extends @self, AstNode, UnderscoreVariable { - override string describeQlClass() { result = "Self" } - - override Location getLocation() { self_def(this, _, result) } - - string getText() { self_def(this, result, _) } -} - -class Super extends @super, AstNode, UnderscoreVariable { - override string describeQlClass() { result = "Super" } - - override Location getLocation() { super_def(this, _, result) } - - string getText() { super_def(this, result, _) } -} - -class ThenUnnamed extends @then_unnamed, AstNode { - override string describeQlClass() { result = "ThenUnnamed" } - - override Location getLocation() { then_unnamed_def(this, _, result) } - - string getText() { then_unnamed_def(this, result, _) } -} - -class True extends @true, AstNode, UnderscoreLhs { - override string describeQlClass() { result = "True" } - - override Location getLocation() { true_def(this, _, result) } - - string getText() { true_def(this, result, _) } -} - -class UndefUnnamed extends @undef_unnamed, AstNode { - override string describeQlClass() { result = "UndefUnnamed" } - - override Location getLocation() { undef_unnamed_def(this, _, result) } - - string getText() { undef_unnamed_def(this, result, _) } -} - -class Uninterpreted extends @uninterpreted, AstNode, ProgramChildType { - override string describeQlClass() { result = "Uninterpreted" } - - override Location getLocation() { uninterpreted_def(this, _, result) } - - string getText() { uninterpreted_def(this, result, _) } -} - -class UnlessUnnamed extends @unless_unnamed, AstNode { - override string describeQlClass() { result = "UnlessUnnamed" } - - override Location getLocation() { unless_unnamed_def(this, _, result) } - - string getText() { unless_unnamed_def(this, result, _) } -} - -class UntilUnnamed extends @until_unnamed, AstNode { - override string describeQlClass() { result = "UntilUnnamed" } - - override Location getLocation() { until_unnamed_def(this, _, result) } - - string getText() { until_unnamed_def(this, result, _) } -} - -class WhenUnnamed extends @when_unnamed, AstNode { - override string describeQlClass() { result = "WhenUnnamed" } - - override Location getLocation() { when_unnamed_def(this, _, result) } - - string getText() { when_unnamed_def(this, result, _) } -} - -class WhileUnnamed extends @while_unnamed, AstNode { - override string describeQlClass() { result = "WhileUnnamed" } - - override Location getLocation() { while_unnamed_def(this, _, result) } - - string getText() { while_unnamed_def(this, result, _) } -} - -class YieldUnnamed extends @yield_unnamed, AstNode { - override string describeQlClass() { result = "YieldUnnamed" } - - override Location getLocation() { yield_unnamed_def(this, _, result) } - - string getText() { yield_unnamed_def(this, result, _) } -} - -class LbraceUnnamed extends @lbrace_unnamed, AstNode { - override string describeQlClass() { result = "LbraceUnnamed" } - - override Location getLocation() { lbrace_unnamed_def(this, _, result) } - - string getText() { lbrace_unnamed_def(this, result, _) } -} - -class PipeUnnamed extends @pipe_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "PipeUnnamed" } - - override Location getLocation() { pipe_unnamed_def(this, _, result) } - - string getText() { pipe_unnamed_def(this, result, _) } -} - -class PipeequalUnnamed extends @pipeequal_unnamed, AstNode { - override string describeQlClass() { result = "PipeequalUnnamed" } - - override Location getLocation() { pipeequal_unnamed_def(this, _, result) } - - string getText() { pipeequal_unnamed_def(this, result, _) } -} - -class PipepipeUnnamed extends @pipepipe_unnamed, AstNode, BinaryOperatorType { - override string describeQlClass() { result = "PipepipeUnnamed" } - - override Location getLocation() { pipepipe_unnamed_def(this, _, result) } - - string getText() { pipepipe_unnamed_def(this, result, _) } -} - -class PipepipeequalUnnamed extends @pipepipeequal_unnamed, AstNode { - override string describeQlClass() { result = "PipepipeequalUnnamed" } - - override Location getLocation() { pipepipeequal_unnamed_def(this, _, result) } - - string getText() { pipepipeequal_unnamed_def(this, result, _) } -} - -class RbraceUnnamed extends @rbrace_unnamed, AstNode { - override string describeQlClass() { result = "RbraceUnnamed" } - - override Location getLocation() { rbrace_unnamed_def(this, _, result) } - - string getText() { rbrace_unnamed_def(this, result, _) } -} - -class TildeUnnamed extends @tilde_unnamed, AstNode { - override string describeQlClass() { result = "TildeUnnamed" } - - override Location getLocation() { tilde_unnamed_def(this, _, result) } - - string getText() { tilde_unnamed_def(this, result, _) } -} diff --git a/ql/src/ruby.dbscheme b/ql/src/ruby.dbscheme index a1bbe360f76..aab4c4709e2 100644 --- a/ql/src/ruby.dbscheme +++ b/ql/src/ruby.dbscheme @@ -48,15 +48,15 @@ sourceLocationPrefix( @underscore_arg = @underscore_primary | @assignment | @binary | @conditional | @operator_assignment | @range | @unary -@underscore_lhs = @underscore_variable | @call | @element_reference | @false | @method_call | @nil | @scope_resolution | @true +@underscore_lhs = @underscore_variable | @call | @element_reference | @token_false | @method_call | @token_nil | @scope_resolution | @token_true -@underscore_method_name = @class_variable | @constant | @global_variable | @identifier | @instance_variable | @operator | @setter | @symbol +@underscore_method_name = @token_class_variable | @token_constant | @token_global_variable | @token_identifier | @token_instance_variable | @token_operator | @setter | @symbol -@underscore_primary = @underscore_lhs | @array | @begin | @break | @case__ | @chained_string | @character | @class | @complex | @float__ | @for | @hash | @heredoc_beginning | @if | @integer | @lambda | @method | @module | @next | @parenthesized_statements | @rational | @redo | @regex | @retry | @return | @singleton_class | @singleton_method | @string__ | @string_array | @subshell | @symbol | @symbol_array | @unary | @unless | @until | @while | @yield +@underscore_primary = @underscore_lhs | @array | @begin | @break | @case__ | @chained_string | @token_character | @class | @token_complex | @token_float | @for | @hash | @token_heredoc_beginning | @if | @token_integer | @lambda | @method | @module | @next | @parenthesized_statements | @rational | @redo | @regex | @retry | @return | @singleton_class | @singleton_method | @string__ | @string_array | @subshell | @symbol | @symbol_array | @unary | @unless | @until | @while | @yield @underscore_statement = @underscore_arg | @alias | @assignment | @begin_block | @binary | @break | @call | @end_block | @if_modifier | @method_call | @next | @operator_assignment | @rescue_modifier | @return | @unary | @undef | @unless_modifier | @until_modifier | @while_modifier | @yield -@underscore_variable = @class_variable | @constant | @global_variable | @identifier | @instance_variable | @self | @super +@underscore_variable = @token_class_variable | @token_constant | @token_global_variable | @token_identifier | @token_instance_variable | @token_self | @token_super alias_def( unique int id: @alias, @@ -104,7 +104,7 @@ assignment_def( int loc: @location ref ); -@bare_string_child_type = @escape_sequence | @interpolation +@bare_string_child_type = @token_escape_sequence | @interpolation #keyset[bare_string, index] bare_string_child( @@ -118,7 +118,7 @@ bare_string_def( int loc: @location ref ); -@bare_symbol_child_type = @escape_sequence | @interpolation +@bare_symbol_child_type = @token_escape_sequence | @interpolation #keyset[bare_symbol, index] bare_symbol_child( @@ -132,7 +132,7 @@ bare_symbol_def( int loc: @location ref ); -@begin_child_type = @underscore_statement | @else | @empty_statement | @ensure | @rescue +@begin_child_type = @underscore_statement | @else | @token_empty_statement | @ensure | @rescue #keyset[begin, index] begin_child( @@ -146,7 +146,7 @@ begin_def( int loc: @location ref ); -@begin_block_child_type = @underscore_statement | @empty_statement +@begin_block_child_type = @underscore_statement | @token_empty_statement #keyset[begin_block, index] begin_block_child( @@ -162,7 +162,7 @@ begin_block_def( @binary_left_type = @underscore_arg | @break | @call | @method_call | @next | @return | @yield -@binary_operator_type = @bangequal_unnamed | @bangtilde_unnamed | @percent_unnamed | @ampersand_unnamed | @ampersandampersand_unnamed | @star_unnamed | @starstar_unnamed | @plus_unnamed | @minus_unnamed | @slash_unnamed | @langle_unnamed | @langlelangle_unnamed | @langleequal_unnamed | @langleequalrangle_unnamed | @equalequal_unnamed | @equalequalequal_unnamed | @equaltilde_unnamed | @rangle_unnamed | @rangleequal_unnamed | @ranglerangle_unnamed | @caret_unnamed | @and_unnamed | @or_unnamed | @pipe_unnamed | @pipepipe_unnamed +@binary_operator_type = @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word | @reserved_word @binary_right_type = @underscore_arg | @break | @call | @method_call | @next | @return | @yield @@ -174,7 +174,7 @@ binary_def( int loc: @location ref ); -@block_child_type = @underscore_statement | @block_parameters | @empty_statement +@block_child_type = @underscore_statement | @block_parameters | @token_empty_statement #keyset[block, index] block_child( @@ -196,11 +196,11 @@ block_argument_def( block_parameter_def( unique int id: @block_parameter, - int name: @identifier ref, + int name: @token_identifier ref, int loc: @location ref ); -@block_parameters_child_type = @block_parameter | @destructured_parameter | @hash_splat_parameter | @identifier | @keyword_parameter | @optional_parameter | @splat_parameter +@block_parameters_child_type = @block_parameter | @destructured_parameter | @hash_splat_parameter | @token_identifier | @keyword_parameter | @optional_parameter | @splat_parameter #keyset[block_parameters, index] block_parameters_child( @@ -224,7 +224,7 @@ break_def( int loc: @location ref ); -@call_method_type = @argument_list | @constant | @identifier | @operator +@call_method_type = @argument_list | @token_constant | @token_identifier | @token_operator @call_receiver_type = @underscore_primary | @method_call @@ -266,9 +266,9 @@ chained_string_def( int loc: @location ref ); -@class_name_type = @constant | @scope_resolution +@class_name_type = @token_constant | @scope_resolution -@class_child_type = @underscore_statement | @else | @empty_statement | @ensure | @rescue | @superclass +@class_child_type = @underscore_statement | @else | @token_empty_statement | @ensure | @rescue | @superclass #keyset[class, index] class_child( @@ -305,7 +305,7 @@ destructured_left_assignment_def( int loc: @location ref ); -@destructured_parameter_child_type = @block_parameter | @destructured_parameter | @hash_splat_parameter | @identifier | @keyword_parameter | @optional_parameter | @splat_parameter +@destructured_parameter_child_type = @block_parameter | @destructured_parameter | @hash_splat_parameter | @token_identifier | @keyword_parameter | @optional_parameter | @splat_parameter #keyset[destructured_parameter, index] destructured_parameter_child( @@ -319,7 +319,7 @@ destructured_parameter_def( int loc: @location ref ); -@do_child_type = @underscore_statement | @empty_statement +@do_child_type = @underscore_statement | @token_empty_statement #keyset[do, index] do_child( @@ -333,7 +333,7 @@ do_def( int loc: @location ref ); -@do_block_child_type = @underscore_statement | @block_parameters | @else | @empty_statement | @ensure | @rescue +@do_block_child_type = @underscore_statement | @block_parameters | @else | @token_empty_statement | @ensure | @rescue #keyset[do_block, index] do_block_child( @@ -364,10 +364,10 @@ element_reference_def( else_condition( unique int else: @else ref, - unique int semicolon_unnamed: @semicolon_unnamed ref + unique int reserved_word: @reserved_word ref ); -@else_child_type = @underscore_statement | @empty_statement +@else_child_type = @underscore_statement | @token_empty_statement #keyset[else, index] else_child( @@ -399,13 +399,7 @@ elsif_def( int loc: @location ref ); -empty_statement_def( - unique int id: @empty_statement, - string text: string ref, - int loc: @location ref -); - -@end_block_child_type = @underscore_statement | @empty_statement +@end_block_child_type = @underscore_statement | @token_empty_statement #keyset[end_block, index] end_block_child( @@ -419,7 +413,7 @@ end_block_def( int loc: @location ref ); -@ensure_child_type = @underscore_statement | @empty_statement +@ensure_child_type = @underscore_statement | @token_empty_statement #keyset[ensure, index] ensure_child( @@ -491,7 +485,7 @@ hash_splat_argument_def( hash_splat_parameter_name( unique int hash_splat_parameter: @hash_splat_parameter ref, - unique int identifier: @identifier ref + unique int token_identifier: @token_identifier ref ); hash_splat_parameter_def( @@ -499,7 +493,7 @@ hash_splat_parameter_def( int loc: @location ref ); -@heredoc_body_child_type = @escape_sequence | @heredoc_end | @interpolation +@heredoc_body_child_type = @token_escape_sequence | @token_heredoc_end | @interpolation #keyset[heredoc_body, index] heredoc_body_child( @@ -559,7 +553,7 @@ keyword_parameter_value( keyword_parameter_def( unique int id: @keyword_parameter, - int name: @identifier ref, + int name: @token_identifier ref, int loc: @location ref ); @@ -576,7 +570,7 @@ lambda_def( int loc: @location ref ); -@lambda_parameters_child_type = @block_parameter | @destructured_parameter | @hash_splat_parameter | @identifier | @keyword_parameter | @optional_parameter | @splat_parameter +@lambda_parameters_child_type = @block_parameter | @destructured_parameter | @hash_splat_parameter | @token_identifier | @keyword_parameter | @optional_parameter | @splat_parameter #keyset[lambda_parameters, index] lambda_parameters_child( @@ -609,7 +603,7 @@ method_parameters( unique int method_parameters: @method_parameters ref ); -@method_child_type = @underscore_statement | @else | @empty_statement | @ensure | @rescue +@method_child_type = @underscore_statement | @else | @token_empty_statement | @ensure | @rescue #keyset[method, index] method_child( @@ -644,7 +638,7 @@ method_call_def( int loc: @location ref ); -@method_parameters_child_type = @block_parameter | @destructured_parameter | @hash_splat_parameter | @identifier | @keyword_parameter | @optional_parameter | @splat_parameter +@method_parameters_child_type = @block_parameter | @destructured_parameter | @hash_splat_parameter | @token_identifier | @keyword_parameter | @optional_parameter | @splat_parameter #keyset[method_parameters, index] method_parameters_child( @@ -658,9 +652,9 @@ method_parameters_def( int loc: @location ref ); -@module_name_type = @constant | @scope_resolution +@module_name_type = @token_constant | @scope_resolution -@module_child_type = @underscore_statement | @else | @empty_statement | @ensure | @rescue +@module_child_type = @underscore_statement | @else | @token_empty_statement | @ensure | @rescue #keyset[module, index] module_child( @@ -685,12 +679,6 @@ next_def( int loc: @location ref ); -operator_def( - unique int id: @operator, - string text: string ref, - int loc: @location ref -); - @operator_assignment_right_type = @underscore_arg | @break | @call | @method_call | @next | @return | @yield operator_assignment_def( @@ -702,7 +690,7 @@ operator_assignment_def( optional_parameter_def( unique int id: @optional_parameter, - int name: @identifier ref, + int name: @token_identifier ref, int value: @underscore_arg ref, int loc: @location ref ); @@ -716,7 +704,7 @@ pair_def( int loc: @location ref ); -@parenthesized_statements_child_type = @underscore_statement | @empty_statement +@parenthesized_statements_child_type = @underscore_statement | @token_empty_statement #keyset[parenthesized_statements, index] parenthesized_statements_child( @@ -738,7 +726,7 @@ pattern_def( int loc: @location ref ); -@program_child_type = @underscore_statement | @empty_statement | @uninterpreted +@program_child_type = @underscore_statement | @token_empty_statement | @token_uninterpreted #keyset[program, index] program_child( @@ -766,7 +754,7 @@ range_def( rational_def( unique int id: @rational, - int child: @integer ref, + int child: @token_integer ref, int loc: @location ref ); @@ -780,7 +768,7 @@ redo_def( int loc: @location ref ); -@regex_child_type = @escape_sequence | @interpolation +@regex_child_type = @token_escape_sequence | @interpolation #keyset[regex, index] regex_child( @@ -867,7 +855,7 @@ right_assignment_list_def( int loc: @location ref ); -@scope_resolution_name_type = @constant | @identifier +@scope_resolution_name_type = @token_constant | @token_identifier scope_resolution_scope( unique int scope_resolution: @scope_resolution ref, @@ -882,11 +870,11 @@ scope_resolution_def( setter_def( unique int id: @setter, - int child: @identifier ref, + int child: @token_identifier ref, int loc: @location ref ); -@singleton_class_child_type = @underscore_statement | @else | @empty_statement | @ensure | @rescue +@singleton_class_child_type = @underscore_statement | @else | @token_empty_statement | @ensure | @rescue #keyset[singleton_class, index] singleton_class_child( @@ -908,7 +896,7 @@ singleton_method_parameters( unique int method_parameters: @method_parameters ref ); -@singleton_method_child_type = @underscore_statement | @else | @empty_statement | @ensure | @rescue +@singleton_method_child_type = @underscore_statement | @else | @token_empty_statement | @ensure | @rescue #keyset[singleton_method, index] singleton_method_child( @@ -932,7 +920,7 @@ splat_argument_def( splat_parameter_name( unique int splat_parameter: @splat_parameter ref, - unique int identifier: @identifier ref + unique int token_identifier: @token_identifier ref ); splat_parameter_def( @@ -940,7 +928,7 @@ splat_parameter_def( int loc: @location ref ); -@string_child_type = @escape_sequence | @interpolation +@string_child_type = @token_escape_sequence | @interpolation #keyset[string__, index] string_child( @@ -966,7 +954,7 @@ string_array_def( int loc: @location ref ); -@subshell_child_type = @escape_sequence | @interpolation +@subshell_child_type = @token_escape_sequence | @interpolation #keyset[subshell, index] subshell_child( @@ -988,7 +976,7 @@ superclass_def( int loc: @location ref ); -@symbol_child_type = @escape_sequence | @interpolation +@symbol_child_type = @token_escape_sequence | @interpolation #keyset[symbol, index] symbol_child( @@ -1014,7 +1002,7 @@ symbol_array_def( int loc: @location ref ); -@then_child_type = @underscore_statement | @empty_statement +@then_child_type = @underscore_statement | @token_empty_statement #keyset[then, index] then_child( @@ -1028,7 +1016,7 @@ then_def( int loc: @location ref ); -@unary_child_type = @underscore_arg | @break | @call | @float__ | @integer | @method_call | @next | @parenthesized_statements | @return | @yield +@unary_child_type = @underscore_arg | @break | @call | @token_float | @token_integer | @method_call | @next | @parenthesized_statements | @return | @yield unary_def( unique int id: @unary, @@ -1096,7 +1084,7 @@ when_body( unique int then: @then ref ); -@when_pattern_type = @comma_unnamed | @pattern +@when_pattern_type = @reserved_word | @pattern #keyset[when, index] when_pattern( @@ -1136,725 +1124,40 @@ yield_def( int loc: @location ref ); -bang_unnamed_def( - unique int id: @bang_unnamed, - string text: string ref, - int loc: @location ref -); - -bangequal_unnamed_def( - unique int id: @bangequal_unnamed, - string text: string ref, - int loc: @location ref -); - -bangtilde_unnamed_def( - unique int id: @bangtilde_unnamed, - string text: string ref, - int loc: @location ref -); - -dquote_unnamed_def( - unique int id: @dquote_unnamed, - string text: string ref, - int loc: @location ref -); - -hashlbrace_unnamed_def( - unique int id: @hashlbrace_unnamed, - string text: string ref, - int loc: @location ref -); - -percent_unnamed_def( - unique int id: @percent_unnamed, - string text: string ref, - int loc: @location ref -); - -percentequal_unnamed_def( - unique int id: @percentequal_unnamed, - string text: string ref, - int loc: @location ref -); - -percentilparen_unnamed_def( - unique int id: @percentilparen_unnamed, - string text: string ref, - int loc: @location ref -); - -percentwlparen_unnamed_def( - unique int id: @percentwlparen_unnamed, - string text: string ref, - int loc: @location ref -); - -ampersand_unnamed_def( - unique int id: @ampersand_unnamed, - string text: string ref, - int loc: @location ref -); - -ampersandampersand_unnamed_def( - unique int id: @ampersandampersand_unnamed, - string text: string ref, - int loc: @location ref -); - -ampersandampersandequal_unnamed_def( - unique int id: @ampersandampersandequal_unnamed, - string text: string ref, - int loc: @location ref -); - -ampersanddot_unnamed_def( - unique int id: @ampersanddot_unnamed, - string text: string ref, - int loc: @location ref -); - -ampersandequal_unnamed_def( - unique int id: @ampersandequal_unnamed, - string text: string ref, - int loc: @location ref -); - -lparen_unnamed_def( - unique int id: @lparen_unnamed, - string text: string ref, - int loc: @location ref -); - -rparen_unnamed_def( - unique int id: @rparen_unnamed, - string text: string ref, - int loc: @location ref -); - -star_unnamed_def( - unique int id: @star_unnamed, - string text: string ref, - int loc: @location ref -); - -starstar_unnamed_def( - unique int id: @starstar_unnamed, - string text: string ref, - int loc: @location ref -); - -starstarequal_unnamed_def( - unique int id: @starstarequal_unnamed, - string text: string ref, - int loc: @location ref -); - -starequal_unnamed_def( - unique int id: @starequal_unnamed, - string text: string ref, - int loc: @location ref -); - -plus_unnamed_def( - unique int id: @plus_unnamed, - string text: string ref, - int loc: @location ref -); - -plusequal_unnamed_def( - unique int id: @plusequal_unnamed, - string text: string ref, - int loc: @location ref -); - -plusat_unnamed_def( - unique int id: @plusat_unnamed, - string text: string ref, - int loc: @location ref -); - -comma_unnamed_def( - unique int id: @comma_unnamed, - string text: string ref, - int loc: @location ref -); - -minus_unnamed_def( - unique int id: @minus_unnamed, - string text: string ref, - int loc: @location ref -); - -minusequal_unnamed_def( - unique int id: @minusequal_unnamed, - string text: string ref, - int loc: @location ref -); - -minusrangle_unnamed_def( - unique int id: @minusrangle_unnamed, - string text: string ref, - int loc: @location ref -); - -minusat_unnamed_def( - unique int id: @minusat_unnamed, - string text: string ref, - int loc: @location ref -); - -dot_unnamed_def( - unique int id: @dot_unnamed, - string text: string ref, - int loc: @location ref -); - -dotdot_unnamed_def( - unique int id: @dotdot_unnamed, - string text: string ref, - int loc: @location ref -); - -dotdotdot_unnamed_def( - unique int id: @dotdotdot_unnamed, - string text: string ref, - int loc: @location ref -); - -slash_unnamed_def( - unique int id: @slash_unnamed, - string text: string ref, - int loc: @location ref -); - -slashequal_unnamed_def( - unique int id: @slashequal_unnamed, - string text: string ref, - int loc: @location ref -); - -colon_unnamed_def( - unique int id: @colon_unnamed, - string text: string ref, - int loc: @location ref -); - -colondquote_unnamed_def( - unique int id: @colondquote_unnamed, - string text: string ref, - int loc: @location ref -); - -coloncolon_unnamed_def( - unique int id: @coloncolon_unnamed, - string text: string ref, - int loc: @location ref -); - -semicolon_unnamed_def( - unique int id: @semicolon_unnamed, - string text: string ref, - int loc: @location ref -); - -langle_unnamed_def( - unique int id: @langle_unnamed, - string text: string ref, - int loc: @location ref -); - -langlelangle_unnamed_def( - unique int id: @langlelangle_unnamed, - string text: string ref, - int loc: @location ref -); - -langlelangleequal_unnamed_def( - unique int id: @langlelangleequal_unnamed, - string text: string ref, - int loc: @location ref -); - -langleequal_unnamed_def( - unique int id: @langleequal_unnamed, - string text: string ref, - int loc: @location ref -); - -langleequalrangle_unnamed_def( - unique int id: @langleequalrangle_unnamed, - string text: string ref, - int loc: @location ref -); - -equal_unnamed_def( - unique int id: @equal_unnamed, - string text: string ref, - int loc: @location ref -); - -equalequal_unnamed_def( - unique int id: @equalequal_unnamed, - string text: string ref, - int loc: @location ref -); - -equalequalequal_unnamed_def( - unique int id: @equalequalequal_unnamed, - string text: string ref, - int loc: @location ref -); - -equalrangle_unnamed_def( - unique int id: @equalrangle_unnamed, - string text: string ref, - int loc: @location ref -); - -equaltilde_unnamed_def( - unique int id: @equaltilde_unnamed, - string text: string ref, - int loc: @location ref -); - -rangle_unnamed_def( - unique int id: @rangle_unnamed, - string text: string ref, - int loc: @location ref -); - -rangleequal_unnamed_def( - unique int id: @rangleequal_unnamed, - string text: string ref, - int loc: @location ref -); - -ranglerangle_unnamed_def( - unique int id: @ranglerangle_unnamed, - string text: string ref, - int loc: @location ref -); - -ranglerangleequal_unnamed_def( - unique int id: @ranglerangleequal_unnamed, - string text: string ref, - int loc: @location ref -); - -question_unnamed_def( - unique int id: @question_unnamed, - string text: string ref, - int loc: @location ref -); - -b_e_g_i_n__unnamed_def( - unique int id: @b_e_g_i_n__unnamed, - string text: string ref, - int loc: @location ref -); - -e_n_d__unnamed_def( - unique int id: @e_n_d__unnamed, - string text: string ref, - int loc: @location ref -); - -lbracket_unnamed_def( - unique int id: @lbracket_unnamed, - string text: string ref, - int loc: @location ref -); - -lbracketrbracket_unnamed_def( - unique int id: @lbracketrbracket_unnamed, - string text: string ref, - int loc: @location ref -); - -lbracketrbracketequal_unnamed_def( - unique int id: @lbracketrbracketequal_unnamed, - string text: string ref, - int loc: @location ref -); - -rbracket_unnamed_def( - unique int id: @rbracket_unnamed, - string text: string ref, - int loc: @location ref -); - -caret_unnamed_def( - unique int id: @caret_unnamed, - string text: string ref, - int loc: @location ref -); - -caretequal_unnamed_def( - unique int id: @caretequal_unnamed, - string text: string ref, - int loc: @location ref -); - -underscore__e_n_d____unnamed_def( - unique int id: @underscore__e_n_d____unnamed, - string text: string ref, - int loc: @location ref -); - -backtick_unnamed_def( - unique int id: @backtick_unnamed, - string text: string ref, - int loc: @location ref -); - -alias_unnamed_def( - unique int id: @alias_unnamed, - string text: string ref, - int loc: @location ref -); - -and_unnamed_def( - unique int id: @and_unnamed, - string text: string ref, - int loc: @location ref -); - -begin_unnamed_def( - unique int id: @begin_unnamed, - string text: string ref, - int loc: @location ref -); - -break_unnamed_def( - unique int id: @break_unnamed, - string text: string ref, - int loc: @location ref -); - -case_unnamed_def( - unique int id: @case_unnamed, - string text: string ref, - int loc: @location ref -); - -character_def( - unique int id: @character, - string text: string ref, - int loc: @location ref -); - -class_unnamed_def( - unique int id: @class_unnamed, - string text: string ref, - int loc: @location ref -); - -class_variable_def( - unique int id: @class_variable, - string text: string ref, - int loc: @location ref -); - -comment_def( - unique int id: @comment, - string text: string ref, - int loc: @location ref -); - -complex_def( - unique int id: @complex, - string text: string ref, - int loc: @location ref -); - -constant_def( - unique int id: @constant, - string text: string ref, - int loc: @location ref -); - -def_unnamed_def( - unique int id: @def_unnamed, - string text: string ref, - int loc: @location ref -); - -definedquestion_unnamed_def( - unique int id: @definedquestion_unnamed, - string text: string ref, - int loc: @location ref -); - -do_unnamed_def( - unique int id: @do_unnamed, - string text: string ref, - int loc: @location ref -); - -else_unnamed_def( - unique int id: @else_unnamed, - string text: string ref, - int loc: @location ref -); - -elsif_unnamed_def( - unique int id: @elsif_unnamed, - string text: string ref, - int loc: @location ref -); - -end_unnamed_def( - unique int id: @end_unnamed, - string text: string ref, - int loc: @location ref -); - -ensure_unnamed_def( - unique int id: @ensure_unnamed, - string text: string ref, - int loc: @location ref -); - -escape_sequence_def( - unique int id: @escape_sequence, - string text: string ref, - int loc: @location ref -); - -false_def( - unique int id: @false, - string text: string ref, - int loc: @location ref -); - -float_def( - unique int id: @float__, - string text: string ref, - int loc: @location ref -); - -for_unnamed_def( - unique int id: @for_unnamed, - string text: string ref, - int loc: @location ref -); - -global_variable_def( - unique int id: @global_variable, - string text: string ref, - int loc: @location ref -); - -heredoc_beginning_def( - unique int id: @heredoc_beginning, - string text: string ref, - int loc: @location ref -); - -heredoc_end_def( - unique int id: @heredoc_end, - string text: string ref, - int loc: @location ref -); - -identifier_def( - unique int id: @identifier, - string text: string ref, - int loc: @location ref -); - -if_unnamed_def( - unique int id: @if_unnamed, - string text: string ref, - int loc: @location ref -); - -in_unnamed_def( - unique int id: @in_unnamed, - string text: string ref, - int loc: @location ref -); - -instance_variable_def( - unique int id: @instance_variable, - string text: string ref, - int loc: @location ref -); - -integer_def( - unique int id: @integer, - string text: string ref, - int loc: @location ref -); - -module_unnamed_def( - unique int id: @module_unnamed, - string text: string ref, - int loc: @location ref -); - -next_unnamed_def( - unique int id: @next_unnamed, - string text: string ref, - int loc: @location ref -); - -nil_def( - unique int id: @nil, - string text: string ref, - int loc: @location ref -); - -not_unnamed_def( - unique int id: @not_unnamed, - string text: string ref, - int loc: @location ref -); - -or_unnamed_def( - unique int id: @or_unnamed, - string text: string ref, - int loc: @location ref -); - -r_unnamed_def( - unique int id: @r_unnamed, - string text: string ref, - int loc: @location ref -); - -redo_unnamed_def( - unique int id: @redo_unnamed, - string text: string ref, - int loc: @location ref -); - -rescue_unnamed_def( - unique int id: @rescue_unnamed, - string text: string ref, - int loc: @location ref -); - -retry_unnamed_def( - unique int id: @retry_unnamed, - string text: string ref, - int loc: @location ref -); - -return_unnamed_def( - unique int id: @return_unnamed, - string text: string ref, - int loc: @location ref -); - -self_def( - unique int id: @self, - string text: string ref, - int loc: @location ref -); - -super_def( - unique int id: @super, - string text: string ref, - int loc: @location ref -); - -then_unnamed_def( - unique int id: @then_unnamed, - string text: string ref, - int loc: @location ref -); - -true_def( - unique int id: @true, - string text: string ref, - int loc: @location ref -); - -undef_unnamed_def( - unique int id: @undef_unnamed, - string text: string ref, - int loc: @location ref -); - -uninterpreted_def( - unique int id: @uninterpreted, - string text: string ref, - int loc: @location ref -); - -unless_unnamed_def( - unique int id: @unless_unnamed, - string text: string ref, - int loc: @location ref -); - -until_unnamed_def( - unique int id: @until_unnamed, - string text: string ref, - int loc: @location ref -); - -when_unnamed_def( - unique int id: @when_unnamed, - string text: string ref, - int loc: @location ref -); - -while_unnamed_def( - unique int id: @while_unnamed, - string text: string ref, - int loc: @location ref -); - -yield_unnamed_def( - unique int id: @yield_unnamed, - string text: string ref, - int loc: @location ref -); - -lbrace_unnamed_def( - unique int id: @lbrace_unnamed, - string text: string ref, - int loc: @location ref -); - -pipe_unnamed_def( - unique int id: @pipe_unnamed, - string text: string ref, - int loc: @location ref -); - -pipeequal_unnamed_def( - unique int id: @pipeequal_unnamed, - string text: string ref, - int loc: @location ref -); - -pipepipe_unnamed_def( - unique int id: @pipepipe_unnamed, - string text: string ref, - int loc: @location ref -); - -pipepipeequal_unnamed_def( - unique int id: @pipepipeequal_unnamed, - string text: string ref, - int loc: @location ref -); - -rbrace_unnamed_def( - unique int id: @rbrace_unnamed, - string text: string ref, - int loc: @location ref -); - -tilde_unnamed_def( - unique int id: @tilde_unnamed, - string text: string ref, - int loc: @location ref -); - -@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 | @empty_statement | @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 | @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 | @unary | @undef | @unless | @unless_modifier | @until | @until_modifier | @when | @while | @while_modifier | @yield | @bang_unnamed | @bangequal_unnamed | @bangtilde_unnamed | @dquote_unnamed | @hashlbrace_unnamed | @percent_unnamed | @percentequal_unnamed | @percentilparen_unnamed | @percentwlparen_unnamed | @ampersand_unnamed | @ampersandampersand_unnamed | @ampersandampersandequal_unnamed | @ampersanddot_unnamed | @ampersandequal_unnamed | @lparen_unnamed | @rparen_unnamed | @star_unnamed | @starstar_unnamed | @starstarequal_unnamed | @starequal_unnamed | @plus_unnamed | @plusequal_unnamed | @plusat_unnamed | @comma_unnamed | @minus_unnamed | @minusequal_unnamed | @minusrangle_unnamed | @minusat_unnamed | @dot_unnamed | @dotdot_unnamed | @dotdotdot_unnamed | @slash_unnamed | @slashequal_unnamed | @colon_unnamed | @colondquote_unnamed | @coloncolon_unnamed | @semicolon_unnamed | @langle_unnamed | @langlelangle_unnamed | @langlelangleequal_unnamed | @langleequal_unnamed | @langleequalrangle_unnamed | @equal_unnamed | @equalequal_unnamed | @equalequalequal_unnamed | @equalrangle_unnamed | @equaltilde_unnamed | @rangle_unnamed | @rangleequal_unnamed | @ranglerangle_unnamed | @ranglerangleequal_unnamed | @question_unnamed | @b_e_g_i_n__unnamed | @e_n_d__unnamed | @lbracket_unnamed | @lbracketrbracket_unnamed | @lbracketrbracketequal_unnamed | @rbracket_unnamed | @caret_unnamed | @caretequal_unnamed | @underscore__e_n_d____unnamed | @backtick_unnamed | @alias_unnamed | @and_unnamed | @begin_unnamed | @break_unnamed | @case_unnamed | @character | @class_unnamed | @class_variable | @comment | @complex | @constant | @def_unnamed | @definedquestion_unnamed | @do_unnamed | @else_unnamed | @elsif_unnamed | @end_unnamed | @ensure_unnamed | @escape_sequence | @false | @float__ | @for_unnamed | @global_variable | @heredoc_beginning | @heredoc_end | @identifier | @if_unnamed | @in_unnamed | @instance_variable | @integer | @module_unnamed | @next_unnamed | @nil | @not_unnamed | @or_unnamed | @r_unnamed | @redo_unnamed | @rescue_unnamed | @retry_unnamed | @return_unnamed | @self | @super | @then_unnamed | @true | @undef_unnamed | @uninterpreted | @unless_unnamed | @until_unnamed | @when_unnamed | @while_unnamed | @yield_unnamed | @lbrace_unnamed | @pipe_unnamed | @pipeequal_unnamed | @pipepipe_unnamed | @pipepipeequal_unnamed | @rbrace_unnamed | @tilde_unnamed +tokeninfo( + unique int id: @token, + 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_heredoc_beginning +| 12 = @token_heredoc_end +| 13 = @token_identifier +| 14 = @token_instance_variable +| 15 = @token_integer +| 16 = @token_nil +| 17 = @token_operator +| 18 = @token_self +| 19 = @token_super +| 20 = @token_true +| 21 = @token_uninterpreted +; + + +@ast_node = @token | @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 | @unary | @undef | @unless | @unless_modifier | @until | @until_modifier | @when | @while | @while_modifier | @yield