mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-14 09:20:04 -04:00
feat: add LLVM TableGen
This commit is contained in:
parent
01e8a51451
commit
17c275bfff
8 changed files with 266 additions and 0 deletions
|
|
@ -325,6 +325,7 @@ We are looking for maintainers to add more parsers and to write query files for
|
||||||
- [x] [swift](https://github.com/alex-pinkus/tree-sitter-swift) (maintained by @alex-pinkus)
|
- [x] [swift](https://github.com/alex-pinkus/tree-sitter-swift) (maintained by @alex-pinkus)
|
||||||
- [x] [sxhkdrc](https://github.com/RaafatTurki/tree-sitter-sxhkdrc) (maintained by @RaafatTurki)
|
- [x] [sxhkdrc](https://github.com/RaafatTurki/tree-sitter-sxhkdrc) (maintained by @RaafatTurki)
|
||||||
- [x] [t32](https://codeberg.org/xasc/tree-sitter-t32) (maintained by @xasc)
|
- [x] [t32](https://codeberg.org/xasc/tree-sitter-t32) (maintained by @xasc)
|
||||||
|
- [x] [tablegen](https://github.com/amaanq/tree-sitter-tablegen) (maintained by @amaanq)
|
||||||
- [x] [teal](https://github.com/euclidianAce/tree-sitter-teal) (maintained by @euclidianAce)
|
- [x] [teal](https://github.com/euclidianAce/tree-sitter-teal) (maintained by @euclidianAce)
|
||||||
- [x] [terraform](https://github.com/MichaHoffmann/tree-sitter-hcl) (maintained by @MichaHoffmann)
|
- [x] [terraform](https://github.com/MichaHoffmann/tree-sitter-hcl) (maintained by @MichaHoffmann)
|
||||||
- [x] [thrift](https://github.com/duskmoon314/tree-sitter-thrift) (maintained by @amaanq, @duskmoon314)
|
- [x] [thrift](https://github.com/duskmoon314/tree-sitter-thrift) (maintained by @amaanq, @duskmoon314)
|
||||||
|
|
|
||||||
|
|
@ -455,6 +455,9 @@
|
||||||
"t32": {
|
"t32": {
|
||||||
"revision": "f8106fcf5a27f905b3d9d55d9cd3e910bea70c60"
|
"revision": "f8106fcf5a27f905b3d9d55d9cd3e910bea70c60"
|
||||||
},
|
},
|
||||||
|
"tablegen": {
|
||||||
|
"revision": "e5e046e1b221e25111175469f02f3cf336010857"
|
||||||
|
},
|
||||||
"teal": {
|
"teal": {
|
||||||
"revision": "2158ecce11ea542f9b791baf2c7fb33798174ed2"
|
"revision": "2158ecce11ea542f9b791baf2c7fb33798174ed2"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1350,6 +1350,14 @@ list.t32 = {
|
||||||
maintainers = { "@xasc" },
|
maintainers = { "@xasc" },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list.tablegen = {
|
||||||
|
install_info = {
|
||||||
|
url = "https://github.com/amaanq/tree-sitter-tablegen",
|
||||||
|
files = { "src/parser.c", "src/scanner.c" },
|
||||||
|
},
|
||||||
|
maintainers = { "@amaanq" },
|
||||||
|
}
|
||||||
|
|
||||||
list.teal = {
|
list.teal = {
|
||||||
install_info = {
|
install_info = {
|
||||||
url = "https://github.com/euclidianAce/tree-sitter-teal",
|
url = "https://github.com/euclidianAce/tree-sitter-teal",
|
||||||
|
|
|
||||||
13
queries/tablegen/folds.scm
Normal file
13
queries/tablegen/folds.scm
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
[
|
||||||
|
(assert)
|
||||||
|
(class)
|
||||||
|
(multiclass)
|
||||||
|
(def)
|
||||||
|
(defm)
|
||||||
|
(defset)
|
||||||
|
(defvar)
|
||||||
|
(foreach)
|
||||||
|
(if)
|
||||||
|
(let)
|
||||||
|
(value_suffix)
|
||||||
|
] @fold
|
||||||
156
queries/tablegen/highlights.scm
Normal file
156
queries/tablegen/highlights.scm
Normal file
|
|
@ -0,0 +1,156 @@
|
||||||
|
; Preprocs
|
||||||
|
|
||||||
|
(preprocessor_directive) @preproc
|
||||||
|
|
||||||
|
; Includes
|
||||||
|
|
||||||
|
"include" @include
|
||||||
|
|
||||||
|
; Keywords
|
||||||
|
|
||||||
|
[
|
||||||
|
"assert"
|
||||||
|
"class"
|
||||||
|
"multiclass"
|
||||||
|
"field"
|
||||||
|
"let"
|
||||||
|
"def"
|
||||||
|
"defm"
|
||||||
|
"defset"
|
||||||
|
"defvar"
|
||||||
|
] @keyword
|
||||||
|
|
||||||
|
[
|
||||||
|
"in"
|
||||||
|
] @keyword.operator
|
||||||
|
|
||||||
|
; Conditionals
|
||||||
|
|
||||||
|
[
|
||||||
|
"if"
|
||||||
|
"else"
|
||||||
|
"then"
|
||||||
|
] @conditional
|
||||||
|
|
||||||
|
; Repeats
|
||||||
|
|
||||||
|
[
|
||||||
|
"foreach"
|
||||||
|
] @repeat
|
||||||
|
|
||||||
|
; Variables
|
||||||
|
|
||||||
|
(identifier) @variable
|
||||||
|
|
||||||
|
(var) @variable.builtin
|
||||||
|
|
||||||
|
; Parameters
|
||||||
|
|
||||||
|
(template_arg (identifier) @parameter)
|
||||||
|
|
||||||
|
|
||||||
|
; Types
|
||||||
|
|
||||||
|
(type) @type
|
||||||
|
|
||||||
|
[
|
||||||
|
"bit"
|
||||||
|
"int"
|
||||||
|
"string"
|
||||||
|
"dag"
|
||||||
|
"bits"
|
||||||
|
"list"
|
||||||
|
"code"
|
||||||
|
] @type.builtin
|
||||||
|
|
||||||
|
(class name: (identifier) @type)
|
||||||
|
|
||||||
|
(multiclass name: (identifier) @type)
|
||||||
|
|
||||||
|
(def name: (value (_) @type))
|
||||||
|
|
||||||
|
(defm name: (value (_) @type))
|
||||||
|
|
||||||
|
(defset name: (identifier) @type)
|
||||||
|
|
||||||
|
(parent_class_list (identifier) @type (value (_) @type)?)
|
||||||
|
|
||||||
|
(anonymous_record (identifier) @type)
|
||||||
|
|
||||||
|
(anonymous_record (value (_) @type))
|
||||||
|
|
||||||
|
((identifier) @type
|
||||||
|
(#lua-match? @type "^_*[A-Z][A-Z0-9_]+$"))
|
||||||
|
|
||||||
|
; Fields
|
||||||
|
|
||||||
|
(instruction
|
||||||
|
(identifier) @field)
|
||||||
|
|
||||||
|
(let_instruction
|
||||||
|
(identifier) @field)
|
||||||
|
|
||||||
|
; Functions
|
||||||
|
|
||||||
|
([
|
||||||
|
(bang_operator)
|
||||||
|
(cond_operator)
|
||||||
|
] @function
|
||||||
|
(#set! "priority" 105))
|
||||||
|
|
||||||
|
; Operators
|
||||||
|
|
||||||
|
[
|
||||||
|
"="
|
||||||
|
"#"
|
||||||
|
"-"
|
||||||
|
":"
|
||||||
|
"..."
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
; Literals
|
||||||
|
|
||||||
|
(string) @string
|
||||||
|
|
||||||
|
(code) @string.special
|
||||||
|
|
||||||
|
(integer) @number
|
||||||
|
|
||||||
|
(boolean) @boolean
|
||||||
|
|
||||||
|
(uninitialized_value) @constant.builtin
|
||||||
|
|
||||||
|
; Punctuation
|
||||||
|
|
||||||
|
[ "{" "}" ] @punctuation.bracket
|
||||||
|
|
||||||
|
[ "[" "]" ] @punctuation.bracket
|
||||||
|
|
||||||
|
[ "(" ")" ] @punctuation.bracket
|
||||||
|
|
||||||
|
[ "<" ">" ] @punctuation.bracket
|
||||||
|
|
||||||
|
[
|
||||||
|
"."
|
||||||
|
","
|
||||||
|
";"
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
[
|
||||||
|
"!"
|
||||||
|
] @punctuation.special
|
||||||
|
|
||||||
|
; Comments
|
||||||
|
|
||||||
|
[
|
||||||
|
(comment)
|
||||||
|
(multiline_comment)
|
||||||
|
] @comment @spell
|
||||||
|
|
||||||
|
|
||||||
|
((comment) @preproc
|
||||||
|
(#lua-match? @preproc "^.*RUN"))
|
||||||
|
|
||||||
|
; Errors
|
||||||
|
|
||||||
|
(ERROR) @error
|
||||||
27
queries/tablegen/indents.scm
Normal file
27
queries/tablegen/indents.scm
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
[
|
||||||
|
(assert)
|
||||||
|
(class)
|
||||||
|
(multiclass)
|
||||||
|
(def)
|
||||||
|
(defm)
|
||||||
|
(defvar)
|
||||||
|
(foreach)
|
||||||
|
(if)
|
||||||
|
(let)
|
||||||
|
(value_suffix)
|
||||||
|
] @indent
|
||||||
|
|
||||||
|
[
|
||||||
|
"}"
|
||||||
|
"]"
|
||||||
|
")"
|
||||||
|
">"
|
||||||
|
] @indent_end
|
||||||
|
|
||||||
|
[ "{" "}" ] @branch
|
||||||
|
|
||||||
|
[ "[" "]" ] @branch
|
||||||
|
|
||||||
|
[ "(" ")" ] @branch
|
||||||
|
|
||||||
|
[ "<" ">" ] @branch
|
||||||
7
queries/tablegen/injections.scm
Normal file
7
queries/tablegen/injections.scm
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
((code) @cpp
|
||||||
|
(#offset! @cpp 0 2 0 -2))
|
||||||
|
|
||||||
|
((tablegen_file
|
||||||
|
(comment) @bash)
|
||||||
|
(#lua-match? @bash "^.*RUN")
|
||||||
|
(#offset! @bash 0 8))
|
||||||
51
queries/tablegen/locals.scm
Normal file
51
queries/tablegen/locals.scm
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
; Scopes
|
||||||
|
|
||||||
|
[
|
||||||
|
(class)
|
||||||
|
(multiclass)
|
||||||
|
(def)
|
||||||
|
(defm)
|
||||||
|
(defset)
|
||||||
|
(defvar)
|
||||||
|
(foreach)
|
||||||
|
(if)
|
||||||
|
(let)
|
||||||
|
] @scope
|
||||||
|
|
||||||
|
; References
|
||||||
|
|
||||||
|
[
|
||||||
|
(var)
|
||||||
|
(identifier)
|
||||||
|
] @reference
|
||||||
|
|
||||||
|
; Definitions
|
||||||
|
|
||||||
|
(instruction
|
||||||
|
(identifier) @definition.field)
|
||||||
|
|
||||||
|
(let_instruction
|
||||||
|
(identifier) @definition.field)
|
||||||
|
|
||||||
|
(include_directive
|
||||||
|
(string) @definition.import)
|
||||||
|
|
||||||
|
(template_arg (identifier) @definition.parameter)
|
||||||
|
|
||||||
|
(class
|
||||||
|
name: (identifier) @definition.type)
|
||||||
|
|
||||||
|
(multiclass
|
||||||
|
name: (identifier) @definition.type)
|
||||||
|
|
||||||
|
(def
|
||||||
|
name: (value (_) @definition.type))
|
||||||
|
|
||||||
|
(defm
|
||||||
|
name: (value (_) @definition.type))
|
||||||
|
|
||||||
|
(defset
|
||||||
|
name: (identifier) @definition.type)
|
||||||
|
|
||||||
|
(def_var
|
||||||
|
name: (identifier) @definition.var)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue