dk_engine/parser/langs/
cpp.rs1use crate::parser::lang_config::{CommentStyle, LanguageConfig};
4use dk_core::Visibility;
5use tree_sitter::Language;
6
7pub struct CppConfig;
9
10impl LanguageConfig for CppConfig {
11 fn language(&self) -> Language {
12 tree_sitter_cpp::LANGUAGE.into()
13 }
14
15 fn extensions(&self) -> &'static [&'static str] {
16 &["cpp", "cc", "cxx", "c", "h", "hpp", "hxx"]
20 }
21
22 fn symbols_query(&self) -> &'static str {
23 include_str!("../queries/cpp_symbols.scm")
24 }
25
26 fn calls_query(&self) -> &'static str {
27 include_str!("../queries/cpp_calls.scm")
28 }
29
30 fn imports_query(&self) -> &'static str {
31 include_str!("../queries/cpp_imports.scm")
32 }
33
34 fn comment_style(&self) -> CommentStyle {
35 CommentStyle::SlashSlash
36 }
37
38 fn resolve_visibility(&self, _modifiers: Option<&str>, _name: &str) -> Visibility {
39 Visibility::Public
43 }
44
45 fn is_external_import(&self, module_path: &str) -> bool {
46 module_path.starts_with('<')
50 }
51}