diff options
| author | Serhii Khoma <srghma@gmail.com> | 2025-01-16 23:34:37 +0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-16 17:34:37 +0100 |
| commit | 8758abeb4d7c0fb501226d584cd45a1c6836f535 (patch) | |
| tree | 59ff4aa550627cdbd7f75b9ac7f46e8f82aa9fdd /queries | |
| parent | bot(lockfile): update earthfile, gotmpl, heex, helm, vhs (#7557) (diff) | |
| download | nvim-treesitter-8758abeb4d7c0fb501226d584cd45a1c6836f535.tar nvim-treesitter-8758abeb4d7c0fb501226d584cd45a1c6836f535.tar.gz nvim-treesitter-8758abeb4d7c0fb501226d584cd45a1c6836f535.tar.bz2 nvim-treesitter-8758abeb4d7c0fb501226d584cd45a1c6836f535.tar.lz nvim-treesitter-8758abeb4d7c0fb501226d584cd45a1c6836f535.tar.xz nvim-treesitter-8758abeb4d7c0fb501226d584cd45a1c6836f535.tar.zst nvim-treesitter-8758abeb4d7c0fb501226d584cd45a1c6836f535.zip | |
feat(idris): add parser and queries (#7274)
Diffstat (limited to 'queries')
| -rw-r--r-- | queries/idris/folds.scm | 1 | ||||
| -rw-r--r-- | queries/idris/highlights.scm | 224 | ||||
| -rw-r--r-- | queries/idris/injections.scm | 2 | ||||
| -rw-r--r-- | queries/idris/locals.scm | 33 |
4 files changed, 260 insertions, 0 deletions
diff --git a/queries/idris/folds.scm b/queries/idris/folds.scm new file mode 100644 index 000000000..2f4885165 --- /dev/null +++ b/queries/idris/folds.scm @@ -0,0 +1 @@ +(function) @fold diff --git a/queries/idris/highlights.scm b/queries/idris/highlights.scm new file mode 100644 index 000000000..f39deaec6 --- /dev/null +++ b/queries/idris/highlights.scm @@ -0,0 +1,224 @@ +; ------------------------------------------------------------------------------ +; Literals and comments +[ + (integer) + (quantity) +] @number + +(literal + (number)) @number.float + +(char) @character + +[ + (string) + (pat_string) + (triple_quote_string) +] @string + +(comment) @comment @spell + +((comment) @comment.documentation + (#lua-match? @comment.documentation "^|||")) + +(unit) @constant + +; more general captures are moved to the top +; before overwritten later by more specific captures +[ + (loname) + (caname) +] @variable + +; ------------------------------------------------------------------------------ +; Punctuation +[ + "(" + ")" + "{" + "@{" + "}" + "[" + "[<" + "]" +] @punctuation.bracket + +[ + (comma) + (colon) + (pat_op) + (tuple_operator) +] @punctuation.delimiter + +(pat_name + (loname) @variable.parameter) + +; ------------------------------------------------------------------------------ +; Types +(signature + (loname) @type) + +; ------------------------------------------------------------------------------ +; Keywords, operators, imports +[ + "if" + "then" + "else" + "case" + "of" +] @keyword.conditional + +[ + "import" + "module" + "namespace" + "parameters" +] @keyword.import + +[ + (operator) + (equal) + (wildcard) + "." + "|" + "=>" + "⇒" + "<=" + "⇐" + "->" + "→" + "<-" + "←" + "\\" + "`" +] @operator + +(qualified_loname + (caname) @module) + +(qualified_caname + (caname) @constructor) + +(qualified_operator + (caname) @module) + +(import + (caname) @module) + +(module + (caname) @module) + +[ + (where) + "rewrite" + "interface" + "implementation" + "using" + "record" + "as" + "do" + (forall) + (fixity) + (impossible) + (with) + (proof) +] @keyword.operator + +[ + "data" + "let" + "in" + (visibility) + (totality) +] @keyword.modifier + +[ + "=" + "$=" + ":=" +] @operator + +(hole) @label + +[ + (pragma_language) + (pragma_default) + (pragma_builtin) + (pragma_name) + (pragma_ambiguity_depth) + (pragma_auto_implicit_depth) + (pragma_logging) + (pragma_prefix_record_projections) + (pragma_transform) + (pragma_unbound_implicits) + (pragma_auto_lazy) + (pragma_search_timeout) + (pragma_nf_metavar_threshold) + (pragma_cg) + (pragma_allow_overloads) + (pragma_deprecate) + (pragma_inline) + (pragma_noinline) + (pragma_tcinline) + (pragma_hide) + (pragma_unhide) + (pragma_unsafe) + (pragma_spec) + (pragma_foreign) + (pragma_foreign_impl) + (pragma_export) + (pragma_nomangle) + (pragma_hint) + (pragma_defaulthint) + (pragma_globalhint) + (pragma_extern) + (pragma_macro) + (pragma_start) + (pragma_rewrite) + (pragma_pair) + (pragma_integerLit) + (pragma_stringLit) + (pragma_charLit) + (pragma_doubleLit) + (pragma_TTImpLit) + (pragma_declsLit) + (pragma_nameLit) + (pragma_runElab) + (pragma_search) + (pragma_World) + (pragma_MkWorld) + (pragma_syntactic) +] @label + +; ------------------------------------------------------------------------------ +; Functions and variables +(exp_name + (loname) @function.call) + +(constructor + "constructor" @keyword.function + . + (caname) @constructor) + +(exp_record_access + field: (_) @variable.member) + +(signature + name: (loname) @function) + +(function + (lhs + (funvar + subject: [ + (loname) + (caname) + ] @function))) + +(data + name: (data_name) @type) + +(interface_head + name: (interface_name) @type) + +(implementation_head + (interface_name) @type) diff --git a/queries/idris/injections.scm b/queries/idris/injections.scm new file mode 100644 index 000000000..2f0e58eb6 --- /dev/null +++ b/queries/idris/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/idris/locals.scm b/queries/idris/locals.scm new file mode 100644 index 000000000..c46f831f7 --- /dev/null +++ b/queries/idris/locals.scm @@ -0,0 +1,33 @@ +(signature + name: (loname)) @local.definition.var + +(signature + name: (caname)) @local.definition.type + +(function + (lhs + (funvar + subject: (loname)))) @local.definition.function + +(function + (lhs + (funvar + subject: (caname)))) @local.definition.function + +(type_var + (loname)) @local.definition.type + +(pat_name + (loname)) @local.definition.var + +(pat_name + (caname)) @local.definition.var + +(exp_name + (loname)) @local.reference + +(exp_name + (caname)) @local.reference + +(function + (rhs) @local.scope) |
