mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat(circom): add parser and queries
This commit is contained in:
parent
c56507f6a1
commit
be17791f86
6 changed files with 175 additions and 0 deletions
|
|
@ -65,6 +65,9 @@
|
|||
"chatito": {
|
||||
"revision": "b4cbe9ab7672d5106e9550d8413835395a1be362"
|
||||
},
|
||||
"circom": {
|
||||
"revision": "02150524228b1e6afef96949f2d6b7cc0aaf999e"
|
||||
},
|
||||
"clojure": {
|
||||
"revision": "f4236d4da8aa92bc105d9c118746474c608e6af7"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -249,6 +249,14 @@ list.chatito = {
|
|||
maintainers = { "@ObserverOfTime" },
|
||||
}
|
||||
|
||||
list.circom = {
|
||||
install_info = {
|
||||
url = "https://github.com/Decurity/tree-sitter-circom",
|
||||
files = { "src/parser.c" },
|
||||
},
|
||||
maintainers = { "@alexandr-martirosyan" },
|
||||
}
|
||||
|
||||
list.clojure = {
|
||||
install_info = {
|
||||
url = "https://github.com/sogaiu/tree-sitter-clojure",
|
||||
|
|
|
|||
13
queries/circom/folds.scm
Normal file
13
queries/circom/folds.scm
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
[
|
||||
(template_body)
|
||||
(block_statement)
|
||||
(if_statement)
|
||||
(for_statement)
|
||||
(while_statement)
|
||||
(function_body)
|
||||
(call_expression)
|
||||
(array_expression)
|
||||
(tuple_expression)
|
||||
(comment)
|
||||
(include_directive)+
|
||||
] @fold
|
||||
137
queries/circom/highlights.scm
Normal file
137
queries/circom/highlights.scm
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
; identifiers
|
||||
; -----------
|
||||
(identifier) @variable
|
||||
|
||||
; Pragma
|
||||
; -----------
|
||||
[
|
||||
"pragma"
|
||||
"circom"
|
||||
] @keyword.directive
|
||||
|
||||
(circom_version) @string.special
|
||||
|
||||
; Include
|
||||
; -----------
|
||||
[
|
||||
"public"
|
||||
"signal"
|
||||
"var"
|
||||
"include"
|
||||
] @keyword.import
|
||||
|
||||
; Literals
|
||||
; --------
|
||||
(string) @string
|
||||
|
||||
(int_literal) @number
|
||||
|
||||
; Definitions
|
||||
; -----------
|
||||
(function_definition
|
||||
name: (identifier) @function)
|
||||
|
||||
(template_definition
|
||||
name: (identifier) @function)
|
||||
|
||||
; Use constructor coloring for special functions
|
||||
"main" @constructor
|
||||
|
||||
; Invocations
|
||||
(call_expression
|
||||
.
|
||||
(identifier) @function.call)
|
||||
|
||||
; Function parameters
|
||||
(parameter
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
; Members
|
||||
(member_expression
|
||||
property: (property_identifier) @property)
|
||||
|
||||
; Tokens
|
||||
; -------
|
||||
; Keywords
|
||||
[
|
||||
"input"
|
||||
"output"
|
||||
"public"
|
||||
"component"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"for"
|
||||
"while"
|
||||
] @keyword.repeat
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
] @keyword.conditional
|
||||
|
||||
"return" @keyword.return
|
||||
|
||||
[
|
||||
"function"
|
||||
"template"
|
||||
] @keyword.function
|
||||
|
||||
; Punctuation
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"."
|
||||
","
|
||||
";"
|
||||
] @punctuation.delimiter
|
||||
|
||||
; Operators
|
||||
[
|
||||
"&&"
|
||||
"||"
|
||||
">>"
|
||||
"<<"
|
||||
"&"
|
||||
"^"
|
||||
"|"
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"**"
|
||||
"<"
|
||||
"<="
|
||||
"="
|
||||
"=="
|
||||
"!="
|
||||
"+="
|
||||
"-="
|
||||
">="
|
||||
">"
|
||||
"!"
|
||||
"~"
|
||||
"-"
|
||||
"+"
|
||||
"++"
|
||||
"--"
|
||||
"<=="
|
||||
"==>"
|
||||
"<--"
|
||||
"-->"
|
||||
"==="
|
||||
] @operator
|
||||
|
||||
; Comments
|
||||
(comment) @comment @spell
|
||||
|
||||
((comment) @comment.documentation
|
||||
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
|
||||
2
queries/circom/injections.scm
Normal file
2
queries/circom/injections.scm
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
12
queries/circom/locals.scm
Normal file
12
queries/circom/locals.scm
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
(function_definition) @local.scope
|
||||
|
||||
(template_definition) @local.scope
|
||||
|
||||
(main_component_definition) @local.scope
|
||||
|
||||
(block_statement) @local.scope
|
||||
|
||||
(parameter
|
||||
name: (identifier) @local.definition) @local.definition
|
||||
|
||||
(identifier) @local.reference
|
||||
Loading…
Add table
Add a link
Reference in a new issue