Add LLVM TableGen highlighting (#1409)
Add a tree-sitter grammar and highlights for TableGen files. TableGen and its grammar are described here: https://llvm.org/docs/TableGen/index.html Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
This commit is contained in:
parent
93a948d889
commit
8f2af71340
8 changed files with 121 additions and 0 deletions
4
.gitmodules
vendored
4
.gitmodules
vendored
|
@ -178,6 +178,10 @@
|
||||||
path = helix-syntax/languages/tree-sitter-git-diff
|
path = helix-syntax/languages/tree-sitter-git-diff
|
||||||
url = https://github.com/the-mikedavis/tree-sitter-git-diff.git
|
url = https://github.com/the-mikedavis/tree-sitter-git-diff.git
|
||||||
shallow = true
|
shallow = true
|
||||||
|
[submodule "helix-syntax/languages/tree-sitter-tablegen"]
|
||||||
|
path = helix-syntax/languages/tree-sitter-tablegen
|
||||||
|
url = https://github.com/Flakebi/tree-sitter-tablegen
|
||||||
|
shallow = true
|
||||||
[submodule "helix-syntax/languages/tree-sitter-git-rebase"]
|
[submodule "helix-syntax/languages/tree-sitter-git-rebase"]
|
||||||
path = helix-syntax/languages/tree-sitter-git-rebase
|
path = helix-syntax/languages/tree-sitter-git-rebase
|
||||||
url = https://github.com/the-mikedavis/tree-sitter-git-rebase.git
|
url = https://github.com/the-mikedavis/tree-sitter-git-rebase.git
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
| rust | ✓ | ✓ | ✓ | `rust-analyzer` |
|
| rust | ✓ | ✓ | ✓ | `rust-analyzer` |
|
||||||
| scala | ✓ | | ✓ | `metals` |
|
| scala | ✓ | | ✓ | `metals` |
|
||||||
| svelte | ✓ | | ✓ | `svelteserver` |
|
| svelte | ✓ | | ✓ | `svelteserver` |
|
||||||
|
| tablegen | ✓ | ✓ | ✓ | |
|
||||||
| toml | ✓ | | | |
|
| toml | ✓ | | | |
|
||||||
| tsq | ✓ | | | |
|
| tsq | ✓ | | | |
|
||||||
| tsx | ✓ | | | `typescript-language-server` |
|
| tsx | ✓ | | | `typescript-language-server` |
|
||||||
|
|
1
helix-syntax/languages/tree-sitter-tablegen
Submodule
1
helix-syntax/languages/tree-sitter-tablegen
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 568dd8a937347175fd58db83d4c4cdaeb6069bd2
|
|
@ -436,6 +436,15 @@ file-types = ["ll"]
|
||||||
comment-token = ";"
|
comment-token = ";"
|
||||||
indent = { tab-width = 2, unit = " " }
|
indent = { tab-width = 2, unit = " " }
|
||||||
|
|
||||||
|
[[language]]
|
||||||
|
name = "tablegen"
|
||||||
|
scope = "source.tablegen"
|
||||||
|
roots = []
|
||||||
|
file-types = ["td"]
|
||||||
|
comment-token = "//"
|
||||||
|
indent = { tab-width = 2, unit = " " }
|
||||||
|
injection-regex = "tablegen"
|
||||||
|
|
||||||
[[language]]
|
[[language]]
|
||||||
name = "markdown"
|
name = "markdown"
|
||||||
scope = "source.md"
|
scope = "source.md"
|
||||||
|
|
90
runtime/queries/tablegen/highlights.scm
Normal file
90
runtime/queries/tablegen/highlights.scm
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
[
|
||||||
|
(comment)
|
||||||
|
(multiline_comment)
|
||||||
|
] @comment
|
||||||
|
|
||||||
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
"<"
|
||||||
|
">"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
[
|
||||||
|
","
|
||||||
|
";"
|
||||||
|
"."
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
[
|
||||||
|
"#"
|
||||||
|
"-"
|
||||||
|
"..."
|
||||||
|
":"
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
[
|
||||||
|
"="
|
||||||
|
"!cond"
|
||||||
|
(operator_keyword)
|
||||||
|
] @function
|
||||||
|
|
||||||
|
[
|
||||||
|
"true"
|
||||||
|
"false"
|
||||||
|
] @constant.builtin.boolean
|
||||||
|
|
||||||
|
[
|
||||||
|
"?"
|
||||||
|
] @constant.builtin
|
||||||
|
|
||||||
|
(var) @variable
|
||||||
|
|
||||||
|
(template_arg (identifier) @variable.parameter)
|
||||||
|
|
||||||
|
(_ argument: (value (identifier) @variable.parameter))
|
||||||
|
|
||||||
|
(type) @type
|
||||||
|
|
||||||
|
"code" @type.builtin
|
||||||
|
|
||||||
|
(number) @constant.numeric.integer
|
||||||
|
[
|
||||||
|
(string_string)
|
||||||
|
(code_string)
|
||||||
|
] @string
|
||||||
|
|
||||||
|
(preprocessor) @keyword.directive
|
||||||
|
|
||||||
|
[
|
||||||
|
"class"
|
||||||
|
"field"
|
||||||
|
"let"
|
||||||
|
"defvar"
|
||||||
|
"def"
|
||||||
|
"defset"
|
||||||
|
"defvar"
|
||||||
|
"assert"
|
||||||
|
] @keyword
|
||||||
|
|
||||||
|
[
|
||||||
|
"let"
|
||||||
|
"in"
|
||||||
|
"foreach"
|
||||||
|
"if"
|
||||||
|
"then"
|
||||||
|
"else"
|
||||||
|
] @keyword.operator
|
||||||
|
|
||||||
|
"include" @keyword.control.import
|
||||||
|
|
||||||
|
[
|
||||||
|
"multiclass"
|
||||||
|
"defm"
|
||||||
|
] @namespace
|
||||||
|
|
||||||
|
(ERROR) @error
|
7
runtime/queries/tablegen/indents.toml
Normal file
7
runtime/queries/tablegen/indents.toml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
indent = [
|
||||||
|
"statement",
|
||||||
|
]
|
||||||
|
|
||||||
|
outdent = [
|
||||||
|
"}",
|
||||||
|
]
|
2
runtime/queries/tablegen/injections.scm
Normal file
2
runtime/queries/tablegen/injections.scm
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
([ (comment) (multiline_comment)] @injection.content
|
||||||
|
(#set! injection.language "comment"))
|
7
runtime/queries/tablegen/textobjects.scm
Normal file
7
runtime/queries/tablegen/textobjects.scm
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
(class
|
||||||
|
body: (_) @class.inside) @class.around
|
||||||
|
|
||||||
|
(multiclass
|
||||||
|
body: (_) @class.inside) @class.around
|
||||||
|
|
||||||
|
(_ argument: _ @parameter.inside)
|
Loading…
Add table
Reference in a new issue