rust_code_analysis_code_split/
langs.rs1use std::path::Path;
2use std::sync::Arc;
3use tree_sitter::Language;
4
5use crate::macros::{
6 get_language, mk_action, mk_code, mk_emacs_mode, mk_extensions, mk_lang, mk_langs,
7};
8use crate::preproc::PreprocResults;
9use crate::*;
10
11mk_langs!(
12 (
21 Mozjs,
22 "The `Mozjs` language is variant of the `JavaScript` language",
23 "javascript",
24 MozjsCode,
25 MozjsParser,
26 tree_sitter_mozjs,
27 [js, jsm, mjs, jsx],
28 ["js", "js2"]
29 ),
30 (
31 Javascript,
32 "The `JavaScript` language",
33 "javascript",
34 JavascriptCode,
35 JavascriptParser,
36 tree_sitter_javascript,
37 [],
38 []
39 ),
40 (
41 Java,
42 "The `Java` language",
43 "java",
44 JavaCode,
45 JavaParser,
46 tree_sitter_java,
47 [java],
48 ["java"]
49 ),
50 (
51 Kotlin,
52 "The `Kotlin` language",
53 "kotlin",
54 KotlinCode,
55 KotlinParser,
56 tree_sitter_kotlin_ng,
57 [kt, kts],
58 ["kotlin"]
59 ),
60 (
61 Rust,
62 "The `Rust` language",
63 "rust",
64 RustCode,
65 RustParser,
66 tree_sitter_rust,
67 [rs],
68 ["rust"]
69 ),
70 (
71 Cpp,
72 "The `C/C++` language",
73 "c/c++",
74 CppCode,
75 CppParser,
76 tree_sitter_cpp,
77 [cpp, cxx, cc, hxx, hpp, c, h, hh, inc, mm, m],
78 ["c++", "c", "objc", "objc++", "objective-c++", "objective-c"]
79 ),
80 (
81 Python,
82 "The `Python` language",
83 "python",
84 PythonCode,
85 PythonParser,
86 tree_sitter_python,
87 [py],
88 ["python"]
89 ),
90 (
91 Tsx,
92 "The `Tsx` language incorporates the `JSX` syntax inside `TypeScript`",
93 "typescript",
94 TsxCode,
95 TsxParser,
96 tree_sitter_tsx,
97 [tsx],
98 []
99 ),
100 (
101 Typescript,
102 "The `TypeScript` language",
103 "typescript",
104 TypescriptCode,
105 TypescriptParser,
106 tree_sitter_typescript,
107 [ts, jsw, jsmw],
108 ["typescript"]
109 ),
110 (
111 Ccomment,
112 "The `Ccomment` language is a variant of the `C` language focused on comments",
113 "ccomment",
114 CcommentCode,
115 CcommentParser,
116 tree_sitter_ccomment,
117 [],
118 []
119 ),
120 (
121 Preproc,
122 "The `PreProc` language is a variant of the `C/C++` language focused on macros",
123 "preproc",
124 PreprocCode,
125 PreprocParser,
126 tree_sitter_preproc,
127 [],
128 []
129 )
130);
131
132pub(crate) mod fake {
133 pub(crate) fn get_true<'a>(ext: &str, mode: &str) -> Option<&'a str> {
134 if ext == "m"
135 || ext == "mm"
136 || mode == "objc"
137 || mode == "objc++"
138 || mode == "objective-c++"
139 || mode == "objective-c"
140 {
141 Some("obj-c/c++")
142 } else {
143 None
144 }
145 }
146}