Skip to content

Commit e5d7e5c

Browse files
committed
Add Cab support
1 parent 6edff24 commit e5d7e5c

File tree

3 files changed

+111
-0
lines changed

3 files changed

+111
-0
lines changed

languages.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,20 @@ args = { console = "internalConsole", attachCommands = [ "platform select remote
552552
name = "c"
553553
source = { git = "https://github.com/tree-sitter/tree-sitter-c", rev = "7175a6dd5fc1cee660dce6fe23f6043d75af424a" }
554554

555+
[[language]]
556+
name = "cab"
557+
scope = "source.cab"
558+
injection-regex = "cab"
559+
file-types = ["cab"]
560+
shebangs = []
561+
comment-token = "#"
562+
language-servers = []
563+
indent = { tab-width = 2, unit = " " }
564+
565+
[[grammar]]
566+
name = "cab"
567+
source = { git = "https://github.com/cull-os/tree-sitter-cab", rev = "da2650f1761789e70c716d7c8c7fd6a494facdd6" }
568+
555569
[[language]]
556570
name = "cpp"
557571
scope = "source.cpp"

runtime/queries/cab/highlights.scm

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
(singleline_comment) @comment.line
2+
(multiline_comment) @comment.block
3+
4+
[
5+
"("
6+
")"
7+
"["
8+
"]"
9+
"{"
10+
"}"
11+
] @punctuation.bracket
12+
13+
[
14+
","
15+
";"
16+
] @punctuation.delimiter
17+
18+
(prefix_operation
19+
operator: _ @operator)
20+
21+
(infix_operation
22+
operator: _ @operator)
23+
24+
; Not a keyword, but use the colors anyway.
25+
((identifier) @keyword.control.import
26+
(#match? @keyword.control.import "^(import|provide|expect)$")
27+
(#is-not? local))
28+
29+
((identifier) @keyword.control.exception
30+
(#match? @keyword.control.exception "^error$")
31+
(#is-not? local))
32+
33+
((identifier) @type.builtin
34+
(#match? @type.builtin "^(list|attributes|string|number)$")
35+
(#is-not? local))
36+
37+
((identifier) @variable.builtin
38+
(#match? @variable.builtin "^(true|false|null)$")
39+
(#is-not? local))
40+
41+
(infix_operation
42+
operator: "|>"
43+
right: _ @function)
44+
45+
(infix_operation
46+
left: _ @function
47+
!operator)
48+
49+
(infix_operation
50+
left: _ @function
51+
operator: "<|")
52+
53+
(infix_operation
54+
operator: "."
55+
right: (identifier) @variable.other.member)
56+
57+
(suffix_operation
58+
operator: _ @operator)
59+
60+
(interpolation
61+
"\\(" @punctuation.special
62+
")" @punctuation.special)
63+
64+
[
65+
(path)
66+
(island)
67+
] @string.special.path
68+
69+
(pattern_identifier) @variable.parameter
70+
71+
(identifier) @variable
72+
73+
(string) @string
74+
75+
(escape) @constant.character.escape
76+
77+
[
78+
"if"
79+
"then"
80+
"is"
81+
"else"
82+
] @keyword.control.conditional
83+
84+
(number) @constant.numeric

runtime/queries/cab/indents.scm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[
2+
(parenthesis)
3+
(list)
4+
(attribute_list)
5+
(string)
6+
] @indent
7+
8+
[
9+
")"
10+
"]"
11+
"}"
12+
(string_end)
13+
] @outdent

0 commit comments

Comments
 (0)