Skip to content

Commit 63a67b8

Browse files
authored
add highlights and rainbows for bovex (#14651)
1 parent 6e36634 commit 63a67b8

File tree

4 files changed

+119
-0
lines changed

4 files changed

+119
-0
lines changed

book/src/generated/lang-support.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
| bitbake || | | | | `bitbake-language-server` |
1616
| blade ||| | || |
1717
| blueprint || | | | | `blueprint-compiler` |
18+
| bovex || | | || |
1819
| c |||||| `clangd` |
1920
| c-sharp ||| || | `OmniSharp` |
2021
| cabal | | | | | | `haskell-language-server-wrapper` |

languages.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4933,3 +4933,22 @@ block-comment-tokens = { start = "/*", end = "*/"}
49334933
[[grammer]]
49344934
name = "kcl"
49354935
source = { git = "https://github.com/KittyCAD/tree-sitter-kcl", rev = "8905e0bdbf5870b50bc3f24345f1af27746f42e8"}
4936+
4937+
[[language]]
4938+
name = "bovex"
4939+
scope = "source.bovex"
4940+
file-types = ["bovex", "bibvex"]
4941+
comment-tokens = []
4942+
block-comment-tokens = [{start = "(*", end = "*)"}, {start = "[*", end = "*]"}]
4943+
indent = {tab-width = 2, unit = " "}
4944+
[language.auto-pairs]
4945+
'(' = ')'
4946+
'[' = ']'
4947+
'{' = '}'
4948+
'"' = '"'
4949+
'“' = ''
4950+
'‘' = ''
4951+
4952+
[[grammar]]
4953+
name = "bovex"
4954+
source = { git = "https://github.com/mi2ebi/tree-sitter-bovex", rev = "de7657a9cc3525b9b77c6d268da09dad5b1346b0" }
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
[(code_comment) (layout_comment)] @comment.block
2+
3+
(do_decl "do" @keyword.control)
4+
(val_decl "val" @keyword.storage.type)
5+
(fun_decl ["fun" "and"] @keyword.storage.type)
6+
(datatype_decl ["datatype" "and"] @keyword.storage.type)
7+
(datatype_arm "of" @keyword.storage.type)
8+
(object_decl ["object" "of"] @keyword.storage.type)
9+
(type_decl "type" @keyword.storage.type)
10+
(local_decl ["local" "in" "end"] @keyword.storage.modifier)
11+
(open_decl "open" @keyword.control)
12+
(import_decl "import" @keyword.control.import)
13+
(with_expr ["with" "without"] @keyword.operator)
14+
(orelse_expr ["orelse" "otherwise"] @keyword.operator)
15+
(andalso_expr ["andalso" "andthen"] @keyword.operator)
16+
(fn_expr ["fn" "as"] @keyword.function)
17+
(if_expr ["if" "then" "else"] @keyword.control.conditional)
18+
(case_expr ["case" "of"] @keyword.control)
19+
(fail_expr "fail" @keyword.control)
20+
(let_expr ["let" "in" "end"] @keyword.storage.modifier)
21+
(pat "as" @keyword.operator)
22+
23+
(boolean_lit) @constant.builtin.boolean
24+
(numeric_lit) @constant.numeric.integer
25+
(float_lit) @constant.numeric.float
26+
(string_lit) @string.quoted.double
27+
(backslash_escape) @constant.character.escape
28+
29+
["=" ":" ","] @punctuation.delimiter
30+
["->" "=>"] @operator
31+
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
32+
33+
[(ident) (label)] @variable.other
34+
(type_ident) @type
35+
(atomic_pat (ident) @variable.other)
36+
(pat (app_pat (atomic_pat (ident) @variable.parameter)))
37+
38+
(type_var) @type.parameter
39+
(atomic_type (type_ident) @type.builtin)
40+
[(record_type) (product_type) (app_type) (arrow_type)] @type
41+
42+
(atomic_expr (ident) @variable.other)
43+
(project_expr) @variable.member
44+
(field_binding (label) @variable.member.private)
45+
(field_binding (expr) @variable.other)
46+
(record_pat (ident) @variable.member.private)
47+
48+
(app_expr
49+
(app_expr (atomic_expr (ident) @function.call))
50+
(atomic_expr))
51+
(app_expr
52+
_
53+
[":=" "@" "::" "o" "==" "!=" "==." "!=."
54+
"<" "<=" ">" ">=" "<." "<=." ">." ">=."
55+
"+" "-" "+." "-." "*" "*." "/" "/." "div" "mod"
56+
"shl" "shr" "andb" "xorb" "orb"] @operator
57+
_)
58+
59+
(app_expr
60+
(app_expr (atomic_expr (ident) @function.builtin (#eq? @function.builtin "b")))
61+
(atomic_expr (layout_lit (layout_content (layout_text) @markup.bold))))
62+
(app_expr
63+
(app_expr (atomic_expr (ident) @function.builtin (#eq? @function.builtin "it")))
64+
(atomic_expr (layout_lit (layout_content (layout_text) @markup.italic))))
65+
(app_expr
66+
(app_expr (atomic_expr (ident) @function.builtin (#eq? @function.builtin "rm")))
67+
(atomic_expr (layout_lit)))
68+
(app_expr
69+
(app_expr (atomic_expr (ident) @function.builtin (#match? @function.builtin "^(tt|courier|fixedersys)$")))
70+
(atomic_expr (layout_lit (layout_content (layout_text) @markup.raw.inline))))
71+
(app_expr
72+
(app_expr (atomic_expr (ident) @function.builtin (#eq? @function.builtin "title")))
73+
(atomic_expr (layout_lit (layout_content (layout_text) @markup.heading.1))))
74+
(app_expr
75+
(app_expr (atomic_expr (ident) @function.builtin (#eq? @function.builtin "section")))
76+
(atomic_expr (layout_lit (layout_content (layout_text) @markup.heading.2))))
77+
(app_expr
78+
(app_expr (atomic_expr (ident) @function.builtin (#eq? @function.builtin "subsection")))
79+
(atomic_expr (layout_lit (layout_content (layout_text) @markup.heading.3))))
80+
(app_expr
81+
(app_expr (atomic_expr (ident) @function.builtin (#eq? @function.builtin "subsubsection")))
82+
(atomic_expr (layout_lit (layout_content (layout_text) @markup.heading.4))))
83+
(app_expr
84+
(app_expr (atomic_expr (ident) @function.builtin (#eq? @function.builtin "paragraph")))
85+
(atomic_expr (layout_lit (layout_content (layout_text) @markup.heading.5))))
86+
(app_expr
87+
(app_expr (atomic_expr (ident) @function.builtin (#eq? @function.builtin "blockquote")))
88+
(atomic_expr (layout_lit (layout_content (layout_text) @markup.quote))))

runtime/queries/bovex/rainbows.scm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
["(" ")" "[" "]" "{" "}"] @rainbow.bracket
2+
[
3+
(tuple_expr)
4+
(record_expr)
5+
(layout_lit)
6+
(layout_antiquote)
7+
(tuple_pat)
8+
(record_pat)
9+
(atomic_type)
10+
(record_type)
11+
] @rainbow.scope

0 commit comments

Comments
 (0)