Unnamed repository; edit this file 'description' to name the repository.
add highlights and rainbows for bovex (#14651)
evie 4 months ago
parent 6e36634 · commit 63a67b8
-rw-r--r--book/src/generated/lang-support.md1
-rw-r--r--languages.toml19
-rw-r--r--runtime/queries/bovex/highlights.scm88
-rw-r--r--runtime/queries/bovex/rainbows.scm11
4 files changed, 119 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index 690a7f27..f2d94a1c 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -15,6 +15,7 @@
| bitbake | ✓ | | | | | `bitbake-language-server` |
| blade | ✓ | ✓ | | | ✓ | |
| blueprint | ✓ | | | | | `blueprint-compiler` |
+| bovex | ✓ | | | | ✓ | |
| c | ✓ | ✓ | ✓ | ✓ | ✓ | `clangd` |
| c-sharp | ✓ | ✓ | | ✓ | | `OmniSharp` |
| cabal | | | | | | `haskell-language-server-wrapper` |
diff --git a/languages.toml b/languages.toml
index ed77164a..6f52db11 100644
--- a/languages.toml
+++ b/languages.toml
@@ -4933,3 +4933,22 @@ block-comment-tokens = { start = "/*", end = "*/"}
[[grammer]]
name = "kcl"
source = { git = "https://github.com/KittyCAD/tree-sitter-kcl", rev = "8905e0bdbf5870b50bc3f24345f1af27746f42e8"}
+
+[[language]]
+name = "bovex"
+scope = "source.bovex"
+file-types = ["bovex", "bibvex"]
+comment-tokens = []
+block-comment-tokens = [{start = "(*", end = "*)"}, {start = "[*", end = "*]"}]
+indent = {tab-width = 2, unit = " "}
+[language.auto-pairs]
+'(' = ')'
+'[' = ']'
+'{' = '}'
+'"' = '"'
+'“' = '”'
+'‘' = '’'
+
+[[grammar]]
+name = "bovex"
+source = { git = "https://github.com/mi2ebi/tree-sitter-bovex", rev = "de7657a9cc3525b9b77c6d268da09dad5b1346b0" }
diff --git a/runtime/queries/bovex/highlights.scm b/runtime/queries/bovex/highlights.scm
new file mode 100644
index 00000000..cc4ffe0a
--- /dev/null
+++ b/runtime/queries/bovex/highlights.scm
@@ -0,0 +1,88 @@
+[(code_comment) (layout_comment)] @comment.block
+
+(do_decl "do" @keyword.control)
+(val_decl "val" @keyword.storage.type)
+(fun_decl ["fun" "and"] @keyword.storage.type)
+(datatype_decl ["datatype" "and"] @keyword.storage.type)
+(datatype_arm "of" @keyword.storage.type)
+(object_decl ["object" "of"] @keyword.storage.type)
+(type_decl "type" @keyword.storage.type)
+(local_decl ["local" "in" "end"] @keyword.storage.modifier)
+(open_decl "open" @keyword.control)
+(import_decl "import" @keyword.control.import)
+(with_expr ["with" "without"] @keyword.operator)
+(orelse_expr ["orelse" "otherwise"] @keyword.operator)
+(andalso_expr ["andalso" "andthen"] @keyword.operator)
+(fn_expr ["fn" "as"] @keyword.function)
+(if_expr ["if" "then" "else"] @keyword.control.conditional)
+(case_expr ["case" "of"] @keyword.control)
+(fail_expr "fail" @keyword.control)
+(let_expr ["let" "in" "end"] @keyword.storage.modifier)
+(pat "as" @keyword.operator)
+
+(boolean_lit) @constant.builtin.boolean
+(numeric_lit) @constant.numeric.integer
+(float_lit) @constant.numeric.float
+(string_lit) @string.quoted.double
+(backslash_escape) @constant.character.escape
+
+["=" ":" ","] @punctuation.delimiter
+["->" "=>"] @operator
+["(" ")" "[" "]" "{" "}"] @punctuation.bracket
+
+[(ident) (label)] @variable.other
+(type_ident) @type
+(atomic_pat (ident) @variable.other)
+(pat (app_pat (atomic_pat (ident) @variable.parameter)))
+
+(type_var) @type.parameter
+(atomic_type (type_ident) @type.builtin)
+[(record_type) (product_type) (app_type) (arrow_type)] @type
+
+(atomic_expr (ident) @variable.other)
+(project_expr) @variable.member
+(field_binding (label) @variable.member.private)
+(field_binding (expr) @variable.other)
+(record_pat (ident) @variable.member.private)
+
+(app_expr
+ (app_expr (atomic_expr (ident) @function.call))
+ (atomic_expr))
+(app_expr
+ _
+ [":=" "@" "::" "o" "==" "!=" "==." "!=."
+ "<" "<=" ">" ">=" "<." "<=." ">." ">=."
+ "+" "-" "+." "-." "*" "*." "/" "/." "div" "mod"
+ "shl" "shr" "andb" "xorb" "orb"] @operator
+ _)
+
+(app_expr
+ (app_expr (atomic_expr (ident) @function.builtin (#eq? @function.builtin "b")))
+ (atomic_expr (layout_lit (layout_content (layout_text) @markup.bold))))
+(app_expr
+ (app_expr (atomic_expr (ident) @function.builtin (#eq? @function.builtin "it")))
+ (atomic_expr (layout_lit (layout_content (layout_text) @markup.italic))))
+(app_expr
+ (app_expr (atomic_expr (ident) @function.builtin (#eq? @function.builtin "rm")))
+ (atomic_expr (layout_lit)))
+(app_expr
+ (app_expr (atomic_expr (ident) @function.builtin (#match? @function.builtin "^(tt|courier|fixedersys)$")))
+ (atomic_expr (layout_lit (layout_content (layout_text) @markup.raw.inline))))
+(app_expr
+ (app_expr (atomic_expr (ident) @function.builtin (#eq? @function.builtin "title")))
+ (atomic_expr (layout_lit (layout_content (layout_text) @markup.heading.1))))
+(app_expr
+ (app_expr (atomic_expr (ident) @function.builtin (#eq? @function.builtin "section")))
+ (atomic_expr (layout_lit (layout_content (layout_text) @markup.heading.2))))
+(app_expr
+ (app_expr (atomic_expr (ident) @function.builtin (#eq? @function.builtin "subsection")))
+ (atomic_expr (layout_lit (layout_content (layout_text) @markup.heading.3))))
+(app_expr
+ (app_expr (atomic_expr (ident) @function.builtin (#eq? @function.builtin "subsubsection")))
+ (atomic_expr (layout_lit (layout_content (layout_text) @markup.heading.4))))
+(app_expr
+ (app_expr (atomic_expr (ident) @function.builtin (#eq? @function.builtin "paragraph")))
+ (atomic_expr (layout_lit (layout_content (layout_text) @markup.heading.5))))
+(app_expr
+ (app_expr (atomic_expr (ident) @function.builtin (#eq? @function.builtin "blockquote")))
+ (atomic_expr (layout_lit (layout_content (layout_text) @markup.quote))))
diff --git a/runtime/queries/bovex/rainbows.scm b/runtime/queries/bovex/rainbows.scm
new file mode 100644
index 00000000..f00c454f
--- /dev/null
+++ b/runtime/queries/bovex/rainbows.scm
@@ -0,0 +1,11 @@
+["(" ")" "[" "]" "{" "}"] @rainbow.bracket
+[
+ (tuple_expr)
+ (record_expr)
+ (layout_lit)
+ (layout_antiquote)
+ (tuple_pat)
+ (record_pat)
+ (atomic_type)
+ (record_type)
+] @rainbow.scope