diff options
| -rw-r--r-- | lockfile.json | 3 | ||||
| -rw-r--r-- | lua/nvim-treesitter/parsers.lua | 8 | ||||
| -rw-r--r-- | queries/circom/folds.scm | 13 | ||||
| -rw-r--r-- | queries/circom/highlights.scm | 137 | ||||
| -rw-r--r-- | queries/circom/injections.scm | 2 | ||||
| -rw-r--r-- | queries/circom/locals.scm | 12 |
6 files changed, 175 insertions, 0 deletions
diff --git a/lockfile.json b/lockfile.json index 4931e3b4f..05f673feb 100644 --- a/lockfile.json +++ b/lockfile.json @@ -65,6 +65,9 @@ "chatito": { "revision": "b4cbe9ab7672d5106e9550d8413835395a1be362" }, + "circom": { + "revision": "02150524228b1e6afef96949f2d6b7cc0aaf999e" + }, "clojure": { "revision": "f4236d4da8aa92bc105d9c118746474c608e6af7" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index 24642824e..1fe72bc89 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -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", diff --git a/queries/circom/folds.scm b/queries/circom/folds.scm new file mode 100644 index 000000000..47525b174 --- /dev/null +++ b/queries/circom/folds.scm @@ -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 diff --git a/queries/circom/highlights.scm b/queries/circom/highlights.scm new file mode 100644 index 000000000..c61925e7a --- /dev/null +++ b/queries/circom/highlights.scm @@ -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 "^/[*][*][^*].*[*]/$")) diff --git a/queries/circom/injections.scm b/queries/circom/injections.scm new file mode 100644 index 000000000..2f0e58eb6 --- /dev/null +++ b/queries/circom/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/circom/locals.scm b/queries/circom/locals.scm new file mode 100644 index 000000000..4c3a75152 --- /dev/null +++ b/queries/circom/locals.scm @@ -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 |
