mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
feat: add Pony
This commit is contained in:
parent
ac13230ddd
commit
eadf4f43c6
7 changed files with 497 additions and 0 deletions
|
|
@ -353,6 +353,9 @@
|
|||
"poe_filter": {
|
||||
"revision": "80dc10195e26c72598ed1ab02cdf2d8e4c792e7b"
|
||||
},
|
||||
"pony": {
|
||||
"revision": "9c6a4d98dea80772dbd7967fe556652a220469e5"
|
||||
},
|
||||
"prisma": {
|
||||
"revision": "eca2596a355b1a9952b4f80f8f9caed300a272b5"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1070,6 +1070,14 @@ list.poe_filter = {
|
|||
experimental = true,
|
||||
}
|
||||
|
||||
list.pony = {
|
||||
install_info = {
|
||||
url = "https://github.com/amaanq/tree-sitter-pony",
|
||||
files = { "src/parser.c", "src/scanner.c" },
|
||||
},
|
||||
maintainers = { "@amaanq", "@mfelsche" },
|
||||
}
|
||||
|
||||
list.prisma = {
|
||||
install_info = {
|
||||
url = "https://github.com/victorhqc/tree-sitter-prisma",
|
||||
|
|
|
|||
39
queries/pony/folds.scm
Normal file
39
queries/pony/folds.scm
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
[
|
||||
(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
|
||||
292
queries/pony/highlights.scm
Normal file
292
queries/pony/highlights.scm
Normal file
|
|
@ -0,0 +1,292 @@
|
|||
; Includes
|
||||
|
||||
[
|
||||
"use"
|
||||
] @include
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"type"
|
||||
"actor"
|
||||
"class"
|
||||
"primitive"
|
||||
"interface"
|
||||
"trait"
|
||||
"struct"
|
||||
"embed"
|
||||
"let"
|
||||
"var"
|
||||
(compile_intrinsic)
|
||||
"as"
|
||||
"consume"
|
||||
"recover"
|
||||
"object"
|
||||
"where"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"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"
|
||||
] @type.qualifier
|
||||
|
||||
; Conditionals
|
||||
|
||||
[
|
||||
"if"
|
||||
"ifdef"
|
||||
"iftype"
|
||||
"then"
|
||||
"else"
|
||||
"elseif"
|
||||
"match"
|
||||
] @conditional
|
||||
|
||||
(if_statement "end" @conditional)
|
||||
|
||||
(iftype_statement "end" @conditional)
|
||||
|
||||
(match_statement "end" @conditional)
|
||||
|
||||
; Repeats
|
||||
|
||||
[
|
||||
"repeat"
|
||||
"until"
|
||||
"while"
|
||||
"for"
|
||||
"continue"
|
||||
"do"
|
||||
"break"
|
||||
] @repeat
|
||||
|
||||
(do_block "end" @repeat)
|
||||
|
||||
(repeat_statement "end" @repeat)
|
||||
|
||||
; Exceptions
|
||||
|
||||
[
|
||||
"try"
|
||||
(error)
|
||||
"compile_error"
|
||||
] @exception
|
||||
|
||||
(try_statement "end" @exception)
|
||||
|
||||
(recover_statement "end" @exception)
|
||||
|
||||
; Attributes
|
||||
|
||||
(annotation) @attribute
|
||||
|
||||
; Variables
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(this) @variable.builtin
|
||||
|
||||
; Fields
|
||||
|
||||
(field name: (identifier) @field)
|
||||
|
||||
(member_expression "." (identifier) @field)
|
||||
|
||||
; Constructors
|
||||
|
||||
(constructor "new" @keyword.operator (identifier) @constructor)
|
||||
|
||||
; Methods
|
||||
|
||||
(method (identifier) @method)
|
||||
|
||||
(behavior (identifier) @method)
|
||||
|
||||
(ffi_method (identifier) @method)
|
||||
|
||||
((ffi_method (string) @string.special)
|
||||
(#set! "priority" 105))
|
||||
|
||||
(call_expression
|
||||
callee:
|
||||
[
|
||||
(identifier) @method.call
|
||||
(ffi_identifier (identifier) @method.call)
|
||||
(member_expression "." (identifier) @method.call)
|
||||
])
|
||||
|
||||
; Parameters
|
||||
|
||||
(parameter name: (identifier) @parameter)
|
||||
(lambda_parameter name: (identifier) @parameter)
|
||||
|
||||
; Types
|
||||
|
||||
(type_alias (identifier) @type.definition)
|
||||
|
||||
(base_type name: (identifier) @type)
|
||||
|
||||
(generic_parameter (identifier) @type)
|
||||
|
||||
(lambda_type (identifier)? @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) @float
|
||||
|
||||
(boolean) @boolean
|
||||
|
||||
; Punctuation
|
||||
|
||||
[ "{" "}" ] @punctuation.bracket
|
||||
|
||||
[ "[" "]" ] @punctuation.bracket
|
||||
|
||||
[ "(" ")" ] @punctuation.bracket
|
||||
|
||||
[
|
||||
"."
|
||||
","
|
||||
";"
|
||||
":"
|
||||
"~"
|
||||
".>"
|
||||
"->"
|
||||
"=>"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"@"
|
||||
"!"
|
||||
"^"
|
||||
"..."
|
||||
] @punctuation.special
|
||||
|
||||
; Comments
|
||||
|
||||
[
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
] @comment @spell
|
||||
|
||||
; Errors
|
||||
|
||||
(ERROR) @error
|
||||
60
queries/pony/indents.scm
Normal file
60
queries/pony/indents.scm
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
[
|
||||
(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
|
||||
4
queries/pony/injections.scm
Normal file
4
queries/pony/injections.scm
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
] @comment
|
||||
91
queries/pony/locals.scm
Normal file
91
queries/pony/locals.scm
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
; 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)
|
||||
] @scope
|
||||
|
||||
; References
|
||||
|
||||
(identifier) @reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(field
|
||||
name: (identifier) @definition.field)
|
||||
|
||||
(use_statement
|
||||
(identifier) @definition.import)
|
||||
|
||||
(constructor
|
||||
(identifier) @definition.method)
|
||||
|
||||
(method
|
||||
(identifier) @definition.method)
|
||||
|
||||
(behavior
|
||||
(identifier) @definition.method)
|
||||
|
||||
(actor_definition
|
||||
(identifier) @definition.type)
|
||||
|
||||
(type_alias
|
||||
(identifier) @definition.type)
|
||||
|
||||
(class_definition
|
||||
(identifier) @definition.type)
|
||||
|
||||
(primitive_definition
|
||||
(identifier) @definition.type)
|
||||
|
||||
(interface_definition
|
||||
(identifier) @definition.type)
|
||||
|
||||
(trait_definition
|
||||
(identifier) @definition.type)
|
||||
|
||||
(struct_definition
|
||||
(identifier) @definition.type)
|
||||
|
||||
(parameter
|
||||
name: (identifier) @definition.parameter)
|
||||
|
||||
(variable_declaration
|
||||
(identifier) @definition.var)
|
||||
|
||||
(for_statement
|
||||
[
|
||||
(identifier) @definition.var
|
||||
(tuple_expression (identifier) @definition.var)
|
||||
])
|
||||
|
||||
(with_elem
|
||||
(identifier) @definition.var)
|
||||
Loading…
Add table
Add a link
Reference in a new issue