diff options
| -rw-r--r-- | lockfile.json | 3 | ||||
| -rw-r--r-- | lua/nvim-treesitter/parsers.lua | 9 | ||||
| -rw-r--r-- | queries/runescript/highlights.scm | 119 | ||||
| -rw-r--r-- | queries/runescript/injections.scm | 2 |
4 files changed, 133 insertions, 0 deletions
diff --git a/lockfile.json b/lockfile.json index ea119fc2b..b65793c5c 100644 --- a/lockfile.json +++ b/lockfile.json @@ -671,6 +671,9 @@ "ruby": { "revision": "557ec01403bd1fcfea50f1805641ca773cbaaa42" }, + "runescript": { + "revision": "e0568a271a1901b8ef87367bbf282b5c639cd742" + }, "rust": { "revision": "2ace7a922a755960f44d73a7bb1efffeb4cc5501" }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index a0ed0b427..871cd4458 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -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", diff --git a/queries/runescript/highlights.scm b/queries/runescript/highlights.scm new file mode 100644 index 000000000..d0c9432bd --- /dev/null +++ b/queries/runescript/highlights.scm @@ -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 diff --git a/queries/runescript/injections.scm b/queries/runescript/injections.scm new file mode 100644 index 000000000..2f0e58eb6 --- /dev/null +++ b/queries/runescript/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) |
