Skip to main content

normalize_languages/
yuri.rs

1//! Yuri language support (tree-sitter-yuri).
2
3use crate::{Language, LanguageSymbols};
4
5/// Yuri language support.
6pub struct Yuri;
7
8impl Language for Yuri {
9    fn name(&self) -> &'static str {
10        "Yuri"
11    }
12    fn extensions(&self) -> &'static [&'static str] {
13        &["yuri"]
14    }
15    fn grammar_name(&self) -> &'static str {
16        "yuri"
17    }
18
19    fn as_symbols(&self) -> Option<&dyn LanguageSymbols> {
20        Some(self)
21    }
22
23    fn is_test_symbol(&self, symbol: &crate::Symbol) -> bool {
24        let name = symbol.name.as_str();
25        match symbol.kind {
26            crate::SymbolKind::Function | crate::SymbolKind::Method => name.starts_with("test_"),
27            crate::SymbolKind::Module => name == "tests" || name == "test",
28            _ => false,
29        }
30    }
31}
32
33impl LanguageSymbols for Yuri {}
34
35#[cfg(test)]
36mod tests {
37    use super::*;
38    use crate::validate_unused_kinds_audit;
39
40    #[test]
41    fn unused_node_kinds_audit() {
42        #[rustfmt::skip]
43        let documented_unused: &[&str] = &[
44            // Items
45            "function_item", "function_parameters", "module_item", "import_item",
46            // Types
47            "type_alias_item", "compound_type_item", "compound_type_field",
48            "array_type_item", "primitive_type",
49            // Statements
50            "break_statement", "continue_statement", "return_statement",
51            "else_clause",
52            // Expressions
53            "if_expression", "binary_expression", "unary_expression",
54            "call_expression", "paren_expression", "array_expression",
55            "compound_value_expression",
56            // Other
57            "block", "identifier",
58        ];
59        validate_unused_kinds_audit(&Yuri, documented_unused)
60            .expect("Yuri unused node kinds audit failed");
61    }
62}