diff options
| author | Christian Clason <c.clason@uni-graz.at> | 2023-06-12 09:54:30 -0600 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2025-05-12 18:43:40 +0200 |
| commit | 692b051b09935653befdb8f7ba8afdb640adf17b (patch) | |
| tree | 167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/circom | |
| parent | feat(c-family): inherit injections (diff) | |
| download | nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2 nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip | |
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/circom')
| -rw-r--r-- | runtime/queries/circom/folds.scm | 13 | ||||
| -rw-r--r-- | runtime/queries/circom/highlights.scm | 137 | ||||
| -rw-r--r-- | runtime/queries/circom/injections.scm | 2 | ||||
| -rw-r--r-- | runtime/queries/circom/locals.scm | 12 |
4 files changed, 164 insertions, 0 deletions
diff --git a/runtime/queries/circom/folds.scm b/runtime/queries/circom/folds.scm new file mode 100644 index 000000000..47525b174 --- /dev/null +++ b/runtime/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/runtime/queries/circom/highlights.scm b/runtime/queries/circom/highlights.scm new file mode 100644 index 000000000..c61925e7a --- /dev/null +++ b/runtime/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/runtime/queries/circom/injections.scm b/runtime/queries/circom/injections.scm new file mode 100644 index 000000000..2f0e58eb6 --- /dev/null +++ b/runtime/queries/circom/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/circom/locals.scm b/runtime/queries/circom/locals.scm new file mode 100644 index 000000000..4c3a75152 --- /dev/null +++ b/runtime/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 |
