From 79caadd2432fe21d7d81b3fbea81c955c962b451 Mon Sep 17 00:00:00 2001 From: Ada Alakbarova Date: Mon, 14 Jul 2025 21:18:55 +0200 Subject: [PATCH 01/12] add simple Java signatures --- src/supported_langs.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/supported_langs.rs b/src/supported_langs.rs index e953f79..ce4b430 100644 --- a/src/supported_langs.rs +++ b/src/supported_langs.rs @@ -130,6 +130,7 @@ pub static SUPPORTED_LANGUAGES: LazyLock> = LazyLock::new(|| { // program signature("import_declaration", vec![vec![]]), signature("class_declaration", vec![vec![Field("name")]]), + signature("scoped_identifier", vec![vec![Field("name")]]), // class_body signature( "field_declaration", @@ -154,7 +155,8 @@ pub static SUPPORTED_LANGUAGES: LazyLock> = LazyLock::new(|| { // modifiers signature("visibility", vec![vec![]]), signature("modifier", vec![vec![]]), - signature("marker_annotation", vec![vec![]]), // annotations can be repeatable, so we can't use the name as key + signature("annotation", vec![vec![]]), // annotations can be repeatable, so we can't use the name as key + signature("marker_annotation", vec![vec![]]), // catch_type, type_list, throws signature("identifier", vec![vec![]]), // annotation_argument_list -- 2.47.3 From e2752f799f98310228b187df64f9528b283767a4 Mon Sep 17 00:00:00 2001 From: Ada Alakbarova Date: Mon, 14 Jul 2025 21:45:54 +0200 Subject: [PATCH 02/12] add Java/record_declaration --- src/supported_langs.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/supported_langs.rs b/src/supported_langs.rs index ce4b430..0a384f7 100644 --- a/src/supported_langs.rs +++ b/src/supported_langs.rs @@ -130,6 +130,7 @@ pub static SUPPORTED_LANGUAGES: LazyLock> = LazyLock::new(|| { // program signature("import_declaration", vec![vec![]]), signature("class_declaration", vec![vec![Field("name")]]), + signature("record_declaration", vec![vec![Field("name")]]), signature("scoped_identifier", vec![vec![Field("name")]]), // class_body signature( -- 2.47.3 From 4bb304f44cf19d6121c735ccbdc2da18dd0070ea Mon Sep 17 00:00:00 2001 From: Ada Alakbarova Date: Tue, 15 Jul 2025 13:00:34 +0200 Subject: [PATCH 03/12] rm mentions of Rust/let_declaration not actually a commutative child --- src/supported_langs.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/supported_langs.rs b/src/supported_langs.rs index 0a384f7..fc9f51a 100644 --- a/src/supported_langs.rs +++ b/src/supported_langs.rs @@ -254,7 +254,6 @@ pub static SUPPORTED_LANGUAGES: LazyLock> = LazyLock::new(|| { "function_signature_item", "trait_item", "associated_type", - "let_declaration", "extern_crate_declaration", "static_item", ], @@ -276,7 +275,6 @@ pub static SUPPORTED_LANGUAGES: LazyLock> = LazyLock::new(|| { "function_item", "function_signature_item", "trait_item", - "let_declaration", "extern_crate_declaration", "static_item", ], -- 2.47.3 From b47729c4e48ce75fc84661ae8f97305d4409a2bb Mon Sep 17 00:00:00 2001 From: Ada Alakbarova Date: Tue, 15 Jul 2025 13:00:46 +0200 Subject: [PATCH 04/12] add Rust/extern_crate_declaration --- src/supported_langs.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/supported_langs.rs b/src/supported_langs.rs index fc9f51a..129566e 100644 --- a/src/supported_langs.rs +++ b/src/supported_langs.rs @@ -319,6 +319,7 @@ pub static SUPPORTED_LANGUAGES: LazyLock> = LazyLock::new(|| { signature("unsafe", vec![vec![]]), // source_file signature("use_declaration", vec![vec![Field("argument")]]), + signature("extern_crate_declaration", vec![vec![Field("name")]]), // trait_bound signature("lifetime", vec![vec![]]), // use list -- 2.47.3 From a2a3adcdfc64bc5953a051de47c1b5be38141209 Mon Sep 17 00:00:00 2001 From: Ada Alakbarova Date: Tue, 15 Jul 2025 14:15:42 +0200 Subject: [PATCH 05/12] add Rust/where_predicate --- src/supported_langs.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/supported_langs.rs b/src/supported_langs.rs index 129566e..7d54552 100644 --- a/src/supported_langs.rs +++ b/src/supported_langs.rs @@ -334,6 +334,11 @@ pub static SUPPORTED_LANGUAGES: LazyLock> = LazyLock::new(|| { signature("field_initializer", vec![vec![Field("field")]]), signature("shorthand_field_initializer", vec![vec![]]), signature("base_field_initializer", vec![]), // maximum one per field_initializer_list + // where_clause + signature( + "where_predicate", + vec![vec![Field("left")], vec![Field("bounds")]], + ), ], injections: Some(tree_sitter_rust_orchard::INJECTIONS_QUERY), flattened_nodes: &[], -- 2.47.3 From 40dc6fe9c67958f3b227f73fdf00abd85a8a794f Mon Sep 17 00:00:00 2001 From: Ada Alakbarova Date: Tue, 15 Jul 2025 19:44:15 +0200 Subject: [PATCH 06/12] add Rust/impl_item --- src/supported_langs.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/supported_langs.rs b/src/supported_langs.rs index 7d54552..fbe1dab 100644 --- a/src/supported_langs.rs +++ b/src/supported_langs.rs @@ -252,6 +252,7 @@ pub static SUPPORTED_LANGUAGES: LazyLock> = LazyLock::new(|| { "type_item", "function_item", "function_signature_item", + "impl_item", "trait_item", "associated_type", "extern_crate_declaration", @@ -274,6 +275,7 @@ pub static SUPPORTED_LANGUAGES: LazyLock> = LazyLock::new(|| { "type_item", "function_item", "function_signature_item", + "impl_item", "trait_item", "extern_crate_declaration", "static_item", @@ -310,6 +312,10 @@ pub static SUPPORTED_LANGUAGES: LazyLock> = LazyLock::new(|| { signature("type_item", vec![vec![Field("name")]]), signature("function_item", vec![vec![Field("name")]]), signature("function_signature_item", vec![vec![Field("name")]]), + // one can have multiple `impl Foo { ... }` items in the source code, and the + // only real way to find out if they are identical is to go through the entire body + // -- so we do just that by using the entire body as the signature + signature("impl_item", vec![vec![]]), signature("trait_item", vec![vec![Field("name")]]), signature("static_item", vec![vec![Field("name")]]), // function_modifiers -- 2.47.3 From c73cb3c27a4b770df58e373bba46de56d31da80d Mon Sep 17 00:00:00 2001 From: Ada Alakbarova Date: Tue, 15 Jul 2025 19:51:14 +0200 Subject: [PATCH 07/12] rm mentions of Rust/associated_type was removed from the grammar: https://codeberg.org/grammar-orchard/tree-sitter-rust-orchard/pulls/18 --- src/supported_langs.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/supported_langs.rs b/src/supported_langs.rs index fbe1dab..55e4074 100644 --- a/src/supported_langs.rs +++ b/src/supported_langs.rs @@ -254,7 +254,6 @@ pub static SUPPORTED_LANGUAGES: LazyLock> = LazyLock::new(|| { "function_signature_item", "impl_item", "trait_item", - "associated_type", "extern_crate_declaration", "static_item", ], -- 2.47.3 From 905ac6f59c1112b1310678d2777b67279fb659ed Mon Sep 17 00:00:00 2001 From: Ada Alakbarova Date: Tue, 15 Jul 2025 20:00:49 +0200 Subject: [PATCH 08/12] add Rust/foreign_mod_item --- src/supported_langs.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/supported_langs.rs b/src/supported_langs.rs index 55e4074..9198699 100644 --- a/src/supported_langs.rs +++ b/src/supported_langs.rs @@ -325,6 +325,10 @@ pub static SUPPORTED_LANGUAGES: LazyLock> = LazyLock::new(|| { // source_file signature("use_declaration", vec![vec![Field("argument")]]), signature("extern_crate_declaration", vec![vec![Field("name")]]), + // one can have multiple `extern "X" { ... }` items in the source code, and the + // only real way to find out if they are identical is to go through the entire body + // -- so we do just that by using the entire body as the signature + signature("foreign_mod_item", vec![vec![]]), // trait_bound signature("lifetime", vec![vec![]]), // use list -- 2.47.3 From 294af5fad5c95f4c849e8c965d31f2db5fc12c8d Mon Sep 17 00:00:00 2001 From: Ada Alakbarova Date: Sat, 26 Jul 2025 21:13:11 +0200 Subject: [PATCH 09/12] add the rest of Java signatures --- src/supported_langs.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/supported_langs.rs b/src/supported_langs.rs index 9198699..0e90b1c 100644 --- a/src/supported_langs.rs +++ b/src/supported_langs.rs @@ -129,7 +129,12 @@ pub static SUPPORTED_LANGUAGES: LazyLock> = LazyLock::new(|| { signatures: vec![ // program signature("import_declaration", vec![vec![]]), + signature("module_declaration", vec![vec![Field("name")]]), + signature("package_declaration", vec![vec![ChildType("identifier")]]), + signature("annotation_type_declaration", vec![vec![Field("name")]]), + signature("enum_declaration", vec![vec![Field("name")]]), signature("class_declaration", vec![vec![Field("name")]]), + signature("interface_declaration", vec![vec![Field("name")]]), signature("record_declaration", vec![vec![Field("name")]]), signature("scoped_identifier", vec![vec![Field("name")]]), // class_body @@ -137,6 +142,22 @@ pub static SUPPORTED_LANGUAGES: LazyLock> = LazyLock::new(|| { "field_declaration", vec![vec![Field("declarator"), Field("name")]], ), + signature( + "constructor_declaration", + vec![ + vec![Field("name")], + vec![ + Field("parameters"), + ChildType("formal_parameter"), + Field("type"), + ], + vec![ + Field("parameters"), + ChildType("spread_parameter"), + ChildType("identifier"), + ], + ], + ), signature( "method_declaration", vec![ @@ -153,6 +174,7 @@ pub static SUPPORTED_LANGUAGES: LazyLock> = LazyLock::new(|| { ], ], ), + signature("compact_constructor_declaration", vec![vec![Field("name")]]), // modifiers signature("visibility", vec![vec![]]), signature("modifier", vec![vec![]]), -- 2.47.3 From e3671016f600c0c21ae14a3813cd11bd46f71df0 Mon Sep 17 00:00:00 2001 From: Ada Alakbarova Date: Sat, 26 Jul 2025 21:41:04 +0200 Subject: [PATCH 10/12] add Kotlin/property_declaration --- src/supported_langs.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/supported_langs.rs b/src/supported_langs.rs index 0e90b1c..1084736 100644 --- a/src/supported_langs.rs +++ b/src/supported_langs.rs @@ -229,6 +229,7 @@ pub static SUPPORTED_LANGUAGES: LazyLock> = LazyLock::new(|| { ], signatures: vec![ signature("import", vec![vec![]]), + // class_body signature( "function_declaration", vec![ @@ -240,7 +241,16 @@ pub static SUPPORTED_LANGUAGES: LazyLock> = LazyLock::new(|| { ], ], ), + signature( + "property_declaration", + vec![vec![ + ChildType("variable_declaration"), + ChildType("identifier"), + ]], + ), + // class_declaration signature("delegation_specifier", vec![vec![]]), + // modifiers signature("public", vec![vec![]]), signature("protected", vec![vec![]]), signature("private", vec![vec![]]), -- 2.47.3 From 02752ddc2a7379c39c3556a6217a768b850872c9 Mon Sep 17 00:00:00 2001 From: Ada Alakbarova Date: Sat, 26 Jul 2025 21:42:00 +0200 Subject: [PATCH 11/12] add Kotlin/annotation --- src/supported_langs.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/supported_langs.rs b/src/supported_langs.rs index 1084736..b66d2ec 100644 --- a/src/supported_langs.rs +++ b/src/supported_langs.rs @@ -251,6 +251,7 @@ pub static SUPPORTED_LANGUAGES: LazyLock> = LazyLock::new(|| { // class_declaration signature("delegation_specifier", vec![vec![]]), // modifiers + signature("annotation", vec![vec![]]), // annotations can be repeatable, so we can't use the name as key signature("public", vec![vec![]]), signature("protected", vec![vec![]]), signature("private", vec![vec![]]), -- 2.47.3 From ddf7f7b2aeca9753a34db9cb88916469ff69d534 Mon Sep 17 00:00:00 2001 From: Ada Alakbarova Date: Sat, 2 Aug 2025 00:03:52 +0200 Subject: [PATCH 12/12] add Go/import_declaration --- src/supported_langs.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/supported_langs.rs b/src/supported_langs.rs index b66d2ec..191f243 100644 --- a/src/supported_langs.rs +++ b/src/supported_langs.rs @@ -418,6 +418,7 @@ pub static SUPPORTED_LANGUAGES: LazyLock> = LazyLock::new(|| { "method_declaration", vec![vec![Field("receiver")], vec![Field("name")]], ), + signature("import_declaration", vec![vec![]]), // can't use a field, since it can be either `import_spec` or `import_spec_list` signature("import_spec", vec![vec![Field("path")]]), // ideally we'd also take the 'name' into account, as it must probably be unique signature("keyed_element", vec![vec![Field("key")]]), ], -- 2.47.3