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