mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-08 14:30:05 -04:00
feat: add FIRRTL
This commit is contained in:
parent
eadf4f43c6
commit
eb1e599251
7 changed files with 257 additions and 0 deletions
|
|
@ -122,6 +122,9 @@
|
|||
"fennel": {
|
||||
"revision": "517195970428aacca60891b050aa53eabf4ba78d"
|
||||
},
|
||||
"firrtl": {
|
||||
"revision": "58e9655caa6b6d0ef8dc0e6bd3d8e060beb6b40d"
|
||||
},
|
||||
"fish": {
|
||||
"revision": "f9176908c9eb2e11eb684d79e1d00f3b29bd65c9"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -415,6 +415,14 @@ list.fennel = {
|
|||
maintainers = { "@TravonteD" },
|
||||
}
|
||||
|
||||
list.firrtl = {
|
||||
install_info = {
|
||||
url = "https://github.com/amaanq/tree-sitter-firrtl",
|
||||
files = { "src/parser.c", "src/scanner.cc" },
|
||||
},
|
||||
maintainers = { "@amaanq" },
|
||||
}
|
||||
|
||||
list.fish = {
|
||||
install_info = {
|
||||
url = "https://github.com/ram02z/tree-sitter-fish",
|
||||
|
|
|
|||
6
queries/firrtl/folds.scm
Normal file
6
queries/firrtl/folds.scm
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[
|
||||
(circuit)
|
||||
(module)
|
||||
(when)
|
||||
(else)
|
||||
] @fold
|
||||
189
queries/firrtl/highlights.scm
Normal file
189
queries/firrtl/highlights.scm
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
; Namespaces
|
||||
|
||||
(circuit (identifier) @namespace)
|
||||
|
||||
(module (identifier) @namespace)
|
||||
|
||||
; Types
|
||||
|
||||
((identifier) @type
|
||||
(#lua-match? @type "^[A-Z][A-Za-z0-9_$]*$"))
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"circuit"
|
||||
"module"
|
||||
"extmodule"
|
||||
|
||||
"flip"
|
||||
"parameter"
|
||||
"reset"
|
||||
"wire"
|
||||
|
||||
"cmem"
|
||||
"smem"
|
||||
"mem"
|
||||
|
||||
"reg"
|
||||
"with"
|
||||
"mport"
|
||||
"inst"
|
||||
"of"
|
||||
"node"
|
||||
"is"
|
||||
"invalid"
|
||||
"skip"
|
||||
|
||||
"infer"
|
||||
"read"
|
||||
"write"
|
||||
"rdwr"
|
||||
|
||||
"defname"
|
||||
] @keyword
|
||||
|
||||
; Qualifiers
|
||||
|
||||
(qualifier) @type.qualifier
|
||||
|
||||
; Storageclasses
|
||||
|
||||
[
|
||||
"input"
|
||||
"output"
|
||||
] @storageclass
|
||||
|
||||
; Conditionals
|
||||
|
||||
[
|
||||
"when"
|
||||
"else"
|
||||
] @conditional
|
||||
|
||||
; Annotations
|
||||
|
||||
(info) @attribute
|
||||
|
||||
; Builtins
|
||||
|
||||
[
|
||||
"stop"
|
||||
"printf"
|
||||
"assert"
|
||||
"assume"
|
||||
"cover"
|
||||
"attach"
|
||||
"mux"
|
||||
"validif"
|
||||
] @function.builtin
|
||||
|
||||
[
|
||||
"UInt"
|
||||
"SInt"
|
||||
"Analog"
|
||||
"Fixed"
|
||||
"Clock"
|
||||
"AsyncReset"
|
||||
"Reset"
|
||||
] @type.builtin
|
||||
|
||||
; Fields
|
||||
|
||||
[
|
||||
"data-type"
|
||||
"depth"
|
||||
"read-latency"
|
||||
"write-latency"
|
||||
"read-under-write"
|
||||
"reader"
|
||||
"writer"
|
||||
"readwriter"
|
||||
] @field.builtin
|
||||
|
||||
((field_id) @field
|
||||
(#set! "priority" 105))
|
||||
|
||||
(port (identifier) @field)
|
||||
|
||||
(wire (identifier) @field)
|
||||
|
||||
(cmem (identifier) @field)
|
||||
|
||||
(smem (identifier) @field)
|
||||
|
||||
(memory (identifier) @field)
|
||||
|
||||
(register (identifier) @field)
|
||||
|
||||
; Parameters
|
||||
|
||||
(primitive_operation (identifier) @parameter)
|
||||
|
||||
(mux (identifier) @parameter)
|
||||
(printf (identifier) @parameter)
|
||||
(reset (identifier) @parameter)
|
||||
(stop (identifier) @parameter)
|
||||
|
||||
; Variables
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; Operators
|
||||
|
||||
(primop) @keyword.operator
|
||||
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
"="
|
||||
"=>"
|
||||
"<="
|
||||
"<-"
|
||||
] @operator
|
||||
|
||||
; Literals
|
||||
|
||||
[
|
||||
(uint)
|
||||
(number)
|
||||
] @number
|
||||
|
||||
(number_str) @string.special
|
||||
|
||||
(double) @float
|
||||
|
||||
(string) @string
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
[
|
||||
"old"
|
||||
"new"
|
||||
"undefined"
|
||||
] @constant.builtin
|
||||
|
||||
; Punctuation
|
||||
|
||||
[ "{" "}" ] @punctuation.bracket
|
||||
|
||||
[ "[" "]" ] @punctuation.bracket
|
||||
|
||||
[ "<" ">" ] @punctuation.bracket
|
||||
|
||||
[ "(" ")" ] @punctuation.bracket
|
||||
|
||||
[
|
||||
","
|
||||
"."
|
||||
":"
|
||||
] @punctuation.delimiter
|
||||
|
||||
; Comments
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
["=>" "<=" "="] @operator
|
||||
|
||||
; Error
|
||||
(ERROR) @error
|
||||
12
queries/firrtl/indents.scm
Normal file
12
queries/firrtl/indents.scm
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[
|
||||
(circuit)
|
||||
(module)
|
||||
(memory)
|
||||
(when)
|
||||
(else)
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
] @indent.auto
|
||||
1
queries/firrtl/injections.scm
Normal file
1
queries/firrtl/injections.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
(comment) @comment
|
||||
38
queries/firrtl/locals.scm
Normal file
38
queries/firrtl/locals.scm
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
; Scopes
|
||||
|
||||
[
|
||||
(source_file)
|
||||
(circuit)
|
||||
(module)
|
||||
|
||||
(else)
|
||||
(when)
|
||||
] @scope
|
||||
|
||||
; References
|
||||
|
||||
(identifier) @reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(port (identifier) @definition.field)
|
||||
|
||||
(wire (identifier) @definition.field)
|
||||
|
||||
(cmem (identifier) @definition.field)
|
||||
|
||||
(smem (identifier) @definition.field)
|
||||
|
||||
(memory (identifier) @definition.field)
|
||||
|
||||
(register (identifier) @definition.field)
|
||||
|
||||
(circuit (identifier) @definition.namespace)
|
||||
|
||||
(module (identifier) @definition.namespace)
|
||||
|
||||
(parameter (identifier) @definition.parameter)
|
||||
|
||||
(rdwr (identifier) @definition.var)
|
||||
|
||||
(node (identifier) @definition.var)
|
||||
Loading…
Add table
Add a link
Reference in a new issue