feat(runescript): add parser and queries (#7305)

This commit is contained in:
David Lysenko 2024-11-06 18:09:38 +01:00 committed by GitHub
parent 4b9a83f601
commit 7c5a4632c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 133 additions and 0 deletions

View file

@ -671,6 +671,9 @@
"ruby": {
"revision": "557ec01403bd1fcfea50f1805641ca773cbaaa42"
},
"runescript": {
"revision": "e0568a271a1901b8ef87367bbf282b5c639cd742"
},
"rust": {
"revision": "2ace7a922a755960f44d73a7bb1efffeb4cc5501"
},

View file

@ -21,6 +21,7 @@ for ft, lang in pairs {
mysql = "sql",
sbt = "scala",
neomuttrc = "muttrc",
clientscript = "runescript",
--- short-hand list from https://github.com/helix-editor/helix/blob/master/languages.toml
rs = "rust",
ex = "elixir",
@ -1948,6 +1949,14 @@ list.ruby = {
maintainers = { "@TravonteD" },
}
list.runescript = {
install_info = {
url = "https://github.com/2004Scape/tree-sitter-runescript",
files = { "src/parser.c", "src/scanner.c" },
},
maintainers = { "@2004Scape" },
}
list.rust = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-rust",

View file

@ -0,0 +1,119 @@
; Variables
(identifier) @variable
(local_variable
"$" @attribute.builtin)
(game_variable
[
"%"
".%"
] @attribute.builtin)
(constant_variable
"^" @attribute.builtin)
(parameter
(local_variable
name: (identifier) @variable.parameter))
; Scripts
(script
trigger: (identifier) @keyword.directive
subject: (identifier) @function)
; Calls
(call
[
"~"
"@"
]? @attribute.builtin
callee: (identifier) @function.call)
; Literals
((literal) @boolean
(#any-of? @boolean "true" "false"))
(literal
"null" @constant.builtin)
(integer_literal) @number
(coord_literal) @string.special
(comment) @comment @spell
[
(string_fragment)
"\""
] @string
(escape_sequence) @string.escape
(string_interpolation
[
"<"
">"
] @punctuation.special)
(string_tag) @punctuation.special
; Types
(type) @type
(parameter_type) @type
; Tokens
[
";"
":"
","
] @punctuation.delimiter
[
"("
")"
"{"
"}"
] @punctuation.bracket
[
"["
"]"
] @punctuation.special
[
"*"
"/"
"+"
"-"
"&"
"|"
">"
">="
"<"
"<="
"="
"!"
] @operator
(arithmetic
"%" @operator)
[
(def_type_keyword)
(switch_type_keyword)
] @keyword.modifier
"return" @keyword.return
"while" @keyword.repeat
[
"default"
"if"
"else"
"case"
] @keyword.conditional
"calc" @keyword

View file

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))