Skip to content

Commit b0e331e

Browse files
wetnebWilfred
authored andcommitted
Unvendor tree-sitter-ada
1 parent 43274db commit b0e331e

35 files changed

+194
-102640
lines changed

Cargo.lock

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ tree-sitter = "0.25.9"
7777
tree-sitter-language = "0.1.3"
7878

7979
# tree-sitter parsers that are available on crates.io.
80+
tree-sitter-ada = "0.1.0"
8081
tree-sitter-bash = "0.23.3"
8182
tree-sitter-c = "0.23.4"
8283
tree-sitter-c-sharp = "0.23.1"

build.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@ impl TreeSitterParser {
6767

6868
fn main() {
6969
let parsers = vec![
70-
TreeSitterParser {
71-
name: "tree-sitter-ada",
72-
src_dir: "vendored_parsers/tree-sitter-ada-src",
73-
extra_files: vec![],
74-
},
7570
TreeSitterParser {
7671
name: "tree-sitter-clojure",
7772
src_dir: "vendored_parsers/tree-sitter-clojure-src",

src/parse/tree_sitter_parser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ pub(crate) struct TreeSitterConfig {
6969
}
7070

7171
extern "C" {
72-
fn tree_sitter_ada() -> ts::Language;
7372
fn tree_sitter_clojure() -> ts::Language;
7473
fn tree_sitter_commonlisp() -> ts::Language;
7574
fn tree_sitter_elisp() -> ts::Language;
@@ -101,7 +100,8 @@ pub(crate) fn from_language(language: guess::Language) -> TreeSitterConfig {
101100
use guess::Language::*;
102101
match language {
103102
Ada => {
104-
let language = unsafe { tree_sitter_ada() };
103+
let language_fn = tree_sitter_ada::LANGUAGE;
104+
let language = tree_sitter::Language::new(language_fn);
105105
TreeSitterConfig {
106106
language: language.clone(),
107107
atom_nodes: ["string_literal", "character_literal"]

vendored_parsers/highlights/ada.scm

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
;; highlight queries.
2+
;; See the syntax at https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries
3+
;; See also https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#parser-configurations
4+
;; for a list of recommended @ tags, though not all of them have matching
5+
;; highlights in neovim.
6+
7+
[
8+
"abort"
9+
"abs"
10+
"abstract"
11+
"accept"
12+
"access"
13+
"all"
14+
"array"
15+
"at"
16+
"begin"
17+
"declare"
18+
"delay"
19+
"delta"
20+
"digits"
21+
"do"
22+
"end"
23+
"entry"
24+
"exit"
25+
"generic"
26+
"interface"
27+
"is"
28+
"limited"
29+
"null"
30+
"of"
31+
"others"
32+
"out"
33+
"pragma"
34+
"private"
35+
"range"
36+
"synchronized"
37+
"tagged"
38+
"task"
39+
"terminate"
40+
"until"
41+
"when"
42+
] @keyword
43+
[
44+
"aliased"
45+
"constant"
46+
"renames"
47+
] @storageclass
48+
[
49+
"mod"
50+
"new"
51+
"protected"
52+
"record"
53+
"subtype"
54+
"type"
55+
] @keyword.type
56+
[
57+
"with"
58+
"use"
59+
] @include
60+
[
61+
"body"
62+
"function"
63+
"overriding"
64+
"procedure"
65+
"package"
66+
"separate"
67+
] @keyword.function
68+
[
69+
"and"
70+
"in"
71+
"not"
72+
"or"
73+
"xor"
74+
] @keyword.operator
75+
[
76+
"while"
77+
"loop"
78+
"for"
79+
"parallel"
80+
"reverse"
81+
"some"
82+
] @repeat
83+
[
84+
"return"
85+
] @keyword.return
86+
[
87+
"case"
88+
"if"
89+
"else"
90+
"then"
91+
"elsif"
92+
"select"
93+
] @conditional
94+
[
95+
"exception"
96+
"raise"
97+
] @exception
98+
(comment) @comment
99+
(comment) @spell ;; spell-check comments
100+
(string_literal) @string
101+
(string_literal) @spell ;; spell-check strings
102+
(character_literal) @string
103+
(numeric_literal) @number
104+
105+
;; Highlight the name of subprograms
106+
(procedure_specification name: (_) @function)
107+
(function_specification name: (_) @function)
108+
(package_declaration name: (_) @function)
109+
(package_body name: (_) @function)
110+
(generic_instantiation name: (_) @function)
111+
(entry_declaration . (identifier) @function)
112+
113+
;; Some keywords should take different categories depending on the context
114+
(use_clause "use" @include "type" @include)
115+
(with_clause "private" @include)
116+
(with_clause "limited" @include)
117+
(use_clause (_) @namespace)
118+
(with_clause (_) @namespace)
119+
120+
(loop_statement "end" @keyword.repeat)
121+
(if_statement "end" @conditional)
122+
(loop_parameter_specification "in" @keyword.repeat)
123+
(loop_parameter_specification "in" @keyword.repeat)
124+
(iterator_specification ["in" "of"] @keyword.repeat)
125+
(range_attribute_designator "range" @keyword.repeat)
126+
127+
(raise_statement "with" @exception)
128+
129+
(gnatprep_declarative_if_statement) @preproc
130+
(gnatprep_if_statement) @preproc
131+
(gnatprep_identifier) @preproc
132+
133+
(subprogram_declaration "is" @keyword.function "abstract" @keyword.function)
134+
(aspect_specification "with" @keyword.function)
135+
136+
(full_type_declaration "is" @keyword.type)
137+
(subtype_declaration "is" @keyword.type)
138+
(record_definition "end" @keyword.type)
139+
(full_type_declaration (_ "access" @keyword.type))
140+
(array_type_definition "array" @keyword.type "of" @keyword.type)
141+
(access_to_object_definition "access" @keyword.type)
142+
(access_to_object_definition "access" @keyword.type
143+
[
144+
(general_access_modifier "constant" @keyword.type)
145+
(general_access_modifier "all" @keyword.type)
146+
]
147+
)
148+
(range_constraint "range" @keyword.type)
149+
(signed_integer_type_definition "range" @keyword.type)
150+
(index_subtype_definition "range" @keyword.type)
151+
(record_type_definition "abstract" @keyword.type)
152+
(record_type_definition "tagged" @keyword.type)
153+
(record_type_definition "limited" @keyword.type)
154+
(record_type_definition (record_definition "null" @keyword.type))
155+
(private_type_declaration "is" @keyword.type "private" @keyword.type)
156+
(private_type_declaration "tagged" @keyword.type)
157+
(private_type_declaration "limited" @keyword.type)
158+
(task_type_declaration "task" @keyword.type "is" @keyword.type)
159+
160+
;; Gray the body of expression functions
161+
(expression_function_declaration
162+
(function_specification)
163+
"is"
164+
(_) @attribute
165+
)
166+
(subprogram_declaration (aspect_specification) @attribute)
167+
168+
;; Highlight full subprogram specifications
169+
;(subprogram_body
170+
; [
171+
; (procedure_specification)
172+
; (function_specification)
173+
; ] @function.spec
174+
;)
175+
176+
;; Highlight errors in red. This is not very useful in practice, as text will
177+
;; be highlighted as user types, and the error could be elsewhere in the code.
178+
;; This also requires defining :hi @error guifg=Red for instance.
179+
(ERROR) @error
180+

vendored_parsers/tree-sitter-ada-src

Lines changed: 0 additions & 1 deletion
This file was deleted.

vendored_parsers/tree-sitter-ada/.gitignore

Lines changed: 0 additions & 9 deletions
This file was deleted.

vendored_parsers/tree-sitter-ada/README.md

Lines changed: 0 additions & 136 deletions
This file was deleted.

0 commit comments

Comments
 (0)