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/pony | |
| 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/pony')
| -rw-r--r-- | runtime/queries/pony/folds.scm | 33 | ||||
| -rw-r--r-- | runtime/queries/pony/highlights.scm | 333 | ||||
| -rw-r--r-- | runtime/queries/pony/indents.scm | 71 | ||||
| -rw-r--r-- | runtime/queries/pony/injections.scm | 5 | ||||
| -rw-r--r-- | runtime/queries/pony/locals.scm | 86 |
5 files changed, 528 insertions, 0 deletions
diff --git a/runtime/queries/pony/folds.scm b/runtime/queries/pony/folds.scm new file mode 100644 index 000000000..95b76eb69 --- /dev/null +++ b/runtime/queries/pony/folds.scm @@ -0,0 +1,33 @@ +[ + (use_statement) + (actor_definition) + (class_definition) + (primitive_definition) + (interface_definition) + (trait_definition) + (struct_definition) + (constructor) + (method) + (behavior) + (parameters) + (type) + (if_statement) + (iftype_statement) + (elseif_block) + (elseiftype_block) + (else_block) + (for_statement) + (while_statement) + (try_statement) + (with_statement) + (repeat_statement) + (recover_statement) + (match_statement) + (case_statement) + (parenthesized_expression) + (tuple_expression) + (array_literal) + (object_literal) + (string) + (block_comment) +] @fold diff --git a/runtime/queries/pony/highlights.scm b/runtime/queries/pony/highlights.scm new file mode 100644 index 000000000..f3d4b5dca --- /dev/null +++ b/runtime/queries/pony/highlights.scm @@ -0,0 +1,333 @@ +; Includes +"use" @keyword.import + +; Keywords +[ + "primitive" + "embed" + "let" + "var" + (compile_intrinsic) + "as" + "consume" + "recover" + "object" + "where" +] @keyword + +[ + "class" + "struct" + "type" + "interface" + "trait" + "actor" +] @keyword.type + +"fun" @keyword.function + +"be" @keyword.coroutine + +[ + "in" + "is" +] @keyword.operator + +"return" @keyword.return + +; Qualifiers +[ + "iso" + "trn" + "ref" + "val" + "box" + "tag" + "#read" + "#send" + "#share" + "#alias" + "#any" +] @keyword.modifier + +; Conditionals +[ + "if" + "ifdef" + "iftype" + "then" + "else" + "elseif" + "match" +] @keyword.conditional + +(if_statement + "end" @keyword.conditional) + +(iftype_statement + "end" @keyword.conditional) + +(match_statement + "end" @keyword.conditional) + +; Repeats +[ + "repeat" + "until" + "while" + "for" + "continue" + "do" + "break" +] @keyword.repeat + +(do_block + "end" @keyword.repeat) + +(repeat_statement + "end" @keyword.repeat) + +; Exceptions +[ + "try" + (error) + "compile_error" +] @keyword.exception + +(try_statement + "end" @keyword.exception) + +(recover_statement + "end" @keyword.exception) + +; Attributes +(annotation) @attribute + +; Variables +(identifier) @variable + +(this) @variable.builtin + +; Fields +(field + name: (identifier) @variable.member) + +(member_expression + "." + (identifier) @variable.member) + +; Constructors +(constructor + "new" @keyword.operator + (identifier) @constructor) + +; Methods +(method + (identifier) @function.method) + +(behavior + (identifier) @function.method) + +(ffi_method + (identifier) @function.method) + +((ffi_method + (string) @string.special) + (#set! priority 105)) + +(call_expression + callee: [ + (identifier) @function.method.call + (ffi_identifier + (identifier) @function.method.call) + (member_expression + "." + (identifier) @function.method.call) + ]) + +; Parameters +(parameter + name: (identifier) @variable.parameter) + +(lambda_parameter + name: (identifier) @variable.parameter) + +; Types +(type_alias + (identifier) @type.definition) + +(base_type + name: (identifier) @type) + +(generic_parameter + (identifier) @type) + +(lambda_type + (identifier)? @function.method) + +((identifier) @type + (#lua-match? @type "^_*[A-Z][a-zA-Z0-9_]*$")) + +; Operators +(unary_expression + operator: [ + "not" + "addressof" + "digestof" + ] @keyword.operator) + +(binary_expression + operator: [ + "and" + "or" + "xor" + "is" + "isnt" + ] @keyword.operator) + +[ + "=" + "?" + "|" + "&" + "-~" + "+" + "-" + "*" + "/" + "%" + "%%" + "<<" + ">>" + "==" + "!=" + ">" + ">=" + "<=" + "<" + "+~" + "-~" + "*~" + "/~" + "%~" + "%%~" + "<<~" + ">>~" + "==~" + "!=~" + ">~" + ">=~" + "<=~" + "<~" + "+?" + "-?" + "*?" + "/?" + "%?" + "%%?" + "<:" +] @operator + +; Literals +(string) @string + +(source_file + (string) @string.documentation) + +(actor_definition + (string) @string.documentation) + +(class_definition + (string) @string.documentation) + +(primitive_definition + (string) @string.documentation) + +(interface_definition + (string) @string.documentation) + +(trait_definition + (string) @string.documentation) + +(struct_definition + (string) @string.documentation) + +(type_alias + (string) @string.documentation) + +(field + (string) @string.documentation) + +(constructor + [ + (string) @string.documentation + (block + . + (string) @string.documentation) + ]) + +(method + [ + (string) @string.documentation + (block + . + (string) @string.documentation) + ]) + +(behavior + [ + (string) @string.documentation + (block + . + (string) @string.documentation) + ]) + +(character) @character + +(escape_sequence) @string.escape + +(number) @number + +(float) @number.float + +(boolean) @boolean + +; Punctuation +[ + "{" + "}" +] @punctuation.bracket + +[ + "[" + "]" +] @punctuation.bracket + +[ + "(" + ")" +] @punctuation.bracket + +[ + "." + "," + ";" + ":" + "~" + ".>" + "->" + "=>" +] @punctuation.delimiter + +[ + "@" + "!" + "^" + "..." +] @punctuation.special + +; Comments +[ + (line_comment) + (block_comment) +] @comment @spell diff --git a/runtime/queries/pony/indents.scm b/runtime/queries/pony/indents.scm new file mode 100644 index 000000000..3bddd29de --- /dev/null +++ b/runtime/queries/pony/indents.scm @@ -0,0 +1,71 @@ +[ + (use_statement) + (actor_definition) + (class_definition) + (primitive_definition) + (interface_definition) + (trait_definition) + (struct_definition) + (constructor) + (method) + (behavior) + (parameters) + (if_block) + (then_block) + (elseif_block) + (else_block) + (iftype_statement) + (elseiftype_block) + (do_block) + (match_statement) + (parenthesized_expression) + (tuple_expression) + (array_literal) + (object_literal) +] @indent.begin + +(try_statement + (block) @indent.begin) + +(repeat_statement + (block) @indent.begin) + +(recover_statement + (block) @indent.begin) + +(return_statement + (block) @indent.begin) + +(continue_statement + (block) @indent.begin) + +(break_statement + (block) @indent.begin) + +[ + "}" + "]" + ")" +] @indent.end + +[ + "{" + "}" +] @indent.branch + +[ + "[" + "]" +] @indent.branch + +[ + "(" + ")" +] @indent.branch + +[ + (ERROR) + (string) + (line_comment) + (block_comment) +] @indent.auto diff --git a/runtime/queries/pony/injections.scm b/runtime/queries/pony/injections.scm new file mode 100644 index 000000000..3cd6aac8e --- /dev/null +++ b/runtime/queries/pony/injections.scm @@ -0,0 +1,5 @@ +([ + (line_comment) + (block_comment) +] @injection.content + (#set! injection.language "comment")) diff --git a/runtime/queries/pony/locals.scm b/runtime/queries/pony/locals.scm new file mode 100644 index 000000000..a27e501a3 --- /dev/null +++ b/runtime/queries/pony/locals.scm @@ -0,0 +1,86 @@ +; Scopes +[ + (use_statement) + (actor_definition) + (class_definition) + (primitive_definition) + (interface_definition) + (trait_definition) + (struct_definition) + (constructor) + (method) + (behavior) + (if_statement) + (iftype_statement) + (elseif_block) + (elseiftype_block) + (else_block) + (for_statement) + (while_statement) + (try_statement) + (with_statement) + (repeat_statement) + (recover_statement) + (match_statement) + (case_statement) + (parenthesized_expression) + (tuple_expression) + (array_literal) + (object_literal) +] @local.scope + +; References +(identifier) @local.reference + +; Definitions +(field + name: (identifier) @local.definition.field) + +(use_statement + (identifier) @local.definition.import) + +(constructor + (identifier) @local.definition.method) + +(method + (identifier) @local.definition.method) + +(behavior + (identifier) @local.definition.method) + +(actor_definition + (identifier) @local.definition.type) + +(type_alias + (identifier) @local.definition.type) + +(class_definition + (identifier) @local.definition.type) + +(primitive_definition + (identifier) @local.definition.type) + +(interface_definition + (identifier) @local.definition.type) + +(trait_definition + (identifier) @local.definition.type) + +(struct_definition + (identifier) @local.definition.type) + +(parameter + name: (identifier) @local.definition.parameter) + +(variable_declaration + (identifier) @local.definition.var) + +(for_statement + [ + (identifier) @local.definition.var + (tuple_expression + (identifier) @local.definition.var) + ]) + +(with_elem + (identifier) @local.definition.var) |
